diff --git a/gui/preload-mesh.js b/gui/preload-mesh.js
index 90fc7cdc..80b8f387 100644
--- a/gui/preload-mesh.js
+++ b/gui/preload-mesh.js
@@ -159,10 +159,10 @@ ipcRenderer.on("action-update-mesh-table", (event, arg) => {
}
destination.appendChild(destinationText);
- var router = document.createElement("td");
- var routerText = document.createElement("span");
- routerText.innerText = routes[i]["router"];
- router.appendChild(routerText);
+ var origin = document.createElement("td");
+ var originText = document.createElement("span");
+ originText.innerText = routes[i]["origin"];
+ origin.appendChild(originText);
var frametype = document.createElement("td");
var frametypeText = document.createElement("span");
@@ -186,7 +186,7 @@ ipcRenderer.on("action-update-mesh-table", (event, arg) => {
row.appendChild(timestamp);
row.appendChild(destination);
- row.appendChild(router);
+ row.appendChild(origin);
row.appendChild(frametype);
row.appendChild(payload);
row.appendChild(attempt);
diff --git a/gui/src/mesh-module.html b/gui/src/mesh-module.html
index 9a039392..d7af25cb 100644
--- a/gui/src/mesh-module.html
+++ b/gui/src/mesh-module.html
@@ -56,7 +56,7 @@
Timestamp |
Destination |
- Router |
+ Origin |
Frametype |
Payload |
Attempt |
diff --git a/tnc/mesh.py b/tnc/mesh.py
index 92728199..496861bd 100644
--- a/tnc/mesh.py
+++ b/tnc/mesh.py
@@ -271,7 +271,7 @@ class MeshRouter():
def mesh_signalling_dispatcher(self):
- # [timestamp, destination, router, frametype, payload, attempt, status]
+ # [timestamp, destination, origin, frametype, payload, attempt, status]
# --------------0------------1---------2---------3--------4---------5--------6 #
@@ -295,11 +295,11 @@ class MeshRouter():
# check if it is time to transmit
if time.time() >= transmission_time:
entry[5] += 1
- self.log.info("[MESH] [TX] Ping", destination=entry[1])
+ self.log.info("[MESH] [TX] Ping", destination=entry[1], origin=entry[2])
channel_busy_timeout = time.time() + 5
while ModemParam.channel_busy and time.time() < channel_busy_timeout:
threading.Event().wait(0.01)
- self.transmit_mesh_signalling_ping(bytes.fromhex(entry[1]))
+ self.transmit_mesh_signalling_ping(bytes.fromhex(entry[1]), bytes.fromhex(entry[2]))
#print("...")
def received_routing_table(self, data_in):
@@ -376,30 +376,31 @@ class MeshRouter():
def received_mesh_ping(self, data_in):
destination = data_in[1:4].hex()
+ origin = data_in[4:7].hex()
if destination == Station.mycallsign_crc.hex():
- self.log.info("[MESH] [RX] [PING] [REQ]", destination=destination, mycall=Station.mycallsign_crc.hex())
+ self.log.info("[MESH] [RX] [PING] [REQ]", destination=destination, origin=origin, mycall=Station.mycallsign_crc.hex())
# use case 1: set status to acknowleding if we are the receiver of a PING
- self.add_mesh_ping_to_signalling_table(destination, status="acknowledging")
+ self.add_mesh_ping_to_signalling_table(destination, origin, status="acknowledging")
channel_busy_timeout = time.time() + 5
while ModemParam.channel_busy and time.time() < channel_busy_timeout:
threading.Event().wait(0.01)
- dxcallsign_crc = Station.mycallsign_crc
- self.transmit_mesh_signalling_ping_ack(dxcallsign_crc)
+ # dxcallsign_crc = Station.mycallsign_crc
+ self.transmit_mesh_signalling_ping_ack(bytes.fromhex(destination), bytes.fromhex(origin))
else:
- self.log.info("[MESH] [RX] [PING] [REQ]", destination=destination, mycall=Station.mycallsign_crc.hex())
+ self.log.info("[MESH] [RX] [PING] [REQ]", destination=destination, origin=origin, mycall=Station.mycallsign_crc.hex())
# lookup if entry is already in database - if so, udpate and exit
for item in MESH_SIGNALLING_TABLE:
if item[1] == destination and item[5] >= self.signalling_max_attempts:
# use case 2: set status to forwarded if we are not the receiver of a PING and out of retries
- self.add_mesh_ping_to_signalling_table(destination, status="forwarded")
+ self.add_mesh_ping_to_signalling_table(destination, origin, status="forwarded")
return
print("......................")
# use case 1: set status to forwarding if we are not the receiver of a PING and we don't have an entry in our database
- self.add_mesh_ping_to_signalling_table(destination, status="forwarding")
+ self.add_mesh_ping_to_signalling_table(destination, origin, status="forwarding")
def received_mesh_ping_ack(self, data_in):
# TODO:
@@ -408,16 +409,17 @@ class MeshRouter():
# if not, then add to table
destination = data_in[1:4].hex()
+ origin = data_in[4:7].hex()
timestamp = time.time()
- router = ""
+ #router = ""
frametype = "PING-ACK"
payload = ""
attempt = 0
if destination == Station.mycallsign_crc.hex():
- self.log.info("[MESH] [RX] [PING] [ACK]", destination=destination, mycall=Station.mycallsign_crc.hex())
- self.add_mesh_ping_ack_to_signalling_table(destination, status="acknowledged")
+ self.log.info("[MESH] [RX] [PING] [ACK]", destination=destination, origin=origin, mycall=Station.mycallsign_crc.hex())
+ self.add_mesh_ping_ack_to_signalling_table(destination, origin, status="acknowledged")
else:
#status = "forwarding"
#self.add_mesh_ping_ack_to_signalling_table(destination, status)
@@ -428,23 +430,23 @@ class MeshRouter():
self.add_mesh_ping_ack_to_signalling_table(destination, status="forwarded")
return
- self.add_mesh_ping_ack_to_signalling_table(destination, status="forwarding")
+ self.add_mesh_ping_ack_to_signalling_table(destination, origin, status="forwarding")
#dxcallsign_crc = bytes.fromhex(destination)
#self.transmit_mesh_signalling_ping_ack(dxcallsign_crc)
print(MESH_SIGNALLING_TABLE)
- def add_mesh_ping_to_signalling_table(self, destination, status):
+ def add_mesh_ping_to_signalling_table(self, destination, origin, status):
timestamp = time.time()
- router = ""
+ #router = ""
frametype = "PING"
payload = ""
attempt = 0
- # [timestamp, destination, router, frametype, payload, attempt, status]
+ # [timestamp, destination, origin, frametype, payload, attempt, status]
# --------------0------------1---------2---------3--------4---------5--------6-----#
- new_entry = [timestamp, destination, router, frametype, payload, attempt, status]
+ new_entry = [timestamp, destination, origin, frametype, payload, attempt, status]
for _, item in enumerate(MESH_SIGNALLING_TABLE):
# update entry if exists
if destination in item[1] and "PING" in item[3]:
@@ -465,14 +467,14 @@ class MeshRouter():
MESH_SIGNALLING_TABLE.append(new_entry)
- def add_mesh_ping_ack_to_signalling_table(self, destination, status):
+ def add_mesh_ping_ack_to_signalling_table(self, destination, origin, status):
timestamp = time.time()
- router = ""
+ #router = ""
frametype = "PING-ACK"
payload = ""
attempt = 0
- new_entry = [timestamp, destination, router, frametype, payload, attempt, status]
+ new_entry = [timestamp, destination, origin, frametype, payload, attempt, status]
for _, item in enumerate(MESH_SIGNALLING_TABLE):
# update entry if exists
@@ -528,27 +530,27 @@ class MeshRouter():
threading.Event().wait(0.01)
- def transmit_mesh_signalling_ping(self, dxcallsign_crc):
+ def transmit_mesh_signalling_ping(self, destination, origin):
frame_type = bytes([FRAME_TYPE.MESH_SIGNALLING_PING.value])
ping_frame = bytearray(14)
ping_frame[:1] = frame_type
- ping_frame[1:4] = dxcallsign_crc
- ping_frame[4:7] = helpers.get_crc_24(Station.mycallsign)
+ ping_frame[1:4] = destination
+ ping_frame[4:7] = origin
ping_frame[7:13] = helpers.callsign_to_bytes(Station.mycallsign)
self.enqueue_frame_for_tx([ping_frame], c2_mode=FREEDV_MODE.sig0.value)
- def transmit_mesh_signalling_ping_ack(self, dxcallsign_crc):
+ def transmit_mesh_signalling_ping_ack(self, destination, origin):
#dxcallsign_crc = bytes.fromhex(data[1])
frame_type = bytes([FRAME_TYPE.MESH_SIGNALLING_PING_ACK.value])
ping_frame = bytearray(14)
ping_frame[:1] = frame_type
- ping_frame[1:4] = dxcallsign_crc
- #ping_frame[4:7] = helpers.get_crc_24(Station.mycallsign)
+ ping_frame[1:4] = destination
+ ping_frame[4:7] = origin
#ping_frame[7:13] = helpers.callsign_to_bytes(Station.mycallsign)
self.enqueue_frame_for_tx([ping_frame], c2_mode=FREEDV_MODE.sig0.value)
\ No newline at end of file
diff --git a/tnc/sock.py b/tnc/sock.py
index 20f6ce03..99420544 100644
--- a/tnc/sock.py
+++ b/tnc/sock.py
@@ -1219,7 +1219,7 @@ def send_tnc_state():
{
"timestamp": MESH_SIGNALLING_TABLE[_][0],
"destination": MESH_SIGNALLING_TABLE[_][1],
- "router": MESH_SIGNALLING_TABLE[_][2],
+ "origin": MESH_SIGNALLING_TABLE[_][2],
"frametype": MESH_SIGNALLING_TABLE[_][3],
"payload": MESH_SIGNALLING_TABLE[_][4],
"attempt": MESH_SIGNALLING_TABLE[_][5],