openwebrx/owrx/source/pluto_sdr.py

40 lines
1.2 KiB
Python
Raw Normal View History

2021-02-20 18:09:24 +01:00
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
from owrx.form.input import Input, TextInput
2024-01-17 22:39:05 +01:00
from owrx.form.input.validator import Range
from typing import List
class PlutoSdrSource(SoapyConnectorSource):
def getDriver(self):
2020-01-22 21:55:22 +01:00
return "plutosdr"
2021-02-20 18:09:24 +01:00
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
2021-02-20 18:09:24 +01:00
class PlutoSdrDeviceDescription(SoapyConnectorDeviceDescription):
def getName(self):
return "PlutoSDR"
2024-01-17 22:39:05 +01:00
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]:
2024-01-17 22:39:05 +01:00
return [Range(520833, 61440000)]