From 47bcd369b6d81e05729b112c9fbaaca9320ad464 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Mon, 24 May 2021 16:08:11 +0200 Subject: [PATCH] Bugfix in message, added a handle for returning a list of the stream messages from handleMessages() --- lasp/lasp_avstream.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lasp/lasp_avstream.py b/lasp/lasp_avstream.py index 283b25b..03a8071 100644 --- a/lasp/lasp_avstream.py +++ b/lasp/lasp_avstream.py @@ -124,7 +124,7 @@ class AudioStream: ] if len(matching_devices) == 0: - raise RuntimeError("Could not find device {daqconfig.device_name}") + raise RuntimeError(f"Could not find device {daqconfig.device_name}") # TODO: We pick te first one, what to do if we have multiple matches? # Is that even possible? @@ -160,7 +160,7 @@ class AudioStream: # TODO: Fix this. This gives bug on Windows, the threading lock does # give a strange erro. try: - if not self.running(): + if not self.running: return 1 except Exception as e: print(e) @@ -291,7 +291,7 @@ class AvStreamProcess(mp.Process): except Exception as e: self.sendAllQueues( - StreamMsg.streamError, avtype, f"Error starting stream {str(e)}" + StreamMsg.streamError, avtype, f"Error starting stream: {str(e)}" ) return @@ -494,6 +494,7 @@ class StreamManager: Handle messages that are still on the pipe. """ # logging.debug('StreamManager::handleMessages()') + msgs = [] while not self.our_msgqueue.empty(): msg, data = self.our_msgqueue.get() logging.debug(f'StreamManager obtained message {msg}') @@ -535,6 +536,9 @@ class StreamManager: devices, = data # logging.debug(devices) self.devices = devices + msgs.append((msg, data)) + + return msgs def getDeviceList(self): self.handleMessages()