openwebrx/owrx/source/airspy.py

63 lines
2 KiB
Python
Raw Normal View History

2021-02-20 18:09:24 +01:00
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
2021-04-29 15:17:21 +02:00
from owrx.form.input import Input, CheckboxInput
from owrx.form.input.device import BiasTeeInput
2024-01-17 22:39:05 +01:00
from owrx.form.input.validator import Range
from typing import List
class AirspySource(SoapyConnectorSource):
def getSoapySettingsMappings(self):
mappings = super().getSoapySettingsMappings()
2020-03-21 15:18:45 +01:00
mappings.update(
{
"bias_tee": "biastee",
"bitpack": "bitpack",
}
)
return mappings
2019-12-28 00:33:27 +01:00
def getDriver(self):
return "airspy"
2021-02-20 18:09:24 +01:00
class AirspyDeviceDescription(SoapyConnectorDeviceDescription):
def getName(self):
return "Airspy R2 or Mini"
def supportsPpm(self):
# not supported by the device API
# frequency calibration can be done with separate tools and will be persisted on the device.
# see discussion here: https://groups.io/g/openwebrx/topic/79360293
return False
def getInputs(self) -> List[Input]:
return super().getInputs() + [
BiasTeeInput(),
CheckboxInput(
"bitpack",
"Enable bit-packing",
infotext="Packs two 12-bit samples into 3 bytes."
+ " Lowers USB bandwidth consumption, increases CPU load",
),
]
def getDeviceOptionalKeys(self):
return super().getDeviceOptionalKeys() + ["bias_tee", "bitpack"]
2021-02-23 18:32:23 +01:00
def getProfileOptionalKeys(self):
return super().getProfileOptionalKeys() + ["bias_tee"]
2021-02-23 17:36:16 +01:00
def getGainStages(self):
return ["LNA", "MIX", "VGA"]
2024-01-17 22:39:05 +01:00
def getSampleRateRanges(self) -> List[Range]:
2024-01-17 22:39:05 +01:00
# Airspy R2 does 2.5 or 10 MS/s
# Airspy mini does 3 or 6 MS/s
# we don't know what device we're actually dealing with, but we can still clamp it down to a sum of the options.
return [
Range(2500000),
Range(3000000),
Range(6000000),
Range(10000000),
]