diff --git a/gui/preload-main.js b/gui/preload-main.js
index 8a7f2873..c80a9fba 100644
--- a/gui/preload-main.js
+++ b/gui/preload-main.js
@@ -909,7 +909,15 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
var toastDATACHANNELreceivedopener = document.getElementById('toastDATACHANNELreceivedopener')
var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELreceivedopener) // Returns a Bootstrap toast instance
toast.show()
- }
+ }
+ // TRANSMISSION STOPPED
+ if (arg.info[i] == "TRANSMISSION;STOPPED"){
+ var toastDATACHANNELreceivedopener = document.getElementById('toastTRANSMISSIONstopped')
+ var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELreceivedopener) // Returns a Bootstrap toast instance
+ toast.show()
+ }
+
+
// DATACHANNEL FAILED TOAST
if (arg.info[i] == "DATACHANNEL;FAILED"){
var toastDATACHANNELfailed = document.getElementById('toastDATACHANNELfailed')
diff --git a/gui/src/index.html b/gui/src/index.html
index b0498d1d..4072fdbc 100644
--- a/gui/src/index.html
+++ b/gui/src/index.html
@@ -143,6 +143,15 @@
+
+
diff --git a/tnc/data_handler.py b/tnc/data_handler.py
index efd39b49..be094fc6 100644
--- a/tnc/data_handler.py
+++ b/tnc/data_handler.py
@@ -72,7 +72,9 @@ class DATA():
if data[0] == 'CQ':
# [0] CQ
self.transmit_cq()
-
+ elif data[0] == 'STOP':
+ self.stop_transmission()
+
elif data[0] == 'PING':
# [0] PING
# [1] dxcallsign
@@ -204,6 +206,12 @@ class DATA():
structlog.get_logger("structlog").debug("ARQ arq_received_channel_is_open")
self.arq_received_channel_is_open(bytes_out[:-2])
+
+ # ARQ STOP TRANSMISSION
+ elif frametype == 227:
+ structlog.get_logger("structlog").debug("ARQ received stop transmis")
+ self.received_stop_transmission(bytes_out[:-2])
+
# ARQ CONNECT ACK / KEEP ALIVE
# this is outdated and we may remove it
elif frametype == 230:
@@ -859,8 +867,31 @@ class DATA():
static.TNC_STATE = 'IDLE'
+ def stop_transmission(self):
+ structlog.get_logger("structlog").warning("[TNC] Stopping transmission!")
+ stop_frame = bytearray(14)
+ stop_frame[:1] = bytes([227])
+ stop_frame[1:2] = static.DXCALLSIGN_CRC8
+ stop_frame[2:3] = static.MYCALLSIGN_CRC8
+ txbuffer = [stop_frame]
+ static.TRANSMITTING = True
+ modem.MODEM_TRANSMIT_QUEUE.put([14,2,250,txbuffer])
+ while static.TRANSMITTING:
+ time.sleep(0.01)
+
+ static.TNC_STATE = 'IDLE'
+ static.ARQ_STATE = False
+ static.INFO.append("TRANSMISSION;STOPPED")
+ self.arq_cleanup()
+ def received_stop_transmission(self):
+ structlog.get_logger("structlog").warning("[TNC] Stopping transmission!")
+ static.TNC_STATE = 'IDLE'
+ static.ARQ_STATE = False
+ static.INFO.append("TRANSMISSION;STOPPED")
+ self.arq_cleanup()
+
# ----------- BROADCASTS
def run_beacon(self, interval:int):
diff --git a/tnc/sock.py b/tnc/sock.py
index b0effc2e..601c3e89 100644
--- a/tnc/sock.py
+++ b/tnc/sock.py
@@ -171,6 +171,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
if received_json["type"] == 'ARQ' and received_json["command"] == "stopTransmission":
+ data_handler.DATA_QUEUE_TRANSMIT.put(['STOP'])
print(" >>> STOPPING TRANSMISSION <<<")
structlog.get_logger("structlog").warning("[TNC] Stopping transmission!")
static.TNC_STATE = 'IDLE'