add more device-specific options

This commit is contained in:
Jakob Ketterl 2021-02-20 19:20:31 +01:00
parent 8b24eff72e
commit 361ed55b93
5 changed files with 72 additions and 6 deletions

View File

@ -1,4 +1,4 @@
from owrx.form import Input, CheckboxInput, DropdownInput, DropdownEnum
from owrx.form import Input, CheckboxInput, DropdownInput, DropdownEnum, TextInput
from owrx.form.converter import OptionalConverter, EnumConverter
from owrx.soapy import SoapySettings
@ -155,3 +155,10 @@ class DirectSamplingInput(DropdownInput):
defaultFormValue=DirectSamplingOptions.DIRECT_SAMPLING_OFF.name,
),
)
class RemoteInput(TextInput):
def __init__(self):
super().__init__(
"remote", "Remote IP and Port", infotext="Remote hostname or IP and port to connect to. Format = IP:Port"
)

View File

@ -1,6 +1,7 @@
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
from owrx.form import Input
from owrx.form import Input, CheckboxInput
from owrx.form.device import BiasTeeInput
from owrx.form.converter import OptionalConverter
from typing import List
@ -21,4 +22,17 @@ class AirspySource(SoapyConnectorSource):
class AirspyDeviceDescription(SoapyConnectorDeviceDescription):
def getInputs(self) -> List[Input]:
return self.mergeInputs(super().getInputs(), [BiasTeeInput()])
return self.mergeInputs(
super().getInputs(),
[
BiasTeeInput(),
CheckboxInput(
"bitpack",
"",
checkboxText="Enable bit-packing",
infotext="Packs two 12-bit samples into 3 bytes."
+ " Lowers USB bandwidth consumption, increases CPU load",
converter=OptionalConverter(defaultFormValue=False),
),
],
)

View File

@ -1,5 +1,8 @@
from owrx.source.connector import ConnectorSource, ConnectorDeviceDescription
from owrx.command import Flag, Option, Argument
from owrx.form import Input
from owrx.form.device import RemoteInput
from typing import List
class RtlTcpSource(ConnectorSource):
@ -19,4 +22,5 @@ class RtlTcpSource(ConnectorSource):
class RtlTcpDeviceDescription(ConnectorDeviceDescription):
pass
def getInputs(self) -> List[Input]:
return self.mergeInputs(super().getInputs(), [RemoteInput()])

View File

@ -1,5 +1,9 @@
from owrx.source.connector import ConnectorSource, ConnectorDeviceDescription
from owrx.command import Argument, Flag, Option
from owrx.form import Input, DropdownInput, DropdownEnum, CheckboxInput
from owrx.form.device import RemoteInput
from owrx.form.converter import OptionalConverter
from typing import List
class RundsSource(ConnectorSource):
@ -18,5 +22,30 @@ class RundsSource(ConnectorSource):
)
class ProtocolOptions(DropdownEnum):
PROTOCOL_EB200 = ("eb200", "EB200 protocol")
PROTOCOL_AMMOS = ("ammos", "Ammos protocol")
def __new__(cls, *args, **kwargs):
value, description = args
obj = object.__new__(cls)
obj._value_ = value
obj.description = description
return obj
def __str__(self):
return self.description
class RundsDeviceDescription(ConnectorDeviceDescription):
pass
def getInputs(self) -> List[Input]:
return self.mergeInputs(
super().getInputs(),
[
RemoteInput(),
DropdownInput("protocol", "Protocol", ProtocolOptions),
CheckboxInput(
"long", "", "Use 32-bit sample size (LONG)", converter=OptionalConverter(defaultFormValue=False)
),
],
)

View File

@ -1,4 +1,7 @@
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
from owrx.form import Input, TextInput
from owrx.form.device import RemoteInput
from typing import List
class SoapyRemoteSource(SoapyConnectorSource):
@ -18,4 +21,13 @@ class SoapyRemoteSource(SoapyConnectorSource):
class SoapyRemoteDeviceDescription(SoapyConnectorDeviceDescription):
pass
def getInputs(self) -> List[Input]:
return self.mergeInputs(
super().getInputs(),
[
RemoteInput(),
TextInput(
"remote_driver", "Remote driver", infotext="SoapySDR driver to be used on the remote SoapySDRServer"
),
],
)