2018-03-10 07:58:32 +00:00
|
|
|
import re
|
|
|
|
|
2018-04-30 19:00:08 +00:00
|
|
|
from ogn.parser.utils import FPM_TO_MS
|
2018-03-10 08:35:51 +00:00
|
|
|
from ogn.parser.pattern import PATTERN_LT24_POSITION_COMMENT
|
2018-03-10 07:58:32 +00:00
|
|
|
|
2017-10-05 08:36:53 +00:00
|
|
|
from .base import BaseParser
|
|
|
|
|
|
|
|
|
|
|
|
class LT24Parser(BaseParser):
|
|
|
|
def __init__(self):
|
2018-03-10 07:58:32 +00:00
|
|
|
self.beacon_type = 'lt24'
|
2019-06-03 19:09:57 +00:00
|
|
|
self.position_pattern = re.compile(PATTERN_LT24_POSITION_COMMENT)
|
2018-03-10 07:58:32 +00:00
|
|
|
|
2019-06-03 19:09:57 +00:00
|
|
|
def parse_position(self, aprs_comment):
|
|
|
|
ac_match = self.position_pattern.match(aprs_comment)
|
2018-04-28 19:31:50 +00:00
|
|
|
return {'address': ac_match.group('id'),
|
2018-04-30 19:00:08 +00:00
|
|
|
'climb_rate': int(ac_match.group('climb_rate')) * FPM_TO_MS if ac_match.group('climb_rate') else None,
|
2018-03-10 07:58:32 +00:00
|
|
|
'source': ac_match.group('source') if ac_match.group('source') else None}
|