flag services (avoid connecting to aprs network twice)

This commit is contained in:
Jakob Ketterl 2019-09-13 22:28:17 +02:00
parent 5bcad1ef2f
commit 311f22f6ba
3 changed files with 10 additions and 5 deletions

10
csdr.py
View File

@ -65,7 +65,7 @@ class output(object):
class dsp(object): class dsp(object):
def __init__(self, output): def __init__(self, output):
self.samp_rate = 250000 self.samp_rate = 250000
self.output_rate = 11025 # this is default, and cannot be set at the moment self.output_rate = 11025
self.fft_size = 1024 self.fft_size = 1024
self.fft_fps = 5 self.fft_fps = 5
self.offset_freq = 0 self.offset_freq = 0
@ -80,7 +80,7 @@ class dsp(object):
self.demodulator = "nfm" self.demodulator = "nfm"
self.name = "csdr" self.name = "csdr"
self.base_bufsize = 512 self.base_bufsize = 512
self.nc_port = 4951 self.nc_port = None
self.csdr_dynamic_bufsize = False self.csdr_dynamic_bufsize = False
self.csdr_print_bufsizes = False self.csdr_print_bufsizes = False
self.csdr_through = False self.csdr_through = False
@ -108,9 +108,13 @@ class dsp(object):
self.modification_lock = threading.Lock() self.modification_lock = threading.Lock()
self.output = output self.output = output
self.temporary_directory = "/tmp" self.temporary_directory = "/tmp"
self.is_service = False
self.direwolf_config = None self.direwolf_config = None
self.direwolf_port = None self.direwolf_port = None
def set_service(self, flag=True):
self.is_service = flag
def set_temporary_directory(self, what): def set_temporary_directory(self, what):
self.temporary_directory = what self.temporary_directory = what
@ -563,7 +567,7 @@ class dsp(object):
) )
self.direwolf_port = KissClient.getFreePort() self.direwolf_port = KissClient.getFreePort()
file = open(self.direwolf_config, "w") file = open(self.direwolf_config, "w")
file.write(DirewolfConfig().getConfig(self.direwolf_port)) file.write(DirewolfConfig().getConfig(self.direwolf_port, self.is_service))
file.close() file.close()
else: else:
self.direwolf_config = None self.direwolf_config = None

View File

@ -13,7 +13,7 @@ TFESC = 0xDD
class DirewolfConfig(object): class DirewolfConfig(object):
def getConfig(self, port): def getConfig(self, port, is_service):
pm = PropertyManager.getSharedInstance() pm = PropertyManager.getSharedInstance()
config = """ config = """
@ -29,7 +29,7 @@ AGWPORT off
port=port, callsign=pm["aprs_callsign"] port=port, callsign=pm["aprs_callsign"]
) )
if pm["aprs_igate_enabled"]: if is_service and pm["aprs_igate_enabled"]:
config += """ config += """
IGSERVER {server} IGSERVER {server}
IGLOGIN {callsign} {password} IGLOGIN {callsign} {password}

View File

@ -196,6 +196,7 @@ class ServiceHandler(object):
d.set_secondary_demodulator(mode) d.set_secondary_demodulator(mode)
d.set_audio_compression("none") d.set_audio_compression("none")
d.set_samp_rate(source.getProps()["samp_rate"]) d.set_samp_rate(source.getProps()["samp_rate"])
d.set_service()
d.start() d.start()
return d return d