From d2ce27eeab8ed822dcf916e39f7ed21a8298e8f7 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 14 Mar 2020 23:07:23 +0100 Subject: [PATCH] convert boolean values into something that soapy understands --- owrx/source/soapy.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/owrx/source/soapy.py b/owrx/source/soapy.py index e5ef480..d4702c2 100644 --- a/owrx/source/soapy.py +++ b/owrx/source/soapy.py @@ -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)