Make hpsdrconnector into a true connector.

This commit is contained in:
Jim Ancona 2020-11-09 19:19:34 -05:00
parent c85400063c
commit 91572c56e2

View File

@ -1,4 +1,4 @@
from .direct import DirectSource from .connector import ConnectorSource
from owrx.command import Flag, Option from owrx.command import Flag, Option
# In order to use an HPSDR radio, you must install hpsdrconnector from https://github.com/jancona/hpsdrconnector # In order to use an HPSDR radio, you must install hpsdrconnector from https://github.com/jancona/hpsdrconnector
@ -11,21 +11,24 @@ from owrx.command import Flag, Option
# IP address of radio (default use first radio discovered) # IP address of radio (default use first radio discovered)
# --samplerate uint # --samplerate uint
# Use the specified samplerate: one of 48000, 96000, 192000, 384000 (default 96000) # Use the specified samplerate: one of 48000, 96000, 192000, 384000 (default 96000)
# --debug
# Emit debug log messages on stdout
# #
# If you omit `remote` from config_webrx.py, hpsdrconnector will use the HPSDR discovery protocol # If you omit `remote` from config_webrx.py, hpsdrconnector will use the HPSDR discovery protocol
# to find radios on your local network and will connect to the first radio it discovered. # to find radios on your local network and will connect to the first radio it discovered.
class HpsdrSource(DirectSource): class HpsdrSource(ConnectorSource):
def getCommandMapper(self): def getCommandMapper(self):
return super().getCommandMapper().setBase("hpsdrconnector").setMappings( return (
super()
.getCommandMapper()
.setBase("hpsdrconnector")
.setMappings(
{ {
"tuner_freq": Option("--frequency"), "tuner_freq": Option("--frequency"),
"samp_rate": Option("--samplerate"), "samp_rate": Option("--samplerate"),
"remote": Option("--radio"), "remote": Option("--radio"),
"rf_gain": Option("--gain"), "rf_gain": Option("--gain"),
} "debug": Flag("--debug"),
})
) )
def getFormatConversion(self):
return ["csdr convert_s24_f"]