From 48260f2c09b8095fb834102508375f0b555bd6dd Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 13 Dec 2023 11:51:54 +0100 Subject: [PATCH] ARQ WIP --- modem/arq_session.py | 8 ++++---- modem/arq_session_irs.py | 8 +++++--- modem/arq_session_iss.py | 7 +------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/modem/arq_session.py b/modem/arq_session.py index b8da1a0e..d98c3eb2 100644 --- a/modem/arq_session.py +++ b/modem/arq_session.py @@ -6,9 +6,9 @@ import structlog class ARQSession(): MODE_BY_SPEED = [ - codec2.FREEDV_MODE.datac4.value, - codec2.FREEDV_MODE.datac3.value, - codec2.FREEDV_MODE.datac1.value, + codec2.FREEDV_MODE.datac4, + codec2.FREEDV_MODE.datac3, + codec2.FREEDV_MODE.datac1, ] def __init__(self, config: dict, tx_frame_queue: queue.Queue, dxcall: str): @@ -53,7 +53,7 @@ class ARQSession(): def get_payload_size(self, speed_level): mode = self.MODE_BY_SPEED[speed_level] - return codec2.get_bytes_per_frame(mode) + return codec2.get_bytes_per_frame(mode.value) def set_details(self, snr, frequency_offset): self.snr = snr diff --git a/modem/arq_session_irs.py b/modem/arq_session_irs.py index f39758f1..141cd626 100644 --- a/modem/arq_session_irs.py +++ b/modem/arq_session_irs.py @@ -48,7 +48,8 @@ class ARQSessionIRS(arq_session.ARQSession): if self.event_data_received.wait(self.TIMEOUT_DATA): retries = self.RETRIES_TRANSFER self.append_data_to_burst_buffer() - + self.send_data_nack + else: self.send_data_nack() self.state = self.STATE_FAILED @@ -68,8 +69,9 @@ class ARQSessionIRS(arq_session.ARQSession): self.snr) self.transmit_frame(ack_frame) - def send_data_nack(self): - nack = self.frame_factory.build_arq_burst_nack(self.session_id, self.snr, self.speed_level, + def send_data_ack_nack(self, ack: bool): + nack = self.frame_factory.build_arq_burst_nack( + self.session_id, self.snr, self.speed_level, 10, # WTF? 1) self.transmit_frame(nack) diff --git a/modem/arq_session_iss.py b/modem/arq_session_iss.py index 51a7cbaf..f6892db7 100644 --- a/modem/arq_session_iss.py +++ b/modem/arq_session_iss.py @@ -91,18 +91,13 @@ class ARQSessionISS(arq_session.ARQSession): # Sends the full payload in multiple frames def send_data(self): - # Todo make this n frames per burst stuff part of the protocol again - # hard coding n frames per burst to 1 for now. - n_frames_per_burst = 1 - n_frame = 1 - offset = 0 while offset < len(self.data): max_size = self.get_payload_size(self.speed_level) end_offset = min(len(self.data), max_size) frame_payload = self.data[offset:end_offset] - print(self.id) data_frame = self.frame_factory.build_arq_burst_frame( + self.MODE_BY_SPEED[self.speed_level], self.id, offset, frame_payload) self.set_state(self.STATE_SENDING) if not self.send_arq(data_frame):