kopia lustrzana https://github.com/glidernet/python-ogn-client
Incompatible IDs from lt24, skylines, spider spot renamed to separate IDs, fixes #64
rodzic
4968b9adf7
commit
14fbcd7c12
|
@ -11,6 +11,6 @@ class LT24Parser(BaseParser):
|
|||
|
||||
def parse_position(self, aprs_comment):
|
||||
match = self.position_pattern.match(aprs_comment)
|
||||
return {'address': match.group('id'),
|
||||
return {'lt24_id': match.group('lt24_id'),
|
||||
'climb_rate': int(match.group('climb_rate')) * FPM_TO_MS if match.group('climb_rate') else None,
|
||||
'source': match.group('source') if match.group('source') else None}
|
||||
|
|
|
@ -11,5 +11,5 @@ class SkylinesParser(BaseParser):
|
|||
|
||||
def parse_position(self, aprs_comment):
|
||||
match = self.position_pattern.match(aprs_comment)
|
||||
return {'address': match.group('id'),
|
||||
return {'skylines_id': match.group('skylines_id'),
|
||||
'climb_rate': int(match.group('climb_rate')) * FPM_TO_MS if match.group('climb_rate') else None}
|
||||
|
|
|
@ -10,7 +10,7 @@ class SpiderParser(BaseParser):
|
|||
|
||||
def parse_position(self, aprs_comment):
|
||||
ac_match = self.position_pattern.match(aprs_comment)
|
||||
return {'address': ac_match.group('id'),
|
||||
return {'spider_id': ac_match.group('spider_id'),
|
||||
'signal_power': int(ac_match.group('signal_power')) if ac_match.group('signal_power') else None,
|
||||
'spider_id': ac_match.group('spider_id') if ac_match.group('spider_id') else None,
|
||||
'spider_registration': ac_match.group('spider_registration') if ac_match.group('spider_registration') else None,
|
||||
'gps_quality': ac_match.group('gps_quality') if ac_match.group('gps_quality') else None}
|
||||
|
|
|
@ -10,6 +10,6 @@ class SpotParser(BaseParser):
|
|||
|
||||
def parse_position(self, aprs_comment):
|
||||
match = self.position_pattern.match(aprs_comment)
|
||||
return {'address': match.group('id'),
|
||||
return {'spot_id': match.group('spot_id'),
|
||||
'model': match.group('model') if match.group('model') else None,
|
||||
'status': match.group('status') if match.group('status') else None}
|
||||
|
|
|
@ -11,6 +11,13 @@ PATTERN_FANET_POSITION_COMMENT = re.compile(r"""
|
|||
(?:(?P<climb_rate>[+-]\d+)fpm)?
|
||||
""", re.VERBOSE | re.MULTILINE)
|
||||
|
||||
PATTERN_FANET_STATUS_COMMENT = re.compile(r"""
|
||||
(?:(Name=\"(?P<user_name>[^\"]*)\")\s?)?
|
||||
(?:(?P<signal_quality>[\d.]+?)dB\s?)?
|
||||
(?:(?P<frequency_offset>[+-][\d.]+?)kHz\s?)?
|
||||
(?:(?P<error_count>\d+)e\s?)?
|
||||
""", re.VERBOSE | re.MULTILINE)
|
||||
|
||||
PATTERN_FLARM_POSITION_COMMENT = re.compile(r"""
|
||||
id(?P<details>[\dA-F]{2})(?P<address>[\dA-F]{6}?)\s?
|
||||
(?:(?P<climb_rate>[+-]\d+?)fpm\s)?
|
||||
|
@ -26,7 +33,7 @@ PATTERN_FLARM_POSITION_COMMENT = re.compile(r"""
|
|||
""", re.VERBOSE | re.MULTILINE)
|
||||
|
||||
PATTERN_LT24_POSITION_COMMENT = re.compile(r"""
|
||||
id(?P<id>\d+)\s
|
||||
id(?P<lt24_id>\d+)\s
|
||||
(?P<climb_rate>[+-]\d+)fpm\s
|
||||
(?P<source>.+)
|
||||
""", re.VERBOSE | re.MULTILINE)
|
||||
|
@ -38,19 +45,19 @@ PATTERN_NAVITER_POSITION_COMMENT = re.compile(r"""
|
|||
""", re.VERBOSE | re.MULTILINE)
|
||||
|
||||
PATTERN_SKYLINES_POSITION_COMMENT = re.compile(r"""
|
||||
id(?P<id>\d+)\s
|
||||
id(?P<skylines_id>\d+)\s
|
||||
(?P<climb_rate>[+-]\d+)fpm
|
||||
""", re.VERBOSE | re.MULTILINE)
|
||||
|
||||
PATTERN_SPIDER_POSITION_COMMENT = re.compile(r"""
|
||||
id(?P<id>[\d-]+)\s
|
||||
id(?P<spider_id>[\d-]+)\s
|
||||
(?P<signal_power>[+-]\d+)dB\s
|
||||
(?P<spider_id>[A-Z0-9]+)\s
|
||||
(?P<spider_registration>[A-Z0-9]+)\s
|
||||
(?P<gps_quality>.+)
|
||||
""", re.VERBOSE | re.MULTILINE)
|
||||
|
||||
PATTERN_SPOT_POSITION_COMMENT = re.compile(r"""
|
||||
id(?P<id>[\d-]+)\s
|
||||
id(?P<spot_id>[\d-]+)\s
|
||||
(?P<model>SPOT[A-Z\d]+)\s
|
||||
(?P<status>[A-Z]+)
|
||||
""", re.VERBOSE | re.MULTILINE)
|
||||
|
|
|
@ -8,7 +8,7 @@ class TestStringMethods(unittest.TestCase):
|
|||
def test_position_comment(self):
|
||||
message = LT24Parser().parse_position("id25387 +123fpm GPS")
|
||||
|
||||
self.assertEqual(message['address'], "25387")
|
||||
self.assertEqual(message['lt24_id'], "25387")
|
||||
self.assertAlmostEqual(message['climb_rate'], 123 * FPM_TO_MS, 2)
|
||||
self.assertEqual(message['source'], 'GPS')
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ class TestStringMethods(unittest.TestCase):
|
|||
def test_position_comment(self):
|
||||
message = SkylinesParser().parse_position("id2816 -015fpm")
|
||||
|
||||
self.assertEqual(message['address'], "2816")
|
||||
self.assertEqual(message['skylines_id'], "2816")
|
||||
self.assertAlmostEqual(message['climb_rate'], -15 * FPM_TO_MS, 2)
|
||||
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ class TestStringMethods(unittest.TestCase):
|
|||
def test_position_comment(self):
|
||||
message = SpiderParser().parse_position("id300234060668560 +30dB K23W 3D")
|
||||
|
||||
self.assertEqual(message['address'], "300234060668560")
|
||||
self.assertEqual(message['spider_id'], "300234060668560")
|
||||
self.assertEqual(message['signal_power'], 30)
|
||||
self.assertEqual(message['spider_id'], "K23W")
|
||||
self.assertEqual(message['spider_registration'], "K23W")
|
||||
self.assertEqual(message['gps_quality'], "3D")
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class TestStringMethods(unittest.TestCase):
|
|||
def test_position_comment(self):
|
||||
message = SpotParser().parse_position("id0-2860357 SPOT3 GOOD")
|
||||
|
||||
self.assertEqual(message['address'], "0-2860357")
|
||||
self.assertEqual(message['spot_id'], "0-2860357")
|
||||
self.assertEqual(message['model'], 'SPOT3')
|
||||
self.assertEqual(message['status'], "GOOD")
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue