From cd2b0dc1333a2187f969fd84a715fa172caead0d Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Sun, 4 Dec 2022 12:22:35 +0100 Subject: [PATCH] fixed send raw callsign override --- tnc/data_handler.py | 11 +++++++---- tnc/sock.py | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tnc/data_handler.py b/tnc/data_handler.py index 9c3230f5..713b97ae 100644 --- a/tnc/data_handler.py +++ b/tnc/data_handler.py @@ -263,7 +263,7 @@ class DATA: # [4] self.transmission_uuid str # [5] mycallsign with ssid # [6] attempts - self.open_dc_and_transmit(data[1], data[2], data[3], data[4], data[5], data[6]) + self.open_dc_and_transmit(data[1], data[2], data[3], data[4], data[5], data[6], data[7]) else: self.log.error( @@ -1673,6 +1673,7 @@ class DATA: n_frames_per_burst: int, transmission_uuid: str, mycallsign, + dxcallsign, attempts: int, ) -> bool: """ @@ -1692,6 +1693,7 @@ class DATA: """ # overwrite mycallsign in case of different SSID self.mycallsign = mycallsign + self.dxcallsign = dxcallsign # override session connection attempts self.data_channel_max_retries = attempts @@ -1773,7 +1775,6 @@ class DATA: if not static.ARQ_SESSION: # self.session_id = randbytes(1) self.session_id = np.random.bytes(1) - print(self.session_id) # Update data_channel timestamp self.data_channel_last_received = int(time.time()) @@ -1802,13 +1803,15 @@ class DATA: freedata="tnc-message", arq="transmission", status="opening", + mycallsign=str(mycallsign, 'UTF-8'), + dxcallsign=str(self.dxcallsign,'UTF-8'), ) self.log.info( "[TNC] ARQ | DATA | TX | [" + str(mycallsign, "UTF-8") + "]>> <<[" - + str(static.DXCALLSIGN, "UTF-8") + + str(self.dxcallsign, "UTF-8") + "]", attempt=f"{str(attempt + 1)}/{str(self.data_channel_max_retries)}", ) @@ -1842,7 +1845,7 @@ class DATA: "[TNC] ARQ | TX | DATA [" + str(mycallsign, "UTF-8") + "]>>X<<[" - + str(static.DXCALLSIGN, "UTF-8") + + str(self.dxcallsign, "UTF-8") + "]" ) self.datachannel_timeout = True diff --git a/tnc/sock.py b/tnc/sock.py index 720b4b66..f4e965a2 100644 --- a/tnc/sock.py +++ b/tnc/sock.py @@ -439,6 +439,9 @@ def process_tnc_commands(data): # check if specific callsign is set with different SSID than the TNC is initialized try: mycallsign = received_json["parameter"][0]["mycallsign"] + mycallsign = helpers.callsign_to_bytes(mycallsign) + mycallsign = helpers.bytes_to_callsign(mycallsign) + except Exception: mycallsign = static.MYCALLSIGN @@ -462,7 +465,7 @@ def process_tnc_commands(data): binarydata = base64.b64decode(base64data) DATA_QUEUE_TRANSMIT.put( - ["ARQ_RAW", binarydata, mode, n_frames, arq_uuid, mycallsign, attempts] + ["ARQ_RAW", binarydata, mode, n_frames, arq_uuid, mycallsign, dxcallsign, attempts] ) except Exception as err: