openwebrx-clone/owrx/source/sdrplay.py

78 lines
2.3 KiB
Python
Raw Normal View History

2021-02-19 14:29:17 +00:00
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
from owrx.form.input import Input, CheckboxInput, DropdownInput, NumberInput, DropdownEnum
from owrx.form.input.device import BiasTeeInput, GainInput
from typing import List
class SdrplaySource(SoapyConnectorSource):
2020-03-14 00:15:25 +00:00
def getSoapySettingsMappings(self):
mappings = super().getSoapySettingsMappings()
mappings.update(
{
"bias_tee": "biasT_ctrl",
"rf_notch": "rfnotch_ctrl",
"dab_notch": "dabnotch_ctrl",
"if_mode": "if_mode",
2020-12-27 12:52:49 +00:00
"external_reference": "extref_ctrl",
"rfgain_sel": "rfgain_sel",
"agc_setpoint": "agc_setpoint",
}
)
2020-03-14 00:15:25 +00:00
return mappings
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):
def getName(self):
return "SDRPlay device (RSP1, RSP2, RSPDuo, RSPDx)"
def getInputs(self) -> List[Input]:
return super().getInputs() + [
BiasTeeInput(),
CheckboxInput(
"rf_notch",
"Enable RF notch filter",
),
CheckboxInput(
"dab_notch",
"Enable DAB notch filter",
),
DropdownInput(
"if_mode",
"IF Mode",
IfModeOptions,
),
NumberInput(
"rfgain_sel",
"RF gain reduction",
),
NumberInput(
"agc_setpoint",
"AGC setpoint",
append="dBFS",
),
GainInput(
"rf_gain",
"IF gain reduction",
has_agc=self.hasAgc(),
),
]
def getDeviceOptionalKeys(self):
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):
return super().getProfileOptionalKeys() + ["bias_tee", "rf_notch", "dab_notch", "if_mode", "rfgain_sel", "agc_setpoint"]