From e2ce2d718c400cf5aa0af92913c62f32f00ba24a Mon Sep 17 00:00:00 2001 From: ash Date: Tue, 7 Oct 2025 11:08:50 -0400 Subject: [PATCH] Added iperf error handling, labelled RSRP outputs --- relay.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/relay.py b/relay.py index ee36a41..4c4fced 100644 --- a/relay.py +++ b/relay.py @@ -69,12 +69,28 @@ def calculate_ping( def relay_iperf( filename: str, base_address: str, relay_address: str, duration: str ) -> None: - collect_iperf( - filename=filename, server_ip=base_address, duration=duration, stations="eg" - ) - collect_iperf( - filename=filename, server_ip=relay_address, duration=duration, stations="er" - ) + try: + collect_iperf( + filename=filename, server_ip=base_address, duration=duration, stations="eg" + ) + except Exception as e: + print(f"iPerf error: {e}") + data = { + "iperf_full": f"Error: {e}", + "stations": "eg", + } + save_data_to_json(data=data, filename=filename) + try: + collect_iperf( + filename=filename, server_ip=relay_address, duration=duration, stations="er" + ) + except Exception as e: + print(f"iPerf error: {e}") + data = { + "iperf_full": f"Error: {e}", + "stations": "er", + } + save_data_to_json(data=data, filename=filename) # try: # collect_iperf_remote(filename=filename) # except Exception as e: @@ -117,7 +133,7 @@ def collect_data( # Send to server print(f"\nPing Time: {data.get('ping_time')}") print( - f"RSRP: {data.get('RSRP PRX')} {data.get('RSRP DRX')} {data.get('RSRP RX2')} {data.get('RSRP RX3')}" + f"RSRP: PRX: {data.get('RSRP PRX')} DRX: {data.get('RSRP DRX')} RX2: {data.get('RSRP RX2')} RX3: {data.get('RSRP RX3')}" ) print(f"Service: {data.get('network information')}")