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