2020-03-15 16:24:36 +00:00
|
|
|
from .direct import DirectSource
|
|
|
|
from owrx.command import Flag, Option
|
|
|
|
|
|
|
|
|
|
|
|
#
|
2020-03-15 23:13:51 +00:00
|
|
|
# In order to interface Perseus hardware, we resolve to use the
|
|
|
|
# perseustest utility that comes with libperseus-sdr support package.
|
|
|
|
# Below the base options used are shown:
|
|
|
|
#
|
|
|
|
# -p output I/Q samples as 32 bits floating point
|
|
|
|
# -d -1 suppress debug messages
|
|
|
|
# -a don't test attenuators on startup
|
|
|
|
# -t 0 runs indefinitely
|
|
|
|
# -o - output samples on stdout
|
|
|
|
#
|
|
|
|
# As we are already returning I/Q samples as pairs of 32 bits
|
|
|
|
# floating points (option -p),no need for further conversions,
|
|
|
|
# so the method getFormatConversion(self) is not implemented at all.
|
2020-03-15 16:24:36 +00:00
|
|
|
|
|
|
|
class PerseussdrSource(DirectSource):
|
|
|
|
def getCommandMapper(self):
|
2020-03-15 23:13:51 +00:00
|
|
|
return super().getCommandMapper().setBase("perseustest -p -d -1 -a -t 0 -o - ").setMappings(
|
2020-03-15 16:24:36 +00:00
|
|
|
{
|
|
|
|
"samp_rate": Option("-s"),
|
|
|
|
"tuner_freq": Option("-f"),
|
2020-03-15 23:13:51 +00:00
|
|
|
"attenuator": Option("-u"),
|
|
|
|
"adc_preamp": Option("-m"),
|
|
|
|
"adc_dither": Option("-x"),
|
|
|
|
"wideband": Option("-w"),
|
2020-03-15 16:24:36 +00:00
|
|
|
}
|
2020-03-15 23:13:51 +00:00
|
|
|
)
|
2020-03-15 16:24:36 +00:00
|
|
|
|
|
|
|
def getEventNames(self):
|
|
|
|
return super().getEventNames() + [
|
2020-03-15 23:13:51 +00:00
|
|
|
"attenuator",
|
|
|
|
"adc_preamp",
|
|
|
|
"adc_dither",
|
|
|
|
"wideband",
|
2020-03-15 16:24:36 +00:00
|
|
|
]
|