2018-03-10 08:35:51 +00:00
|
|
|
from ogn.parser.pattern import PATTERN_NAVITER_POSITION_COMMENT
|
2018-04-30 19:45:28 +00:00
|
|
|
from ogn.parser.utils import FPM_TO_MS, HPM_TO_DEGS
|
2017-10-04 21:23:41 +00:00
|
|
|
|
2017-10-05 08:36:53 +00:00
|
|
|
from .base import BaseParser
|
2017-09-30 06:48:56 +00:00
|
|
|
|
2017-10-05 08:36:53 +00:00
|
|
|
|
|
|
|
class NaviterParser(BaseParser):
|
|
|
|
def __init__(self):
|
2018-03-10 07:58:32 +00:00
|
|
|
self.beacon_type = 'naviter'
|
2020-05-21 21:14:31 +00:00
|
|
|
self.position_pattern = PATTERN_NAVITER_POSITION_COMMENT
|
2017-09-30 06:48:56 +00:00
|
|
|
|
2019-06-03 19:09:57 +00:00
|
|
|
def parse_position(self, aprs_comment):
|
|
|
|
match = self.position_pattern.match(aprs_comment)
|
2017-10-04 21:23:41 +00:00
|
|
|
return {'stealth': (int(match.group('details'), 16) & 0b1000000000000000) >> 15 == 1,
|
|
|
|
'do_not_track': (int(match.group('details'), 16) & 0b0100000000000000) >> 14 == 1,
|
|
|
|
'aircraft_type': (int(match.group('details'), 16) & 0b0011110000000000) >> 10,
|
|
|
|
'address_type': (int(match.group('details'), 16) & 0b0000001111110000) >> 4,
|
|
|
|
'reserved': (int(match.group('details'), 16) & 0b0000000000001111),
|
2018-04-28 11:44:01 +00:00
|
|
|
'address': match.group('address'),
|
2018-04-30 19:00:08 +00:00
|
|
|
'climb_rate': int(match.group('climb_rate')) * FPM_TO_MS if match.group('climb_rate') else None,
|
2018-04-30 19:45:28 +00:00
|
|
|
'turn_rate': float(match.group('turn_rate')) * HPM_TO_DEGS if match.group('turn_rate') else None}
|