add hostname as an option for plutosdr for devices on the net

This commit is contained in:
Jakob Ketterl 2024-02-02 01:59:18 +01:00
parent c3720d0778
commit 6cd6f9aa70
2 changed files with 24 additions and 1 deletions

View file

@ -1,4 +1,5 @@
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
from owrx.form.input import Input, TextInput
from owrx.form.input.validator import Range
from typing import List
@ -7,10 +8,32 @@ class PlutoSdrSource(SoapyConnectorSource):
def getDriver(self):
return "plutosdr"
def getEventNames(self):
return super().getEventNames() + ["hostname"]
def buildSoapyDeviceParameters(self, parsed, values):
params = super().buildSoapyDeviceParameters(parsed, values)
if "hostname" in values:
params = [p for p in params if "hostname" not in p]
params += [{"hostname": values["hostname"]}]
return params
class PlutoSdrDeviceDescription(SoapyConnectorDeviceDescription):
def getName(self):
return "PlutoSDR"
def getInputs(self) -> List[Input]:
return super().getInputs() + [
TextInput(
"hostname",
"Hostname",
infotext="Use this for PlutoSDR devices attached to the network"
)
]
def getDeviceOptionalKeys(self):
return super().getDeviceOptionalKeys() + ["hostname"]
def getSampleRateRanges(self) -> List[Range]:
return [Range(520833, 61440000)]

View file

@ -14,7 +14,7 @@ class SoapyRemoteSource(SoapyConnectorSource):
def buildSoapyDeviceParameters(self, parsed, values):
params = super().buildSoapyDeviceParameters(parsed, values)
params = [v for v in params if not "remote" in params]
params = [v for v in params if "remote" not in params]
params += [{"remote": values["remote"]}]
if "remote_driver" in values and values["remote_driver"] is not None:
params += [{"remote:driver": values["remote_driver"]}]