2021-02-19 14:29:17 +00:00
|
|
|
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
|
2022-08-25 16:30:08 +00:00
|
|
|
from owrx.form.input import Input, CheckboxInput, DropdownInput, NumberInput, DropdownEnum
|
|
|
|
from owrx.form.input.device import BiasTeeInput, GainInput
|
2022-08-25 22:22:54 +00:00
|
|
|
from owrx.form.input.validator import RangeValidator
|
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",
|
2022-08-25 16:30:08 +00:00
|
|
|
"rfgain_sel": "rfgain_sel",
|
|
|
|
"agc_setpoint": "agc_setpoint",
|
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-04-17 15:42:08 +00:00
|
|
|
def getName(self):
|
|
|
|
return "SDRPlay device (RSP1, RSP2, RSPDuo, RSPDx)"
|
|
|
|
|
2021-02-20 17:48:12 +00:00
|
|
|
def getInputs(self) -> List[Input]:
|
2021-02-21 23:35:47 +00:00
|
|
|
return super().getInputs() + [
|
|
|
|
BiasTeeInput(),
|
|
|
|
CheckboxInput(
|
|
|
|
"rf_notch",
|
2021-02-21 23:57:02 +00:00
|
|
|
"Enable RF notch filter",
|
2021-02-21 23:35:47 +00:00
|
|
|
),
|
|
|
|
CheckboxInput(
|
|
|
|
"dab_notch",
|
2021-02-21 23:57:02 +00:00
|
|
|
"Enable DAB notch filter",
|
2021-02-21 23:35:47 +00:00
|
|
|
),
|
|
|
|
DropdownInput(
|
|
|
|
"if_mode",
|
|
|
|
"IF Mode",
|
|
|
|
IfModeOptions,
|
|
|
|
),
|
2022-08-25 16:30:08 +00:00
|
|
|
NumberInput(
|
|
|
|
"rfgain_sel",
|
|
|
|
"RF gain reduction",
|
2022-08-25 22:22:54 +00:00
|
|
|
validator=RangeValidator(0, 32),
|
2022-08-25 16:30:08 +00:00
|
|
|
),
|
|
|
|
NumberInput(
|
|
|
|
"agc_setpoint",
|
|
|
|
"AGC setpoint",
|
|
|
|
append="dBFS",
|
2022-08-25 22:22:54 +00:00
|
|
|
validator=RangeValidator(-60, 0),
|
2022-08-25 16:30:08 +00:00
|
|
|
),
|
|
|
|
GainInput(
|
|
|
|
"rf_gain",
|
|
|
|
"IF gain reduction",
|
|
|
|
has_agc=self.hasAgc(),
|
|
|
|
),
|
2021-02-21 23:35:47 +00:00
|
|
|
]
|
|
|
|
|
2021-03-24 22:17:50 +00:00
|
|
|
def getDeviceOptionalKeys(self):
|
2022-08-25 16:30:08 +00:00
|
|
|
return super().getDeviceOptionalKeys() + ["bias_tee", "rf_notch", "dab_notch", "if_mode", "rfgain_sel", "agc_setpoint"]
|
2021-02-23 17:32:23 +00:00
|
|
|
|
|
|
|
def getProfileOptionalKeys(self):
|
2022-08-25 16:30:08 +00:00
|
|
|
return super().getProfileOptionalKeys() + ["bias_tee", "rf_notch", "dab_notch", "if_mode", "rfgain_sel", "agc_setpoint"]
|