Merge pull request #219 from DJ2LS/issue_218_fix_with_test

Issue 218 fix with test
This commit is contained in:
Paul Kronenwetter 2022-06-20 20:02:14 -04:00 committed by GitHub
commit 1deed67bfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 6 deletions

View file

@ -175,7 +175,7 @@ def test_chat_text(
STATIONS[0],
STATIONS[1],
messages[message_no],
freedv_mode == "datac3", # low bandwidth mode
freedv_mode == "datac3", # == low bandwidth mode
tmp_path,
),
daemon=True,
@ -189,7 +189,7 @@ def test_chat_text(
STATIONS[1],
STATIONS[0],
messages[message_no],
freedv_mode == "datac3", # low bandwidth mode
freedv_mode == "datac3", # == low bandwidth mode
tmp_path,
),
daemon=True,

View file

@ -100,7 +100,30 @@ def t_highsnr_arq_short_station1(
# log.info("S1 TX: ", frames=t_frames)
for item in t_frames:
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
# original function captured before this one was put in place.

View file

@ -146,7 +146,7 @@ def t_highsnr_arq_short_station2(
timeout = time.time() + 20
while '"arq":"session","status":"close"' not in str(sock.SOCKET_QUEUE.queue):
if time.time() > timeout:
log.error("station2", TIMEOUT=True)
log.warning("station2", TIMEOUT=True)
break
time.sleep(0.5)
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":"session","status":"close"' in str(sock.SOCKET_QUEUE.queue)
log.error("station2: Exiting!")
log.warning("station2: Exiting!")

View file

@ -1561,7 +1561,7 @@ class DATA:
# Update data_channel timestamp
self.data_channel_last_received = int(time.time())
if static.LOW_BANDWIDTH_MODE and mode == 255:
if static.LOW_BANDWIDTH_MODE:
frametype = bytes([227])
self.log.debug("[TNC] Requesting low bandwidth mode")