python-ogn-client/ogn/parser/aprs_comment/spot_parser.py

16 wiersze
557 B
Python

from ogn.parser.pattern import PATTERN_SPOT_POSITION_COMMENT
from .base import BaseParser
class SpotParser(BaseParser):
def __init__(self):
self.beacon_type = 'spot'
self.position_pattern = PATTERN_SPOT_POSITION_COMMENT
def parse_position(self, aprs_comment):
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') if match.group('status') else None}