use the command mapper to generate event keys

This commit is contained in:
Jakob Ketterl 2020-04-02 00:10:28 +02:00
parent d9e15357f3
commit 112eda2021
6 changed files with 4 additions and 29 deletions

View File

@ -34,6 +34,8 @@ class SdrSource(ABC):
def __init__(self, id, props): def __init__(self, id, props):
self.id = id self.id = id
self.commandMapper = None
self.props = PropertyStack() self.props = PropertyStack()
# layer 0 reserved for profile properties # layer 0 reserved for profile properties
self.props.addLayer(1, props) self.props.addLayer(1, props)
@ -43,7 +45,6 @@ class SdrSource(ABC):
self.profile_id = None self.profile_id = None
self.activateProfile() self.activateProfile()
self.wireEvents() self.wireEvents()
self.commandMapper = None
if "port" in props and props["port"] is not None: if "port" in props and props["port"] is not None:
self.port = props["port"] self.port = props["port"]
@ -72,7 +73,7 @@ class SdrSource(ABC):
"ppm", "ppm",
"rf_gain", "rf_gain",
"lfo_offset", "lfo_offset",
] ] + list(self.getCommandMapper().keys())
def getCommandMapper(self): def getCommandMapper(self):
if self.commandMapper is None: if self.commandMapper is None:

View File

@ -29,13 +29,6 @@ class ConnectorSource(SdrSource):
} }
) )
def getEventNames(self):
return super().getEventNames() + [
"device",
"iqswap",
"rtltcp_compat",
]
def sendControlMessage(self, prop, value): def sendControlMessage(self, prop, value):
logger.debug("sending property change over control socket: {0} changed to {1}".format(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()) self.controlSocket.sendall("{prop}:{value}\n".format(prop=prop, value=value).encode())

View File

@ -14,11 +14,5 @@ class HackrfSource(DirectSource):
} }
).setStatic("-r-") ).setStatic("-r-")
def getEventNames(self):
return super().getEventNames() + [
"lna_gain",
"rf_amp",
]
def getFormatConversion(self): def getFormatConversion(self):
return ["csdr convert_s8_f"] return ["csdr convert_s8_f"]

View File

@ -29,11 +29,3 @@ class PerseussdrSource(DirectSource):
"wideband": Option("-w"), "wideband": Option("-w"),
} }
) )
def getEventNames(self):
return super().getEventNames() + [
"attenuator",
"adc_preamp",
"adc_dither",
"wideband",
]

View File

@ -10,6 +10,3 @@ class RtlSdrSource(ConnectorSource):
.setBase("rtl_connector") .setBase("rtl_connector")
.setMappings({"bias_tee": Flag("-b"), "direct_sampling": Option("-e")}) .setMappings({"bias_tee": Flag("-b"), "direct_sampling": Option("-e")})
) )
def getEventNames(self):
return super().getEventNames() + ["bias_tee", "direct_sampling"]

View File

@ -22,9 +22,7 @@ class SoapyConnectorSource(ConnectorSource, metaclass=ABCMeta):
pass pass
def getEventNames(self): def getEventNames(self):
return super().getEventNames() + [ return super().getEventNames() + list(self.getSoapySettingsMappings().keys())
"antenna",
] + list(self.getSoapySettingsMappings().keys())
def parseDeviceString(self, dstr): def parseDeviceString(self, dstr):
def decodeComponent(c): def decodeComponent(c):