mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Merge pull request #219 from DJ2LS/issue_218_fix_with_test
Issue 218 fix with test
This commit is contained in:
commit
1deed67bfb
4 changed files with 29 additions and 6 deletions
|
@ -175,7 +175,7 @@ def test_chat_text(
|
||||||
STATIONS[0],
|
STATIONS[0],
|
||||||
STATIONS[1],
|
STATIONS[1],
|
||||||
messages[message_no],
|
messages[message_no],
|
||||||
freedv_mode == "datac3", # low bandwidth mode
|
freedv_mode == "datac3", # == low bandwidth mode
|
||||||
tmp_path,
|
tmp_path,
|
||||||
),
|
),
|
||||||
daemon=True,
|
daemon=True,
|
||||||
|
@ -189,7 +189,7 @@ def test_chat_text(
|
||||||
STATIONS[1],
|
STATIONS[1],
|
||||||
STATIONS[0],
|
STATIONS[0],
|
||||||
messages[message_no],
|
messages[message_no],
|
||||||
freedv_mode == "datac3", # low bandwidth mode
|
freedv_mode == "datac3", # == low bandwidth mode
|
||||||
tmp_path,
|
tmp_path,
|
||||||
),
|
),
|
||||||
daemon=True,
|
daemon=True,
|
||||||
|
|
|
@ -100,7 +100,30 @@ def t_highsnr_arq_short_station1(
|
||||||
# log.info("S1 TX: ", frames=t_frames)
|
# log.info("S1 TX: ", frames=t_frames)
|
||||||
for item in t_frames:
|
for item in t_frames:
|
||||||
frametype = int.from_bytes(item[:1], "big") # type: ignore
|
frametype = int.from_bytes(item[:1], "big") # type: ignore
|
||||||
log.info("S1 TX: ", TX=frametype)
|
log.info("S1 TX: ", mode=static.FRAME_TYPE(frametype).name)
|
||||||
|
|
||||||
|
if (
|
||||||
|
static.LOW_BANDWIDTH_MODE
|
||||||
|
and frametype == static.FRAME_TYPE.ARQ_DC_OPEN_W.value
|
||||||
|
):
|
||||||
|
mesg = (
|
||||||
|
"enqueue_frame_for_tx: Low BW global "
|
||||||
|
"but DC Open narrow frame NOT chosen."
|
||||||
|
)
|
||||||
|
# Low bandwidth data type, wide bandwidth frame type
|
||||||
|
log.error(mesg)
|
||||||
|
assert False, mesg
|
||||||
|
if (
|
||||||
|
not static.LOW_BANDWIDTH_MODE
|
||||||
|
and frametype == static.FRAME_TYPE.ARQ_DC_OPEN_N.value
|
||||||
|
):
|
||||||
|
mesg = (
|
||||||
|
"enqueue_frame_for_tx: High BW global "
|
||||||
|
"but DC Open wide frame NOT chosen."
|
||||||
|
)
|
||||||
|
# High bandwidth data type, low bandwidth frame type
|
||||||
|
log.error(mesg)
|
||||||
|
assert False, mesg
|
||||||
|
|
||||||
# Apologies for the Python "magic." "orig_func" is a pointer to the
|
# Apologies for the Python "magic." "orig_func" is a pointer to the
|
||||||
# original function captured before this one was put in place.
|
# original function captured before this one was put in place.
|
||||||
|
|
|
@ -146,7 +146,7 @@ def t_highsnr_arq_short_station2(
|
||||||
timeout = time.time() + 20
|
timeout = time.time() + 20
|
||||||
while '"arq":"session","status":"close"' not in str(sock.SOCKET_QUEUE.queue):
|
while '"arq":"session","status":"close"' not in str(sock.SOCKET_QUEUE.queue):
|
||||||
if time.time() > timeout:
|
if time.time() > timeout:
|
||||||
log.error("station2", TIMEOUT=True)
|
log.warning("station2", TIMEOUT=True)
|
||||||
break
|
break
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
log.info("station2", arq_state=pformat(static.ARQ_STATE))
|
log.info("station2", arq_state=pformat(static.ARQ_STATE))
|
||||||
|
@ -158,4 +158,4 @@ def t_highsnr_arq_short_station2(
|
||||||
assert '"arq":"transmission","status":"received"' in str(sock.SOCKET_QUEUE.queue)
|
assert '"arq":"transmission","status":"received"' in str(sock.SOCKET_QUEUE.queue)
|
||||||
|
|
||||||
assert '"arq":"session","status":"close"' in str(sock.SOCKET_QUEUE.queue)
|
assert '"arq":"session","status":"close"' in str(sock.SOCKET_QUEUE.queue)
|
||||||
log.error("station2: Exiting!")
|
log.warning("station2: Exiting!")
|
||||||
|
|
|
@ -1561,7 +1561,7 @@ class DATA:
|
||||||
# Update data_channel timestamp
|
# Update data_channel timestamp
|
||||||
self.data_channel_last_received = int(time.time())
|
self.data_channel_last_received = int(time.time())
|
||||||
|
|
||||||
if static.LOW_BANDWIDTH_MODE and mode == 255:
|
if static.LOW_BANDWIDTH_MODE:
|
||||||
frametype = bytes([227])
|
frametype = bytes([227])
|
||||||
self.log.debug("[TNC] Requesting low bandwidth mode")
|
self.log.debug("[TNC] Requesting low bandwidth mode")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue