Merge pull request #62 from glidernet/clementallen_master

Bugfix for #61
pull/65/head
Meisterschueler 2019-05-07 22:45:49 +02:00 zatwierdzone przez GitHub
commit 4780a08500
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 16 dodań i 12 usunięć

Wyświetl plik

@ -2,6 +2,7 @@ import re
from ogn.parser.pattern import PATTERN_TRACKER_POSITION_COMMENT, PATTERN_TRACKER_STATUS_COMMENT
from ogn.parser.utils import FPM_TO_MS, HPM_TO_DEGS
from ogn.parser.exceptions import OgnParseError
from .base import BaseParser
@ -30,6 +31,7 @@ class TrackerParser(BaseParser):
@staticmethod
def parse_status(aprs_comment):
match = re.search(PATTERN_TRACKER_STATUS_COMMENT, aprs_comment)
if match:
return {'hardware_version': int(match.group('hardware_version')) if match.group('hardware_version') else None,
'software_version': int(match.group('software_version')) if match.group('software_version') else None,
'gps_satellites': int(match.group('gps_satellites')) if match.group('gps_satellites') else None,
@ -42,3 +44,5 @@ class TrackerParser(BaseParser):
'transmitter_power': int(match.group('transmitter_power')) if match.group('transmitter_power') else None,
'noise_level': float(match.group('noise_level')) if match.group('noise_level') else None,
'relays': int(match.group('relays')) if match.group('relays') else None}
else:
raise OgnParseError("OGNTRK status message invalid: {}".format(aprs_comment))