Added RSSI and SNR to echo example

This commit is contained in:
Mark Qvist 2021-10-12 18:09:02 +02:00
parent 8d01586a5a
commit c3dcd9366d
1 changed files with 8 additions and 0 deletions

View File

@ -22,6 +22,8 @@ APP_NAME = "example_utilities"
# This initialisation is executed when the users chooses # This initialisation is executed when the users chooses
# to run as a server # to run as a server
def server(configpath): def server(configpath):
global reticulum
# We must first initialise Reticulum # We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath) reticulum = RNS.Reticulum(configpath)
@ -78,6 +80,8 @@ def announceLoop(destination):
def server_callback(message, packet): def server_callback(message, packet):
global reticulum
# Tell the user that we received an echo request, and # Tell the user that we received an echo request, and
# that we are going to send a reply to the requester. # that we are going to send a reply to the requester.
# Sending the proof is handled automatically, since we # Sending the proof is handled automatically, since we
@ -111,6 +115,8 @@ def server_callback(message, packet):
# This initialisation is executed when the users chooses # This initialisation is executed when the users chooses
# to run as a client # to run as a client
def client(destination_hexhash, configpath, timeout=None): def client(destination_hexhash, configpath, timeout=None):
global reticulum
# We need a binary representation of the destination # We need a binary representation of the destination
# hash that was entered on the command line # hash that was entered on the command line
try: try:
@ -207,6 +213,8 @@ def client(destination_hexhash, configpath, timeout=None):
# This function is called when our reply destination # This function is called when our reply destination
# receives a proof packet. # receives a proof packet.
def packet_delivered(receipt): def packet_delivered(receipt):
global reticulum
if receipt.status == RNS.PacketReceipt.DELIVERED: if receipt.status == RNS.PacketReceipt.DELIVERED:
rtt = receipt.get_rtt() rtt = receipt.get_rtt()
if (rtt >= 1): if (rtt >= 1):