2021-02-19 15:29:17 +01:00
|
|
|
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
|
2024-01-17 23:12:24 +01:00
|
|
|
from owrx.form.input import Input, CheckboxInput
|
2021-04-29 15:17:21 +02:00
|
|
|
from owrx.form.input.device import BiasTeeInput
|
2024-01-17 22:39:05 +01:00
|
|
|
from owrx.form.input.validator import Range
|
2021-02-20 18:48:12 +01:00
|
|
|
from typing import List
|
2019-12-21 20:58:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class SdrplaySource(SoapyConnectorSource):
|
2020-03-14 01:15:25 +01:00
|
|
|
def getSoapySettingsMappings(self):
|
|
|
|
|
mappings = super().getSoapySettingsMappings()
|
2020-03-14 01:21:43 +01:00
|
|
|
mappings.update(
|
|
|
|
|
{
|
|
|
|
|
"bias_tee": "biasT_ctrl",
|
|
|
|
|
"rf_notch": "rfnotch_ctrl",
|
|
|
|
|
"dab_notch": "dabnotch_ctrl",
|
2020-12-27 13:52:49 +01:00
|
|
|
"external_reference": "extref_ctrl",
|
2024-01-17 23:12:24 +01:00
|
|
|
"hdr_ctrl": "hdr_ctrl",
|
2020-03-14 01:21:43 +01:00
|
|
|
}
|
|
|
|
|
)
|
2020-03-14 01:15:25 +01:00
|
|
|
return mappings
|
|
|
|
|
|
2019-12-21 20:58:28 +01:00
|
|
|
def getDriver(self):
|
|
|
|
|
return "sdrplay"
|
2021-02-19 15:29:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class SdrplayDeviceDescription(SoapyConnectorDeviceDescription):
|
2021-04-17 17:42:08 +02:00
|
|
|
def getName(self):
|
|
|
|
|
return "SDRPlay device (RSP1, RSP2, RSPDuo, RSPDx)"
|
|
|
|
|
|
2021-02-19 18:18:25 +01:00
|
|
|
def getGainStages(self):
|
|
|
|
|
return ["RFGR", "IFGR"]
|
2021-02-20 18:48:12 +01:00
|
|
|
|
|
|
|
|
def getInputs(self) -> List[Input]:
|
2021-02-22 00:35:47 +01:00
|
|
|
return super().getInputs() + [
|
|
|
|
|
BiasTeeInput(),
|
|
|
|
|
CheckboxInput(
|
|
|
|
|
"rf_notch",
|
2021-02-22 00:57:02 +01:00
|
|
|
"Enable RF notch filter",
|
2021-02-22 00:35:47 +01:00
|
|
|
),
|
|
|
|
|
CheckboxInput(
|
|
|
|
|
"dab_notch",
|
2021-02-22 00:57:02 +01:00
|
|
|
"Enable DAB notch filter",
|
2021-02-22 00:35:47 +01:00
|
|
|
),
|
2024-01-17 23:12:24 +01:00
|
|
|
CheckboxInput(
|
|
|
|
|
"external_reference",
|
|
|
|
|
"Enable external reference clock",
|
2021-02-22 00:35:47 +01:00
|
|
|
),
|
2024-01-17 23:12:24 +01:00
|
|
|
CheckboxInput(
|
|
|
|
|
"hdr_ctrl",
|
|
|
|
|
"Enable RSPdx HDR mode",
|
|
|
|
|
)
|
2021-02-22 00:35:47 +01:00
|
|
|
]
|
|
|
|
|
|
2021-03-24 23:17:50 +01:00
|
|
|
def getDeviceOptionalKeys(self):
|
2024-01-17 23:12:24 +01:00
|
|
|
return super().getDeviceOptionalKeys() + [
|
|
|
|
|
"bias_tee", "rf_notch", "dab_notch", "external_reference", "hdr_ctrl"
|
|
|
|
|
]
|
2021-02-23 18:32:23 +01:00
|
|
|
|
|
|
|
|
def getProfileOptionalKeys(self):
|
2024-01-17 23:12:24 +01:00
|
|
|
return super().getProfileOptionalKeys() + [
|
|
|
|
|
"bias_tee", "rf_notch", "dab_notch", "external_reference", "hdr_ctrl"
|
|
|
|
|
]
|
2024-01-17 22:39:05 +01:00
|
|
|
|
2024-01-19 02:39:15 +01:00
|
|
|
def getSampleRateRanges(self) -> List[Range]:
|
2024-01-17 22:39:05 +01:00
|
|
|
# this is from SoapySDRPlay3's implementation of listSampleRates().
|
|
|
|
|
# i don't think it's accurate, but this is the limitation we'd be running into if we had proper soapy
|
|
|
|
|
# integration.
|
|
|
|
|
return [
|
|
|
|
|
Range(62500),
|
|
|
|
|
Range(96000),
|
|
|
|
|
Range(125000),
|
|
|
|
|
Range(192000),
|
|
|
|
|
Range(250000),
|
|
|
|
|
Range(384000),
|
|
|
|
|
Range(500000),
|
|
|
|
|
Range(768000),
|
|
|
|
|
Range(1000000),
|
|
|
|
|
Range(2000000),
|
|
|
|
|
Range(2048000),
|
|
|
|
|
Range(3000000),
|
|
|
|
|
Range(4000000),
|
|
|
|
|
Range(5000000),
|
|
|
|
|
Range(6000000),
|
|
|
|
|
Range(7000000),
|
|
|
|
|
Range(8000000),
|
|
|
|
|
Range(9000000),
|
|
|
|
|
Range(10000000),
|
|
|
|
|
]
|