From a39e2698ea17a700a97e01e0eedaea1aab95e85f Mon Sep 17 00:00:00 2001 From: liamcottle Date: Mon, 23 Dec 2024 22:26:00 +1300 Subject: [PATCH] add signal metrics to ping result if available --- .../messages/ConversationDropDownMenu.vue | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/frontend/components/messages/ConversationDropDownMenu.vue b/src/frontend/components/messages/ConversationDropDownMenu.vue index 4f3bb09..5c1b3a0 100644 --- a/src/frontend/components/messages/ConversationDropDownMenu.vue +++ b/src/frontend/components/messages/ConversationDropDownMenu.vue @@ -102,8 +102,34 @@ export default { }, }); + const pingResult = response.data.ping_result; + const rttMilliseconds = (pingResult.rtt * 1000).toFixed(3); + const rttDurationString = `${rttMilliseconds} ms`; + + const info = [ + `Valid reply from ${this.peer.destination_hash}`, + `Duration: ${rttDurationString}`, + `Hops There: ${pingResult.hops_there}`, + `Hops Back: ${pingResult.hops_back}`, + ]; + + // add signal quality if available + if(pingResult.quality != null){ + info.push(`Signal Quality: ${pingResult.quality}%`); + } + + // add rssi if available + if(pingResult.rssi != null){ + info.push(`RSSI: ${pingResult.rssi}dBm`); + } + + // add snr if available + if(pingResult.snr != null){ + info.push(`SNR: ${pingResult.snr}dB`); + } + // show result - DialogUtils.alert(response.data.message); + DialogUtils.alert(info.join("\n")); } catch(e) { console.log(e);