Relax APRS packet parser pattern to allow other destination calls than APRS

APRS spec allows any callsign-like string, and it is widely used to signal
which software or device generated the packet.
For OGN use, I would recommend using OGN-specific destination callsigns,
maybe software/tracker-specific OGN-prefixed calls. APRS tocall
index is found here, AP-prefixed tocalls are used for APRS devices.
https://github.com/hessu/aprs-deviceid/blob/master/tocalls.yaml

Fixes #9.
pull/10/head
Heikki Hannikainen 2016-08-03 22:21:55 +03:00 zatwierdzone przez Fabian P. Schmidt
rodzic 58cceb9aa2
commit de99c3b052
2 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -14,6 +14,7 @@ def parse_aprs(message, reference_date=None):
if match:
return {'name': match.group('callsign'),
'receiver_name': match.group('receiver'),
'dstcall': match.group('dstcall'),
'timestamp': createTimestamp(match.group('time'), reference_date),
'latitude': dmsToDeg(float(match.group('latitude')) / 100) *
(-1 if match.group('latitude_sign') == 'S' else 1) +

Wyświetl plik

@ -1,7 +1,7 @@
import re
PATTERN_APRS = re.compile(r"^(?P<callsign>.+?)>APRS,.+,(?P<receiver>.+?):/(?P<time>\d{6})+h(?P<latitude>\d{4}\.\d{2})(?P<latitude_sign>N|S)(?P<symbol_table>.)(?P<longitude>\d{5}\.\d{2})(?P<longitude_sign>E|W)(?P<symbol>.)(?P<course_extension>(?P<course>\d{3})/(?P<ground_speed>\d{3}))?/A=(?P<altitude>\d{6})(?P<pos_extension>\s!W((?P<latitude_enhancement>\d)(?P<longitude_enhancement>\d))!)?\s(?P<comment>.*)$")
PATTERN_APRS = re.compile(r"^(?P<callsign>.+?)>(?P<dstcall>[A-Z0-9]+),.+,(?P<receiver>.+?):/(?P<time>\d{6})+h(?P<latitude>\d{4}\.\d{2})(?P<latitude_sign>N|S)(?P<symbol_table>.)(?P<longitude>\d{5}\.\d{2})(?P<longitude_sign>E|W)(?P<symbol>.)(?P<course_extension>(?P<course>\d{3})/(?P<ground_speed>\d{3}))?/A=(?P<altitude>\d{6})(?P<pos_extension>\s!W((?P<latitude_enhancement>\d)(?P<longitude_enhancement>\d))!)?\s(?P<comment>.*)$")
# The following regexp patterns are part of the ruby ogn-client.
# source: https://github.com/svoop/ogn_client-ruby