stdDAQ seems ok
This commit is contained in:
@@ -74,7 +74,9 @@ class StdDaqMixin(CustomDeviceMixin):
|
||||
print('Reconfiguring')
|
||||
# Stop if current status is not idle
|
||||
if self.parent.state() != "idle":
|
||||
self.parent.surestop()
|
||||
# self.parent.surestop()
|
||||
self.parent.blueunstage()
|
||||
|
||||
print(self.parent.state())
|
||||
print(self.parent.state())
|
||||
print(self.parent.state())
|
||||
@@ -92,12 +94,16 @@ class StdDaqMixin(CustomDeviceMixin):
|
||||
""" Stop a running acquisition and close connection
|
||||
"""
|
||||
self.parent.create_virtual_dataset()
|
||||
self.parent.surestop()
|
||||
# self.parent.surestop()
|
||||
self.parent.blueunstage()
|
||||
|
||||
|
||||
def on_stop(self):
|
||||
""" Stop a running acquisition and close connection
|
||||
"""
|
||||
self.parent.surestop()
|
||||
# self.parent.surestop()
|
||||
self.parent.blueunstage()
|
||||
|
||||
|
||||
def poll(self) -> None:
|
||||
""" Monitor status messages while connection is open. This will block the reply monitoring
|
||||
@@ -137,7 +143,7 @@ class StdDaqClient(PSIDeviceBase):
|
||||
"""
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
custom_prepare_cls = StdDaqMixin
|
||||
USER_ACCESS = ["set_daq_config", "get_daq_config", "surestop", "nuke", "connect", "message", "state", "bluestage"]
|
||||
USER_ACCESS = ["set_daq_config", "get_daq_config", "nuke", "connect", "message", "state", "bluestage", "blueunstage"]
|
||||
_wsclient = None
|
||||
|
||||
# Status attributes
|
||||
@@ -177,7 +183,7 @@ class StdDaqClient(PSIDeviceBase):
|
||||
self.rest_url._metadata["write_access"] = False
|
||||
self.rest_url.set(rest_url, force=True).wait()
|
||||
|
||||
# Connect ro the DAQ and initialize values
|
||||
# Connect to the DAQ and initialize values
|
||||
try:
|
||||
self.read_daq_config()
|
||||
except Exception as ex:
|
||||
@@ -209,6 +215,9 @@ class StdDaqClient(PSIDeviceBase):
|
||||
Note: finishing acquisition means StdDAQ will close connection, so
|
||||
there's no idle state polling.
|
||||
"""
|
||||
# Prepare message
|
||||
msg = json.dumps(message) if isinstance(message, dict) else str(message)
|
||||
|
||||
# Connect if client was destroyed
|
||||
if self._wsclient is None:
|
||||
self.connect()
|
||||
@@ -228,7 +237,10 @@ class StdDaqClient(PSIDeviceBase):
|
||||
try:
|
||||
reply = self._wsclient.recv(timeout)
|
||||
return reply
|
||||
except (ConnectionClosedError, ConnectionClosedOK, TimeoutError, RuntimeError) as ex:
|
||||
except (ConnectionClosedError, ConnectionClosedOK) as ex:
|
||||
self._wsclient = None
|
||||
logger.error(f"[{self.name}] WS connection was closed before reply: {ex}")
|
||||
except (TimeoutError, RuntimeError) as ex:
|
||||
logger.error(f"[{self.name}] Error in receiving ws reply: {ex}")
|
||||
return reply
|
||||
|
||||
@@ -296,8 +308,8 @@ class StdDaqClient(PSIDeviceBase):
|
||||
print(status)
|
||||
|
||||
# if self.state() != "idle":
|
||||
if status != "idle":
|
||||
self.surestop()
|
||||
# if status != "idle":
|
||||
# self.surestop()
|
||||
|
||||
status = self.state()
|
||||
print(status)
|
||||
@@ -351,7 +363,7 @@ class StdDaqClient(PSIDeviceBase):
|
||||
|
||||
|
||||
def blueunstage(self):
|
||||
|
||||
""" Unstages the DAQ from a new connection"""
|
||||
ii = 0
|
||||
while True:
|
||||
self.connect()
|
||||
|
||||
Reference in New Issue
Block a user