introduce connector source for sdrplay

This commit is contained in:
Jakob Ketterl 2019-11-17 20:52:16 +01:00
parent 6619a1b4a6
commit a9b99fa0ff
2 changed files with 20 additions and 11 deletions

View File

@ -20,8 +20,9 @@ class FeatureDetector(object):
features = { features = {
"core": ["csdr", "nmux", "nc"], "core": ["csdr", "nmux", "nc"],
"rtl_sdr": ["rtl_sdr"], "rtl_sdr": ["rtl_sdr"],
"rtl_sdr_socket": ["owrx_connector"], "rtl_sdr_connector": ["owrx_connector"],
"sdrplay": ["rx_tools"], "sdrplay": ["rx_tools"],
"sdrplay_connector": ["owrx_connector"],
"hackrf": ["hackrf_transfer"], "hackrf": ["hackrf_transfer"],
"airspy": ["airspy_rx"], "airspy": ["airspy_rx"],
"digital_voice_digiham": ["digiham", "sox"], "digital_voice_digiham": ["digiham", "sox"],

View File

@ -199,9 +199,7 @@ class SdrSource(object):
props = self.rtlProps props = self.rtlProps
cmd = self.getCommand().format( cmd = self.getCommand().format(
**props.collect( **props.collect(*self.getEventNames()).__dict__()
"samp_rate", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna", "if_gain"
).__dict__()
) )
format_conversion = self.getFormatConversion() format_conversion = self.getFormatConversion()
@ -439,15 +437,12 @@ class Resampler(SdrSource):
pass pass
class RtlSdrSocketSource(SdrSource): class ConnectorSource(SdrSource):
def __init__(self, id, props, port): def __init__(self, id, props, port):
super().__init__(id, props, port) super().__init__(id, props, port)
self.controlSocket = None self.controlSocket = None
self.controlPort = getAvailablePort() self.controlPort = getAvailablePort()
def getEventNames(self):
return ["samp_rate", "center_freq", "ppm", "rf_gain"]
def wireEvents(self): def wireEvents(self):
def reconfigure(prop, value): def reconfigure(prop, value):
if self.monitor is None: if self.monitor is None:
@ -468,9 +463,6 @@ class RtlSdrSocketSource(SdrSource):
self.controlSocket.close() self.controlSocket.close()
self.controlSocket = None self.controlSocket = None
def getCommand(self):
return "rtl_connector -p {port} -c {controlPort}".format(port=self.port, controlPort=self.controlPort) + " -s {samp_rate} -f {center_freq} -g {rf_gain} -P {ppm}"
def getFormatConversion(self): def getFormatConversion(self):
return None return None
@ -478,6 +470,22 @@ class RtlSdrSocketSource(SdrSource):
return False return False
class RtlSdrConnectorSource(ConnectorSource):
def getEventNames(self):
return ["samp_rate", "center_freq", "ppm", "rf_gain"]
def getCommand(self):
return "rtl_connector -p {port} -c {controlPort}".format(port=self.port, controlPort=self.controlPort) + " -s {samp_rate} -f {center_freq} -g {rf_gain} -P {ppm}"
class SdrplayConnectorSource(ConnectorSource):
def getEventNames(self):
return ["samp_rate", "center_freq", "ppm", "rf_gain", "antenna", "device"]
def getCommand(self):
return "soapy_connector -p {port} -c {controlPort}".format(port=self.port, controlPort=self.controlPort) + " -s {samp_rate} -f {center_freq} -g \"{rf_gain}\" -P {ppm} -a \"{antenna}\" -d \"{device}\""
class RtlSdrSource(SdrSource): class RtlSdrSource(SdrSource):
def getCommand(self): def getCommand(self):
return "rtl_sdr -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -" return "rtl_sdr -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -"