Implements TODO from #173 .

This commit is contained in:
Paul Kronenwetter 2022-05-01 11:07:54 -04:00
parent 0e8e3d1b67
commit 7b4f75f66c

View file

@ -289,7 +289,7 @@ class DATA():
# SESSION CLOSE # SESSION CLOSE
elif frametype == 223: elif frametype == 223:
structlog.get_logger("structlog").debug("CLOSE ARQ SESSION RECEIVED....") structlog.get_logger("structlog").debug("CLOSE ARQ SESSION RECEIVED....")
self.received_session_close() self.received_session_close(bytes_out[:-2])
# ARQ FILE TRANSFER RECEIVED! # ARQ FILE TRANSFER RECEIVED!
elif frametype == 225 or frametype == 227: elif frametype == 225 or frametype == 227:
@ -1128,14 +1128,11 @@ class DATA():
# wait while transmitting # wait while transmitting
while static.TRANSMITTING: while static.TRANSMITTING:
time.sleep(0.01) time.sleep(0.01)
def received_session_close(self, data_in:bytes):
def received_session_close(self):
""" """ """ """
# TODO: we need to check for dx stations crc as well so we are only accept frames from a station we are connected to # Close the session if the DXCALLSIGN_CRC matches the station in static.
if static.ARQ_SESSION: if static.DXCALLSIGN_CRC == bytes(data_in[4:7]):
static.ARQ_SESSION_STATE = 'disconnected' static.ARQ_SESSION_STATE = 'disconnected'
helpers.add_to_heard_stations(static.DXCALLSIGN,static.DXGRID, 'DATA-CHANNEL', static.SNR, static.FREQ_OFFSET, static.HAMLIB_FREQUENCY) helpers.add_to_heard_stations(static.DXCALLSIGN,static.DXGRID, 'DATA-CHANNEL', static.SNR, static.FREQ_OFFSET, static.HAMLIB_FREQUENCY)
structlog.get_logger("structlog").info("SESSION [" + str(self.mycallsign, 'utf-8') + "]<<X>>[" + str(static.DXCALLSIGN, 'utf-8') + "]", state=static.ARQ_SESSION_STATE) structlog.get_logger("structlog").info("SESSION [" + str(self.mycallsign, 'utf-8') + "]<<X>>[" + str(static.DXCALLSIGN, 'utf-8') + "]", state=static.ARQ_SESSION_STATE)
@ -1145,7 +1142,6 @@ class DATA():
static.ARQ_SESSION = False static.ARQ_SESSION = False
self.arq_cleanup() self.arq_cleanup()
def transmit_session_heartbeat(self): def transmit_session_heartbeat(self):
""" """ """ """