This commit is contained in:
Pedro 2023-12-13 11:51:54 +01:00
parent 4eec0b969a
commit 48260f2c09
3 changed files with 10 additions and 13 deletions

View file

@ -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

View file

@ -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)

View file

@ -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):