convert boolean values into something that soapy understands

This commit is contained in:
Jakob Ketterl 2020-03-14 23:07:23 +01:00
parent 00a7b7877c
commit d2ce27eeab

View File

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