From c92929a32dfbefa0c5b7757e9a4806039cff42f9 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sun, 9 Feb 2020 13:59:37 +0100 Subject: [PATCH] add soapyremote source --- CHANGELOG.md | 3 +++ owrx/feature.py | 9 +++++++++ owrx/source/soapy.py | 19 +++++++++++-------- owrx/source/soapy_remote.py | 17 +++++++++++++++++ 4 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 owrx/source/soapy_remote.py diff --git a/CHANGELOG.md b/CHANGELOG.md index cdc47ca..78ea99b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +**unreleased** +- Support for SoapyRemote + **2020-02-08** - Compression, resampling and filtering in the frontend have been rewritten in javascript, sdr.js has been removed - Decoding of Pocsag modulation is now possible diff --git a/owrx/feature.py b/owrx/feature.py index 2798a87..ee49bc1 100644 --- a/owrx/feature.py +++ b/owrx/feature.py @@ -30,6 +30,7 @@ class FeatureDetector(object): "lime_sdr": ["soapy_connector", "soapy_lime_sdr"], "fifi_sdr": ["alsa"], "pluto_sdr": ["soapy_connector", "soapy_pluto_sdr"], + "soapy_remote": ["soapy_connector", "soapy_remote"], # optional features and their requirements "digital_voice_digiham": ["digiham", "sox"], "digital_voice_dsd": ["dsd", "sox", "digiham"], @@ -290,6 +291,14 @@ class FeatureDetector(object): """ return self._has_soapy_driver("PlutoSDR") + def has_soapy_remote(self): + """ + The SoapyRemote allows the usage of remote SDR devices using the SoapySDRServer. + + You can get the code and find additional information [here](https://github.com/pothosware/SoapyRemote/wiki). + """ + return self._has_soapy_driver("remote") + def has_dsd(self): """ The digital voice modes NXDN and D-Star can be decoded by the dsd project. Please note that you need the version diff --git a/owrx/source/soapy.py b/owrx/source/soapy.py index 0810884..76ce625 100644 --- a/owrx/source/soapy.py +++ b/owrx/source/soapy.py @@ -41,18 +41,21 @@ class SoapyConnectorSource(ConnectorSource, metaclass=ABCMeta): return ",".join([encodeComponent(c) for c in dobj]) - """ - this method always attempts to inject a driver= part into the soapysdr query, depending on what connector was used. - this prevents the soapy_connector from using the wrong device in scenarios where there's no same-type sdrs. - """ + def buildSoapyDeviceParameters(self, parsed, values): + """ + this method always attempts to inject a driver= part into the soapysdr query, depending on what connector was used. + this prevents the soapy_connector from using the wrong device in scenarios where there's no same-type sdrs. + """ + parsed = [v for v in parsed if "driver" not in v] + parsed += [{"driver": self.getDriver()}] + return parsed def getCommandValues(self): values = super().getCommandValues() if "device" in values and values["device"] is not None: parsed = self.parseDeviceString(values["device"]) - parsed = [v for v in parsed if "driver" not in v] - parsed += [{"driver": self.getDriver()}] - values["device"] = self.encodeDeviceString(parsed) else: - values["device"] = "driver={0}".format(self.getDriver()) + parsed = [] + modified = self.buildSoapyDeviceParameters(parsed, values) + values["device"] = self.encodeDeviceString(modified) return values diff --git a/owrx/source/soapy_remote.py b/owrx/source/soapy_remote.py new file mode 100644 index 0000000..53a3196 --- /dev/null +++ b/owrx/source/soapy_remote.py @@ -0,0 +1,17 @@ +from .soapy import SoapyConnectorSource + + +class SoapyRemoteSource(SoapyConnectorSource): + def getEventNames(self): + return super().getEventNames() + ["remote", "remote_driver"] + + def getDriver(self): + return "remote" + + def buildSoapyDeviceParameters(self, parsed, values): + params = super().buildSoapyDeviceParameters(parsed, values) + params = [v for v in params if not "remote" in params] + params += [{"remote": values["remote"]}] + if "remote_driver" in values and values["remote_driver"] is not None: + params += [{"remote:driver": values["remote_driver"]}] + return params