diff --git a/plugins/Eiger.form b/plugins/Eiger.form
index b58d010..b4089d8 100644
--- a/plugins/Eiger.form
+++ b/plugins/Eiger.form
@@ -72,6 +72,7 @@
+
@@ -87,6 +88,8 @@
+
+
@@ -140,6 +143,14 @@
+
+
+
+
+
+
+
+
@@ -192,32 +203,34 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/plugins/Eiger.java b/plugins/Eiger.java
index 62efc33..958f14d 100644
--- a/plugins/Eiger.java
+++ b/plugins/Eiger.java
@@ -98,6 +98,7 @@ public class Eiger extends Panel {
buttonConfigDet = new javax.swing.JButton();
deviceStatePanel2 = new ch.psi.pshell.swing.DeviceStatePanel();
buttonParsDet = new javax.swing.JButton();
+ buttonApplyConfigDet = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
renderer = new ch.psi.pshell.imaging.Renderer();
jPanel3 = new javax.swing.JPanel();
@@ -145,6 +146,13 @@ public class Eiger extends Panel {
}
});
+ buttonApplyConfigDet.setText("Apply Config");
+ buttonApplyConfigDet.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonApplyConfigDetActionPerformed(evt);
+ }
+ });
+
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
@@ -160,7 +168,8 @@ public class Eiger extends Panel {
.addComponent(buttonConfigDet, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStartDet, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStopDet, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(buttonParsDet, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(buttonParsDet, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(buttonApplyConfigDet, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())))
);
jPanel1Layout.setVerticalGroup(
@@ -171,6 +180,8 @@ public class Eiger extends Panel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonStopDet)
.addGap(18, 18, Short.MAX_VALUE)
+ .addComponent(buttonApplyConfigDet)
+ .addGap(18, 18, Short.MAX_VALUE)
.addComponent(buttonConfigDet)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonParsDet)
@@ -243,25 +254,26 @@ public class Eiger extends Panel {
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonConfig, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(jPanel3Layout.createSequentialGroup()
- .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
- .addComponent(jLabel1)
- .addGap(6, 6, 6))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
- .addComponent(jLabel2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
- .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(spinnerImages, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)
- .addComponent(textFile, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)))
- .addComponent(buttonStart, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(buttonStart, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(buttonStop, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
- .addComponent(jLabel3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(deviceValuePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE))
- .addComponent(buttonStop, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
+ .addComponent(jLabel1)
+ .addGap(6, 6, 6))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
+ .addComponent(jLabel2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(spinnerImages, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)
+ .addComponent(textFile, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
+ .addComponent(jLabel3)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(deviceValuePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)))))
.addContainerGap())
);
@@ -441,7 +453,12 @@ public class Eiger extends Panel {
if (stddaq!=null){
int images = (Integer)spinnerImages.getValue();
String file = textFile.getText();
- evalAsync("std_daq.start(" + images + ", '" + file + "')");
+ evalAsync("std_daq.start(" + images + ", '" + file + "')").handle((r,e)->{
+ if (e!=null){
+ showException((Exception) e);
+ }
+ return r;
+ });
}
} catch (Exception ex){
showException(ex);
@@ -451,7 +468,12 @@ public class Eiger extends Panel {
private void buttonStopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStopActionPerformed
try{
if (stddaq!=null){
- evalAsync("std_daq.abort()");
+ evalAsync("std_daq.abort()").handle((r,e)->{
+ if (e!=null){
+ showException((Exception) e);
+ }
+ return r;
+ });
}
} catch (Exception ex){
showException(ex);
@@ -461,7 +483,12 @@ public class Eiger extends Panel {
private void buttonStartDetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartDetActionPerformed
try{
if (stddaq!=null){
- evalAsync("detector.start()");
+ evalAsync("detector.start()").handle((r,e)->{
+ if (e!=null){
+ showException((Exception) e);
+ }
+ return r;
+ });
}
} catch (Exception ex){
showException(ex);
@@ -471,14 +498,35 @@ public class Eiger extends Panel {
private void buttonStopDetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStopDetActionPerformed
try{
if (stddaq!=null){
- evalAsync("detector.stop()");
+ evalAsync("detector.stop()").handle((r,e)->{
+ if (e!=null){
+ showException((Exception) e);
+ }
+ return r;
+ });
}
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_buttonStopDetActionPerformed
+ private void buttonApplyConfigDetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonApplyConfigDetActionPerformed
+ try{
+ if (stddaq!=null){
+ evalAsync("detector.apply_config()").handle((r,e)->{
+ if (e!=null){
+ showException((Exception) e);
+ }
+ return r;
+ });
+ }
+ } catch (Exception ex){
+ showException(ex);
+ }
+ }//GEN-LAST:event_buttonApplyConfigDetActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton buttonApplyConfigDet;
private javax.swing.JButton buttonConfig;
private javax.swing.JButton buttonConfigDet;
private javax.swing.JButton buttonParsDet;
diff --git a/script/devices/Detector.py b/script/devices/Detector.py
index bb66b41..9130069 100644
--- a/script/devices/Detector.py
+++ b/script/devices/Detector.py
@@ -9,19 +9,28 @@ class Detector(DeviceBase):
def doInitialize(self):
pass
+
+ def send_cmd(self, cmd):
+ print "Send detector command: ", cmd
+ if not self.simulated:
+ data = {"det_name":"eiger","cmd":cmd}
+ headers = {'Content-type': 'application/json'}
+ r = requests.post(url = self.url + "/detector/eiger", json=data, headers=headers)
def start(self):
self.state.assertIs(State.Ready)
- if not self.simulated:
- pass
+ self.send_cmd("START")
self.setState(State.Busy)
def stop(self):
self.state.assertIs(State.Busy)
- if not self.simulated:
- pass
+ self.send_cmd("STOP")
self.setState(State.Ready)
+ def apply_config(self):
+ self.state.assertIs(State.Ready)
+ self.send_cmd("SET_CONFIG")
+
def get_pars(self):
if self.simulated:
return self.simulated_pars
@@ -40,12 +49,13 @@ class Detector(DeviceBase):
def set_config(self, config):
if type(config) == dict or isinstance(config, java.util.Map) :
+ print "Send detector config: ", config
if self.simulated:
self.simulated_config=config
else:
data = {"det_name":"eiger","config":config}
headers = {'Content-type': 'application/json'}
- r = requests.post(url = self.url + "/detector", json=data, headers=headers)
+ r = requests.post(url = self.url + "/detector/eiger", json=data, headers=headers)
def doClose(self):