Add APRS type to message

pull/31/head
Konstantin Gründger 2017-09-29 08:54:48 +02:00
rodzic 6044e58773
commit ca5636456a
2 zmienionych plików z 8 dodań i 2 usunięć

Wyświetl plik

@ -29,7 +29,8 @@ def parse_aprs(message, reference_date=None, reference_time=None):
'track': int(match_position.group('course')) if match_position.group('course_extension') else None,
'ground_speed': int(match_position.group('ground_speed')) * kts2kmh if match_position.group('ground_speed') else None,
'altitude': int(match_position.group('altitude')) * feet2m,
'comment': match_position.group('comment')}
'comment': match_position.group('comment'),
'aprs_type': 'position'}
match_status = re.search(PATTERN_APRS_STATUS, message)
if match_status:
@ -37,7 +38,8 @@ def parse_aprs(message, reference_date=None, reference_time=None):
'dstcall': match_status.group('dstcall'),
'receiver_name': match_status.group('receiver'),
'timestamp': createTimestamp(match_status.group('time'), reference_date, reference_time),
'comment': match_status.group('comment')}
'comment': match_status.group('comment'),
'aprs_type': 'status'}
raise AprsParseError(message)

Wyświetl plik

@ -28,6 +28,8 @@ class TestStringMethods(unittest.TestCase):
self.assertAlmostEqual(message['altitude'] * m2feet, 5524, 5)
self.assertEqual(message['comment'], "this is a comment")
self.assertEqual(message['aprs_type'], 'position')
def test_v024(self):
# higher precision datum format introduced
raw_message = "FLRDDA5BA>APRS,qAS,LFMX:/160829h4415.41N/00600.03E'342/049/A=005524 !W26! id21400EA9 -2454fpm +0.9rot 19.5dB 0e -6.6kHz gps1x1 s6.02 h44 rDF0C56"
@ -46,6 +48,8 @@ class TestStringMethods(unittest.TestCase):
self.assertEqual(message['timestamp'].strftime('%H:%M:%S'), "09:34:56")
self.assertEqual(message['comment'], "this is a comment")
self.assertEqual(message['aprs_type'], 'status')
def test_v026(self):
# from 0.2.6 the ogn comment of a receiver beacon is just optional
raw_message = "Ulrichamn>APRS,TCPIP*,qAC,GLIDERN1:/085616h5747.30NI01324.77E&/A=001322"