From 0c7b0d2eaad902d7b79a7a29893209cc36f31a17 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Tue, 27 Apr 2021 01:58:20 +0200 Subject: [PATCH] improve dsp control handling --- owrx/connection.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/owrx/connection.py b/owrx/connection.py index 0081ac3..0cd8ea7 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -270,14 +270,14 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient): message = json.loads(message) if "type" in message: if message["type"] == "dspcontrol": - if "action" in message and message["action"] == "start": - self.startDsp() + dsp = self.getDsp() + if dsp is None: + logger.warning("DSP not available; discarding client dspcontrol message") + else: + if "action" in message and message["action"] == "start": + dsp.start() - if "params" in message: - dsp = self.getDsp() - if dsp is None: - logger.warning("DSP not available; discarding client data") - else: + if "params" in message: params = message["params"] dsp.setProperties(params) @@ -337,9 +337,6 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient): def handleNoSdrsAvailable(self): self.write_sdr_error("No SDR Devices available") - def startDsp(self): - self.getDsp().start() - def close(self): if self.sdr is not None: self.sdr.removeClient(self)