add sdrplay specific options

This commit is contained in:
Jakob Ketterl 2021-02-20 19:00:28 +01:00
parent 18e8ca5e43
commit 8b24eff72e

View File

@ -1,6 +1,7 @@
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
from owrx.form import Input from owrx.form import Input, CheckboxInput, DropdownInput, DropdownEnum
from owrx.form.device import BiasTeeInput from owrx.form.device import BiasTeeInput
from owrx.form.converter import OptionalConverter, EnumConverter
from typing import List from typing import List
@ -22,9 +23,44 @@ class SdrplaySource(SoapyConnectorSource):
return "sdrplay" return "sdrplay"
class IfModeOptions(DropdownEnum):
IFMODE_ZERO_IF = "Zero-IF"
IFMODE_450 = "450kHz"
IFMODE_1620 = "1620kHz"
IFMODE_2048 = "2048kHz"
def __str__(self):
return self.value
class SdrplayDeviceDescription(SoapyConnectorDeviceDescription): class SdrplayDeviceDescription(SoapyConnectorDeviceDescription):
def getGainStages(self): def getGainStages(self):
return ["RFGR", "IFGR"] return ["RFGR", "IFGR"]
def getInputs(self) -> List[Input]: def getInputs(self) -> List[Input]:
return self.mergeInputs(super().getInputs(), [BiasTeeInput()]) return self.mergeInputs(
super().getInputs(),
[
BiasTeeInput(),
CheckboxInput(
"rf_notch",
"",
checkboxText="Enable RF notch filter",
converter=OptionalConverter(defaultFormValue=True),
),
CheckboxInput(
"dab_notch",
"",
checkboxText="Enable DAB notch filter",
converter=OptionalConverter(defaultFormValue=True),
),
DropdownInput(
"if_mode",
"IF Mode",
IfModeOptions,
converter=OptionalConverter(
EnumConverter(IfModeOptions), defaultFormValue=IfModeOptions.IFMODE_ZERO_IF.name
),
),
],
)