Fixed gate in APRS packets to always use the SSID configured in the [APRS] section of the config. Fixed failure case for loading default configuration to exit after complaining.

This commit is contained in:
Christopher Smith 2021-03-29 15:27:50 -05:00
parent 3f0600e2be
commit 9a67fc084a

View file

@ -64,6 +64,7 @@ else: #Default behavior if no file specified.
if not loadConfig("/etc/" + cf): if not loadConfig("/etc/" + cf):
if not loadConfig(cf): if not loadConfig(cf):
print("Can't find default configuration: " + cf) print("Can't find default configuration: " + cf)
sys.exit(1)
#Allow command-line arguments to override the config file. #Allow command-line arguments to override the config file.
if opts.ssid: if opts.ssid:
@ -98,7 +99,7 @@ SSNum = int(SSNum)
#The beginning of our APRS packets should contain a source, path, #The beginning of our APRS packets should contain a source, path,
# q construct, and gateway address. We'll reuse the same SSID as a gate. # q construct, and gateway address. We'll reuse the same SSID as a gate.
# This is the part between the source and the gate. # This is the part between the source and the gate.
ARPreamble = ''.join(['>APRS,','TCPIP*,','qAS,']) ARPreamble = ''.join(['>APRS,','TCPIP*,','qAS,',conf['APRS']['SSID']])
NAME = "iR-APRSISD" NAME = "iR-APRSISD"
REV = "0.2" REV = "0.2"
@ -263,7 +264,7 @@ def sendAPRS(Placemark):
# @092345z/4903.50N/07201.75W>088/036 # @092345z/4903.50N/07201.75W>088/036
# with a comment on the end that can include altitude and other # with a comment on the end that can include altitude and other
# information. # information.
aprsPacket = ''.join([getSSID(IMEI),ARPreamble,getSSID(IMEI),':@',aprstime,aprspos,aprscs,aprsalt,comment]) aprsPacket = ''.join([getSSID(IMEI),ARPreamble,':@',aprstime,aprspos,aprscs,aprsalt,comment])
#This will throw an exception if the packet is somehow wrong. #This will throw an exception if the packet is somehow wrong.
aprslib.parse(aprsPacket) aprslib.parse(aprsPacket)
AIS.sendall(aprsPacket) AIS.sendall(aprsPacket)