diff --git a/ogn/parser/parse.py b/ogn/parser/parse.py index 7bf5202..8719bb6 100644 --- a/ogn/parser/parse.py +++ b/ogn/parser/parse.py @@ -56,7 +56,8 @@ def parse_ogn_aircraft_beacon(aprs_comment): 'gps_status': ac_match.group('gps_accuracy'), 'software_version': float(ac_match.group('flarm_software_version')) if ac_match.group('flarm_software_version') else None, 'hardware_version': int(ac_match.group('flarm_hardware_version'), 16) if ac_match.group('flarm_hardware_version') else None, - 'real_address': ac_match.group('flarm_id')} + 'real_address': ac_match.group('flarm_id'), + 'power': ac_match('power')} else: return None @@ -72,16 +73,16 @@ def parse_ogn_receiver_beacon(aprs_comment): 'ntp_error': float(rec_match.group('ntp_offset')), 'rt_crystal_correction': float(rec_match.group('ntp_correction')), 'cpu_temp': float(rec_match.group('cpu_temperature')) if rec_match.group('cpu_temperature') else None, - 'aircraft_counter_visible': int(rec_match.group('aircraft_counter_visible')) if rec_match.group('aircraft_counter_visible') else None, - 'aircraft_counter_total': int(rec_match.group('aircraft_counter_total')) if rec_match.group('aircraft_counter_total') else None, - 'rec_crystal_correction': int(rec_match.group('manual_correction')) if rec_match.group('manual_correction') else 0, - 'rec_crystal_correction_fine': float(rec_match.group('automatic_correction')) if rec_match.group('automatic_correction') else 0.0, - 'rec_input_noise': float(rec_match.group('input_noise')) if rec_match.group('input_noise') else None, - 'total_snr': float(rec_match.group('total_snr')) if rec_match.group('total_snr') else None, - 'total_fixes': float(rec_match.group('total_fixes')) if rec_match.group('total_fixes') else None, - 'daily_snr_selection': float(rec_match.group('daily_snr_selection')) if rec_match.group('daily_snr_selection') else None, - 'daily_devices_selection': float(rec_match.group('daily_devices_selection')) if rec_match.group('daily_devices_selection') else None, - 'daily_devices': float(rec_match.group('daily_devices')) if rec_match.group('daily_devices') else None} + 'senders_visible': int(rec_match.group('visible_senders')) if rec_match.group('visible_senders') else None, + 'senders_total': int(rec_match.group('senders')) if rec_match.group('senders') else None, + 'rec_crystal_correction': int(rec_match.group('rf_correction_manual')) if rec_match.group('rf_correction_manual') else 0, + 'rec_crystal_correction_fine': float(rec_match.group('rf_correction_automatic')) if rec_match.group('rf_correction_automatic') else 0.0, + 'rec_input_noise': float(rec_match.group('signal')) if rec_match.group('signal') else None, + 'senders_signal': float(rec_match.group('senders_signal')) if rec_match.group('senders_signal') else None, + 'senders_messages': float(rec_match.group('senders_messages')) if rec_match.group('senders_messages') else None, + 'good_senders_signal': float(rec_match.group('good_senders_signal')) if rec_match.group('good_senders_signal') else None, + 'good_senders': float(rec_match.group('good_senders')) if rec_match.group('good_senders') else None, + 'good_and_bad_senders': float(rec_match.group('good_and_bad_senders')) if rec_match.group('good_and_bad_senders') else None} else: return None diff --git a/ogn/parser/pattern.py b/ogn/parser/pattern.py index 860fe6a..9b1c689 100644 --- a/ogn/parser/pattern.py +++ b/ogn/parser/pattern.py @@ -36,17 +36,19 @@ PATTERN_RECEIVER_BEACON = re.compile(r""" \s)? CPU:(?P[\d.]+)\s RAM:(?P[\d.]+)\/(?P[\d.]+)MB\s - NTP:(?P[\d.]+)ms\/(?P[+-][\d.]+)ppm\s? + NTP:(?P[\d.]+)ms\/(?P[+-][\d.]+)ppm\s + (?:(?P[\d.]+)V\s)? + (?:(?P[\d.]+)A\s)? (?:(?P[+-][\d.]+)C\s*)? - (?:(?P\d+)\/(?P\d+)Acfts\[1h\]\s*)? + (?:(?P\d+)\/(?P\d+)Acfts\[1h\]\s*)? (?:RF: (?: - (?P[+-][\d]+) - (?P[+-][\d.]+)ppm\/ + (?P[+-][\d]+) + (?P[+-][\d.]+)ppm\/ )? - (?P[+-][\d.]+)dB - (?:\/(?P[+-][\d.]+)dB\@10km\[(?P\d+)\])? - (?:\/(?P[+-][\d.]+)dB\@10km\[(?P\d+)\/(?P\d+)\])? + (?P[+-][\d.]+)dB + (?:\/(?P[+-][\d.]+)dB@10km\[(?P\d+)\])? + (?:\/(?P[+-][\d.]+)dB@10km\[(?P\d+)\/(?P\d+)\])? )? """, re.VERBOSE | re.MULTILINE) @@ -63,5 +65,6 @@ PATTERN_AIRCRAFT_BEACON = re.compile(r""" (?:s(?P[\d.]+)\s?)? (?:h(?P[\dA-F]{2})\s?)? (?:r(?P[\dA-F]+)\s?)? + (?:(?P[+-][\d.]+)dBm\s?)? (?:hear(?P.+))? """, re.VERBOSE | re.MULTILINE) diff --git a/tests/parser/test_receiver_beacon.py b/tests/parser/test_receiver_beacon.py index db4faea..3c4c379 100644 --- a/tests/parser/test_receiver_beacon.py +++ b/tests/parser/test_receiver_beacon.py @@ -28,17 +28,17 @@ class TestStringMethods(unittest.TestCase): def test_v025(self): receiver_beacon = parse_ogn_receiver_beacon("v0.2.5.RPI-GPU CPU:0.8 RAM:287.3/458.7MB NTP:1.0ms/-6.4ppm +51.9C RF:+55+0.4ppm/-0.67dB/+10.8dB@10km[57282]") - self.assertEqual(receiver_beacon['total_snr'], 10.8) - self.assertEqual(receiver_beacon['total_fixes'], 57282) + self.assertEqual(receiver_beacon['senders_signal'], 10.8) + self.assertEqual(receiver_beacon['senders_messages'], 57282) receiver_beacon = parse_ogn_receiver_beacon("v0.2.5.ARM CPU:0.4 RAM:638.0/970.5MB NTP:0.2ms/-1.1ppm +65.5C 14/16Acfts[1h] RF:+45+0.0ppm/+3.88dB/+24.0dB@10km[143717]/+26.7dB@10km[68/135]") - self.assertEqual(receiver_beacon['aircraft_counter_visible'], 14) - self.assertEqual(receiver_beacon['aircraft_counter_total'], 16) - self.assertEqual(receiver_beacon['total_snr'], 24.0) - self.assertEqual(receiver_beacon['total_fixes'], 143717) - self.assertEqual(receiver_beacon['daily_snr_selection'], 26.7) - self.assertEqual(receiver_beacon['daily_devices_selection'], 68) - self.assertEqual(receiver_beacon['daily_devices'], 135) + self.assertEqual(receiver_beacon['senders_visible'], 14) + self.assertEqual(receiver_beacon['senders_total'], 16) + self.assertEqual(receiver_beacon['senders_signal'], 24.0) + self.assertEqual(receiver_beacon['senders_messages'], 143717) + self.assertEqual(receiver_beacon['good_senders_signal'], 26.7) + self.assertEqual(receiver_beacon['good_senders'], 68) + self.assertEqual(receiver_beacon['good_and_bad_senders'], 135) if __name__ == '__main__':