2018-03-10 08:35:51 +00:00
|
|
|
from ogn.parser.pattern import PATTERN_SPOT_POSITION_COMMENT
|
2018-03-10 07:58:32 +00:00
|
|
|
|
2017-10-05 08:36:53 +00:00
|
|
|
from .base import BaseParser
|
|
|
|
|
|
|
|
|
|
|
|
class SpotParser(BaseParser):
|
|
|
|
def __init__(self):
|
2018-03-10 07:58:32 +00:00
|
|
|
self.beacon_type = 'spot'
|
2020-05-21 21:14:31 +00:00
|
|
|
self.position_pattern = PATTERN_SPOT_POSITION_COMMENT
|
2018-03-10 07:58:32 +00:00
|
|
|
|
2019-06-03 19:09:57 +00:00
|
|
|
def parse_position(self, aprs_comment):
|
2020-05-21 21:14:31 +00:00
|
|
|
match = self.position_pattern.match(aprs_comment)
|
2020-05-22 08:43:41 +00:00
|
|
|
return {'spot_id': match.group('spot_id'),
|
2020-05-21 21:14:31 +00:00
|
|
|
'model': match.group('model') if match.group('model') else None,
|
|
|
|
'status': match.group('status') if match.group('status') else None}
|