From 4053616ec16e5987ffbd23010b128c2649a95155 Mon Sep 17 00:00:00 2001 From: Mohacsi Istvan Date: Mon, 24 Jun 2024 09:44:07 +0200 Subject: [PATCH] The websockets interface is useless --- tomcat_bec/devices/stddaqclient.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tomcat_bec/devices/stddaqclient.py b/tomcat_bec/devices/stddaqclient.py index e07cebf..d1d13fc 100644 --- a/tomcat_bec/devices/stddaqclient.py +++ b/tomcat_bec/devices/stddaqclient.py @@ -28,6 +28,9 @@ class StdDaqClientDevice(Device): self.n_image.set(100) self.file_path.set("/gpfs/test/test-beamline") + def connect(self): + self._client = connect(self.ws_server_url) + def configure(self, d: dict) -> tuple: """ Example: @@ -77,12 +80,12 @@ class StdDaqClientDevice(Device): Note: finishing acquisition meang StdDAQ will close connections """ - print(d) reply = None if isinstance(d, dict): msg = json.dumps(d) else: msg = str(d) + print("Q: ", msg) # Send message (reopen connection if needed) try: self._client.send(msg) @@ -105,9 +108,10 @@ class StdDaqClientDevice(Device): # Wait for reply try: reply = self._client.recv(timeout) - print(reply) - except ConnectionClosedError: - pass + print("A: ", reply) + except ConnectionClosedError as ex: + print(ex) + pass except TimeoutError: pass return reply