mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Merge pull request #183 from DJ2LS/issue173_fix
Implements TODO from #173 .
This commit is contained in:
commit
e375cee792
1 changed files with 15 additions and 11 deletions
|
@ -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:
|
||||||
|
@ -1129,13 +1129,18 @@ class DATA():
|
||||||
while static.TRANSMITTING:
|
while static.TRANSMITTING:
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
|
|
||||||
|
def received_session_close(self, data_in:bytes):
|
||||||
|
"""
|
||||||
|
Closes the session when a close session frame is received and
|
||||||
|
the DXCALLSIGN_CRC matches the remote station participating in the session.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
data_in:bytes:
|
||||||
|
|
||||||
|
Returns:
|
||||||
def received_session_close(self):
|
"""
|
||||||
""" """
|
# Close the session if the DXCALLSIGN_CRC matches the station in static.
|
||||||
# TODO: we need to check for dx stations crc as well so we are only accept frames from a station we are connected to
|
if helpers.check_callsign(static.DXCALLSIGN, bytes(data_in[4:7])):
|
||||||
if static.ARQ_SESSION:
|
|
||||||
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 +1150,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):
|
||||||
""" """
|
""" """
|
||||||
|
|
||||||
|
@ -1182,8 +1186,8 @@ class DATA():
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# TODO: we need to check for dx stations crc as well so we are only accept frames from a station we are connected to
|
# Accept session data if the DXCALLSIGN_CRC matches the station in static.
|
||||||
if static.ARQ_SESSION:
|
if helpers.check_callsign(static.DXCALLSIGN, bytes(data_in[4:7])):
|
||||||
structlog.get_logger("structlog").debug("received session heartbeat")
|
structlog.get_logger("structlog").debug("received session heartbeat")
|
||||||
helpers.add_to_heard_stations(static.DXCALLSIGN, static.DXGRID, 'SESSION-HB', static.SNR, static.FREQ_OFFSET, static.HAMLIB_FREQUENCY)
|
helpers.add_to_heard_stations(static.DXCALLSIGN, static.DXGRID, 'SESSION-HB', static.SNR, static.FREQ_OFFSET, static.HAMLIB_FREQUENCY)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue