def test_position_comment(self): message = FanetParser.parse_position("id1E1103CE -02fpm") self.assertEqual(message['address_type'], 2) self.assertEqual(message['aircraft_type'], 7) self.assertFalse(message['stealth']) self.assertEqual(message['address'], "1103CE") self.assertAlmostEqual(message['climb_rate'], -2 * FPM_TO_MS, 0.1)
def test_v028_status(self): message = FanetParser().parse_status( 'Name="Juerg Zweifel" 15.0dB -17.1kHz 1e') self.assertEqual(message['fanet_name'], "Juerg Zweifel") self.assertEqual(message['signal_quality'], 15.0) self.assertEqual(message['frequency_offset'], -17.1) self.assertEqual(message['error_count'], 1)
def test_pseudo_status_comment(self): message = FanetParser.parse_position("") self.assertIsNone(message['address_type']) self.assertIsNone(message['aircraft_type']) self.assertIsNone(message['stealth']) self.assertIsNone(message['address']) self.assertIsNone(message['climb_rate'])
reference_timestamp), 'comment': match_status.group('comment') if match_status.group('comment') else "" }) else: raise NotImplementedError(message) else: raise AprsParseError(message) return result dstcall_parser_mapping = { 'APRS': OgnParser(), 'OGNFNT': FanetParser(), 'OGFLR': FlarmParser(), 'OGNTRK': TrackerParser(), 'OGNSDR': ReceiverParser(), 'OGCAPT': GenericParser(beacon_type='capturs'), 'OGFLYM': GenericParser(beacon_type='flymaster'), 'OGINRE': InreachParser(), 'OGLT24': LT24Parser(), 'OGNAVI': NaviterParser(), 'OGPAW': GenericParser(beacon_type='pilot_aware'), 'OGSKYL': SkylinesParser(), 'OGSPID': SpiderParser(), 'OGSPOT': SpotParser(), 'GENERIC': GenericParser(beacon_type='unknown'), }
def test_pseudo_status_comment(self): message = FanetParser().parse_position("") self.assertEqual(message, {})