add bias_tee and direct_sampling options

This commit is contained in:
Jakob Ketterl 2021-02-20 18:48:12 +01:00
parent 0ab6729fcc
commit 18e8ca5e43
6 changed files with 63 additions and 5 deletions

View File

@ -1,4 +1,5 @@
from owrx.form import Input
from owrx.form import Input, CheckboxInput, DropdownInput, DropdownEnum
from owrx.form.converter import OptionalConverter, EnumConverter
from owrx.soapy import SoapySettings
@ -118,3 +119,39 @@ class GainInput(Input):
return {self.id: SoapySettings.encode(settings_dict)}
return {self.id: None}
class BiasTeeInput(CheckboxInput):
def __init__(self):
super().__init__(
"bias_tee", "", "Enable Bias-Tee power supply", converter=OptionalConverter(defaultFormValue=False)
)
class DirectSamplingOptions(DropdownEnum):
DIRECT_SAMPLING_OFF = (0, "Off")
DIRECT_SAMPLING_I = (1, "Direct Sampling (I branch)")
DIRECT_SAMPLING_Q = (2, "Direct Sampling (Q branch)")
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 DirectSamplingInput(DropdownInput):
def __init__(self):
super().__init__(
"direct_sampling",
"Direct Sampling",
DirectSamplingOptions,
converter=OptionalConverter(
EnumConverter(DirectSamplingOptions),
defaultFormValue=DirectSamplingOptions.DIRECT_SAMPLING_OFF.name,
),
)

View File

@ -1,4 +1,7 @@
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
from owrx.form import Input
from owrx.form.device import BiasTeeInput
from typing import List
class AirspySource(SoapyConnectorSource):
@ -17,4 +20,5 @@ class AirspySource(SoapyConnectorSource):
class AirspyDeviceDescription(SoapyConnectorDeviceDescription):
pass
def getInputs(self) -> List[Input]:
return self.mergeInputs(super().getInputs(), [BiasTeeInput()])

View File

@ -1,4 +1,7 @@
from .soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
from owrx.form import Input
from owrx.form.device import BiasTeeInput
from typing import List
class HackrfSource(SoapyConnectorSource):
@ -12,4 +15,5 @@ class HackrfSource(SoapyConnectorSource):
class HackrfDeviceDescription(SoapyConnectorDeviceDescription):
pass
def getInputs(self) -> List[Input]:
return self.mergeInputs(super().getInputs(), [BiasTeeInput])

View File

@ -3,6 +3,7 @@ from owrx.command import Flag, Option
from typing import List
from owrx.form import Input, TextInput
from owrx.form.converter import OptionalConverter
from owrx.form.device import BiasTeeInput, DirectSamplingInput
class RtlSdrSource(ConnectorSource):
@ -26,5 +27,7 @@ class RtlSdrDeviceDescription(ConnectorDeviceDescription):
infotext="Device serial number or index",
converter=OptionalConverter(),
),
BiasTeeInput(),
DirectSamplingInput()
],
)

View File

@ -1,4 +1,7 @@
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
from owrx.form import Input
from owrx.form.device import BiasTeeInput, DirectSamplingInput
from typing import List
class RtlSdrSoapySource(SoapyConnectorSource):
@ -12,4 +15,5 @@ class RtlSdrSoapySource(SoapyConnectorSource):
class RtlSdrSoapyDeviceDescription(SoapyConnectorDeviceDescription):
pass
def getInputs(self) -> List[Input]:
return self.mergeInputs(super().getInputs(), [BiasTeeInput(), DirectSamplingInput()])

View File

@ -1,4 +1,7 @@
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
from owrx.form import Input
from owrx.form.device import BiasTeeInput
from typing import List
class SdrplaySource(SoapyConnectorSource):
@ -22,3 +25,6 @@ class SdrplaySource(SoapyConnectorSource):
class SdrplayDeviceDescription(SoapyConnectorDeviceDescription):
def getGainStages(self):
return ["RFGR", "IFGR"]
def getInputs(self) -> List[Input]:
return self.mergeInputs(super().getInputs(), [BiasTeeInput()])