show codecserver errors in the client

This commit is contained in:
Jakob Ketterl 2021-12-13 13:26:47 +01:00
parent 397155983d
commit 4ce3816f48
5 changed files with 34 additions and 15 deletions

View File

@ -67,3 +67,7 @@ class SecondaryDemodulator(Chain):
class ServiceDemodulator(SecondaryDemodulator, FixedAudioRateChain, metaclass=ABCMeta): class ServiceDemodulator(SecondaryDemodulator, FixedAudioRateChain, metaclass=ABCMeta):
pass pass
class DemodulatorError(Exception):
pass

View File

@ -1,8 +1,8 @@
from csdr.chain.demodulator import BaseDemodulatorChain, FixedAudioRateChain, FixedIfSampleRateChain, DialFrequencyReceiver, MetaProvider, SlotFilterChain from csdr.chain.demodulator import BaseDemodulatorChain, FixedAudioRateChain, FixedIfSampleRateChain, DialFrequencyReceiver, MetaProvider, SlotFilterChain, DemodulatorError
from pycsdr.modules import FmDemod, Agc, Writer, Buffer from pycsdr.modules import FmDemod, Agc, Writer, Buffer
from pycsdr.types import Format from pycsdr.types import Format
from digiham.modules import DstarDecoder, DcBlock, FskDemodulator, GfskDemodulator, DigitalVoiceFilter, MbeSynthesizer, NarrowRrcFilter, NxdnDecoder, DmrDecoder, WideRrcFilter, YsfDecoder from digiham.modules import DstarDecoder, DcBlock, FskDemodulator, GfskDemodulator, DigitalVoiceFilter, MbeSynthesizer, NarrowRrcFilter, NxdnDecoder, DmrDecoder, WideRrcFilter, YsfDecoder
from digiham.ambe import Modes from digiham.ambe import Modes, ServerError
from owrx.meta import MetaParser from owrx.meta import MetaParser
@ -17,10 +17,16 @@ class DigihamChain(BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateC
workers = [FmDemod(), DcBlock()] workers = [FmDemod(), DcBlock()]
if filter is not None: if filter is not None:
workers += [filter] workers += [filter]
try:
mbeSynthesizer = MbeSynthesizer(mbeMode, codecserver)
except ConnectionError as ce:
raise DemodulatorError("Connection to codecserver failed: {}".format(ce))
except ServerError as se:
raise DemodulatorError("Codecserver error: {}".format(se))
workers += [ workers += [
fskDemodulator, fskDemodulator,
decoder, decoder,
MbeSynthesizer(mbeMode, codecserver), mbeSynthesizer,
DigitalVoiceFilter(), DigitalVoiceFilter(),
agc agc
] ]

View File

@ -838,6 +838,9 @@ function on_ws_recv(evt) {
$overlay.show(); $overlay.show();
$("#openwebrx-panel-receiver").demodulatorPanel().stopDemodulator(); $("#openwebrx-panel-receiver").demodulatorPanel().stopDemodulator();
break; break;
case "demodulator_error":
divlog(json['value'], true);
break;
case 'secondary_demod': case 'secondary_demod':
var value = json['value']; var value = json['value'];
var panels = [ var panels = [

View File

@ -422,6 +422,9 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
def write_sdr_error(self, message): def write_sdr_error(self, message):
self.send({"type": "sdr_error", "value": message}) self.send({"type": "sdr_error", "value": message})
def write_demodulator_error(self, message):
self.send({"type": "demodulator_error", "value": message})
def write_backoff_message(self, reason): def write_backoff_message(self, reason):
self.send({"type": "backoff", "reason": reason}) self.send({"type": "backoff", "reason": reason})

View File

@ -3,7 +3,7 @@ from owrx.property import PropertyStack, PropertyLayer, PropertyValidator
from owrx.property.validators import OrValidator, RegexValidator, BoolValidator from owrx.property.validators import OrValidator, RegexValidator, BoolValidator
from owrx.modes import Modes, DigitalMode from owrx.modes import Modes, DigitalMode
from csdr.chain import Chain from csdr.chain import Chain
from csdr.chain.demodulator import BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain, HdAudio, SecondaryDemodulator, DialFrequencyReceiver, MetaProvider, SlotFilterChain, SecondarySelectorChain, DeemphasisTauChain from csdr.chain.demodulator import BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain, HdAudio, SecondaryDemodulator, DialFrequencyReceiver, MetaProvider, SlotFilterChain, SecondarySelectorChain, DeemphasisTauChain, DemodulatorError
from csdr.chain.selector import Selector, SecondarySelector from csdr.chain.selector import Selector, SecondarySelector
from csdr.chain.clientaudio import ClientAudioChain from csdr.chain.clientaudio import ClientAudioChain
from csdr.chain.fft import FftChain from csdr.chain.fft import FftChain
@ -544,6 +544,7 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient)
return FreeDV() return FreeDV()
def setDemodulator(self, mod): def setDemodulator(self, mod):
try:
demodulator = self._getDemodulator(mod) demodulator = self._getDemodulator(mod)
if demodulator is None: if demodulator is None:
raise ValueError("unsupported demodulator: {}".format(mod)) raise ValueError("unsupported demodulator: {}".format(mod))
@ -557,6 +558,8 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient)
buffer = Buffer(self.chain.getOutputFormat()) buffer = Buffer(self.chain.getOutputFormat())
self.chain.setWriter(buffer) self.chain.setWriter(buffer)
self.wireOutput(self.audioOutput, buffer) self.wireOutput(self.audioOutput, buffer)
except DemodulatorError as de:
self.handler.write_demodulator_error(str(de))
def _getSecondaryDemodulator(self, mod) -> Optional[SecondaryDemodulator]: def _getSecondaryDemodulator(self, mod) -> Optional[SecondaryDemodulator]:
if isinstance(mod, SecondaryDemodulator): if isinstance(mod, SecondaryDemodulator):