diff --git a/main.py b/main.py index 0753716..d4d3249 100644 --- a/main.py +++ b/main.py @@ -34,8 +34,21 @@ def onReceive(packet, interface): if 'TEXT_MESSAGE_APP' in packet['decoded']: print('TEXT_MESSAGE_APP') - if 'TELEMTRY_APP' in packet['decoded']: - print('Telemetry found. Ignore') + if 'portnum' in decoded: + app_name = decoded['portnum'] + if app_name == 'TELEMETRY_APP': + with open(MESSAGE_FILE, 'w') as file: + file.write(f"TELEMETRY_APP: ") + file.write(str(packet)) + print('Telemetry found') + elif app_name == 'POSITION_APP': + with open(MESSAGE_FILE, 'w') as file: + file.write(f"POSITION_APP: ") + file.write(str(packet)) + print('Position found') + else: + print('Not a recodnized portnum message') + print(packet) if 'decoded' in packet and 'text' in packet['decoded']: print(packet)