2021-02-19 14:29:17 +00:00
|
|
|
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
|
2021-02-20 18:00:28 +00:00
|
|
|
from owrx.form import Input, CheckboxInput, DropdownInput, DropdownEnum
|
2021-02-20 17:48:12 +00:00
|
|
|
from owrx.form.device import BiasTeeInput
|
2021-02-20 18:00:28 +00:00
|
|
|
from owrx.form.converter import OptionalConverter, EnumConverter
|
2021-02-20 17:48:12 +00:00
|
|
|
from typing import List
|
2019-12-21 19:58:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SdrplaySource(SoapyConnectorSource):
|
2020-03-14 00:15:25 +00:00
|
|
|
def getSoapySettingsMappings(self):
|
|
|
|
mappings = super().getSoapySettingsMappings()
|
2020-03-14 00:21:43 +00:00
|
|
|
mappings.update(
|
|
|
|
{
|
|
|
|
"bias_tee": "biasT_ctrl",
|
|
|
|
"rf_notch": "rfnotch_ctrl",
|
|
|
|
"dab_notch": "dabnotch_ctrl",
|
2020-04-26 11:49:03 +00:00
|
|
|
"if_mode": "if_mode",
|
2020-12-27 12:52:49 +00:00
|
|
|
"external_reference": "extref_ctrl",
|
2020-03-14 00:21:43 +00:00
|
|
|
}
|
|
|
|
)
|
2020-03-14 00:15:25 +00:00
|
|
|
return mappings
|
|
|
|
|
2019-12-21 19:58:28 +00:00
|
|
|
def getDriver(self):
|
|
|
|
return "sdrplay"
|
2021-02-19 14:29:17 +00:00
|
|
|
|
|
|
|
|
2021-02-20 18:00:28 +00:00
|
|
|
class IfModeOptions(DropdownEnum):
|
|
|
|
IFMODE_ZERO_IF = "Zero-IF"
|
|
|
|
IFMODE_450 = "450kHz"
|
|
|
|
IFMODE_1620 = "1620kHz"
|
|
|
|
IFMODE_2048 = "2048kHz"
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.value
|
|
|
|
|
|
|
|
|
2021-02-19 14:29:17 +00:00
|
|
|
class SdrplayDeviceDescription(SoapyConnectorDeviceDescription):
|
2021-02-19 17:18:25 +00:00
|
|
|
def getGainStages(self):
|
|
|
|
return ["RFGR", "IFGR"]
|
2021-02-20 17:48:12 +00:00
|
|
|
|
|
|
|
def getInputs(self) -> List[Input]:
|
2021-02-20 18:00:28 +00:00
|
|
|
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
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|