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

18 wiersze
557 B
Python
Czysty Zwykły widok Historia

2018-04-10 16:54:30 +00:00
import re
from ogn.parser.utils import fpm2ms
from ogn.parser.pattern import PATTERN_FANET_POSITION_COMMENT
from .base import BaseParser
class FanetParser(BaseParser):
def __init__(self):
self.beacon_type = 'fanet'
@staticmethod
def parse_position(aprs_comment):
ac_match = re.search(PATTERN_FANET_POSITION_COMMENT, aprs_comment)
return {'id': ac_match.group('id') if ac_match.group('id') else None,
'climb_rate': int(ac_match.group('climb_rate')) * fpm2ms if ac_match.group('climb_rate') else None}