display message when sdr unavailable
This commit is contained in:
parent
5b61f8c7a3
commit
ea67340cab
@ -142,6 +142,11 @@ class OpenWebRxReceiverClient(Client):
|
||||
|
||||
def setSdr(self, id=None):
|
||||
next = SdrService.getSource(id)
|
||||
|
||||
if next is None:
|
||||
self.handleSdrFailure("sdr device failed")
|
||||
return
|
||||
|
||||
if next == self.sdr:
|
||||
return
|
||||
|
||||
@ -180,6 +185,9 @@ class OpenWebRxReceiverClient(Client):
|
||||
|
||||
self.sdr.addSpectrumClient(self)
|
||||
|
||||
def handleSdrFailure(self, message):
|
||||
self.write_sdr_error(message)
|
||||
|
||||
def startDsp(self):
|
||||
if self.dsp is None:
|
||||
self.dsp = DspManager(self, self.sdr)
|
||||
|
@ -76,10 +76,14 @@ class SdrService(object):
|
||||
def getSource(id=None):
|
||||
SdrService.loadProps()
|
||||
sources = SdrService.getSources()
|
||||
if not sources:
|
||||
return None
|
||||
if id is None:
|
||||
# TODO: configure default sdr in config? right now it will pick the first one off the list.
|
||||
id = list(sources.keys())[0]
|
||||
|
||||
if not id in sources:
|
||||
return None
|
||||
return sources[id]
|
||||
|
||||
@staticmethod
|
||||
@ -654,7 +658,7 @@ class DspManager(csdr.output):
|
||||
def onSdrFailed(self):
|
||||
logger.debug("received onSdrFailed, shutting down DspSource")
|
||||
self.dsp.stop()
|
||||
self.handler.write_sdr_error("sdr failed")
|
||||
self.handler.handleSdrFailure("sdr device failed")
|
||||
|
||||
|
||||
class CpuUsageThread(threading.Thread):
|
||||
|
Loading…
Reference in New Issue
Block a user