mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Remove unnecessary callsign checks.
Add notes.
This commit is contained in:
parent
ee82cfe967
commit
06c11e0537
|
@ -481,19 +481,17 @@ class DATA:
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
# We've arrived here from process_data which already checked that the frame
|
||||||
|
# is intended for this station.
|
||||||
data_in = bytes(data_in)
|
data_in = bytes(data_in)
|
||||||
|
|
||||||
# get received crc for different mycall ssids
|
# get received crc for different mycall ssids
|
||||||
self.received_mycall_crc = data_in[2:5]
|
self.received_mycall_crc = data_in[2:5]
|
||||||
|
|
||||||
# check if callsign ssid override
|
# check if callsign ssid override
|
||||||
_valid, mycallsign = helpers.check_callsign(
|
_, mycallsign = helpers.check_callsign(
|
||||||
self.mycallsign, self.received_mycall_crc
|
self.mycallsign, self.received_mycall_crc
|
||||||
)
|
)
|
||||||
if not _valid:
|
|
||||||
# ARQ data packet not for me.
|
|
||||||
self.arq_cleanup()
|
|
||||||
return
|
|
||||||
|
|
||||||
# only process data if we are in ARQ and BUSY state else return to quit
|
# only process data if we are in ARQ and BUSY state else return to quit
|
||||||
if not static.ARQ_STATE and static.TNC_STATE != "BUSY":
|
if not static.ARQ_STATE and static.TNC_STATE != "BUSY":
|
||||||
|
@ -703,14 +701,11 @@ class DATA:
|
||||||
self.transmission_uuid = str(uuid.uuid4())
|
self.transmission_uuid = str(uuid.uuid4())
|
||||||
timestamp = int(time.time())
|
timestamp = int(time.time())
|
||||||
|
|
||||||
# check if callsign ssid override
|
# This shouldn't be needed - it's checked at the start of arq_data_received.
|
||||||
_valid, mycallsign = helpers.check_callsign(
|
# # check if callsign ssid override
|
||||||
self.mycallsign, self.received_mycall_crc
|
# _, mycallsign = helpers.check_callsign(
|
||||||
)
|
# self.mycallsign, self.received_mycall_crc
|
||||||
if not _valid:
|
# )
|
||||||
# ARQ data packet not for me.
|
|
||||||
self.arq_cleanup()
|
|
||||||
return
|
|
||||||
|
|
||||||
# Re-code data_frame in base64, UTF-8 for JSON UI communication.
|
# Re-code data_frame in base64, UTF-8 for JSON UI communication.
|
||||||
base64_data = base64.b64encode(data_frame).decode("UTF-8")
|
base64_data = base64.b64encode(data_frame).decode("UTF-8")
|
||||||
|
@ -756,7 +751,6 @@ class DATA:
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
freedata="tnc-message",
|
freedata="tnc-message",
|
||||||
arq="transmission",
|
arq="transmission",
|
||||||
|
@ -1381,7 +1375,9 @@ class DATA:
|
||||||
data_in:bytes:
|
data_in:bytes:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Close the session if the DXCALLSIGN_CRC matches the station in static.
|
# We've arrived here from process_data which already checked that the frame
|
||||||
|
# is intended for this station.
|
||||||
|
# Close the session if the CRC matches the remote station in static.
|
||||||
_valid_crc, _ = helpers.check_callsign(static.DXCALLSIGN, bytes(data_in[4:7]))
|
_valid_crc, _ = helpers.check_callsign(static.DXCALLSIGN, bytes(data_in[4:7]))
|
||||||
if _valid_crc:
|
if _valid_crc:
|
||||||
static.ARQ_SESSION_STATE = "disconnected"
|
static.ARQ_SESSION_STATE = "disconnected"
|
||||||
|
@ -1614,6 +1610,8 @@ class DATA:
|
||||||
data_in:bytes:
|
data_in:bytes:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
# We've arrived here from process_data which already checked that the frame
|
||||||
|
# is intended for this station.
|
||||||
self.arq_file_transfer = True
|
self.arq_file_transfer = True
|
||||||
self.is_IRS = True
|
self.is_IRS = True
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
|
@ -1621,10 +1619,13 @@ class DATA:
|
||||||
arq="transmission",
|
arq="transmission",
|
||||||
status="opening",
|
status="opening",
|
||||||
)
|
)
|
||||||
|
|
||||||
static.DXCALLSIGN_CRC = bytes(data_in[4:7])
|
static.DXCALLSIGN_CRC = bytes(data_in[4:7])
|
||||||
static.DXCALLSIGN = helpers.bytes_to_callsign(bytes(data_in[7:13]))
|
static.DXCALLSIGN = helpers.bytes_to_callsign(bytes(data_in[7:13]))
|
||||||
|
|
||||||
n_frames_per_burst = int.from_bytes(bytes(data_in[13:14]), "big")
|
# n_frames_per_burst is currently unused
|
||||||
|
# n_frames_per_burst = int.from_bytes(bytes(data_in[13:14]), "big")
|
||||||
|
|
||||||
frametype = int.from_bytes(bytes(data_in[:1]), "big")
|
frametype = int.from_bytes(bytes(data_in[:1]), "big")
|
||||||
# check if we received low bandwidth mode
|
# check if we received low bandwidth mode
|
||||||
if frametype == FR_TYPE.ARQ_DC_OPEN_W.value:
|
if frametype == FR_TYPE.ARQ_DC_OPEN_W.value:
|
||||||
|
@ -1650,11 +1651,7 @@ class DATA:
|
||||||
)
|
)
|
||||||
|
|
||||||
# check if callsign ssid override
|
# check if callsign ssid override
|
||||||
valid, mycallsign = helpers.check_callsign(self.mycallsign, data_in[1:4])
|
_, mycallsign = helpers.check_callsign(self.mycallsign, data_in[1:4])
|
||||||
if not valid:
|
|
||||||
# ARQ connect packet not for me.
|
|
||||||
self.arq_cleanup()
|
|
||||||
return
|
|
||||||
|
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"[TNC] ARQ | DATA | RX | ["
|
"[TNC] ARQ | DATA | RX | ["
|
||||||
|
|
Loading…
Reference in a new issue