2019-06-06 03:11:59 +00:00
|
|
|
from ogn.parser.pattern import PATTERN_INREACH_POSITION_COMMENT
|
|
|
|
|
|
|
|
from .base import BaseParser
|
|
|
|
|
|
|
|
|
|
|
|
class InreachParser(BaseParser):
|
|
|
|
def __init__(self):
|
|
|
|
self.beacon_type = 'inreach'
|
2020-05-21 21:14:31 +00:00
|
|
|
self.position_pattern = PATTERN_INREACH_POSITION_COMMENT
|
2019-06-06 03:11:59 +00:00
|
|
|
|
|
|
|
def parse_position(self, aprs_comment):
|
2020-05-21 21:14:31 +00:00
|
|
|
match = self.position_pattern.match(aprs_comment)
|
|
|
|
return {'address': match.group('id'),
|
|
|
|
'model': match.group('model') if match.group('model') else None,
|
|
|
|
'status': match.group('status') == 'True' if match.group('status') else None,
|
|
|
|
'pilot_name': match.group('pilot_name') if match.group('pilot_name') else None}
|