Closedown

This commit is contained in:
gac-x12sa
2023-01-06 09:23:34 +01:00
parent 12d61a6ceb
commit 152ebac918
3 changed files with 121 additions and 50 deletions
+15 -5
View File
@@ -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):