send a log message to the client when a device fails

This commit is contained in:
Jakob Ketterl 2019-12-23 21:18:06 +01:00
parent 46b5e9034f
commit 11cfca5211
2 changed files with 9 additions and 1 deletions

View File

@ -1142,6 +1142,9 @@ function on_ws_recv(evt) {
case 'secondary_demod':
secondary_demod_push_data(json['value']);
break;
case 'log_message':
divlog(json['value'], true);
break;
default:
console.warn('received message of unknown type: ' + json['type']);
}

View File

@ -185,7 +185,9 @@ class OpenWebRxReceiverClient(Client):
self.startDsp()
# keep trying until we find a suitable SDR
if self.sdr.getState() != SdrSource.STATE_FAILED:
if self.sdr.getState() == SdrSource.STATE_FAILED:
self.write_log_message("SDR device \"{0}\" has failed, selecting new device".format(self.sdr.getName()))
else:
break
# send initial config
@ -308,6 +310,9 @@ class OpenWebRxReceiverClient(Client):
def write_aprs_data(self, data):
self.send({"type": "aprs_data", "value": data})
def write_log_message(self, message):
self.send({"type": "log_message", "value": message})
def write_sdr_error(self, message):
self.send({"type": "sdr_error", "value": message})