send end of transmission frame

closes #113
This commit is contained in:
dj2ls 2022-01-10 18:09:38 +01:00
parent 0baa544bf0
commit 53aefc0f80
4 changed files with 51 additions and 2 deletions

View file

@ -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')

View file

@ -143,6 +143,15 @@
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<!-- STOPPING TRANSMISSION -->
<div class="toast align-items-center text-white bg-danger border-0" id="toastTRANSMISSIONstopped" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body">Transmission stopped!</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<!-- DATACHANNEL RECEIVED OPENER -->
<div class="toast align-items-center text-white bg-secondary border-0" id="toastDATACHANNELreceivedopener" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">

View file

@ -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):

View file

@ -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'