示例#1
0
    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 parse_comment(aprs_comment, dstcall='APRS', aprs_type="position"):
    parser = dstcall_parser_mapping.get(dstcall)
    if parser:
        return parser.parse(aprs_comment, aprs_type)
    else:
        return dstcall_parser_mapping.get('GENERIC').parse(
            aprs_comment, aprs_type)
示例#2
0
    def test_position_comment(self):
        message = SkylinesParser.parse_position("id2816 -015fpm")

        self.assertEqual(message['address'], "2816")
        self.assertAlmostEqual(message['climb_rate'], -15 * FPM_TO_MS, 2)