From 7b84044ac0a5e6b7c97f33fa753a1e9ea384deab Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Fri, 21 Apr 2023 15:04:09 +0200 Subject: [PATCH] moved ctest from datac0 to datac13 --- test/{test_datac0.py => test_datac13.py} | 16 ++--- ...0_negative.py => test_datac13_negative.py} | 16 ++--- test/test_highsnr_stdio_C_P_datacx.py | 4 +- test/test_highsnr_stdio_P_C_datacx.py | 4 +- test/test_highsnr_stdio_P_P_datacx.py | 2 +- test/test_highsnr_stdio_P_P_multi.py | 4 +- test/test_tnc_states.py | 2 +- test/test_virtual1.sh | 4 +- test/test_virtual1a.sh | 4 +- test/test_virtual1b.sh | 4 +- test/test_virtual1c.sh | 4 +- test/test_virtual2.sh | 4 +- test/test_virtual3a.sh | 4 +- test/test_virtual3b.sh | 4 +- test/util_callback_multimode_rx.py | 64 +++++++++---------- test/util_callback_multimode_rx_outside.py | 62 +++++++++--------- test/util_callback_multimode_tx.py | 2 +- test/util_callback_rx.py | 2 +- test/util_callback_rx_outside.py | 2 +- test/util_callback_tx.py | 2 +- test/util_datac0.py | 20 +++--- test/util_datac0_negative.py | 22 +++---- test/util_multimode_rx.py | 8 +-- test/util_multimode_tx.py | 2 +- test/util_rx.py | 2 +- test/util_tx.py | 2 +- 26 files changed, 133 insertions(+), 133 deletions(-) rename test/{test_datac0.py => test_datac13.py} (95%) rename test/{test_datac0_negative.py => test_datac13_negative.py} (95%) diff --git a/test/test_datac0.py b/test/test_datac13.py similarity index 95% rename from test/test_datac0.py rename to test/test_datac13.py index 9ff94392..e9307ffb 100644 --- a/test/test_datac0.py +++ b/test/test_datac13.py @@ -9,7 +9,7 @@ queue used by the daemon process into and out of the TNC. Can be invoked from CMake, pytest, coverage or directly. -Uses util_datac0.py in separate process to perform the data transfer. +Uses util_datac13.py in separate process to perform the data transfer. @author: N2KIQ """ @@ -28,9 +28,9 @@ import pytest import structlog try: - import test.util_datac0 as util + import test.util_datac13 as util except ImportError: - import util_datac0 as util + import util_datac13 as util STATIONS = ["AA2BB", "ZZ9YY"] @@ -196,9 +196,9 @@ def analyze_results(station1: list, station2: list, call_list: list): pytest.param("stop", marks=pytest.mark.flaky(reruns=0)), ], ) -def test_datac0(frame_type: str, tmp_path): - log_handler.setup_logging(filename=tmp_path / "test_datac0", level="DEBUG") - log = structlog.get_logger("test_datac0") +def test_datac13(frame_type: str, tmp_path): + log_handler.setup_logging(filename=tmp_path / "test_datac13", level="DEBUG") + log = structlog.get_logger("test_datac13") s1_data = [] s2_data = [] @@ -227,7 +227,7 @@ def test_datac0(frame_type: str, tmp_path): from_s2, s2_send = multiprocessing.Pipe() proc = [ multiprocessing.Process( - target=util.t_datac0_1, + target=util.t_datac13_1, args=( s1_send, STATIONS[0], @@ -238,7 +238,7 @@ def test_datac0(frame_type: str, tmp_path): daemon=True, ), multiprocessing.Process( - target=util.t_datac0_2, + target=util.t_datac13_2, args=( s2_send, STATIONS[1], diff --git a/test/test_datac0_negative.py b/test/test_datac13_negative.py similarity index 95% rename from test/test_datac0_negative.py rename to test/test_datac13_negative.py index d90fb6f0..b1cbf02b 100644 --- a/test/test_datac0_negative.py +++ b/test/test_datac13_negative.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ -Negative tests for datac0 frames. +Negative tests for datac13 frames. @author: kronenpj """ @@ -20,9 +20,9 @@ import pytest import structlog try: - import test.util_datac0_negative as util + import test.util_datac13_negative as util except ImportError: - import util_datac0_negative as util + import util_datac13_negative as util STATIONS = ["AA2BB", "ZZ9YY"] @@ -163,9 +163,9 @@ def analyze_results(station1: list, station2: list, call_list: list): # @pytest.mark.parametrize("frame_type", ["beacon", "connect", "ping"]) @pytest.mark.parametrize("frame_type", ["ping", "stop"]) -def test_datac0_negative(frame_type: str, tmp_path): - log_handler.setup_logging(filename=tmp_path / "test_datac0", level="DEBUG") - log = structlog.get_logger("test_datac0") +def test_datac13_negative(frame_type: str, tmp_path): + log_handler.setup_logging(filename=tmp_path / "test_datac13", level="DEBUG") + log = structlog.get_logger("test_datac13") s1_data = [] s2_data = [] @@ -194,7 +194,7 @@ def test_datac0_negative(frame_type: str, tmp_path): from_s2, s2_send = multiprocessing.Pipe() proc = [ multiprocessing.Process( - target=util.t_datac0_1, + target=util.t_datac13_1, args=( s1_send, STATIONS[0], @@ -205,7 +205,7 @@ def test_datac0_negative(frame_type: str, tmp_path): daemon=True, ), multiprocessing.Process( - target=util.t_datac0_2, + target=util.t_datac13_2, args=( s2_send, STATIONS[1], diff --git a/test/test_highsnr_stdio_C_P_datacx.py b/test/test_highsnr_stdio_C_P_datacx.py index 21c9c709..aa095cd6 100644 --- a/test/test_highsnr_stdio_C_P_datacx.py +++ b/test/test_highsnr_stdio_C_P_datacx.py @@ -49,7 +49,7 @@ def t_HighSNR_C_P_DATACx( bursts: int, frames_per_burst: int, testframes: int, mode: str ): """ - Test a high signal-to-noise ratio path with DATAC0. + Test a high signal-to-noise ratio path with datac13. :param bursts: Number of bursts :type bursts: str @@ -152,7 +152,7 @@ def t_HighSNR_C_P_DATACx( @pytest.mark.parametrize("bursts", [BURSTS]) @pytest.mark.parametrize("frames_per_burst", [FRAMESPERBURST]) @pytest.mark.parametrize("testframes", [TESTFRAMES]) -@pytest.mark.parametrize("mode", ["datac0", "datac1", "datac3"]) +@pytest.mark.parametrize("mode", ["datac13", "datac1", "datac3"]) def test_HighSNR_C_P_DATACx( bursts: int, frames_per_burst: int, testframes: int, mode: str ): diff --git a/test/test_highsnr_stdio_P_C_datacx.py b/test/test_highsnr_stdio_P_C_datacx.py index f213def4..5574636d 100644 --- a/test/test_highsnr_stdio_P_C_datacx.py +++ b/test/test_highsnr_stdio_P_C_datacx.py @@ -47,7 +47,7 @@ if os.path.exists("test"): def t_HighSNR_P_C_DATACx(bursts: int, frames_per_burst: int, mode: str): """ - Test a high signal-to-noise ratio path with DATAC0. + Test a high signal-to-noise ratio path with datac13. :param bursts: Number of bursts :type bursts: str @@ -154,7 +154,7 @@ def t_HighSNR_P_C_DATACx(bursts: int, frames_per_burst: int, mode: str): # @pytest.mark.parametrize("frames_per_burst", [FRAMESPERBURST, 2, 3]) @pytest.mark.parametrize("bursts", [BURSTS]) @pytest.mark.parametrize("frames_per_burst", [FRAMESPERBURST]) -@pytest.mark.parametrize("mode", ["datac0", "datac1", "datac3"]) +@pytest.mark.parametrize("mode", ["datac13", "datac1", "datac3"]) def test_HighSNR_P_C_DATACx(bursts: int, frames_per_burst: int, mode: str): proc = multiprocessing.Process( target=t_HighSNR_P_C_DATACx, diff --git a/test/test_highsnr_stdio_P_P_datacx.py b/test/test_highsnr_stdio_P_P_datacx.py index 78aaff32..d63aa1e2 100644 --- a/test/test_highsnr_stdio_P_P_datacx.py +++ b/test/test_highsnr_stdio_P_P_datacx.py @@ -115,7 +115,7 @@ def t_HighSNR_P_P_DATACx(bursts: int, frames_per_burst: int, mode: str): # @pytest.mark.parametrize("frames_per_burst", [FRAMESPERBURST, 2, 3]) @pytest.mark.parametrize("bursts", [BURSTS]) @pytest.mark.parametrize("frames_per_burst", [FRAMESPERBURST]) -@pytest.mark.parametrize("mode", ["datac0", "datac1", "datac3"]) +@pytest.mark.parametrize("mode", ["datac13", "datac1", "datac3"]) def test_HighSNR_P_P_DATACx(bursts: int, frames_per_burst: int, mode: str): proc = multiprocessing.Process( target=t_HighSNR_P_P_DATACx, diff --git a/test/test_highsnr_stdio_P_P_multi.py b/test/test_highsnr_stdio_P_P_multi.py index 7ce5b1a5..b830230f 100644 --- a/test/test_highsnr_stdio_P_P_multi.py +++ b/test/test_highsnr_stdio_P_P_multi.py @@ -46,7 +46,7 @@ if os.path.exists("test"): def t_HighSNR_P_P_Multi(bursts: int, frames_per_burst: int): """ - Test a high signal-to-noise ratio path with DATAC0, DATAC1 and DATAC3. + Test a high signal-to-noise ratio path with datac13, DATAC1 and DATAC3. :param bursts: Number of bursts :type bursts: int @@ -101,7 +101,7 @@ def t_HighSNR_P_P_Multi(bursts: int, frames_per_burst: int): if "DATAC" in str(line, "UTF-8") ] ) - assert f"DATAC0: {bursts}/{frames_per_burst * bursts}" in lastline + assert f"datac13: {bursts}/{frames_per_burst * bursts}" in lastline assert f"DATAC1: {bursts}/{frames_per_burst * bursts}" in lastline assert f"DATAC3: {bursts}/{frames_per_burst * bursts}" in lastline print(lastline) diff --git a/test/test_tnc_states.py b/test/test_tnc_states.py index aa7a10dc..a5365b90 100644 --- a/test/test_tnc_states.py +++ b/test/test_tnc_states.py @@ -9,7 +9,7 @@ queue used by the daemon process into and out of the TNC. Can be invoked from CMake, pytest, coverage or directly. -Uses util_datac0.py in separate process to perform the data transfer. +Uses util_datac13.py in separate process to perform the data transfer. @author: N2KIQ """ diff --git a/test/test_virtual1.sh b/test/test_virtual1.sh index 18af9813..01da0d79 100755 --- a/test/test_virtual1.sh +++ b/test/test_virtual1.sh @@ -20,8 +20,8 @@ MAX_RUN_TIME=2600 # make sure all child processes are killed when we exit trap 'jobs -p | xargs -r kill' EXIT -arecord --device="plughw:CARD=CHAT2,DEV=0" -r 48000 -f S16_LE -d $MAX_RUN_TIME | python3 util_rx.py --mode datac0 --frames 2 --bursts 5 --debug & +arecord --device="plughw:CARD=CHAT2,DEV=0" -r 48000 -f S16_LE -d $MAX_RUN_TIME | python3 util_rx.py --mode datac13 --frames 2 --bursts 5 --debug & rx_pid=$! sleep 1 -python3 util_tx.py --mode datac0 --frames 2 --bursts 5 --delay 500 | aplay --device="plughw:CARD=CHAT2,DEV=1" -r 48000 -f S16_LE +python3 util_tx.py --mode datac13 --frames 2 --bursts 5 --delay 500 | aplay --device="plughw:CARD=CHAT2,DEV=1" -r 48000 -f S16_LE wait ${rx_pid} diff --git a/test/test_virtual1a.sh b/test/test_virtual1a.sh index 402e4507..af528dc9 100755 --- a/test/test_virtual1a.sh +++ b/test/test_virtual1a.sh @@ -8,9 +8,9 @@ MAX_RUN_TIME=2600 trap 'jobs -p | xargs -r kill' EXIT arecord -r 48000 --device="plughw:CARD=CHAT1,DEV=0" -f S16_LE -d $MAX_RUN_TIME | \ - python3 util_rx.py --mode datac0 --frames 2 --bursts 5 --debug & + python3 util_rx.py --mode datac13 --frames 2 --bursts 5 --debug & rx_pid=$! sleep 1 -python3 util_tx.py --mode datac0 --frames 2 --bursts 5 --delay 500 | \ +python3 util_tx.py --mode datac13 --frames 2 --bursts 5 --delay 500 | \ aplay -r 48000 --device="plughw:CARD=CHAT1,DEV=1" -f S16_LE wait ${rx_pid} diff --git a/test/test_virtual1b.sh b/test/test_virtual1b.sh index 140803c3..e38f8e92 100755 --- a/test/test_virtual1b.sh +++ b/test/test_virtual1b.sh @@ -8,8 +8,8 @@ MAX_RUN_TIME=2600 trap 'jobs -p | xargs -r kill' EXIT arecord -r 48000 --device="plughw:CARD=CHAT1,DEV=0" -f S16_LE -d $MAX_RUN_TIME | \ - python3 util_rx.py --mode datac0 --frames 2 --bursts 5 --debug --timeout 20 & + python3 util_rx.py --mode datac13 --frames 2 --bursts 5 --debug --timeout 20 & rx_pid=$! sleep 1 -python3 util_tx.py --mode datac0 --frames 2 --bursts 5 --delay 2000 --audiodev -2 +python3 util_tx.py --mode datac13 --frames 2 --bursts 5 --delay 2000 --audiodev -2 wait ${rx_pid} diff --git a/test/test_virtual1c.sh b/test/test_virtual1c.sh index 3f2835b4..c432e08b 100755 --- a/test/test_virtual1c.sh +++ b/test/test_virtual1c.sh @@ -7,9 +7,9 @@ MAX_RUN_TIME=2600 # make sure all child processes are killed when we exit trap 'jobs -p | xargs -r kill' EXIT -python3 util_rx.py --mode datac0 --frames 2 --bursts 5 --debug --audiodev -2 & +python3 util_rx.py --mode datac13 --frames 2 --bursts 5 --debug --audiodev -2 & rx_pid=$! sleep 1 -python3 util_tx.py --mode datac0 --frames 2 --bursts 5 | \ +python3 util_tx.py --mode datac13 --frames 2 --bursts 5 | \ aplay -r 48000 --device="plughw:CARD=CHAT1,DEV=1" -f S16_LE wait ${rx_pid} diff --git a/test/test_virtual2.sh b/test/test_virtual2.sh index 0357cd60..7eec499c 100755 --- a/test/test_virtual2.sh +++ b/test/test_virtual2.sh @@ -16,8 +16,8 @@ check_alsa_loopback # make sure all child processes are killed when we exit trap 'jobs -p | xargs -r kill' EXIT -python3 util_callback_rx.py --mode datac0 --frames 2 --bursts 3 --audiodev -2 --debug & +python3 util_callback_rx.py --mode datac13 --frames 2 --bursts 3 --audiodev -2 --debug & rx_pid=$! sleep 1 -python3 util_tx.py --mode datac0 --frames 2 --bursts 3 --audiodev -2 +python3 util_tx.py --mode datac13 --frames 2 --bursts 3 --audiodev -2 wait ${rx_pid} diff --git a/test/test_virtual3a.sh b/test/test_virtual3a.sh index 50b68e3a..e49f978f 100755 --- a/test/test_virtual3a.sh +++ b/test/test_virtual3a.sh @@ -16,8 +16,8 @@ check_alsa_loopback # make sure all child processes are killed when we exit trap 'jobs -p | xargs -r kill' EXIT -python3 util_callback_rx.py --mode datac0 --frames 2 --bursts 3 --audiodev -2 --debug & +python3 util_callback_rx.py --mode datac13 --frames 2 --bursts 3 --audiodev -2 --debug & rx_pid=$! #sleep 1 -python3 util_tx.py --mode datac0 --frames 2 --bursts 3 --audiodev -2 +python3 util_tx.py --mode datac13 --frames 2 --bursts 3 --audiodev -2 wait ${rx_pid} diff --git a/test/test_virtual3b.sh b/test/test_virtual3b.sh index 8474adc5..e6fcc5a1 100755 --- a/test/test_virtual3b.sh +++ b/test/test_virtual3b.sh @@ -16,8 +16,8 @@ check_alsa_loopback # make sure all child processes are killed when we exit trap 'jobs -p | xargs -r kill' EXIT -python3 util_callback_rx_outside.py --mode datac0 --frames 2 --bursts 3 --audiodev -2 --debug & +python3 util_callback_rx_outside.py --mode datac13 --frames 2 --bursts 3 --audiodev -2 --debug & rx_pid=$! #sleep 1 -python3 util_tx.py --mode datac0 --frames 2 --bursts 3 --audiodev -2 +python3 util_tx.py --mode datac13 --frames 2 --bursts 3 --audiodev -2 wait ${rx_pid} diff --git a/test/util_callback_multimode_rx.py b/test/util_callback_multimode_rx.py index 573c8a6d..3ef2d35c 100644 --- a/test/util_callback_multimode_rx.py +++ b/test/util_callback_multimode_rx.py @@ -112,17 +112,17 @@ class Test: sys.exit() # open codec2 instance - self.datac0_freedv = ctypes.cast( - codec2.api.freedv_open(codec2.FREEDV_MODE.datac0.value), ctypes.c_void_p + self.datac13_freedv = ctypes.cast( + codec2.api.freedv_open(codec2.FREEDV_MODE.datac13.value), ctypes.c_void_p ) - self.datac0_bytes_per_frame = int( - codec2.api.freedv_get_bits_per_modem_frame(self.datac0_freedv) / 8 + self.datac13_bytes_per_frame = int( + codec2.api.freedv_get_bits_per_modem_frame(self.datac13_freedv) / 8 ) - self.datac0_bytes_out = ctypes.create_string_buffer(self.datac0_bytes_per_frame) + self.datac13_bytes_out = ctypes.create_string_buffer(self.datac13_bytes_per_frame) codec2.api.freedv_set_frames_per_burst( - self.datac0_freedv, self.N_FRAMES_PER_BURST + self.datac13_freedv, self.N_FRAMES_PER_BURST ) - self.datac0_buffer = codec2.audio_buffer(2 * self.AUDIO_FRAMES_PER_BUFFER) + self.datac13_buffer = codec2.audio_buffer(2 * self.AUDIO_FRAMES_PER_BUFFER) self.datac1_freedv = ctypes.cast( codec2.api.freedv_open(codec2.FREEDV_MODE.datac1.value), ctypes.c_void_p @@ -149,9 +149,9 @@ class Test: self.datac3_buffer = codec2.audio_buffer(2 * self.AUDIO_FRAMES_PER_BUFFER) # SET COUNTERS - self.rx_total_frames_datac0 = 0 - self.rx_frames_datac0 = 0 - self.rx_bursts_datac0 = 0 + self.rx_total_frames_datac13 = 0 + self.rx_frames_datac13 = 0 + self.rx_bursts_datac13 = 0 self.rx_total_frames_datac1 = 0 self.rx_frames_datac1 = 0 @@ -173,7 +173,7 @@ class Test: self.frx = open("rx48_callback_multimode.raw", mode="wb") # initial nin values - self.datac0_nin = codec2.api.freedv_nin(self.datac0_freedv) + self.datac13_nin = codec2.api.freedv_nin(self.datac13_freedv) self.datac1_nin = codec2.api.freedv_nin(self.datac1_freedv) self.datac3_nin = codec2.api.freedv_nin(self.datac3_freedv) @@ -187,26 +187,26 @@ class Test: x.tofile(self.frx) x = self.resampler.resample48_to_8(x) - self.datac0_buffer.push(x) + self.datac13_buffer.push(x) self.datac1_buffer.push(x) self.datac3_buffer.push(x) - while self.datac0_buffer.nbuffer >= self.datac0_nin: + while self.datac13_buffer.nbuffer >= self.datac13_nin: # demodulate audio nbytes = codec2.api.freedv_rawdatarx( - self.datac0_freedv, - self.datac0_bytes_out, - self.datac0_buffer.buffer.ctypes, + self.datac13_freedv, + self.datac13_bytes_out, + self.datac13_buffer.buffer.ctypes, ) - self.datac0_buffer.pop(self.datac0_nin) - self.datac0_nin = codec2.api.freedv_nin(self.datac0_freedv) - if nbytes == self.datac0_bytes_per_frame: - self.rx_total_frames_datac0 = self.rx_total_frames_datac0 + 1 - self.rx_frames_datac0 = self.rx_frames_datac0 + 1 + self.datac13_buffer.pop(self.datac13_nin) + self.datac13_nin = codec2.api.freedv_nin(self.datac13_freedv) + if nbytes == self.datac13_bytes_per_frame: + self.rx_total_frames_datac13 = self.rx_total_frames_datac13 + 1 + self.rx_frames_datac13 = self.rx_frames_datac13 + 1 - if self.rx_frames_datac0 == self.N_FRAMES_PER_BURST: - self.rx_frames_datac0 = 0 - self.rx_bursts_datac0 = self.rx_bursts_datac0 + 1 + if self.rx_frames_datac13 == self.N_FRAMES_PER_BURST: + self.rx_frames_datac13 = 0 + self.rx_bursts_datac13 = self.rx_bursts_datac13 + 1 while self.datac1_buffer.nbuffer >= self.datac1_nin: # demodulate audio @@ -243,7 +243,7 @@ class Test: self.rx_bursts_datac3 = self.rx_bursts_datac3 + 1 if ( - self.rx_bursts_datac0 and self.rx_bursts_datac1 and self.rx_bursts_datac3 + self.rx_bursts_datac13 and self.rx_bursts_datac1 and self.rx_bursts_datac3 ) == self.N_BURSTS: self.receive = False @@ -253,11 +253,11 @@ class Test: while self.receive: time.sleep(0.01) if self.DEBUGGING_MODE: - self.datac0_rxstatus = codec2.api.freedv_get_rx_status( - self.datac0_freedv + self.datac13_rxstatus = codec2.api.freedv_get_rx_status( + self.datac13_freedv ) - self.datac0_rxstatus = codec2.api.rx_sync_flags_to_text[ - self.datac0_rxstatus + self.datac13_rxstatus = codec2.api.rx_sync_flags_to_text[ + self.datac13_rxstatus ] self.datac1_rxstatus = codec2.api.freedv_get_rx_status( @@ -277,8 +277,8 @@ class Test: print( "NIN0: %5d RX_STATUS0: %4s NIN1: %5d RX_STATUS1: %4s NIN3: %5d RX_STATUS3: %4s" % ( - self.datac0_nin, - self.datac0_rxstatus, + self.datac13_nin, + self.datac13_rxstatus, self.datac1_nin, self.datac1_rxstatus, self.datac3_nin, @@ -309,7 +309,7 @@ class Test: ) print( - f"DATAC0: {self.rx_bursts_datac0}/{self.rx_total_frames_datac0} DATAC1: {self.rx_bursts_datac1}/{self.rx_total_frames_datac1} DATAC3: {self.rx_bursts_datac3}/{self.rx_total_frames_datac3}", + f"datac13: {self.rx_bursts_datac13}/{self.rx_total_frames_datac13} DATAC1: {self.rx_bursts_datac1}/{self.rx_total_frames_datac1} DATAC3: {self.rx_bursts_datac3}/{self.rx_total_frames_datac3}", file=sys.stderr, ) self.frx.close() diff --git a/test/util_callback_multimode_rx_outside.py b/test/util_callback_multimode_rx_outside.py index 9c9d8b3a..eb4d8952 100644 --- a/test/util_callback_multimode_rx_outside.py +++ b/test/util_callback_multimode_rx_outside.py @@ -110,17 +110,17 @@ class Test: sys.exit() # open codec2 instance - self.datac0_freedv = ctypes.cast( - codec2.api.freedv_open(codec2.FREEDV_MODE.datac0.value), ctypes.c_void_p + self.datac13_freedv = ctypes.cast( + codec2.api.freedv_open(codec2.FREEDV_MODE.datac13.value), ctypes.c_void_p ) - self.datac0_bytes_per_frame = int( - codec2.api.freedv_get_bits_per_modem_frame(self.datac0_freedv) / 8 + self.datac13_bytes_per_frame = int( + codec2.api.freedv_get_bits_per_modem_frame(self.datac13_freedv) / 8 ) - self.datac0_bytes_out = ctypes.create_string_buffer(self.datac0_bytes_per_frame) + self.datac13_bytes_out = ctypes.create_string_buffer(self.datac13_bytes_per_frame) codec2.api.freedv_set_frames_per_burst( - self.datac0_freedv, self.N_FRAMES_PER_BURST + self.datac13_freedv, self.N_FRAMES_PER_BURST ) - self.datac0_buffer = codec2.audio_buffer(2 * self.AUDIO_FRAMES_PER_BUFFER) + self.datac13_buffer = codec2.audio_buffer(2 * self.AUDIO_FRAMES_PER_BUFFER) self.datac1_freedv = ctypes.cast( codec2.api.freedv_open(codec2.FREEDV_MODE.datac1.value), ctypes.c_void_p @@ -147,9 +147,9 @@ class Test: self.datac3_buffer = codec2.audio_buffer(2 * self.AUDIO_FRAMES_PER_BUFFER) # SET COUNTERS - self.rx_total_frames_datac0 = 0 - self.rx_frames_datac0 = 0 - self.rx_bursts_datac0 = 0 + self.rx_total_frames_datac13 = 0 + self.rx_frames_datac13 = 0 + self.rx_bursts_datac13 = 0 self.rx_total_frames_datac1 = 0 self.rx_frames_datac1 = 0 @@ -171,7 +171,7 @@ class Test: self.frx = open("rx48_callback_multimode.raw", mode="wb") # initial nin values - self.datac0_nin = codec2.api.freedv_nin(self.datac0_freedv) + self.datac13_nin = codec2.api.freedv_nin(self.datac13_freedv) self.datac1_nin = codec2.api.freedv_nin(self.datac1_freedv) self.datac3_nin = codec2.api.freedv_nin(self.datac3_freedv) @@ -181,7 +181,7 @@ class Test: x.tofile(self.frx) x = self.resampler.resample48_to_8(x) - self.datac0_buffer.push(x) + self.datac13_buffer.push(x) self.datac1_buffer.push(x) self.datac3_buffer.push(x) @@ -189,9 +189,9 @@ class Test: def print_stats(self): if self.DEBUGGING_MODE: - self.datac0_rxstatus = codec2.api.freedv_get_rx_status(self.datac0_freedv) - self.datac0_rxstatus = codec2.api.rx_sync_flags_to_text[ - self.datac0_rxstatus + self.datac13_rxstatus = codec2.api.freedv_get_rx_status(self.datac13_freedv) + self.datac13_rxstatus = codec2.api.rx_sync_flags_to_text[ + self.datac13_rxstatus ] self.datac1_rxstatus = codec2.api.freedv_get_rx_status(self.datac1_freedv) @@ -207,8 +207,8 @@ class Test: print( "NIN0: %5d RX_STATUS0: %4s NIN1: %5d RX_STATUS1: %4s NIN3: %5d RX_STATUS3: %4s" % ( - self.datac0_nin, - self.datac0_rxstatus, + self.datac13_nin, + self.datac13_rxstatus, self.datac1_nin, self.datac1_rxstatus, self.datac3_nin, @@ -225,22 +225,22 @@ class Test: print(f"pyAudio error: {e}", file=sys.stderr) while self.receive and time.time() < self.timeout: - while self.datac0_buffer.nbuffer >= self.datac0_nin: + while self.datac13_buffer.nbuffer >= self.datac13_nin: # demodulate audio nbytes = codec2.api.freedv_rawdatarx( - self.datac0_freedv, - self.datac0_bytes_out, - self.datac0_buffer.buffer.ctypes, + self.datac13_freedv, + self.datac13_bytes_out, + self.datac13_buffer.buffer.ctypes, ) - self.datac0_buffer.pop(self.datac0_nin) - self.datac0_nin = codec2.api.freedv_nin(self.datac0_freedv) - if nbytes == self.datac0_bytes_per_frame: - self.rx_total_frames_datac0 = self.rx_total_frames_datac0 + 1 - self.rx_frames_datac0 = self.rx_frames_datac0 + 1 + self.datac13_buffer.pop(self.datac13_nin) + self.datac13_nin = codec2.api.freedv_nin(self.datac13_freedv) + if nbytes == self.datac13_bytes_per_frame: + self.rx_total_frames_datac13 = self.rx_total_frames_datac13 + 1 + self.rx_frames_datac13 = self.rx_frames_datac13 + 1 - if self.rx_frames_datac0 == self.N_FRAMES_PER_BURST: - self.rx_frames_datac0 = 0 - self.rx_bursts_datac0 = self.rx_bursts_datac0 + 1 + if self.rx_frames_datac13 == self.N_FRAMES_PER_BURST: + self.rx_frames_datac13 = 0 + self.rx_bursts_datac13 = self.rx_bursts_datac13 + 1 self.print_stats() while self.datac1_buffer.nbuffer >= self.datac1_nin: @@ -280,7 +280,7 @@ class Test: self.print_stats() if ( - self.rx_bursts_datac0 + self.rx_bursts_datac13 and self.rx_bursts_datac1 and self.rx_bursts_datac3 ) == self.N_BURSTS: @@ -297,7 +297,7 @@ class Test: ) print( - f"DATAC0: {self.rx_bursts_datac0}/{self.rx_total_frames_datac0} DATAC1: {self.rx_bursts_datac1}/{self.rx_total_frames_datac1} DATAC3: {self.rx_bursts_datac3}/{self.rx_total_frames_datac3}", + f"datac13: {self.rx_bursts_datac13}/{self.rx_total_frames_datac13} DATAC1: {self.rx_bursts_datac1}/{self.rx_total_frames_datac1} DATAC3: {self.rx_bursts_datac3}/{self.rx_total_frames_datac3}", file=sys.stderr, ) self.frx.close() diff --git a/test/util_callback_multimode_tx.py b/test/util_callback_multimode_tx.py index 1e33930b..79e30284 100644 --- a/test/util_callback_multimode_tx.py +++ b/test/util_callback_multimode_tx.py @@ -158,7 +158,7 @@ class Test: def create_modulation(self): modes = [ - codec2.FREEDV_MODE.datac0.value, + codec2.FREEDV_MODE.datac13.value, codec2.FREEDV_MODE.datac1.value, codec2.FREEDV_MODE.datac3.value, ] diff --git a/test/util_callback_rx.py b/test/util_callback_rx.py index 0d0bf01b..b05bfbed 100644 --- a/test/util_callback_rx.py +++ b/test/util_callback_rx.py @@ -22,7 +22,7 @@ parser = argparse.ArgumentParser(description="FreeDATA audio test") parser.add_argument("--bursts", dest="N_BURSTS", default=1, type=int) parser.add_argument("--framesperburst", dest="N_FRAMES_PER_BURST", default=1, type=int) parser.add_argument( - "--mode", dest="FREEDV_MODE", type=str, choices=["datac0", "datac1", "datac3"] + "--mode", dest="FREEDV_MODE", type=str, choices=["datac13", "datac1", "datac3"] ) parser.add_argument( "--audiodev", diff --git a/test/util_callback_rx_outside.py b/test/util_callback_rx_outside.py index e9ec6317..dc1fc3ce 100644 --- a/test/util_callback_rx_outside.py +++ b/test/util_callback_rx_outside.py @@ -22,7 +22,7 @@ parser = argparse.ArgumentParser(description="FreeDATA audio test") parser.add_argument("--bursts", dest="N_BURSTS", default=1, type=int) parser.add_argument("--framesperburst", dest="N_FRAMES_PER_BURST", default=1, type=int) parser.add_argument( - "--mode", dest="FREEDV_MODE", type=str, choices=["datac0", "datac1", "datac3"] + "--mode", dest="FREEDV_MODE", type=str, choices=["datac13", "datac1", "datac3"] ) parser.add_argument( "--audiodev", diff --git a/test/util_callback_tx.py b/test/util_callback_tx.py index 42d8bf0c..3991a71f 100644 --- a/test/util_callback_tx.py +++ b/test/util_callback_tx.py @@ -25,7 +25,7 @@ parser.add_argument("--bursts", dest="N_BURSTS", default=1, type=int) parser.add_argument("--framesperburst", dest="N_FRAMES_PER_BURST", default=1, type=int) parser.add_argument("--delay", dest="DELAY_BETWEEN_BURSTS", default=500, type=int) parser.add_argument( - "--mode", dest="FREEDV_MODE", type=str, choices=["datac0", "datac1", "datac3"] + "--mode", dest="FREEDV_MODE", type=str, choices=["datac13", "datac1", "datac3"] ) parser.add_argument( "--audiodev", diff --git a/test/util_datac0.py b/test/util_datac0.py index 13bd7b1b..c43c3caf 100644 --- a/test/util_datac0.py +++ b/test/util_datac0.py @@ -7,7 +7,7 @@ Near end-to-end test for sending / receiving control frames through the TNC and and back through on the other station. Data injection initiates from the queue used by the daemon process into and out of the TNC. -Invoked from test_datac0.py. +Invoked from test_datac13.py. @author: N2KIQ """ @@ -83,7 +83,7 @@ def t_setup( return tnc, orig_rx_func, orig_tx_func -def t_datac0_1( +def t_datac13_1( parent_pipe, mycall: str, dxcall: str, @@ -93,7 +93,7 @@ def t_datac0_1( log = structlog.get_logger("station1") orig_tx_func: Callable orig_rx_func: Callable - log.debug("t_datac0_1:", TMP_PATH=tmp_path) + log.debug("t_datac13_1:", TMP_PATH=tmp_path) # Unpack tuple data, timeout_duration, tx_check, _, final_tx_check, _ = config @@ -143,12 +143,12 @@ def t_datac0_1( tmp_path, ) - log.info("t_datac0_1:", RXCHANNEL=modem.RXCHANNEL) - log.info("t_datac0_1:", TXCHANNEL=modem.TXCHANNEL) + log.info("t_datac13_1:", RXCHANNEL=modem.RXCHANNEL) + log.info("t_datac13_1:", TXCHANNEL=modem.TXCHANNEL) time.sleep(0.5) if "stop" in data["command"]: - log.debug("t_datac0_1: STOP test, setting TNC state") + log.debug("t_datac13_1: STOP test, setting TNC state") static.TNC_STATE = "BUSY" static.ARQ_STATE = True sock.ThreadedTCPRequestHandler.process_tnc_commands(None,json.dumps(data, indent=None)) @@ -199,7 +199,7 @@ def t_datac0_1( log.warning("station1: Exiting!") -def t_datac0_2( +def t_datac13_2( parent_pipe, mycall: str, dxcall: str, @@ -209,7 +209,7 @@ def t_datac0_2( log = structlog.get_logger("station2") orig_tx_func: Callable orig_rx_func: Callable - log.debug("t_datac0_2:", TMP_PATH=tmp_path) + log.debug("t_datac13_2:", TMP_PATH=tmp_path) # Unpack tuple data, timeout_duration, _, rx_check, _, final_rx_check = config @@ -259,8 +259,8 @@ def t_datac0_2( tmp_path, ) - log.info("t_datac0_2:", RXCHANNEL=modem.RXCHANNEL) - log.info("t_datac0_2:", TXCHANNEL=modem.TXCHANNEL) + log.info("t_datac13_2:", RXCHANNEL=modem.RXCHANNEL) + log.info("t_datac13_2:", TXCHANNEL=modem.TXCHANNEL) if "cq" in data: t_data = {"type": "arq", "command": "stop_transmission"} diff --git a/test/util_datac0_negative.py b/test/util_datac0_negative.py index 08c881e0..f57020e5 100644 --- a/test/util_datac0_negative.py +++ b/test/util_datac0_negative.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ -Negative test utilities for datac0 frames. +Negative test utilities for datac13 frames. @author: kronenpj """ @@ -77,7 +77,7 @@ def t_setup( return tnc, orig_rx_func, orig_tx_func -def t_datac0_1( +def t_datac13_1( parent_pipe, mycall: str, dxcall: str, @@ -87,7 +87,7 @@ def t_datac0_1( log = structlog.get_logger("station1") orig_tx_func: Callable orig_rx_func: Callable - log.debug("t_datac0_1:", TMP_PATH=tmp_path) + log.debug("t_datac13_1:", TMP_PATH=tmp_path) # Unpack tuple data, timeout_duration, tx_check, _, final_tx_check, _ = config @@ -137,14 +137,14 @@ def t_datac0_1( tmp_path, ) - log.info("t_datac0_1:", RXCHANNEL=modem.RXCHANNEL) - log.info("t_datac0_1:", TXCHANNEL=modem.TXCHANNEL) + log.info("t_datac13_1:", RXCHANNEL=modem.RXCHANNEL) + log.info("t_datac13_1:", TXCHANNEL=modem.TXCHANNEL) orig_dxcall = static.DXCALLSIGN if "stop" in data["command"]: time.sleep(0.5) log.debug( - "t_datac0_1: STOP test, setting TNC state", + "t_datac13_1: STOP test, setting TNC state", mycall=static.MYCALLSIGN, dxcall=static.DXCALLSIGN, ) @@ -204,7 +204,7 @@ def t_datac0_1( log.warning("station1: Exiting!") -def t_datac0_2( +def t_datac13_2( parent_pipe, mycall: str, dxcall: str, @@ -214,7 +214,7 @@ def t_datac0_2( log = structlog.get_logger("station2") orig_tx_func: Callable orig_rx_func: Callable - log.debug("t_datac0_2:", TMP_PATH=tmp_path) + log.debug("t_datac13_2:", TMP_PATH=tmp_path) # Unpack tuple data, timeout_duration, _, rx_check, _, final_rx_check = config @@ -264,9 +264,9 @@ def t_datac0_2( tmp_path, ) - log.info("t_datac0_2:", RXCHANNEL=modem.RXCHANNEL) - log.info("t_datac0_2:", TXCHANNEL=modem.TXCHANNEL) - log.info("t_datac0_2:", mycall=static.MYCALLSIGN) + log.info("t_datac13_2:", RXCHANNEL=modem.RXCHANNEL) + log.info("t_datac13_2:", TXCHANNEL=modem.TXCHANNEL) + log.info("t_datac13_2:", mycall=static.MYCALLSIGN) if "cq" in data: t_data = {"type": "arq", "command": "stop_transmission"} diff --git a/test/util_multimode_rx.py b/test/util_multimode_rx.py index 343e1e60..252649dd 100755 --- a/test/util_multimode_rx.py +++ b/test/util_multimode_rx.py @@ -67,7 +67,7 @@ def test_mm_rx(): for idx in range(3): datac_freedv.append( ctypes.cast( - codec2.api.freedv_open(codec2.FREEDV_MODE.datac0.value), ctypes.c_void_p + codec2.api.freedv_open(codec2.FREEDV_MODE.datac13.value), ctypes.c_void_p ) ) datac_bytes_per_frame.append( @@ -121,11 +121,11 @@ def test_mm_rx(): for idx in range(3): datac_nin[idx] = codec2.api.freedv_nin(datac_freedv[idx]) - def print_stats(time_datac0, time_datac1, time_datac3): + def print_stats(time_datac13, time_datac1, time_datac3): if not DEBUGGING_MODE: return - time_datac = [time_datac0, time_datac1, time_datac3] + time_datac = [time_datac13, time_datac1, time_datac3] datac_rxstatus = ["", "", ""] for idx in range(3): datac_rxstatus[idx] = codec2.api.rx_sync_flags_to_text[ @@ -206,7 +206,7 @@ def test_mm_rx(): print("TIMEOUT REACHED", file=sys.stderr) print( - f"DATAC0: {rx_bursts_datac[0]}/{rx_total_frames_datac[0]} " + f"datac13: {rx_bursts_datac[0]}/{rx_total_frames_datac[0]} " f"DATAC1: {rx_bursts_datac[1]}/{rx_total_frames_datac[1]} " f"DATAC3: {rx_bursts_datac[2]}/{rx_total_frames_datac[2]}", file=sys.stderr, diff --git a/test/util_multimode_tx.py b/test/util_multimode_tx.py index 90116f01..00d99b66 100644 --- a/test/util_multimode_tx.py +++ b/test/util_multimode_tx.py @@ -49,7 +49,7 @@ def test_mm_tx(): data_out = b"HELLO WORLD!" modes = [ - codec2.FREEDV_MODE.datac0.value, + codec2.FREEDV_MODE.datac13.value, codec2.FREEDV_MODE.datac1.value, codec2.FREEDV_MODE.datac3.value, ] diff --git a/test/util_rx.py b/test/util_rx.py index ccbaaf89..845558d1 100644 --- a/test/util_rx.py +++ b/test/util_rx.py @@ -221,7 +221,7 @@ def parse_arguments(): "--framesperburst", dest="N_FRAMES_PER_BURST", default=1, type=int ) parser.add_argument( - "--mode", dest="FREEDV_MODE", type=str, choices=["datac0", "datac1", "datac3"] + "--mode", dest="FREEDV_MODE", type=str, choices=["datac13", "datac1", "datac3"] ) parser.add_argument( "--audiodev", diff --git a/test/util_tx.py b/test/util_tx.py index 06e6a636..c4cc6ec1 100644 --- a/test/util_tx.py +++ b/test/util_tx.py @@ -198,7 +198,7 @@ def parse_arguments(): help="delay between bursts in ms", ) parser.add_argument( - "--mode", dest="FREEDV_MODE", type=str, choices=["datac0", "datac1", "datac3"] + "--mode", dest="FREEDV_MODE", type=str, choices=["datac13", "datac1", "datac3"] ) parser.add_argument( "--audiodev",