From dd7931d4212f41a1b7e20dfd03508e1354876fa7 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 22 Dec 2022 11:26:59 +0100 Subject: [PATCH] Added signal quality stats to announce log output --- RNS/Identity.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/RNS/Identity.py b/RNS/Identity.py index 3c814d5..763bc24 100644 --- a/RNS/Identity.py +++ b/RNS/Identity.py @@ -255,10 +255,22 @@ class Identity: RNS.Identity.remember(packet.get_hash(), destination_hash, public_key, app_data) del announced_identity - if hasattr(packet, "transport_id") and packet.transport_id != None: - RNS.log("Valid announce for "+RNS.prettyhexrep(destination_hash)+" "+str(packet.hops)+" hops away, received via "+RNS.prettyhexrep(packet.transport_id)+" on "+str(packet.receiving_interface), RNS.LOG_EXTREME) + if packet.rssi != None or packet.snr != None: + signal_str = " [" + if packet.rssi != None: + signal_str += "RSSI "+str(packet.rssi)+"dBm" + if packet.snr != None: + signal_str += ", " + if packet.snr != None: + signal_str += "SNR "+str(packet.snr)+"dB" + signal_str += "]" else: - RNS.log("Valid announce for "+RNS.prettyhexrep(destination_hash)+" "+str(packet.hops)+" hops away, received on "+str(packet.receiving_interface), RNS.LOG_EXTREME) + signal_str = "" + + if hasattr(packet, "transport_id") and packet.transport_id != None: + RNS.log("Valid announce for "+RNS.prettyhexrep(destination_hash)+" "+str(packet.hops)+" hops away, received via "+RNS.prettyhexrep(packet.transport_id)+" on "+str(packet.receiving_interface)+signal_str, RNS.LOG_EXTREME) + else: + RNS.log("Valid announce for "+RNS.prettyhexrep(destination_hash)+" "+str(packet.hops)+" hops away, received on "+str(packet.receiving_interface)+signal_str, RNS.LOG_EXTREME) return True