Merge branch 'server_rework' into server_rework_dsd
This commit is contained in:
commit
e79c830db5
@ -137,7 +137,8 @@ sdrs = {
|
|||||||
"rf_gain": 40,
|
"rf_gain": 40,
|
||||||
"samp_rate": 500000,
|
"samp_rate": 500000,
|
||||||
"start_freq": 14070000,
|
"start_freq": 14070000,
|
||||||
"start_mod": "usb"
|
"start_mod": "usb",
|
||||||
|
"antenna": "Antenna A"
|
||||||
},
|
},
|
||||||
"30m": {
|
"30m": {
|
||||||
"name":"30m",
|
"name":"30m",
|
||||||
@ -153,7 +154,8 @@ sdrs = {
|
|||||||
"rf_gain": 40,
|
"rf_gain": 40,
|
||||||
"samp_rate": 500000,
|
"samp_rate": 500000,
|
||||||
"start_freq": 7070000,
|
"start_freq": 7070000,
|
||||||
"start_mod": "usb"
|
"start_mod": "usb",
|
||||||
|
"antenna": "Antenna A"
|
||||||
},
|
},
|
||||||
"80m": {
|
"80m": {
|
||||||
"name":"80m",
|
"name":"80m",
|
||||||
@ -161,7 +163,8 @@ sdrs = {
|
|||||||
"rf_gain": 40,
|
"rf_gain": 40,
|
||||||
"samp_rate": 500000,
|
"samp_rate": 500000,
|
||||||
"start_freq": 3570000,
|
"start_freq": 3570000,
|
||||||
"start_mod": "usb"
|
"start_mod": "usb",
|
||||||
|
"antenna": "Antenna A"
|
||||||
},
|
},
|
||||||
"49m": {
|
"49m": {
|
||||||
"name": "49m Broadcast",
|
"name": "49m Broadcast",
|
||||||
@ -169,7 +172,8 @@ sdrs = {
|
|||||||
"rf_gain": 40,
|
"rf_gain": 40,
|
||||||
"samp_rate": 500000,
|
"samp_rate": 500000,
|
||||||
"start_freq": 6070000,
|
"start_freq": 6070000,
|
||||||
"start_mod": "am"
|
"start_mod": "am",
|
||||||
|
"antenna": "Antenna A"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -56,7 +56,7 @@ class PropertyManager(object):
|
|||||||
return PropertyManager.sharedInstance
|
return PropertyManager.sharedInstance
|
||||||
|
|
||||||
def collect(self, *props):
|
def collect(self, *props):
|
||||||
return PropertyManager(dict((name, self.getProperty(name) if self.hasProperty(name) else Property()) for name in props))
|
return PropertyManager({name: self.getProperty(name) if self.hasProperty(name) else Property() for name in props})
|
||||||
|
|
||||||
def __init__(self, properties = None):
|
def __init__(self, properties = None):
|
||||||
self.properties = {}
|
self.properties = {}
|
||||||
|
@ -76,7 +76,7 @@ class SdrSource(object):
|
|||||||
self.props = props
|
self.props = props
|
||||||
self.activateProfile()
|
self.activateProfile()
|
||||||
self.rtlProps = self.props.collect(
|
self.rtlProps = self.props.collect(
|
||||||
"type", "samp_rate", "nmux_memory", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp"
|
"samp_rate", "nmux_memory", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna"
|
||||||
).defaults(PropertyManager.getSharedInstance())
|
).defaults(PropertyManager.getSharedInstance())
|
||||||
|
|
||||||
def restart(name, value):
|
def restart(name, value):
|
||||||
@ -92,9 +92,13 @@ class SdrSource(object):
|
|||||||
self.process = None
|
self.process = None
|
||||||
self.modificationLock = threading.Lock()
|
self.modificationLock = threading.Lock()
|
||||||
|
|
||||||
# override these in subclasses as necessary
|
# override this in subclasses
|
||||||
self.command = None
|
def getCommand(self):
|
||||||
self.format_conversion = None
|
pass
|
||||||
|
|
||||||
|
# override this in subclasses, if necessary
|
||||||
|
def getFormatConversion(self):
|
||||||
|
return None
|
||||||
|
|
||||||
def activateProfile(self, id = None):
|
def activateProfile(self, id = None):
|
||||||
profiles = self.props["profiles"]
|
profiles = self.props["profiles"]
|
||||||
@ -127,17 +131,13 @@ class SdrSource(object):
|
|||||||
|
|
||||||
props = self.rtlProps
|
props = self.rtlProps
|
||||||
|
|
||||||
start_sdr_command = self.command.format(
|
start_sdr_command = self.getCommand().format(
|
||||||
samp_rate = props["samp_rate"],
|
**props.collect("samp_rate", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna").__dict__()
|
||||||
center_freq = props["center_freq"],
|
|
||||||
ppm = props["ppm"],
|
|
||||||
rf_gain = props["rf_gain"],
|
|
||||||
lna_gain = props["lna_gain"],
|
|
||||||
rf_amp = props["rf_amp"]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.format_conversion is not None:
|
format_conversion = self.getFormatConversion()
|
||||||
start_sdr_command += " | " + self.format_conversion
|
if format_conversion is not None:
|
||||||
|
start_sdr_command += " | " + format_conversion
|
||||||
|
|
||||||
nmux_bufcnt = nmux_bufsize = 0
|
nmux_bufcnt = nmux_bufsize = 0
|
||||||
while nmux_bufsize < props["samp_rate"]/4: nmux_bufsize += 4096
|
while nmux_bufsize < props["samp_rate"]/4: nmux_bufsize += 4096
|
||||||
@ -228,22 +228,26 @@ class SdrSource(object):
|
|||||||
|
|
||||||
|
|
||||||
class RtlSdrSource(SdrSource):
|
class RtlSdrSource(SdrSource):
|
||||||
def __init__(self, props, port):
|
def getCommand(self):
|
||||||
super().__init__(props, port)
|
return "rtl_sdr -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -"
|
||||||
self.command = "rtl_sdr -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -"
|
|
||||||
self.format_conversion = "csdr convert_u8_f"
|
def getFormatConversion(self):
|
||||||
|
return "csdr convert_u8_f"
|
||||||
|
|
||||||
class HackrfSource(SdrSource):
|
class HackrfSource(SdrSource):
|
||||||
def __init__(self, props, port):
|
def getCommand(self):
|
||||||
super().__init__(props, port)
|
return "hackrf_transfer -s {samp_rate} -f {center_freq} -g {rf_gain} -l{lna_gain} -a{rf_amp} -r-"
|
||||||
self.command = "hackrf_transfer -s {samp_rate} -f {center_freq} -g {rf_gain} -l{lna_gain} -a{rf_amp} -r-"
|
|
||||||
self.format_conversion = "csdr convert_s8_f"
|
def getFormatConversion(self):
|
||||||
|
return "csdr convert_s8_f"
|
||||||
|
|
||||||
class SdrplaySource(SdrSource):
|
class SdrplaySource(SdrSource):
|
||||||
def __init__(self, props, port):
|
def getCommand(self):
|
||||||
super().__init__(props, port)
|
command = "rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain}"
|
||||||
self.command = "rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -"
|
if self.rtlProps["antenna"] is not None:
|
||||||
self.format_conversion = None
|
command += " -a \"{antenna}\""
|
||||||
|
command += " -"
|
||||||
|
return command
|
||||||
|
|
||||||
def sleepOnRestart(self):
|
def sleepOnRestart(self):
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user