FreeDATA/test/util_callback_multimode_rx_outside.py

312 lines
11 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 23 07:04:24 2020
@author: DJ2LS
"""
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
import argparse
import ctypes
import sys
import time
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
import numpy as np
import pyaudio
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
sys.path.insert(0, "..")
from modem import codec2
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
# --------------------------------------------GET PARAMETER INPUTS
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(
"--audiodev",
dest="AUDIO_INPUT_DEVICE",
default=-1,
type=int,
help="audio device number to use",
)
parser.add_argument("--debug", dest="DEBUGGING_MODE", action="store_true")
parser.add_argument(
"--list",
dest="LIST",
action="store_true",
help="list audio devices by number and exit",
)
parser.add_argument(
"--timeout",
dest="TIMEOUT",
default=10,
type=int,
help="Timeout (seconds) before test ends",
)
args, _ = parser.parse_known_args()
if args.LIST:
p = pyaudio.PyAudio()
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
for dev in range(p.get_device_count()):
print("audiodev: ", dev, p.get_device_info_by_index(dev)["name"])
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
class Test:
def __init__(self):
self.N_BURSTS = args.N_BURSTS
self.N_FRAMES_PER_BURST = args.N_FRAMES_PER_BURST
self.AUDIO_INPUT_DEVICE = args.AUDIO_INPUT_DEVICE
self.DEBUGGING_MODE = args.DEBUGGING_MODE
self.TIMEOUT = args.TIMEOUT
# AUDIO PARAMETERS
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
self.AUDIO_FRAMES_PER_BUFFER = (
2400 * 2
) # <- consider increasing if you get nread_exceptions > 0
self.MODEM_SAMPLE_RATE = codec2.api.FREEDV_FS_8000
self.AUDIO_SAMPLE_RATE_RX = 48000
# make sure our resampler will work
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
assert (
self.AUDIO_SAMPLE_RATE_RX / self.MODEM_SAMPLE_RATE
) == codec2.api.FDMDV_OS_48
# check if we want to use an audio device then do a pyaudio init
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
if self.AUDIO_INPUT_DEVICE != -1:
self.p = pyaudio.PyAudio()
# auto search for loopback devices
if self.AUDIO_INPUT_DEVICE == -2:
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
loopback_list = [
dev
for dev in range(self.p.get_device_count())
if "Loopback: PCM" in self.p.get_device_info_by_index(dev)["name"]
]
if len(loopback_list) >= 2:
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
self.AUDIO_INPUT_DEVICE = loopback_list[0] # 0 = RX 1 = TX
print(f"loopback_list rx: {loopback_list}", file=sys.stderr)
else:
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
sys.exit()
print(
f"AUDIO INPUT DEVICE: {self.AUDIO_INPUT_DEVICE} DEVICE: {self.p.get_device_info_by_index(self.AUDIO_INPUT_DEVICE)['name']} \
AUDIO SAMPLE RATE: {self.AUDIO_SAMPLE_RATE_RX}",
file=sys.stderr,
)
self.stream_rx = self.p.open(
format=pyaudio.paInt16,
channels=1,
rate=self.AUDIO_SAMPLE_RATE_RX,
frames_per_buffer=self.AUDIO_FRAMES_PER_BUFFER,
input=True,
output=False,
input_device_index=self.AUDIO_INPUT_DEVICE,
stream_callback=self.callback,
)
else:
print("test_callback_multimode_rx_outside: Not written for STDIN usage.")
print("Exiting.")
sys.exit()
# open codec2 instance
2023-04-21 15:04:09 +02:00
self.datac13_freedv = ctypes.cast(
codec2.api.freedv_open(codec2.FREEDV_MODE.datac13.value), ctypes.c_void_p
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
)
2023-04-21 15:04:09 +02:00
self.datac13_bytes_per_frame = int(
codec2.api.freedv_get_bits_per_modem_frame(self.datac13_freedv) / 8
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
)
2023-04-21 15:04:09 +02:00
self.datac13_bytes_out = ctypes.create_string_buffer(self.datac13_bytes_per_frame)
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
codec2.api.freedv_set_frames_per_burst(
2023-04-21 15:04:09 +02:00
self.datac13_freedv, self.N_FRAMES_PER_BURST
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
)
2023-04-21 15:04:09 +02:00
self.datac13_buffer = codec2.audio_buffer(2 * self.AUDIO_FRAMES_PER_BUFFER)
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
self.datac1_freedv = ctypes.cast(
codec2.api.freedv_open(codec2.FREEDV_MODE.datac1.value), ctypes.c_void_p
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
)
self.datac1_bytes_per_frame = int(
codec2.api.freedv_get_bits_per_modem_frame(self.datac1_freedv) / 8
)
self.datac1_bytes_out = ctypes.create_string_buffer(self.datac1_bytes_per_frame)
codec2.api.freedv_set_frames_per_burst(
self.datac1_freedv, self.N_FRAMES_PER_BURST
)
self.datac1_buffer = codec2.audio_buffer(2 * self.AUDIO_FRAMES_PER_BUFFER)
self.datac3_freedv = ctypes.cast(
codec2.api.freedv_open(codec2.FREEDV_MODE.datac3.value), ctypes.c_void_p
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
)
self.datac3_bytes_per_frame = int(
codec2.api.freedv_get_bits_per_modem_frame(self.datac3_freedv) / 8
)
self.datac3_bytes_out = ctypes.create_string_buffer(self.datac3_bytes_per_frame)
codec2.api.freedv_set_frames_per_burst(
self.datac3_freedv, self.N_FRAMES_PER_BURST
)
self.datac3_buffer = codec2.audio_buffer(2 * self.AUDIO_FRAMES_PER_BUFFER)
# SET COUNTERS
2023-04-21 15:04:09 +02:00
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
self.rx_bursts_datac1 = 0
self.rx_total_frames_datac3 = 0
self.rx_frames_datac3 = 0
self.rx_bursts_datac3 = 0
self.rx_errors = 0
self.nread_exceptions = 0
self.timeout = time.time() + self.TIMEOUT
self.receive = True
self.resampler = codec2.resampler()
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
# Copy received 48 kHz to a file. Listen to this file with:
# aplay -r 48000 -f S16_LE rx48_callback.raw
# Corruption of this file is a good way to detect audio card issues
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
self.frx = open("rx48_callback_multimode.raw", mode="wb")
# initial nin values
2023-04-21 15:04:09 +02:00
self.datac13_nin = codec2.api.freedv_nin(self.datac13_freedv)
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
self.datac1_nin = codec2.api.freedv_nin(self.datac1_freedv)
self.datac3_nin = codec2.api.freedv_nin(self.datac3_freedv)
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
def callback(self, data_in48k, frame_count, time_info, status):
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
x = np.frombuffer(data_in48k, dtype=np.int16)
x.tofile(self.frx)
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
x = self.resampler.resample48_to_8(x)
2023-04-21 15:04:09 +02:00
self.datac13_buffer.push(x)
self.datac1_buffer.push(x)
self.datac3_buffer.push(x)
return (None, pyaudio.paContinue)
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
def print_stats(self):
if self.DEBUGGING_MODE:
2023-04-21 15:04:09 +02:00
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
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
]
self.datac1_rxstatus = codec2.api.freedv_get_rx_status(self.datac1_freedv)
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
self.datac1_rxstatus = codec2.api.rx_sync_flags_to_text[
self.datac1_rxstatus
]
self.datac3_rxstatus = codec2.api.freedv_get_rx_status(self.datac3_freedv)
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
self.datac3_rxstatus = codec2.api.rx_sync_flags_to_text[
self.datac3_rxstatus
]
print(
"NIN0: %5d RX_STATUS0: %4s NIN1: %5d RX_STATUS1: %4s NIN3: %5d RX_STATUS3: %4s"
% (
2023-04-21 15:04:09 +02:00
self.datac13_nin,
self.datac13_rxstatus,
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
self.datac1_nin,
self.datac1_rxstatus,
self.datac3_nin,
self.datac3_rxstatus,
),
file=sys.stderr,
)
def run_audio(self):
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
try:
2023-02-09 13:26:25 +01:00
print("starting pyaudio callback", file=sys.stderr)
self.stream_rx.start_stream()
except Exception as e:
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
print(f"pyAudio error: {e}", file=sys.stderr)
while self.receive and time.time() < self.timeout:
2023-04-21 15:04:09 +02:00
while self.datac13_buffer.nbuffer >= self.datac13_nin:
# demodulate audio
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
nbytes = codec2.api.freedv_rawdatarx(
2023-04-21 15:04:09 +02:00
self.datac13_freedv,
self.datac13_bytes_out,
self.datac13_buffer.buffer.ctypes,
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
)
2023-04-21 15:04:09 +02:00
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_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:
# demodulate audio
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
nbytes = codec2.api.freedv_rawdatarx(
self.datac1_freedv,
self.datac1_bytes_out,
self.datac1_buffer.buffer.ctypes,
)
self.datac1_buffer.pop(self.datac1_nin)
self.datac1_nin = codec2.api.freedv_nin(self.datac1_freedv)
if nbytes == self.datac1_bytes_per_frame:
self.rx_total_frames_datac1 = self.rx_total_frames_datac1 + 1
self.rx_frames_datac1 = self.rx_frames_datac1 + 1
if self.rx_frames_datac1 == self.N_FRAMES_PER_BURST:
self.rx_frames_datac1 = 0
self.rx_bursts_datac1 = self.rx_bursts_datac1 + 1
self.print_stats()
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
while self.datac3_buffer.nbuffer >= self.datac3_nin:
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
# demodulate audio
nbytes = codec2.api.freedv_rawdatarx(
self.datac3_freedv,
self.datac3_bytes_out,
self.datac3_buffer.buffer.ctypes,
)
self.datac3_buffer.pop(self.datac3_nin)
self.datac3_nin = codec2.api.freedv_nin(self.datac3_freedv)
if nbytes == self.datac3_bytes_per_frame:
self.rx_total_frames_datac3 = self.rx_total_frames_datac3 + 1
self.rx_frames_datac3 = self.rx_frames_datac3 + 1
if self.rx_frames_datac3 == self.N_FRAMES_PER_BURST:
self.rx_frames_datac3 = 0
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
self.rx_bursts_datac3 = self.rx_bursts_datac3 + 1
self.print_stats()
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
if (
2023-04-21 15:04:09 +02:00
self.rx_bursts_datac13
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
and self.rx_bursts_datac1
and self.rx_bursts_datac3
) == self.N_BURSTS:
self.receive = False
if time.time() >= self.timeout:
print("TIMEOUT REACHED")
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
if self.nread_exceptions:
print(
"nread_exceptions %d - receive audio lost! Consider increasing Pyaudio frames_per_buffer..."
% self.nread_exceptions,
file=sys.stderr,
)
print(
2023-04-21 15:04:09 +02:00
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}",
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
file=sys.stderr,
)
self.frx.close()
# cloese pyaudio instance
self.stream_rx.close()
self.p.terminate()
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
test = Test()
Enhance tests (#185) * Initial attempt to create unit tests for DATA class (tnc). * Completed initial set of tests. * Adding pytest to install packages. * Corrects issue #173 fix I didn't look carefully enough at `helpers.check_callsign` to see that it returns a list. The first element of the list is `True`/`False`. * Making check_callsign evaluation more consistent. * Update .gitignore this is more a test commit to see if GitHub Client for MacOS is working, * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * single tnc test file moved to a single file for running tnc tests * fixed typo * Added parameters to tests. Make other minor tweaks and documentation. * Clean up two existing tests. Adapted both tests to pytest and maintained compatibility with existing ctest method. Tweaked CMakeLists.txt . * Adding pure python highsnr_stdio_P_P_multi test. Intended to replace highsnr_stdio_P_P_multi which uses POSIX shell. * Adding pure python highsnr_stdio_P_P_datac0 test. Intended to replace highsnr_stdio_P_P_datac0 which uses POSIX shell. * Parameterize recent tests. Renamed datac0 to datacx after including all data codecs in test. * Parameterize mode as well. Add ability to run tests from main directory as well as within test/. * Add list of tests and brief descriptions. * Add more native python tests conversions. * Update README with new tests. * Tweak README again. * Rename test to be findable by pytest. * Rename test for ctest. * Update correct file this time. * Minor test tweaks. * Add modem test proof-of-concept. * Adjustment to ARQ short test. * Various refactorings. Type hints, trailing backslash, range usage, etc. * Ignore unknown arguments in argparse. * Minor cleanups. * Update test/README.md. * Update test_pa to quiet pylint. * Give up trying to suppress structlog output. * Correct module comments. * Remove excess trailing spaces. * Remove excess newlines. * Various refactorings. Type hints, trailing backslash, range usage, etc. * mkfifo test prototype First partially working prototype for testing the full tnc with mkfifo named pipes. * Update test_tnc and tweak IRS/ISS. * Correct test_modem to detect failures. * Trying to be less dependent on env variables. * Add IRS/ISS tests to ctests * Pin codec2 revision to v1.0.3. * Correcting git mistake. * Pin codec2 revision to master. This should be a specific release, that implements freedv_set_tuning_range. Co-authored-by: DJ2LS <75909252+DJ2LS@users.noreply.github.com>
2022-05-22 01:04:17 +02:00
test.run_audio()