introduce a generic mapping from sdr properties to soapy settings

This commit is contained in:
Jakob Ketterl
2020-03-14 01:04:52 +01:00
parent fb82daf936
commit 5da2047935
2 changed files with 31 additions and 15 deletions

View File

@ -1,19 +1,11 @@
from .soapy import SoapyConnectorSource
from owrx.command import Option
class RtlSdrSoapySource(SoapyConnectorSource):
def getCommandMapper(self):
return super().getCommandMapper().setMappings({"direct_sampling": Option("-t direct_samp").setSpacer("=")})
def getSoapySettingsMappings(self):
mappings = super().getSoapySettingsMappings()
mappings.update({"direct_sampling": "direct_samp"})
return mappings
def getDriver(self):
return "rtlsdr"
def getEventNames(self):
return super().getEventNames() + ["direct_sampling"]
def onPropertyChange(self, prop, value):
if prop == "direct_sampling":
prop = "settings"
value = "direct_samp={0}".format(value)
super().onPropertyChange(prop, value)