improve dsp control handling

This commit is contained in:
Jakob Ketterl 2021-04-27 01:58:20 +02:00
parent cb8ec3c760
commit 0c7b0d2eaa

View File

@ -270,14 +270,14 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
message = json.loads(message) message = json.loads(message)
if "type" in message: if "type" in message:
if message["type"] == "dspcontrol": if message["type"] == "dspcontrol":
if "action" in message and message["action"] == "start": dsp = self.getDsp()
self.startDsp() 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: if "params" in message:
dsp = self.getDsp()
if dsp is None:
logger.warning("DSP not available; discarding client data")
else:
params = message["params"] params = message["params"]
dsp.setProperties(params) dsp.setProperties(params)
@ -337,9 +337,6 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
def handleNoSdrsAvailable(self): def handleNoSdrsAvailable(self):
self.write_sdr_error("No SDR Devices available") self.write_sdr_error("No SDR Devices available")
def startDsp(self):
self.getDsp().start()
def close(self): def close(self):
if self.sdr is not None: if self.sdr is not None:
self.sdr.removeClient(self) self.sdr.removeClient(self)