From 112eda2021b88943f96f0e6a3c35e9fa6797e028 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Thu, 2 Apr 2020 00:10:28 +0200 Subject: [PATCH] use the command mapper to generate event keys --- owrx/source/__init__.py | 5 +++-- owrx/source/connector.py | 7 ------- owrx/source/hackrf.py | 6 ------ owrx/source/perseussdr.py | 8 -------- owrx/source/rtl_sdr.py | 3 --- owrx/source/soapy.py | 4 +--- 6 files changed, 4 insertions(+), 29 deletions(-) diff --git a/owrx/source/__init__.py b/owrx/source/__init__.py index ba70737..407f0bc 100644 --- a/owrx/source/__init__.py +++ b/owrx/source/__init__.py @@ -34,6 +34,8 @@ class SdrSource(ABC): def __init__(self, id, props): self.id = id + self.commandMapper = None + self.props = PropertyStack() # layer 0 reserved for profile properties self.props.addLayer(1, props) @@ -43,7 +45,6 @@ class SdrSource(ABC): self.profile_id = None self.activateProfile() self.wireEvents() - self.commandMapper = None if "port" in props and props["port"] is not None: self.port = props["port"] @@ -72,7 +73,7 @@ class SdrSource(ABC): "ppm", "rf_gain", "lfo_offset", - ] + ] + list(self.getCommandMapper().keys()) def getCommandMapper(self): if self.commandMapper is None: diff --git a/owrx/source/connector.py b/owrx/source/connector.py index d365b4b..f28da98 100644 --- a/owrx/source/connector.py +++ b/owrx/source/connector.py @@ -29,13 +29,6 @@ class ConnectorSource(SdrSource): } ) - def getEventNames(self): - return super().getEventNames() + [ - "device", - "iqswap", - "rtltcp_compat", - ] - def sendControlMessage(self, prop, value): logger.debug("sending property change over control socket: {0} changed to {1}".format(prop, value)) self.controlSocket.sendall("{prop}:{value}\n".format(prop=prop, value=value).encode()) diff --git a/owrx/source/hackrf.py b/owrx/source/hackrf.py index 50001ae..2e6b9b6 100644 --- a/owrx/source/hackrf.py +++ b/owrx/source/hackrf.py @@ -14,11 +14,5 @@ class HackrfSource(DirectSource): } ).setStatic("-r-") - def getEventNames(self): - return super().getEventNames() + [ - "lna_gain", - "rf_amp", - ] - def getFormatConversion(self): return ["csdr convert_s8_f"] diff --git a/owrx/source/perseussdr.py b/owrx/source/perseussdr.py index 890600b..bad4f38 100644 --- a/owrx/source/perseussdr.py +++ b/owrx/source/perseussdr.py @@ -29,11 +29,3 @@ class PerseussdrSource(DirectSource): "wideband": Option("-w"), } ) - - def getEventNames(self): - return super().getEventNames() + [ - "attenuator", - "adc_preamp", - "adc_dither", - "wideband", - ] diff --git a/owrx/source/rtl_sdr.py b/owrx/source/rtl_sdr.py index ab7b40c..a6ecbc9 100644 --- a/owrx/source/rtl_sdr.py +++ b/owrx/source/rtl_sdr.py @@ -10,6 +10,3 @@ class RtlSdrSource(ConnectorSource): .setBase("rtl_connector") .setMappings({"bias_tee": Flag("-b"), "direct_sampling": Option("-e")}) ) - - def getEventNames(self): - return super().getEventNames() + ["bias_tee", "direct_sampling"] diff --git a/owrx/source/soapy.py b/owrx/source/soapy.py index d4702c2..e713ba0 100644 --- a/owrx/source/soapy.py +++ b/owrx/source/soapy.py @@ -22,9 +22,7 @@ class SoapyConnectorSource(ConnectorSource, metaclass=ABCMeta): pass def getEventNames(self): - return super().getEventNames() + [ - "antenna", - ] + list(self.getSoapySettingsMappings().keys()) + return super().getEventNames() + list(self.getSoapySettingsMappings().keys()) def parseDeviceString(self, dstr): def decodeComponent(c):