Merge branch 'develop' into iw0hdv

This commit is contained in:
Andrea Montefusco 2020-03-15 17:25:56 +01:00
commit 8e87aa0342
2 changed files with 8 additions and 3 deletions

View File

@ -4,7 +4,7 @@ from .soapy import SoapyConnectorSource
class RtlSdrSoapySource(SoapyConnectorSource): class RtlSdrSoapySource(SoapyConnectorSource):
def getSoapySettingsMappings(self): def getSoapySettingsMappings(self):
mappings = super().getSoapySettingsMappings() mappings = super().getSoapySettingsMappings()
mappings.update({"direct_sampling": "direct_samp", "bias_tee": "bias_tee"}) mappings.update({"direct_sampling": "direct_samp", "bias_tee": "biastee"})
return mappings return mappings
def getDriver(self): def getDriver(self):

View File

@ -61,9 +61,14 @@ class SoapyConnectorSource(ConnectorSource, metaclass=ABCMeta):
settings = {} settings = {}
for k, v in self.getSoapySettingsMappings().items(): for k, v in self.getSoapySettingsMappings().items():
if k in values and values[k] is not None: if k in values and values[k] is not None:
settings[v] = values[k] settings[v] = self.convertSoapySettingsValue(values[k])
return settings return settings
def convertSoapySettingsValue(self, value):
if isinstance(value, bool):
return "true" if value else "false"
return value
def getCommandValues(self): def getCommandValues(self):
values = super().getCommandValues() values = super().getCommandValues()
if "device" in values and values["device"] is not None: if "device" in values and values["device"] is not None:
@ -80,6 +85,6 @@ class SoapyConnectorSource(ConnectorSource, metaclass=ABCMeta):
def onPropertyChange(self, prop, value): def onPropertyChange(self, prop, value):
mappings = self.getSoapySettingsMappings() mappings = self.getSoapySettingsMappings()
if prop in mappings.keys(): if prop in mappings.keys():
value = "{0}={1}".format(mappings[prop], value) value = "{0}={1}".format(mappings[prop], self.convertSoapySettingsValue(value))
prop = "settings" prop = "settings"
super().onPropertyChange(prop, value) super().onPropertyChange(prop, value)