add soapyremote source

This commit is contained in:
Jakob Ketterl
2020-02-09 13:59:37 +01:00
parent 46c3e5077d
commit c92929a32d
4 changed files with 40 additions and 8 deletions

View File

@ -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

View File

@ -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