2021-02-20 17:09:24 +00:00
|
|
|
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
|
2021-04-29 13:17:21 +00:00
|
|
|
from owrx.form.input import Input, TextInput
|
|
|
|
from owrx.form.input.device import RemoteInput
|
2021-07-05 10:58:16 +00:00
|
|
|
from owrx.form.input.converter import OptionalConverter
|
2021-02-20 18:20:31 +00:00
|
|
|
from typing import List
|
2020-02-09 12:59:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2021-02-20 17:09:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SoapyRemoteDeviceDescription(SoapyConnectorDeviceDescription):
|
2021-04-17 15:42:08 +00:00
|
|
|
def getName(self):
|
|
|
|
return "Device connected to a SoapyRemote server"
|
|
|
|
|
2021-02-20 18:20:31 +00:00
|
|
|
def getInputs(self) -> List[Input]:
|
2021-02-21 23:35:47 +00:00
|
|
|
return super().getInputs() + [
|
|
|
|
RemoteInput(),
|
|
|
|
TextInput(
|
2021-07-05 10:58:16 +00:00
|
|
|
"remote_driver",
|
|
|
|
"Remote driver",
|
|
|
|
infotext="SoapySDR driver to be used on the remote SoapySDRServer",
|
|
|
|
converter=OptionalConverter(),
|
2021-02-21 23:35:47 +00:00
|
|
|
),
|
|
|
|
]
|
|
|
|
|
2021-04-02 19:46:21 +00:00
|
|
|
def getDeviceMandatoryKeys(self):
|
|
|
|
return super().getDeviceMandatoryKeys() + ["remote"]
|
|
|
|
|
2021-03-24 22:17:50 +00:00
|
|
|
def getDeviceOptionalKeys(self):
|
|
|
|
return super().getDeviceOptionalKeys() + ["remote_driver"]
|