mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
ARQ WIP
This commit is contained in:
parent
2189f99918
commit
d35860cc54
|
@ -15,11 +15,10 @@ class ARQSessionIRS(arq_session.ARQSession):
|
|||
|
||||
TIMEOUT_DATA = 6
|
||||
|
||||
def __init__(self, config: dict, tx_frame_queue: queue.Queue, dxcall: str, session_id: int, is_wide_band: bool):
|
||||
def __init__(self, config: dict, tx_frame_queue: queue.Queue, dxcall: str, session_id: int):
|
||||
super().__init__(config, tx_frame_queue, dxcall)
|
||||
|
||||
self.id = session_id
|
||||
self.is_wide_band = is_wide_band
|
||||
self.speed = 0
|
||||
self.version = 1
|
||||
self.snr = 0
|
||||
|
@ -74,7 +73,6 @@ class ARQSessionIRS(arq_session.ARQSession):
|
|||
|
||||
def send_session_ack(self):
|
||||
ack_frame = self.frame_factory.build_arq_session_connect_ack(
|
||||
self.is_wide_band,
|
||||
self.id,
|
||||
self.speed,
|
||||
self.version)
|
||||
|
|
|
@ -123,8 +123,7 @@ class DataFrameFactory:
|
|||
|
||||
# arq data frame
|
||||
# register n frames
|
||||
for n_frame in range(1,5):
|
||||
self.template_list[FR_TYPE.BURST_01.value + (n_frame-1)] = {
|
||||
self.template_list[FR_TYPE.BURST_FRAME.value] = {
|
||||
"frame_length": "dynamic",
|
||||
"n_frames_per_burst": 1,
|
||||
"session_id": 1,
|
||||
|
@ -356,7 +355,7 @@ class DataFrameFactory:
|
|||
"data": frame_payload
|
||||
}
|
||||
|
||||
return self.construct(FR_TYPE.BURST_01.value + (n_frame-1), payload, frame_length=max_size)
|
||||
return self.construct(FR_TYPE.BURST_FRAME.value, payload, frame_length=max_size)
|
||||
|
||||
|
||||
def build_arq_burst_ack(self, session_id: bytes, snr: int, speed_level: int, len_arq_rx_frame_buffer: int):
|
||||
|
|
|
@ -28,12 +28,14 @@ class DISPATCHER():
|
|||
FRAME_HANDLER = {
|
||||
FR_TYPE.ARQ_SESSION_OPEN_ACK.value: {"class": ARQFrameHandler, "name": "ARQ OPEN ACK"},
|
||||
FR_TYPE.ARQ_SESSION_OPEN.value: {"class": ARQFrameHandler, "name": "ARQ Data Channel Open"},
|
||||
FR_TYPE.ARQ_SESSION_INFO_ACK.value: {"class": ARQFrameHandler, "name": "ARQ INFO ACK"},
|
||||
FR_TYPE.ARQ_SESSION_INFO.value: {"class": ARQFrameHandler, "name": "ARQ Data Channel Info"},
|
||||
FR_TYPE.ARQ_CONNECTION_CLOSE.value: {"class": ARQFrameHandler, "name": "ARQ CLOSE SESSION"},
|
||||
FR_TYPE.ARQ_CONNECTION_HB.value: {"class": ARQFrameHandler, "name": "ARQ HEARTBEAT"},
|
||||
FR_TYPE.ARQ_CONNECTION_OPEN.value: {"class": ARQFrameHandler, "name": "ARQ OPEN SESSION"},
|
||||
FR_TYPE.ARQ_STOP.value: {"class": ARQFrameHandler, "name": "ARQ STOP TX"},
|
||||
FR_TYPE.BEACON.value: {"class": FrameHandler, "name": "BEACON"},
|
||||
FR_TYPE.BURST_01.value:{"class": ARQFrameHandler, "name": "BURST_01"},
|
||||
FR_TYPE.BURST_FRAME.value:{"class": ARQFrameHandler, "name": "BURST_01"},
|
||||
FR_TYPE.BURST_ACK.value: {"class": FrameHandler, "name": "BURST ACK"},
|
||||
FR_TYPE.BURST_NACK.value: {"class": FrameHandler, "name": "BURST NACK"},
|
||||
FR_TYPE.CQ.value: {"class": CQFrameHandler, "name": "CQ"},
|
||||
|
|
|
@ -15,22 +15,21 @@ class ARQFrameHandler(frame_handler.FrameHandler):
|
|||
frequency_offset = self.details["frequency_offset"]
|
||||
|
||||
# ARQ session open received
|
||||
if frame['frame_type_int'] in [FR.ARQ_SESSION_OPEN_N.value, FR.ARQ_SESSION_OPEN_W.value]:
|
||||
if frame['frame_type_int'] == FR.ARQ_SESSION_OPEN.value:
|
||||
session = ARQSessionIRS(self.config,
|
||||
self.tx_frame_queue,
|
||||
frame['origin'],
|
||||
frame['session_id'],
|
||||
frame['frame_type_int'] == FR.ARQ_SESSION_OPEN_W.value)
|
||||
self.states.register_arq_irs_session(session, frame['frame_type_int'] == FR.ARQ_SESSION_OPEN_W.value)
|
||||
frame['session_id'])
|
||||
self.states.register_arq_irs_session(session)
|
||||
session.run()
|
||||
|
||||
# ARQ session open ack received
|
||||
elif frame['frame_type_int'] in [FR.ARQ_SESSION_OPEN_ACK_N.value, FR.ARQ_SESSION_OPEN_ACK_W.value]:
|
||||
elif frame['frame_type_int'] == FR.ARQ_SESSION_OPEN_ACK.value:
|
||||
iss_session:ARQSessionISS = self.states.get_arq_iss_session(frame['session_id'])
|
||||
iss_session.on_connection_ack_received(frame)
|
||||
|
||||
# ARQ session data frame received
|
||||
elif frame['frame_type_int'] in [FR.BURST_01.value, FR.BURST_02.value, FR.BURST_03.value, FR.BURST_04.value, FR.BURST_05.value]:
|
||||
elif frame['frame_type_int'] == FR.BURST_FRAME.value:
|
||||
print("received data frame....")
|
||||
print(frame)
|
||||
|
||||
|
|
|
@ -7,16 +7,12 @@ from enum import Enum
|
|||
class FRAME_TYPE(Enum):
|
||||
"""Lookup for frame types"""
|
||||
|
||||
BURST_01 = 1
|
||||
BURST_02 = 2
|
||||
BURST_03 = 3
|
||||
BURST_04 = 4
|
||||
BURST_05 = 5
|
||||
BURST_ACK = 60
|
||||
BURST_FRAME = 10
|
||||
BURST_ACK = 11
|
||||
BURST_NACK = 12
|
||||
FR_ACK = 61
|
||||
FR_REPEAT = 62
|
||||
FR_NACK = 63
|
||||
BURST_NACK = 64
|
||||
MESH_BROADCAST = 100
|
||||
MESH_SIGNALLING_PING = 101
|
||||
MESH_SIGNALLING_PING_ACK = 102
|
||||
|
|
|
@ -119,7 +119,7 @@ class StateManager:
|
|||
raise RuntimeError(f"ARQ ISS Session '{session.id}' already exists!")
|
||||
self.arq_iss_sessions[session.id] = session
|
||||
|
||||
def register_arq_irs_session(self, session, is_wide_band):
|
||||
def register_arq_irs_session(self, session):
|
||||
if session.id in self.arq_irs_sessions:
|
||||
raise RuntimeError(f"ARQ IRS Session '{session.id}' already exists!")
|
||||
self.arq_irs_sessions[session.id] = session
|
||||
|
|
Loading…
Reference in a new issue