From fea03a0242129e088a3d74ed1cc29fd5531846ea Mon Sep 17 00:00:00 2001 From: lwvmobile <59371473+lwvmobile@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:55:20 -0500 Subject: [PATCH 01/10] CMake Changes, NCURSES Tweaks Remove NCurses FindCurses.cmake file, change lines in Cmakelists Tweak and Fix a few NCurses Terminal tidbits --- CMakeLists.txt | 14 +- cmake/222FindCURSES.cmake.old | 276 ++++++++++++++++ src/dsd_audio.c | 16 +- src/dsd_frame.c.bkp | 571 ++++++++++++++++++++++++++++++++++ src/dsd_frame_sync.c | 3 + src/dsd_ncurses.c | 51 +-- src/nxdn_data.c.bkp | 41 +++ src/nxdn_data.c.bkp2 | 72 +++++ src/nxdn_voice.c.bkp3 | 118 +++++++ 9 files changed, 1130 insertions(+), 32 deletions(-) create mode 100644 cmake/222FindCURSES.cmake.old create mode 100644 src/dsd_frame.c.bkp create mode 100644 src/nxdn_data.c.bkp create mode 100644 src/nxdn_data.c.bkp2 create mode 100644 src/nxdn_voice.c.bkp3 diff --git a/CMakeLists.txt b/CMakeLists.txt index 03495c9..d8ead6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,21 +15,23 @@ find_package(RTLSDR) #find_package(Curses) find_package(Curses REQUIRED) #making this required until I can fix all instances of it being called to ifdef lines find_package(PULSEAUDIO) +set(CURSES_NEED_WIDE TRUE) #not quite sure where to put this #include_directories(SYSTEM ${LIBSNDFILE_INCLUDE_DIR} ${MBE_INCLUDE_DIR} ${ITPP_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIRS} ${CURSES_INCLUDE_DIR}) #set(LIBS ${MBE_LIBRARY} ${LIBSNDFILE_LIBRARY} ${ITPP_LIBRARY} ${PULSEAUDIO_SIMPLE_LIBRARY} ${CURSES_LIBRARY}) #remove CURSES from 'required' set up top AFTER switching all commands to ifdef in dsd_main, dsd_framesync, and dsd_ncurses.c #also, figure out how to make it build for wide character support in Linux Mint etc, like this -- $(ncursesw5-config --cflags --libs) + include_directories(SYSTEM ${LIBSNDFILE_INCLUDE_DIR} ${MBE_INCLUDE_DIR} ${ITPP_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIRS} ${CURSES_INCLUDE_DIR}) set(LIBS ${MBE_LIBRARY} ${LIBSNDFILE_LIBRARY} ${ITPP_LIBRARY} ${PULSEAUDIO_SIMPLE_LIBRARY} ${CURSES_LIBRARY}) -if(Curses_FOUND) - set(CURSES_NEED_WIDE TRUE) - include_directories(SYSTEM ${CURSES_INCLUDE_PATH}) - list(APPEND LIBS ${CURSES_LIBRARY}) - add_definitions(-DUSE_CURSES) -endif(Curses_FOUND) +#if(Curses_FOUND) +# set(CURSES_NEED_WIDE TRUE) +# include_directories(SYSTEM ${CURSES_INCLUDE_PATH}) +# list(APPEND LIBS ${CURSES_LIBRARY}) +# add_definitions(-DUSE_CURSES) +#endif(Curses_FOUND) #going to disable PortAudio, works just fine with padsp in Linux, #hoping disabling this doesn't break OSX or cygwin, etc builds diff --git a/cmake/222FindCURSES.cmake.old b/cmake/222FindCURSES.cmake.old new file mode 100644 index 0000000..bfa1d6f --- /dev/null +++ b/cmake/222FindCURSES.cmake.old @@ -0,0 +1,276 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindCurses +---------- + +Find the curses or ncurses include file and library. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``CURSES_FOUND`` + True if Curses is found. +``CURSES_INCLUDE_DIRS`` + The include directories needed to use Curses. +``CURSES_LIBRARIES`` + The libraries needed to use Curses. +``CURSES_CFLAGS`` + .. versionadded:: 3.16 + + Parameters which ought be given to C/C++ compilers when using Curses. +``CURSES_HAVE_CURSES_H`` + True if curses.h is available. +``CURSES_HAVE_NCURSES_H`` + True if ncurses.h is available. +``CURSES_HAVE_NCURSES_NCURSES_H`` + True if ``ncurses/ncurses.h`` is available. +``CURSES_HAVE_NCURSES_CURSES_H`` + True if ``ncurses/curses.h`` is available. + +Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the +``find_package(Curses)`` call if NCurses functionality is required. + +.. versionadded:: 3.10 + Set ``CURSES_NEED_WIDE`` to ``TRUE`` before the + ``find_package(Curses)`` call if unicode functionality is required. + +Backward Compatibility +^^^^^^^^^^^^^^^^^^^^^^ + +The following variable are provided for backward compatibility: + +``CURSES_INCLUDE_DIR`` + Path to Curses include. Use ``CURSES_INCLUDE_DIRS`` instead. +``CURSES_LIBRARY`` + Path to Curses library. Use ``CURSES_LIBRARIES`` instead. +#]=======================================================================] + +include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + +# we don't know anything about cursesw, so only ncurses +# may be ncursesw +if(NOT CURSES_NEED_WIDE) + set(NCURSES_LIBRARY_NAME "ncurses") + set(CURSES_FORM_LIBRARY_NAME "form") +else() + set(NCURSES_LIBRARY_NAME "ncursesw") + set(CURSES_FORM_LIBRARY_NAME "formw") + # Also, if we are searching for wide curses - we are actually searching + # for ncurses, we don't know about any other unicode version. + set(CURSES_NEED_NCURSES TRUE) +endif() + +find_library(CURSES_CURSES_LIBRARY NAMES curses) + +find_library(CURSES_NCURSES_LIBRARY NAMES "${NCURSES_LIBRARY_NAME}" ) +set(CURSES_USE_NCURSES FALSE) + +if(CURSES_NCURSES_LIBRARY AND ((NOT CURSES_CURSES_LIBRARY) OR CURSES_NEED_NCURSES)) + set(CURSES_USE_NCURSES TRUE) +endif() +# http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html +# cygwin ncurses stopped providing curses.h symlinks see above +# message. Cygwin is an ncurses package, so force ncurses on +# cygwin if the curses.h is missing +if(CURSES_NCURSES_LIBRARY AND CYGWIN) + if (CURSES_NEED_WIDE) + if(NOT EXISTS /usr/include/ncursesw/curses.h) + set(CURSES_USE_NCURSES TRUE) + endif() + else() + if(NOT EXISTS /usr/include/curses.h) + set(CURSES_USE_NCURSES TRUE) + endif() + endif() +endif() + + +# Not sure the logic is correct here. +# If NCurses is required, use the function wsyncup() to check if the library +# has NCurses functionality (at least this is where it breaks on NetBSD). +# If wsyncup is in curses, use this one. +# If not, try to find ncurses and check if this has the symbol. +# Once the ncurses library is found, search the ncurses.h header first, but +# some web pages also say that even with ncurses there is not always a ncurses.h: +# http://osdir.com/ml/gnome.apps.mc.devel/2002-06/msg00029.html +# So at first try ncurses.h, if not found, try to find curses.h under the same +# prefix as the library was found, if still not found, try curses.h with the +# default search paths. +if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + cmake_push_check_state() + set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY}) + CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}" + wsyncup "" CURSES_CURSES_HAS_WSYNCUP) + + if(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP) + CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" + wsyncup "" CURSES_NCURSES_HAS_WSYNCUP) + if( CURSES_NCURSES_HAS_WSYNCUP) + set(CURSES_USE_NCURSES TRUE) + endif() + endif() + cmake_pop_check_state() + +endif() + +if(CURSES_USE_NCURSES) + get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH) + get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) + + # Use CURSES_NCURSES_INCLUDE_PATH if set, for compatibility. + if(CURSES_NCURSES_INCLUDE_PATH) + if (CURSES_NEED_WIDE) + find_path(CURSES_INCLUDE_PATH + NAMES ncursesw/ncurses.h ncursesw/curses.h ncursesw.h cursesw.h + PATHS ${CURSES_NCURSES_INCLUDE_PATH} + NO_DEFAULT_PATH + ) + else() + find_path(CURSES_INCLUDE_PATH + NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h + PATHS ${CURSES_NCURSES_INCLUDE_PATH} + NO_DEFAULT_PATH + ) + endif() + endif() + + if (CURSES_NEED_WIDE) + set(CURSES_TINFO_LIBRARY_NAME tinfow) + find_path(CURSES_INCLUDE_PATH + NAMES ncursesw/ncurses.h ncursesw/curses.h ncursesw.h cursesw.h + HINTS "${_cursesParentDir}/include" + ) + else() + set(CURSES_TINFO_LIBRARY_NAME tinfo) + find_path(CURSES_INCLUDE_PATH + NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h + HINTS "${_cursesParentDir}/include" + ) + endif() + + # Previous versions of FindCurses provided these values. + if(NOT DEFINED CURSES_LIBRARY) + set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}") + endif() + + CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" + cbreak "" CURSES_NCURSES_HAS_CBREAK) + CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" + nodelay "" CURSES_NCURSES_HAS_NODELAY) + if(NOT CURSES_NCURSES_HAS_CBREAK OR NOT CURSES_NCURSES_HAS_NODELAY) + find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" HINTS "${_cursesLibDir}") + find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" ) + + mark_as_advanced( + CURSES_EXTRA_LIBRARY + ) + endif() +else() + get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) + get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) + + #We can't find anything with CURSES_NEED_WIDE because we know + #only about ncursesw unicode curses version + if(NOT CURSES_NEED_WIDE) + find_path(CURSES_INCLUDE_PATH + NAMES curses.h + HINTS "${_cursesParentDir}/include" + ) + endif() + + # Previous versions of FindCurses provided these values. + if(NOT DEFINED CURSES_CURSES_H_PATH) + set(CURSES_CURSES_H_PATH "${CURSES_INCLUDE_PATH}") + endif() + if(NOT DEFINED CURSES_LIBRARY) + set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}") + endif() +endif() + +# Report whether each possible header name exists in the include directory. +if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H) + if(CURSES_NEED_WIDE) + if(EXISTS "${CURSES_INCLUDE_PATH}/ncursesw/ncurses.h") + set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncursesw/ncurses.h") + endif() + elseif(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h") + set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h") + endif() + if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H) + set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND") + endif() +endif() +if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H) + if(CURSES_NEED_WIDE) + if(EXISTS "${CURSES_INCLUDE_PATH}/ncursesw/curses.h") + set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncursesw/curses.h") + endif() + elseif(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/curses.h") + set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncurses/curses.h") + endif() + if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H) + set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND") + endif() +endif() +if(NOT CURSES_NEED_WIDE) + #ncursesw can't be found for this paths + if(NOT DEFINED CURSES_HAVE_NCURSES_H) + if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses.h") + set(CURSES_HAVE_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses.h") + else() + set(CURSES_HAVE_NCURSES_H "CURSES_HAVE_NCURSES_H-NOTFOUND") + endif() + endif() + if(NOT DEFINED CURSES_HAVE_CURSES_H) + if(EXISTS "${CURSES_INCLUDE_PATH}/curses.h") + set(CURSES_HAVE_CURSES_H "${CURSES_INCLUDE_PATH}/curses.h") + else() + set(CURSES_HAVE_CURSES_H "CURSES_HAVE_CURSES_H-NOTFOUND") + endif() + endif() +endif() + +find_library(CURSES_FORM_LIBRARY "${CURSES_FORM_LIBRARY_NAME}" HINTS "${_cursesLibDir}") +find_library(CURSES_FORM_LIBRARY "${CURSES_FORM_LIBRARY_NAME}" ) + +# Previous versions of FindCurses provided these values. +if(NOT DEFINED FORM_LIBRARY) + set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}") +endif() + +# Need to provide the *_LIBRARIES +set(CURSES_LIBRARIES ${CURSES_LIBRARY}) + +if(CURSES_EXTRA_LIBRARY) + set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_EXTRA_LIBRARY}) +endif() + +if(CURSES_FORM_LIBRARY) + set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY}) +endif() + +# Provide the *_INCLUDE_DIRS and *_CFLAGS results. +set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH}) +set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(NCURSES QUIET ${NCURSES_LIBRARY_NAME}) + set(CURSES_CFLAGS ${NCURSES_CFLAGS_OTHER}) +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG + CURSES_LIBRARY CURSES_INCLUDE_PATH) + +mark_as_advanced( + CURSES_INCLUDE_PATH + CURSES_CURSES_LIBRARY + CURSES_NCURSES_LIBRARY + CURSES_FORM_LIBRARY + ) diff --git a/src/dsd_audio.c b/src/dsd_audio.c index 6415813..9712f70 100644 --- a/src/dsd_audio.c +++ b/src/dsd_audio.c @@ -25,9 +25,9 @@ pa_sample_spec cc; void openPulseOutput(dsd_opts * opts) { - ss.format = PA_SAMPLE_S16NE; - ss.channels = opts->pulse_raw_out_channels; //doing tests with 2 channels at 22050 for 44100 audio default in pulse - ss.rate = opts->pulse_raw_rate_out; //48000 + //ss.format = PA_SAMPLE_S16NE; + //ss.channels = opts->pulse_raw_out_channels; //doing tests with 2 channels at 22050 for 44100 audio default in pulse + //ss.rate = opts->pulse_raw_rate_out; //48000 tt.format = PA_SAMPLE_S16NE; tt.channels = opts->pulse_digi_out_channels; //doing tests with 2 channels at 22050 for 44100 audio default in pulse @@ -37,7 +37,7 @@ void openPulseOutput(dsd_opts * opts) //ss if (opts->monitor_input_audio == 1) { - opts->pulse_raw_dev_out = pa_simple_new(NULL, "DSD FME", PA_STREAM_PLAYBACK, NULL, "Raw Audio Out", &ss, NULL, NULL, NULL); + //opts->pulse_raw_dev_out = pa_simple_new(NULL, "DSD FME", PA_STREAM_PLAYBACK, NULL, "Raw Audio Out", &ss, NULL, NULL, NULL); } //tt @@ -48,9 +48,9 @@ void openPulseOutput(dsd_opts * opts) void openPulseInput(dsd_opts * opts) { - zz.format = PA_SAMPLE_S16NE; - zz.channels = opts->pulse_raw_in_channels; - zz.rate = opts->pulse_raw_rate_in; //48000 + //zz.format = PA_SAMPLE_S16NE; + //zz.channels = opts->pulse_raw_in_channels; + //zz.rate = opts->pulse_raw_rate_in; //48000 cc.format = PA_SAMPLE_S16NE; cc.channels = opts->pulse_digi_in_channels; @@ -59,7 +59,7 @@ void openPulseInput(dsd_opts * opts) //zz if (opts->monitor_input_audio == 2) { - opts->pulse_raw_dev_in = pa_simple_new(NULL, "DSD FME", PA_STREAM_RECORD, NULL, "Raw Audio In", &zz, NULL, NULL, NULL); + //opts->pulse_raw_dev_in = pa_simple_new(NULL, "DSD FME", PA_STREAM_RECORD, NULL, "Raw Audio In", &zz, NULL, NULL, NULL); } //cc opts->pulse_digi_dev_in = pa_simple_new(NULL, "DSD FME", PA_STREAM_RECORD, NULL, "Audio In", &cc, NULL, NULL, NULL); diff --git a/src/dsd_frame.c.bkp b/src/dsd_frame.c.bkp new file mode 100644 index 0000000..e89cfa3 --- /dev/null +++ b/src/dsd_frame.c.bkp @@ -0,0 +1,571 @@ +/* + * Copyright (C) 2010 DSD Author + * GPG Key ID: 0x3F1D7FD0 (74EF 430D F7F2 0A48 FCE6 F630 FAA2 635D 3F1D 7FD0) + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "dsd.h" +#if !defined(NULL) +#define NULL 0 +#endif + +#include "p25p1_check_nid.h" + +void +printFrameInfo (dsd_opts * opts, dsd_state * state) +{ + + int level; + + level = (int) state->max / 164; + if (opts->verbose > 0) + { + fprintf (stderr,"inlvl: %2i%% ", level); + } + if (state->nac != 0) + { + fprintf (stderr,"nac: %4X ", state->nac); + } + + if (opts->verbose > 1) + { + fprintf (stderr,"src: %8i ", state->lastsrc); + } + fprintf (stderr,"tg: %5i ", state->lasttg); +} + +void +processFrame (dsd_opts * opts, dsd_state * state) +{ + + int i, j, dibit; + char duid[3]; + char nac[13]; + int level; + + char status_0; + char bch_code[63]; + int index_bch_code; + unsigned char parity; + char v; + int new_nac; + char new_duid[3]; + int check_result; + + nac[12] = 0; + duid[2] = 0; + j = 0; + + if (state->rf_mod == 1) + { + state->maxref = (int)(state->max * 0.80F); + state->minref = (int)(state->min * 0.80F); + } + else + { + state->maxref = state->max; + state->minref = state->min; + } + + if ((state->synctype == 8) || (state->synctype == 9)) //lets make this NOT do this...maybe... + { + //state->rf_mod = 2; //wrong type of modulation HERE HERE + state->nac = 0; + state->lastsrc = 0; + state->lasttg = 0; + if (opts->errorbars == 1) + { + if (opts->verbose > 0) + { + level = (int) state->max / 164; + fprintf (stderr,"inlvl: %2i%% ", level); + } + } + state->nac = 0; + if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) + { + openMbeOutFile (opts, state); + } + sprintf (state->fsubtype, " VOICE "); + processNXDNVoice (opts, state); + return; + } + else if ((state->synctype == 16) || (state->synctype == 17)) + { + //state->rf_mod = 2; + state->nac = 0; + state->lastsrc = 0; + state->lasttg = 0; + if (opts->errorbars == 1) + { + if (opts->verbose > 0) + { + level = (int) state->max / 164; + fprintf (stderr, "inlvl: %2i%% ", level); + } + } + state->nac = 0; + if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) + { + openMbeOutFile (opts, state); + } + sprintf (state->fsubtype, " DATA "); + processNXDNData (opts, state); + return; + } + else if ((state->synctype == 6) || (state->synctype == 7)) + { + state->nac = 0; + state->lastsrc = 0; + state->lasttg = 0; + if (opts->errorbars == 1) + { + if (opts->verbose > 0) + { + level = (int) state->max / 164; + fprintf (stderr,"inlvl: %2i%% ", level); + } + } + state->nac = 0; + if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) + { + openMbeOutFile (opts, state); + } + sprintf (state->fsubtype, " VOICE "); + processDSTAR (opts, state); + return; + } + else if ((state->synctype == 18) || (state->synctype == 19)) + { + state->nac = 0; + state->lastsrc = 0; + state->lasttg = 0; + if (opts->errorbars == 1) + { + if (opts->verbose > 0) + { + level = (int) state->max / 164; + fprintf (stderr,"inlvl: %2i%% ", level); + } + } + state->nac = 0; + if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) + { + openMbeOutFile (opts, state); + } + sprintf (state->fsubtype, " DATA "); + processDSTAR_HD (opts, state); + return; + } + + else if ((state->synctype >= 10) && (state->synctype <= 13)) + { + state->nac = 0; + state->lastsrc = 0; + state->lasttg = 0; + if (opts->errorbars == 1) + { + if (opts->verbose > 0) + { + level = (int) state->max / 164; + fprintf (stderr,"inlvl: %2i%% ", level); + } + } + if ((state->synctype == 11) || (state->synctype == 12)) + { + if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) + { + openMbeOutFile (opts, state); + } + sprintf (state->fsubtype, " VOICE "); + processDMRvoice (opts, state); + } + else + { + closeMbeOutFile (opts, state); + state->err_str[0] = 0; + processDMRdata (opts, state); + } + return; + } + else if ((state->synctype >= 2) && (state->synctype <= 5)) + { + state->nac = 0; + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + } + if ((state->synctype == 3) || (state->synctype == 4)) + { + if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) + { + openMbeOutFile (opts, state); + } + sprintf (state->fsubtype, " VOICE "); + processX2TDMAvoice (opts, state); + } + else + { + closeMbeOutFile (opts, state); + state->err_str[0] = 0; + processX2TDMAdata (opts, state); + } + return; + } + else if ((state->synctype == 14) || (state->synctype == 15)) + { + state->nac = 0; + state->lastsrc = 0; + state->lasttg = 0; + if (opts->errorbars == 1) + { + if (opts->verbose > 0) + { + level = (int) state->max / 164; + fprintf (stderr,"inlvl: %2i%% ", level); + } + } + if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) + { + openMbeOutFile (opts, state); + } + sprintf (state->fsubtype, " VOICE "); + processProVoice (opts, state); + return; + } + else + { + // Read the NAC, 12 bits + j = 0; + index_bch_code = 0; + for (i = 0; i < 6; i++) + { + dibit = getDibit (opts, state); + + v = 1 & (dibit >> 1); // bit 1 + nac[j] = v + '0'; + j++; + bch_code[index_bch_code] = v; + index_bch_code++; + + v = 1 & dibit; // bit 0 + nac[j] = v + '0'; + j++; + bch_code[index_bch_code] = v; + index_bch_code++; + } + state->nac = strtol (nac, NULL, 2); + + // Read the DUID, 4 bits + for (i = 0; i < 2; i++) + { + dibit = getDibit (opts, state); + duid[i] = dibit + '0'; + + bch_code[index_bch_code] = 1 & (dibit >> 1); // bit 1 + index_bch_code++; + bch_code[index_bch_code] = 1 & dibit; // bit 0 + index_bch_code++; + } + + // Read the BCH data for error correction of NAC and DUID + for (i = 0; i < 3; i++) + { + dibit = getDibit (opts, state); + + bch_code[index_bch_code] = 1 & (dibit >> 1); // bit 1 + index_bch_code++; + bch_code[index_bch_code] = 1 & dibit; // bit 0 + index_bch_code++; + } + // Intermission: read the status dibit + status_0 = getDibit (opts, state) + '0'; + // ... continue reading the BCH error correction data + for (i = 0; i < 20; i++) + { + dibit = getDibit (opts, state); + + bch_code[index_bch_code] = 1 & (dibit >> 1); // bit 1 + index_bch_code++; + bch_code[index_bch_code] = 1 & dibit; // bit 0 + index_bch_code++; + } + + // Read the parity bit + dibit = getDibit (opts, state); + bch_code[index_bch_code] = 1 & (dibit >> 1); // bit 1 + parity = (1 & dibit); // bit 0 + + // Check if the NID is correct + check_result = check_NID (bch_code, &new_nac, new_duid, parity); + if (check_result) { + if (new_nac != state->nac) { + // NAC fixed by error correction + state->nac = new_nac; + state->debug_header_errors++; + } + if (strcmp(new_duid, duid) != 0) { + // DUID fixed by error correction + //fprintf (stderr,"Fixing DUID %s -> %s\n", duid, new_duid); + duid[0] = new_duid[0]; + duid[1] = new_duid[1]; + state->debug_header_errors++; + } + } else { + // Check of NID failed and unable to recover its value + //fprintf (stderr,"NID error\n"); + duid[0] = 'E'; + duid[1] = 'E'; + state->debug_header_critical_errors++; + } + } + + if (strcmp (duid, "00") == 0) + { + // Header Data Unit + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr," HDU\n"); + } + if (opts->mbe_out_dir[0] != 0) + { + closeMbeOutFile (opts, state); + openMbeOutFile (opts, state); + } + mbe_initMbeParms (state->cur_mp, state->prev_mp, state->prev_mp_enhanced); + state->lastp25type = 2; + sprintf (state->fsubtype, " HDU "); + processHDU (opts, state); + } + else if (strcmp (duid, "11") == 0) + { + // Logical Link Data Unit 1 + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr," LDU1 "); + } + if (opts->mbe_out_dir[0] != 0) + { + if (opts->mbe_out_f == NULL) + { + openMbeOutFile (opts, state); + } + } + state->lastp25type = 1; + sprintf (state->fsubtype, " LDU1 "); + state->numtdulc = 0; + processLDU1 (opts, state); + } + else if (strcmp (duid, "22") == 0) + { + // Logical Link Data Unit 2 + if (state->lastp25type != 1) + { + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr," Ignoring LDU2 not preceeded by LDU1\n"); + } + state->lastp25type = 0; + sprintf (state->fsubtype, " "); + } + else + { + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr," LDU2 "); + } + if (opts->mbe_out_dir[0] != 0) + { + if (opts->mbe_out_f == NULL) + { + openMbeOutFile (opts, state); + } + } + state->lastp25type = 2; + sprintf (state->fsubtype, " LDU2 "); + state->numtdulc = 0; + processLDU2 (opts, state); + } + } + else if (strcmp (duid, "33") == 0) + { + // Terminator with subsequent Link Control + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr," TDULC\n"); + } + if (opts->mbe_out_dir[0] != 0) + { + closeMbeOutFile (opts, state); + } + mbe_initMbeParms (state->cur_mp, state->prev_mp, state->prev_mp_enhanced); + state->lasttg = 0; + state->lastsrc = 0; + state->lastp25type = 0; + state->err_str[0] = 0; + sprintf (state->fsubtype, " TDULC "); + state->numtdulc++; + if ((opts->resume > 0) && (state->numtdulc > opts->resume)) + { + resumeScan (opts, state); + } + processTDULC (opts, state); + state->err_str[0] = 0; + } + else if (strcmp (duid, "03") == 0) + { + // Terminator without subsequent Link Control + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr," TDU\n"); + } + if (opts->mbe_out_dir[0] != 0) + { + closeMbeOutFile (opts, state); + } + mbe_initMbeParms (state->cur_mp, state->prev_mp, state->prev_mp_enhanced); + state->lasttg = 0; + state->lastsrc = 0; + state->lastp25type = 0; + state->err_str[0] = 0; + sprintf (state->fsubtype, " TDU "); + + processTDU (opts, state); + } + else if (strcmp (duid, "13") == 0) + { + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr," TSDU\n"); + } + if (opts->resume > 0) + { + resumeScan (opts, state); + } + state->lasttg = 0; + state->lastsrc = 0; + state->lastp25type = 3; + sprintf (state->fsubtype, " TSDU "); + + // Now processing NID + + skipDibit (opts, state, 328-25); + } + else if (strcmp (duid, "30") == 0) + { + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr," PDU\n"); + } + if (opts->resume > 0) + { + resumeScan (opts, state); + } + if (opts->mbe_out_dir[0] != 0) + { + if (opts->mbe_out_f == NULL) + { + openMbeOutFile (opts, state); + } + } + state->lastp25type = 4; + sprintf (state->fsubtype, " PDU "); + } + // try to guess based on previous frame if unknown type + else if (state->lastp25type == 1) + { + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr,"(LDU2) "); + } + if (opts->mbe_out_dir[0] != 0) + { + if (opts->mbe_out_f == NULL) + { + openMbeOutFile (opts, state); + } + } + //state->lastp25type = 0; + // Guess that the state is LDU2 + state->lastp25type = 2; + sprintf (state->fsubtype, "(LDU2) "); + state->numtdulc = 0; + processLDU2 (opts, state); + } + else if (state->lastp25type == 2) + { + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr,"(LDU1) "); + } + if (opts->mbe_out_dir[0] != 0) + { + if (opts->mbe_out_f == NULL) + { + openMbeOutFile (opts, state); + } + } + //state->lastp25type = 0; + // Guess that the state is LDU1 + state->lastp25type = 1; + sprintf (state->fsubtype, "(LDU1) "); + state->numtdulc = 0; + processLDU1 (opts, state); + } + else if (state->lastp25type == 3) + { + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr," (TSDU)\n"); + } + //state->lastp25type = 0; + // Guess that the state is TSDU + state->lastp25type = 3; + sprintf (state->fsubtype, "(TSDU) "); + + // Now processing NID + + skipDibit (opts, state, 328-25); + } + else if (state->lastp25type == 4) + { + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr," (PDU)\n"); + } + state->lastp25type = 0; + } + else + { + state->lastp25type = 0; + sprintf (state->fsubtype, " "); + if (opts->errorbars == 1) + { + printFrameInfo (opts, state); + fprintf (stderr," duid:%s *Unknown DUID*\n", duid); + } + } +} diff --git a/src/dsd_frame_sync.c b/src/dsd_frame_sync.c index 3b37932..e2a7417 100644 --- a/src/dsd_frame_sync.c +++ b/src/dsd_frame_sync.c @@ -189,10 +189,13 @@ getFrameSync (dsd_opts * opts, dsd_state * state) { ncursesPrinter(opts, state); } + /* if ( opts->monitor_input_audio == 1 && (time(NULL) - now) > 1 ) //okay, still something going on, still doing the read part for some reason { playRawAudio(opts, state); //this is on line 21 in dsd_audio.c } + */ + /* if (opts->reset_state == 1 && state->carrier == 0) { diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index bf3bad1..0175364 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -90,8 +90,8 @@ char * SyncTypes[20] = { "+NXDN VOICE", //8 "-NXDN VOICE", //9 "+DMR DATA", //10 - "-DMR VOICE", //11 - "+DMR DATA", //12 + "-DMR DATA", //11 + "+DMR VOICE", //12 "-DMR VOICE", //13 "+PROVOICE", //14 "-PROVOICE", //15 @@ -121,7 +121,7 @@ char * getTimeN(void) //get pretty hh:mm:ss timestamp void ncursesOpen () { mbe_printVersion (versionstr); - //setlocale(LC_ALL, ""); + setlocale(LC_ALL, ""); initscr(); //Initialize NCURSES screen window start_color(); init_pair(1, COLOR_YELLOW, COLOR_BLACK); //Yellow/Amber for frame sync/control channel, NV style @@ -146,16 +146,17 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) //disabling until wide support can be built for LM, etc. $(ncursesw5-config --cflags --libs) //printw ("%s \n", FM_bannerN[0]); //top line in white attron(COLOR_PAIR(4)); - //for (short int i = 1; i < 7; i++) //following lines in cyan - //{ - //printw("%s \n", FM_bannerN[i]); - //} + for (short int i = 1; i < 7; i++) //following lines in cyan + { + printw("%s \n", FM_bannerN[i]); + } attroff(COLOR_PAIR(4)); printw ("--Build Info------------------------------------------------------------------\n"); - //printw ("| %s \n", FM_bannerN[7]); //http link + printw ("| %s \n", FM_bannerN[7]); //http link printw ("| Digital Speech Decoder: Florida Man Edition\n"); printw ("| Github Build Version: %s \n", GIT_TAG); printw ("| mbelib version %s\n", versionstr); + printw ("| Press CTRL+C twice to exit\n"); printw ("------------------------------------------------------------------------------\n"); @@ -203,7 +204,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) } //if (state->dmr_color_code != dcc && (lls == 11 || lls == 13 || lls == 10 || lls == 12) ) //DMR Voice + last two is data - if ( (call_matrix[9][4] != dcc || call_matrix[9][2] != rd) && (lls == 11 || lls == 13 || lls == 10 || lls == 12) ) //DMR Voice + last two is data + //if ( (call_matrix[9][4] != dcc || call_matrix[9][2] != rd) && (lls == 10 || lls == 11 || lls == 12 || lls == 13) ) //DMR + if ( (call_matrix[9][4] != dcc || call_matrix[9][2] != rd) && (lls == 12 || lls == 13) ) //DMR { //dcc = state->dmr_color_code; for (short int k = 0; k < 9; k++) @@ -317,6 +319,22 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) //src = state->nxdn_last_rid; rn = state->nxdn_last_ran; } + + if (state->dmr_color_code > 0 && (lls == 10 || lls == 11 || lls == 12 || lls == 13) ) //DMR, DCC only carried on Data? + { + dcc = state->dmr_color_code; + } + + if (state->lastsrc > 0 && (lls == 12 || lls == 13)) + { + rd = state->lastsrc; + } + + if (state->lasttg > 0 && (lls == 12 || lls == 13)) + { + tg = state->lasttg; + } + //if (state->lastsynctype == 8 || state->lastsynctype == 9 || state->lastsynctype == 16 || state->lastsynctype == 17) //change this to NXDN syncs later on if (lls == 8 || lls == 9 || lls == 16 || lls == 17) { @@ -342,9 +360,9 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) printw("| NAC: [0x%X] \n", nc); } //if (state->lastsynctype == 12 || state->lastsynctype == 13) //DMR Voice Types - if (lls == 11 || lls == 13) //DMR Voice Types + if (lls == 12 || lls == 13) //DMR Voice Types { - printw ("| DCC: [%i]\n", state->dmr_color_code); + printw ("| DCC: [%i]\n", dcc); //printw ("%s ", state->slot0light); printw ("| SLOT 0 "); if (state->currentslot == 0) //find out how to tell when slot0 has voice @@ -364,10 +382,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) printw ("%s \n", s1last); } - if (state->dmr_color_code > 0 && (lls == 11 || lls == 13 || lls == 10 || lls == 12) ) //DMR Voice + last two is data - { - dcc = state->dmr_color_code; - } + //if (state->lastsynctype == 10 || state->lastsynctype == 11) //DMR Data Types if (lls == 10 || lls == 11) //DMR Data Types { @@ -424,7 +439,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) { printw ("RAN [%2d] ", call_matrix[9-j][1]); } - if (lls == 0 || lls == 1 || lls == 11 || lls == 13) //P25 P1 and DMR Voice + if (lls == 0 || lls == 1 || lls == 12 || lls == 13 || lls == 10 || lls == 11 ) //P25 P1 and DMR { printw ("TID [%2d] ", call_matrix[9-j][1]); } @@ -479,6 +494,6 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) void ncursesClose () { endwin(); - fprintf(stderr, "Press CTRL+C again to close. Thanks."); - fprintf(stderr, "Run 'reset' in your terminal to clean up if necessary."); + printf("Press CTRL+C again to close. Thanks.\n"); + printf("Run 'reset' in your terminal to clean up if necessary."); } diff --git a/src/nxdn_data.c.bkp b/src/nxdn_data.c.bkp new file mode 100644 index 0000000..5e212bd --- /dev/null +++ b/src/nxdn_data.c.bkp @@ -0,0 +1,41 @@ +#include "dsd.h" +#include "nxdn_const.h"//going to test pushing data frames through, but not throught he processMBE portion, want to get those get frames + +void +processNXDNData (dsd_opts * opts, dsd_state * state) +{ + int i, dibit; + //dibit = getDibit (opts, state); + //fprintf (stderr, "D %c \n", dibit + 48); //adding to see what dumps exactly + if (opts->errorbars == 1) + { + fprintf (stderr, "DATA "); + //dibit = getDibit (opts, state); + //fprintf (stderr, "DE %c \n", dibit + 48); //adding to see what dumps exactly + } + + for (i = 0; i < 30; i++) + { + dibit = getDibit (opts, state); +#ifdef NXDN_DUMP + fprintf (stderr, "%c", dibit + 48); +#endif + } +#ifdef NXDN_DUMP + fprintf (stderr, " "); +#endif + + for (i = 0; i < 144; i++) + { + dibit = getDibit (opts, state); + //fprintf (stderr, "%c", dibit + 48); +#ifdef NXDN_DUMP + fprintf (stderr, "%c", dibit + 48); +#endif + } + + if (opts->errorbars == 1) + { + fprintf (stderr, "\n"); + } +} diff --git a/src/nxdn_data.c.bkp2 b/src/nxdn_data.c.bkp2 new file mode 100644 index 0000000..fe3cddf --- /dev/null +++ b/src/nxdn_data.c.bkp2 @@ -0,0 +1,72 @@ +#include "dsd.h" +#include "nxdn_const.h" //test making this just like voice, but not processing MBEframes + +void +processNXDNData (dsd_opts * opts, dsd_state * state) +{ + int i, j, dibit, k, l; + char ambe_fr2[4][24]; + const int *w, *x, *y, *z; + const char *pr; + + if (opts->errorbars == 1) + { + fprintf (stderr,"DATA e:"); + } + + for (i = 0; i < 30; i++) + { + dibit = getDibit (opts, state); +#ifdef NXDN_DUMP + fprintf (stderr,"%c", dibit + 48); +#endif + } +#ifdef NXDN_DUMP + fprintf (stderr," "); +#endif + + pr = nxdnpr; + for (j = 0; j < 4; j++) + { + w = nW; + x = nX; + y = nY; + z = nZ; + for (i = 0; i < 36; i++) + { + dibit = getDibit (opts, state); + //fprintf (stderr,"%c", dibit + 48); //remove later +#ifdef NXDN_DUMP + fprintf (stderr,"%c", dibit + 48); +#endif + ambe_fr2[*w][*x] = *pr ^ (1 & (dibit >> 1)); // bit 1 + pr++; + ambe_fr2[*y][*z] = (1 & dibit); // bit 0 + w++; + x++; + y++; + z++; + //dump this whole lot, figure out what it all means + //fprintf (stderr, "%s\n%s\n", ambe_fr, pr); + } + for (k = 0; k < 36; k++) //was 36 + { + for (l = 0; l < 36; l++) //was 36 + { + //fprintf (stderr, "%X%X", ambe_fr[k][l]); + //fprintf (stderr, "%X", ambe_fr2[k][l]); + } + //fprintf (stderr, "\n"); + } + //processMbeFrame (opts, state, NULL, ambe_fr, NULL); +#ifdef NXDN_DUMP + fprintf (stderr," "); +#endif + + } + //fprintf (stderr, "\nD%s\n%s\n", ambe_fr, pr); + if (opts->errorbars == 1) + { + fprintf (stderr,"\n"); + } +} diff --git a/src/nxdn_voice.c.bkp3 b/src/nxdn_voice.c.bkp3 new file mode 100644 index 0000000..3c79ef4 --- /dev/null +++ b/src/nxdn_voice.c.bkp3 @@ -0,0 +1,118 @@ +#include "dsd.h" +#include "nxdn_const.h" + +void +processNXDNVoice (dsd_opts * opts, dsd_state * state) +{ + int i, j, dibit, k, l; + char ambe_fr[4][24]; + const int *w, *x, *y, *z; + const char *pr; + //borrow from LEH data + unsigned char sacch_raw[72] = {0}; + unsigned char sacch_decoded[32] = {0}; /* 26 bit + 6 bit CRC */ + unsigned char *pr2; //change this to pr2 to differentiate + uint8_t CrcIsGood = 0; + uint8_t StructureField = 0; + uint8_t RAN = 0; + uint8_t PartOfFrame = 0; + + if (opts->errorbars == 1) + { + fprintf (stderr,"VOICE e:"); + } + + for (i = 0; i < 30; i++) + { + dibit = getDibit (opts, state); +#ifdef NXDN_DUMP + fprintf (stderr,"%c", dibit + 48); +#endif + } +#ifdef NXDN_DUMP + fprintf (stderr," "); +#endif + + pr = nxdnpr; + pr2 = (unsigned char *)(&nxdnpr2[8]); //from LEH data + + for (j = 0; j < 4; j++) + { + w = nW; + x = nX; + y = nY; + z = nZ; + for (i = 0; i < 36; i++) + { + dibit = getDibit (opts, state); + //fprintf (stderr,"%c", dibit + 48); //remove later + if (i < 30){ + sacch_raw[(2*i)] = ((*pr2) & 1) ^ (1 & (dibit >> 1)); // bit 1 + sacch_raw[(2*i)+1] = (1 & dibit); // bit 0 + } + +#ifdef NXDN_DUMP + fprintf (stderr,"%c", dibit + 48); +#endif + ambe_fr[*w][*x] = *pr ^ (1 & (dibit >> 1)); // bit 1 + pr++; + ambe_fr[*y][*z] = (1 & dibit); // bit 0 + w++; + x++; + y++; + z++; + } + processMbeFrame (opts, state, NULL, ambe_fr, NULL); + //from LEH data + /* Decode the SACCH fields */ + CrcIsGood = NXDN_SACCH_raw_part_decode(sacch_raw, sacch_decoded); + StructureField = (sacch_decoded[0]<<1 | sacch_decoded[1]<<0) & 0x03; /* Compute the Structure Field (remove 2 first bits of the SR Information in the SACCH) */ + RAN = (sacch_decoded[2]<<5 | sacch_decoded[3]<<4 | sacch_decoded[4]<<3 | sacch_decoded[5]<<2 | sacch_decoded[6]<<1 | sacch_decoded[7]<<0) & 0x3F; /* Compute the RAN (6 last bits of the SR Information in the SACCH) */ + + /* Compute the Part of Frame according to the structure field */ + if (StructureField == 3) PartOfFrame = 0; + else if(StructureField == 2) PartOfFrame = 1; + else if(StructureField == 1) PartOfFrame = 2; + else if(StructureField == 0) PartOfFrame = 3; + else PartOfFrame = 0; /* Normally we should never go here */ + + /* Fill the SACCH structure */ + state->NxdnSacchRawPart[PartOfFrame].CrcIsGood = CrcIsGood; + state->NxdnSacchRawPart[PartOfFrame].StructureField = StructureField; + state->NxdnSacchRawPart[PartOfFrame].RAN = RAN; + + memcpy(state->NxdnSacchRawPart[PartOfFrame].Data, &sacch_decoded[8], 18); /* Copy the 18 bits of SACCH content */ + + //fprintf(stderr, "RAN=%02d - Part %d/4 ", RAN, PartOfFrame + 1); + if(CrcIsGood) + { + //fprintf (stderr, "RAN=%02d - Part %d/4 ", RAN, PartOfFrame + 1); + //fprintf (stderr, " (OK) - "); + state->nxdn_last_ran = RAN; //disable, try to grab this in voice instead + } + + else fprintf (stderr, "(CRC ERR) - "); + + if(PartOfFrame == 3) + { + /* Decode the entire SACCH content */ + NXDN_SACCH_Full_decode(opts, state); + } + + /* Reset the SACCH CRCs when all 4 voice frame + * SACCH spare parts have been received */ + if(PartOfFrame == 3) + { + /* Reset all CRCs of the SACCH */ + for(i = 0; i < 4; i++) state->NxdnSacchRawPart[i].CrcIsGood = 0; + } +#ifdef NXDN_DUMP + fprintf (stderr," "); +#endif + } + //fprintf (stderr, "\nV%c\n%c\n", ambe_fr, pr); + if (opts->errorbars == 1) + { + fprintf (stderr,"\n"); + } +} From d1903b1574a1afbfc323ebea6792db4603ff29f3 Mon Sep 17 00:00:00 2001 From: lwvmobile <59371473+lwvmobile@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:56:48 -0500 Subject: [PATCH 02/10] Delete FindCURSES.cmake --- cmake/FindCURSES.cmake | 276 ----------------------------------------- 1 file changed, 276 deletions(-) delete mode 100644 cmake/FindCURSES.cmake diff --git a/cmake/FindCURSES.cmake b/cmake/FindCURSES.cmake deleted file mode 100644 index bfa1d6f..0000000 --- a/cmake/FindCURSES.cmake +++ /dev/null @@ -1,276 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindCurses ----------- - -Find the curses or ncurses include file and library. - -Result Variables -^^^^^^^^^^^^^^^^ - -This module defines the following variables: - -``CURSES_FOUND`` - True if Curses is found. -``CURSES_INCLUDE_DIRS`` - The include directories needed to use Curses. -``CURSES_LIBRARIES`` - The libraries needed to use Curses. -``CURSES_CFLAGS`` - .. versionadded:: 3.16 - - Parameters which ought be given to C/C++ compilers when using Curses. -``CURSES_HAVE_CURSES_H`` - True if curses.h is available. -``CURSES_HAVE_NCURSES_H`` - True if ncurses.h is available. -``CURSES_HAVE_NCURSES_NCURSES_H`` - True if ``ncurses/ncurses.h`` is available. -``CURSES_HAVE_NCURSES_CURSES_H`` - True if ``ncurses/curses.h`` is available. - -Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the -``find_package(Curses)`` call if NCurses functionality is required. - -.. versionadded:: 3.10 - Set ``CURSES_NEED_WIDE`` to ``TRUE`` before the - ``find_package(Curses)`` call if unicode functionality is required. - -Backward Compatibility -^^^^^^^^^^^^^^^^^^^^^^ - -The following variable are provided for backward compatibility: - -``CURSES_INCLUDE_DIR`` - Path to Curses include. Use ``CURSES_INCLUDE_DIRS`` instead. -``CURSES_LIBRARY`` - Path to Curses library. Use ``CURSES_LIBRARIES`` instead. -#]=======================================================================] - -include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) - -# we don't know anything about cursesw, so only ncurses -# may be ncursesw -if(NOT CURSES_NEED_WIDE) - set(NCURSES_LIBRARY_NAME "ncurses") - set(CURSES_FORM_LIBRARY_NAME "form") -else() - set(NCURSES_LIBRARY_NAME "ncursesw") - set(CURSES_FORM_LIBRARY_NAME "formw") - # Also, if we are searching for wide curses - we are actually searching - # for ncurses, we don't know about any other unicode version. - set(CURSES_NEED_NCURSES TRUE) -endif() - -find_library(CURSES_CURSES_LIBRARY NAMES curses) - -find_library(CURSES_NCURSES_LIBRARY NAMES "${NCURSES_LIBRARY_NAME}" ) -set(CURSES_USE_NCURSES FALSE) - -if(CURSES_NCURSES_LIBRARY AND ((NOT CURSES_CURSES_LIBRARY) OR CURSES_NEED_NCURSES)) - set(CURSES_USE_NCURSES TRUE) -endif() -# http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html -# cygwin ncurses stopped providing curses.h symlinks see above -# message. Cygwin is an ncurses package, so force ncurses on -# cygwin if the curses.h is missing -if(CURSES_NCURSES_LIBRARY AND CYGWIN) - if (CURSES_NEED_WIDE) - if(NOT EXISTS /usr/include/ncursesw/curses.h) - set(CURSES_USE_NCURSES TRUE) - endif() - else() - if(NOT EXISTS /usr/include/curses.h) - set(CURSES_USE_NCURSES TRUE) - endif() - endif() -endif() - - -# Not sure the logic is correct here. -# If NCurses is required, use the function wsyncup() to check if the library -# has NCurses functionality (at least this is where it breaks on NetBSD). -# If wsyncup is in curses, use this one. -# If not, try to find ncurses and check if this has the symbol. -# Once the ncurses library is found, search the ncurses.h header first, but -# some web pages also say that even with ncurses there is not always a ncurses.h: -# http://osdir.com/ml/gnome.apps.mc.devel/2002-06/msg00029.html -# So at first try ncurses.h, if not found, try to find curses.h under the same -# prefix as the library was found, if still not found, try curses.h with the -# default search paths. -if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) - include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) - cmake_push_check_state() - set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY}) - CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}" - wsyncup "" CURSES_CURSES_HAS_WSYNCUP) - - if(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP) - CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" - wsyncup "" CURSES_NCURSES_HAS_WSYNCUP) - if( CURSES_NCURSES_HAS_WSYNCUP) - set(CURSES_USE_NCURSES TRUE) - endif() - endif() - cmake_pop_check_state() - -endif() - -if(CURSES_USE_NCURSES) - get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH) - get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - - # Use CURSES_NCURSES_INCLUDE_PATH if set, for compatibility. - if(CURSES_NCURSES_INCLUDE_PATH) - if (CURSES_NEED_WIDE) - find_path(CURSES_INCLUDE_PATH - NAMES ncursesw/ncurses.h ncursesw/curses.h ncursesw.h cursesw.h - PATHS ${CURSES_NCURSES_INCLUDE_PATH} - NO_DEFAULT_PATH - ) - else() - find_path(CURSES_INCLUDE_PATH - NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h - PATHS ${CURSES_NCURSES_INCLUDE_PATH} - NO_DEFAULT_PATH - ) - endif() - endif() - - if (CURSES_NEED_WIDE) - set(CURSES_TINFO_LIBRARY_NAME tinfow) - find_path(CURSES_INCLUDE_PATH - NAMES ncursesw/ncurses.h ncursesw/curses.h ncursesw.h cursesw.h - HINTS "${_cursesParentDir}/include" - ) - else() - set(CURSES_TINFO_LIBRARY_NAME tinfo) - find_path(CURSES_INCLUDE_PATH - NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h - HINTS "${_cursesParentDir}/include" - ) - endif() - - # Previous versions of FindCurses provided these values. - if(NOT DEFINED CURSES_LIBRARY) - set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}") - endif() - - CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" - cbreak "" CURSES_NCURSES_HAS_CBREAK) - CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" - nodelay "" CURSES_NCURSES_HAS_NODELAY) - if(NOT CURSES_NCURSES_HAS_CBREAK OR NOT CURSES_NCURSES_HAS_NODELAY) - find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" HINTS "${_cursesLibDir}") - find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" ) - - mark_as_advanced( - CURSES_EXTRA_LIBRARY - ) - endif() -else() - get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) - get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - - #We can't find anything with CURSES_NEED_WIDE because we know - #only about ncursesw unicode curses version - if(NOT CURSES_NEED_WIDE) - find_path(CURSES_INCLUDE_PATH - NAMES curses.h - HINTS "${_cursesParentDir}/include" - ) - endif() - - # Previous versions of FindCurses provided these values. - if(NOT DEFINED CURSES_CURSES_H_PATH) - set(CURSES_CURSES_H_PATH "${CURSES_INCLUDE_PATH}") - endif() - if(NOT DEFINED CURSES_LIBRARY) - set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}") - endif() -endif() - -# Report whether each possible header name exists in the include directory. -if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H) - if(CURSES_NEED_WIDE) - if(EXISTS "${CURSES_INCLUDE_PATH}/ncursesw/ncurses.h") - set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncursesw/ncurses.h") - endif() - elseif(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h") - set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h") - endif() - if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H) - set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND") - endif() -endif() -if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H) - if(CURSES_NEED_WIDE) - if(EXISTS "${CURSES_INCLUDE_PATH}/ncursesw/curses.h") - set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncursesw/curses.h") - endif() - elseif(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/curses.h") - set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncurses/curses.h") - endif() - if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H) - set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND") - endif() -endif() -if(NOT CURSES_NEED_WIDE) - #ncursesw can't be found for this paths - if(NOT DEFINED CURSES_HAVE_NCURSES_H) - if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses.h") - set(CURSES_HAVE_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses.h") - else() - set(CURSES_HAVE_NCURSES_H "CURSES_HAVE_NCURSES_H-NOTFOUND") - endif() - endif() - if(NOT DEFINED CURSES_HAVE_CURSES_H) - if(EXISTS "${CURSES_INCLUDE_PATH}/curses.h") - set(CURSES_HAVE_CURSES_H "${CURSES_INCLUDE_PATH}/curses.h") - else() - set(CURSES_HAVE_CURSES_H "CURSES_HAVE_CURSES_H-NOTFOUND") - endif() - endif() -endif() - -find_library(CURSES_FORM_LIBRARY "${CURSES_FORM_LIBRARY_NAME}" HINTS "${_cursesLibDir}") -find_library(CURSES_FORM_LIBRARY "${CURSES_FORM_LIBRARY_NAME}" ) - -# Previous versions of FindCurses provided these values. -if(NOT DEFINED FORM_LIBRARY) - set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}") -endif() - -# Need to provide the *_LIBRARIES -set(CURSES_LIBRARIES ${CURSES_LIBRARY}) - -if(CURSES_EXTRA_LIBRARY) - set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_EXTRA_LIBRARY}) -endif() - -if(CURSES_FORM_LIBRARY) - set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY}) -endif() - -# Provide the *_INCLUDE_DIRS and *_CFLAGS results. -set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH}) -set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility - -find_package(PkgConfig QUIET) -if(PKG_CONFIG_FOUND) - pkg_check_modules(NCURSES QUIET ${NCURSES_LIBRARY_NAME}) - set(CURSES_CFLAGS ${NCURSES_CFLAGS_OTHER}) -endif() - -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG - CURSES_LIBRARY CURSES_INCLUDE_PATH) - -mark_as_advanced( - CURSES_INCLUDE_PATH - CURSES_CURSES_LIBRARY - CURSES_NCURSES_LIBRARY - CURSES_FORM_LIBRARY - ) From 36fbbfd4d7f2695053cba91808c7e17c3d479c1d Mon Sep 17 00:00:00 2001 From: lwvmobile <59371473+lwvmobile@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:56:57 -0500 Subject: [PATCH 03/10] Delete FindCURSES.cmake.bkp --- cmake/FindCURSES.cmake.bkp | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 cmake/FindCURSES.cmake.bkp diff --git a/cmake/FindCURSES.cmake.bkp b/cmake/FindCURSES.cmake.bkp deleted file mode 100644 index 29818ba..0000000 --- a/cmake/FindCURSES.cmake.bkp +++ /dev/null @@ -1,16 +0,0 @@ -# - Try to find NCURSES -# Once done this will define -# -# ITPP_FOUND - System has ITPP -# ITPP_INCLUDE_DIR - The ITPP include directory -# ITPP_LIBRARY - The library needed to use ITPP -# -set(CURSES_LIBRARY "/opt/lib/libncurses.so") -set(CURSES_INCLUDE_PATH "/opt/include") -find_path(CURSES_INCLUDE_DIR /usr/ncurses.h) - -set(CURSES_NAMES ${CURSES_NAMES} curses.h curses curses5w curses6w curses6 curses5 libncursesw) -FIND_LIBRARY(CURSES_LIBRARY NAMES ${CURSES_NAMES}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(CURSES DEFAULT_MSG NCURSES_LIBRARY CURSES_INCLUDE_DIR) From 178b76f0929f9c7663c6f21f97d978981787af9c Mon Sep 17 00:00:00 2001 From: lwvmobile <59371473+lwvmobile@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:57:04 -0500 Subject: [PATCH 04/10] Delete 222FindCURSES.cmake.old --- cmake/222FindCURSES.cmake.old | 276 ---------------------------------- 1 file changed, 276 deletions(-) delete mode 100644 cmake/222FindCURSES.cmake.old diff --git a/cmake/222FindCURSES.cmake.old b/cmake/222FindCURSES.cmake.old deleted file mode 100644 index bfa1d6f..0000000 --- a/cmake/222FindCURSES.cmake.old +++ /dev/null @@ -1,276 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindCurses ----------- - -Find the curses or ncurses include file and library. - -Result Variables -^^^^^^^^^^^^^^^^ - -This module defines the following variables: - -``CURSES_FOUND`` - True if Curses is found. -``CURSES_INCLUDE_DIRS`` - The include directories needed to use Curses. -``CURSES_LIBRARIES`` - The libraries needed to use Curses. -``CURSES_CFLAGS`` - .. versionadded:: 3.16 - - Parameters which ought be given to C/C++ compilers when using Curses. -``CURSES_HAVE_CURSES_H`` - True if curses.h is available. -``CURSES_HAVE_NCURSES_H`` - True if ncurses.h is available. -``CURSES_HAVE_NCURSES_NCURSES_H`` - True if ``ncurses/ncurses.h`` is available. -``CURSES_HAVE_NCURSES_CURSES_H`` - True if ``ncurses/curses.h`` is available. - -Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the -``find_package(Curses)`` call if NCurses functionality is required. - -.. versionadded:: 3.10 - Set ``CURSES_NEED_WIDE`` to ``TRUE`` before the - ``find_package(Curses)`` call if unicode functionality is required. - -Backward Compatibility -^^^^^^^^^^^^^^^^^^^^^^ - -The following variable are provided for backward compatibility: - -``CURSES_INCLUDE_DIR`` - Path to Curses include. Use ``CURSES_INCLUDE_DIRS`` instead. -``CURSES_LIBRARY`` - Path to Curses library. Use ``CURSES_LIBRARIES`` instead. -#]=======================================================================] - -include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) - -# we don't know anything about cursesw, so only ncurses -# may be ncursesw -if(NOT CURSES_NEED_WIDE) - set(NCURSES_LIBRARY_NAME "ncurses") - set(CURSES_FORM_LIBRARY_NAME "form") -else() - set(NCURSES_LIBRARY_NAME "ncursesw") - set(CURSES_FORM_LIBRARY_NAME "formw") - # Also, if we are searching for wide curses - we are actually searching - # for ncurses, we don't know about any other unicode version. - set(CURSES_NEED_NCURSES TRUE) -endif() - -find_library(CURSES_CURSES_LIBRARY NAMES curses) - -find_library(CURSES_NCURSES_LIBRARY NAMES "${NCURSES_LIBRARY_NAME}" ) -set(CURSES_USE_NCURSES FALSE) - -if(CURSES_NCURSES_LIBRARY AND ((NOT CURSES_CURSES_LIBRARY) OR CURSES_NEED_NCURSES)) - set(CURSES_USE_NCURSES TRUE) -endif() -# http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html -# cygwin ncurses stopped providing curses.h symlinks see above -# message. Cygwin is an ncurses package, so force ncurses on -# cygwin if the curses.h is missing -if(CURSES_NCURSES_LIBRARY AND CYGWIN) - if (CURSES_NEED_WIDE) - if(NOT EXISTS /usr/include/ncursesw/curses.h) - set(CURSES_USE_NCURSES TRUE) - endif() - else() - if(NOT EXISTS /usr/include/curses.h) - set(CURSES_USE_NCURSES TRUE) - endif() - endif() -endif() - - -# Not sure the logic is correct here. -# If NCurses is required, use the function wsyncup() to check if the library -# has NCurses functionality (at least this is where it breaks on NetBSD). -# If wsyncup is in curses, use this one. -# If not, try to find ncurses and check if this has the symbol. -# Once the ncurses library is found, search the ncurses.h header first, but -# some web pages also say that even with ncurses there is not always a ncurses.h: -# http://osdir.com/ml/gnome.apps.mc.devel/2002-06/msg00029.html -# So at first try ncurses.h, if not found, try to find curses.h under the same -# prefix as the library was found, if still not found, try curses.h with the -# default search paths. -if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) - include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) - cmake_push_check_state() - set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY}) - CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}" - wsyncup "" CURSES_CURSES_HAS_WSYNCUP) - - if(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP) - CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" - wsyncup "" CURSES_NCURSES_HAS_WSYNCUP) - if( CURSES_NCURSES_HAS_WSYNCUP) - set(CURSES_USE_NCURSES TRUE) - endif() - endif() - cmake_pop_check_state() - -endif() - -if(CURSES_USE_NCURSES) - get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH) - get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - - # Use CURSES_NCURSES_INCLUDE_PATH if set, for compatibility. - if(CURSES_NCURSES_INCLUDE_PATH) - if (CURSES_NEED_WIDE) - find_path(CURSES_INCLUDE_PATH - NAMES ncursesw/ncurses.h ncursesw/curses.h ncursesw.h cursesw.h - PATHS ${CURSES_NCURSES_INCLUDE_PATH} - NO_DEFAULT_PATH - ) - else() - find_path(CURSES_INCLUDE_PATH - NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h - PATHS ${CURSES_NCURSES_INCLUDE_PATH} - NO_DEFAULT_PATH - ) - endif() - endif() - - if (CURSES_NEED_WIDE) - set(CURSES_TINFO_LIBRARY_NAME tinfow) - find_path(CURSES_INCLUDE_PATH - NAMES ncursesw/ncurses.h ncursesw/curses.h ncursesw.h cursesw.h - HINTS "${_cursesParentDir}/include" - ) - else() - set(CURSES_TINFO_LIBRARY_NAME tinfo) - find_path(CURSES_INCLUDE_PATH - NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h - HINTS "${_cursesParentDir}/include" - ) - endif() - - # Previous versions of FindCurses provided these values. - if(NOT DEFINED CURSES_LIBRARY) - set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}") - endif() - - CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" - cbreak "" CURSES_NCURSES_HAS_CBREAK) - CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" - nodelay "" CURSES_NCURSES_HAS_NODELAY) - if(NOT CURSES_NCURSES_HAS_CBREAK OR NOT CURSES_NCURSES_HAS_NODELAY) - find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" HINTS "${_cursesLibDir}") - find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" ) - - mark_as_advanced( - CURSES_EXTRA_LIBRARY - ) - endif() -else() - get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) - get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - - #We can't find anything with CURSES_NEED_WIDE because we know - #only about ncursesw unicode curses version - if(NOT CURSES_NEED_WIDE) - find_path(CURSES_INCLUDE_PATH - NAMES curses.h - HINTS "${_cursesParentDir}/include" - ) - endif() - - # Previous versions of FindCurses provided these values. - if(NOT DEFINED CURSES_CURSES_H_PATH) - set(CURSES_CURSES_H_PATH "${CURSES_INCLUDE_PATH}") - endif() - if(NOT DEFINED CURSES_LIBRARY) - set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}") - endif() -endif() - -# Report whether each possible header name exists in the include directory. -if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H) - if(CURSES_NEED_WIDE) - if(EXISTS "${CURSES_INCLUDE_PATH}/ncursesw/ncurses.h") - set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncursesw/ncurses.h") - endif() - elseif(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h") - set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h") - endif() - if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H) - set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND") - endif() -endif() -if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H) - if(CURSES_NEED_WIDE) - if(EXISTS "${CURSES_INCLUDE_PATH}/ncursesw/curses.h") - set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncursesw/curses.h") - endif() - elseif(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/curses.h") - set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncurses/curses.h") - endif() - if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H) - set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND") - endif() -endif() -if(NOT CURSES_NEED_WIDE) - #ncursesw can't be found for this paths - if(NOT DEFINED CURSES_HAVE_NCURSES_H) - if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses.h") - set(CURSES_HAVE_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses.h") - else() - set(CURSES_HAVE_NCURSES_H "CURSES_HAVE_NCURSES_H-NOTFOUND") - endif() - endif() - if(NOT DEFINED CURSES_HAVE_CURSES_H) - if(EXISTS "${CURSES_INCLUDE_PATH}/curses.h") - set(CURSES_HAVE_CURSES_H "${CURSES_INCLUDE_PATH}/curses.h") - else() - set(CURSES_HAVE_CURSES_H "CURSES_HAVE_CURSES_H-NOTFOUND") - endif() - endif() -endif() - -find_library(CURSES_FORM_LIBRARY "${CURSES_FORM_LIBRARY_NAME}" HINTS "${_cursesLibDir}") -find_library(CURSES_FORM_LIBRARY "${CURSES_FORM_LIBRARY_NAME}" ) - -# Previous versions of FindCurses provided these values. -if(NOT DEFINED FORM_LIBRARY) - set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}") -endif() - -# Need to provide the *_LIBRARIES -set(CURSES_LIBRARIES ${CURSES_LIBRARY}) - -if(CURSES_EXTRA_LIBRARY) - set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_EXTRA_LIBRARY}) -endif() - -if(CURSES_FORM_LIBRARY) - set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY}) -endif() - -# Provide the *_INCLUDE_DIRS and *_CFLAGS results. -set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH}) -set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility - -find_package(PkgConfig QUIET) -if(PKG_CONFIG_FOUND) - pkg_check_modules(NCURSES QUIET ${NCURSES_LIBRARY_NAME}) - set(CURSES_CFLAGS ${NCURSES_CFLAGS_OTHER}) -endif() - -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG - CURSES_LIBRARY CURSES_INCLUDE_PATH) - -mark_as_advanced( - CURSES_INCLUDE_PATH - CURSES_CURSES_LIBRARY - CURSES_NCURSES_LIBRARY - CURSES_FORM_LIBRARY - ) From df14508778aabfc5e16daaaa407cdd7c10995eee Mon Sep 17 00:00:00 2001 From: lwvmobile <59371473+lwvmobile@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:57:20 -0500 Subject: [PATCH 05/10] Delete dsd_frame.c.bkp --- src/dsd_frame.c.bkp | 571 -------------------------------------------- 1 file changed, 571 deletions(-) delete mode 100644 src/dsd_frame.c.bkp diff --git a/src/dsd_frame.c.bkp b/src/dsd_frame.c.bkp deleted file mode 100644 index e89cfa3..0000000 --- a/src/dsd_frame.c.bkp +++ /dev/null @@ -1,571 +0,0 @@ -/* - * Copyright (C) 2010 DSD Author - * GPG Key ID: 0x3F1D7FD0 (74EF 430D F7F2 0A48 FCE6 F630 FAA2 635D 3F1D 7FD0) - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#include "dsd.h" -#if !defined(NULL) -#define NULL 0 -#endif - -#include "p25p1_check_nid.h" - -void -printFrameInfo (dsd_opts * opts, dsd_state * state) -{ - - int level; - - level = (int) state->max / 164; - if (opts->verbose > 0) - { - fprintf (stderr,"inlvl: %2i%% ", level); - } - if (state->nac != 0) - { - fprintf (stderr,"nac: %4X ", state->nac); - } - - if (opts->verbose > 1) - { - fprintf (stderr,"src: %8i ", state->lastsrc); - } - fprintf (stderr,"tg: %5i ", state->lasttg); -} - -void -processFrame (dsd_opts * opts, dsd_state * state) -{ - - int i, j, dibit; - char duid[3]; - char nac[13]; - int level; - - char status_0; - char bch_code[63]; - int index_bch_code; - unsigned char parity; - char v; - int new_nac; - char new_duid[3]; - int check_result; - - nac[12] = 0; - duid[2] = 0; - j = 0; - - if (state->rf_mod == 1) - { - state->maxref = (int)(state->max * 0.80F); - state->minref = (int)(state->min * 0.80F); - } - else - { - state->maxref = state->max; - state->minref = state->min; - } - - if ((state->synctype == 8) || (state->synctype == 9)) //lets make this NOT do this...maybe... - { - //state->rf_mod = 2; //wrong type of modulation HERE HERE - state->nac = 0; - state->lastsrc = 0; - state->lasttg = 0; - if (opts->errorbars == 1) - { - if (opts->verbose > 0) - { - level = (int) state->max / 164; - fprintf (stderr,"inlvl: %2i%% ", level); - } - } - state->nac = 0; - if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) - { - openMbeOutFile (opts, state); - } - sprintf (state->fsubtype, " VOICE "); - processNXDNVoice (opts, state); - return; - } - else if ((state->synctype == 16) || (state->synctype == 17)) - { - //state->rf_mod = 2; - state->nac = 0; - state->lastsrc = 0; - state->lasttg = 0; - if (opts->errorbars == 1) - { - if (opts->verbose > 0) - { - level = (int) state->max / 164; - fprintf (stderr, "inlvl: %2i%% ", level); - } - } - state->nac = 0; - if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) - { - openMbeOutFile (opts, state); - } - sprintf (state->fsubtype, " DATA "); - processNXDNData (opts, state); - return; - } - else if ((state->synctype == 6) || (state->synctype == 7)) - { - state->nac = 0; - state->lastsrc = 0; - state->lasttg = 0; - if (opts->errorbars == 1) - { - if (opts->verbose > 0) - { - level = (int) state->max / 164; - fprintf (stderr,"inlvl: %2i%% ", level); - } - } - state->nac = 0; - if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) - { - openMbeOutFile (opts, state); - } - sprintf (state->fsubtype, " VOICE "); - processDSTAR (opts, state); - return; - } - else if ((state->synctype == 18) || (state->synctype == 19)) - { - state->nac = 0; - state->lastsrc = 0; - state->lasttg = 0; - if (opts->errorbars == 1) - { - if (opts->verbose > 0) - { - level = (int) state->max / 164; - fprintf (stderr,"inlvl: %2i%% ", level); - } - } - state->nac = 0; - if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) - { - openMbeOutFile (opts, state); - } - sprintf (state->fsubtype, " DATA "); - processDSTAR_HD (opts, state); - return; - } - - else if ((state->synctype >= 10) && (state->synctype <= 13)) - { - state->nac = 0; - state->lastsrc = 0; - state->lasttg = 0; - if (opts->errorbars == 1) - { - if (opts->verbose > 0) - { - level = (int) state->max / 164; - fprintf (stderr,"inlvl: %2i%% ", level); - } - } - if ((state->synctype == 11) || (state->synctype == 12)) - { - if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) - { - openMbeOutFile (opts, state); - } - sprintf (state->fsubtype, " VOICE "); - processDMRvoice (opts, state); - } - else - { - closeMbeOutFile (opts, state); - state->err_str[0] = 0; - processDMRdata (opts, state); - } - return; - } - else if ((state->synctype >= 2) && (state->synctype <= 5)) - { - state->nac = 0; - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - } - if ((state->synctype == 3) || (state->synctype == 4)) - { - if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) - { - openMbeOutFile (opts, state); - } - sprintf (state->fsubtype, " VOICE "); - processX2TDMAvoice (opts, state); - } - else - { - closeMbeOutFile (opts, state); - state->err_str[0] = 0; - processX2TDMAdata (opts, state); - } - return; - } - else if ((state->synctype == 14) || (state->synctype == 15)) - { - state->nac = 0; - state->lastsrc = 0; - state->lasttg = 0; - if (opts->errorbars == 1) - { - if (opts->verbose > 0) - { - level = (int) state->max / 164; - fprintf (stderr,"inlvl: %2i%% ", level); - } - } - if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) - { - openMbeOutFile (opts, state); - } - sprintf (state->fsubtype, " VOICE "); - processProVoice (opts, state); - return; - } - else - { - // Read the NAC, 12 bits - j = 0; - index_bch_code = 0; - for (i = 0; i < 6; i++) - { - dibit = getDibit (opts, state); - - v = 1 & (dibit >> 1); // bit 1 - nac[j] = v + '0'; - j++; - bch_code[index_bch_code] = v; - index_bch_code++; - - v = 1 & dibit; // bit 0 - nac[j] = v + '0'; - j++; - bch_code[index_bch_code] = v; - index_bch_code++; - } - state->nac = strtol (nac, NULL, 2); - - // Read the DUID, 4 bits - for (i = 0; i < 2; i++) - { - dibit = getDibit (opts, state); - duid[i] = dibit + '0'; - - bch_code[index_bch_code] = 1 & (dibit >> 1); // bit 1 - index_bch_code++; - bch_code[index_bch_code] = 1 & dibit; // bit 0 - index_bch_code++; - } - - // Read the BCH data for error correction of NAC and DUID - for (i = 0; i < 3; i++) - { - dibit = getDibit (opts, state); - - bch_code[index_bch_code] = 1 & (dibit >> 1); // bit 1 - index_bch_code++; - bch_code[index_bch_code] = 1 & dibit; // bit 0 - index_bch_code++; - } - // Intermission: read the status dibit - status_0 = getDibit (opts, state) + '0'; - // ... continue reading the BCH error correction data - for (i = 0; i < 20; i++) - { - dibit = getDibit (opts, state); - - bch_code[index_bch_code] = 1 & (dibit >> 1); // bit 1 - index_bch_code++; - bch_code[index_bch_code] = 1 & dibit; // bit 0 - index_bch_code++; - } - - // Read the parity bit - dibit = getDibit (opts, state); - bch_code[index_bch_code] = 1 & (dibit >> 1); // bit 1 - parity = (1 & dibit); // bit 0 - - // Check if the NID is correct - check_result = check_NID (bch_code, &new_nac, new_duid, parity); - if (check_result) { - if (new_nac != state->nac) { - // NAC fixed by error correction - state->nac = new_nac; - state->debug_header_errors++; - } - if (strcmp(new_duid, duid) != 0) { - // DUID fixed by error correction - //fprintf (stderr,"Fixing DUID %s -> %s\n", duid, new_duid); - duid[0] = new_duid[0]; - duid[1] = new_duid[1]; - state->debug_header_errors++; - } - } else { - // Check of NID failed and unable to recover its value - //fprintf (stderr,"NID error\n"); - duid[0] = 'E'; - duid[1] = 'E'; - state->debug_header_critical_errors++; - } - } - - if (strcmp (duid, "00") == 0) - { - // Header Data Unit - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr," HDU\n"); - } - if (opts->mbe_out_dir[0] != 0) - { - closeMbeOutFile (opts, state); - openMbeOutFile (opts, state); - } - mbe_initMbeParms (state->cur_mp, state->prev_mp, state->prev_mp_enhanced); - state->lastp25type = 2; - sprintf (state->fsubtype, " HDU "); - processHDU (opts, state); - } - else if (strcmp (duid, "11") == 0) - { - // Logical Link Data Unit 1 - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr," LDU1 "); - } - if (opts->mbe_out_dir[0] != 0) - { - if (opts->mbe_out_f == NULL) - { - openMbeOutFile (opts, state); - } - } - state->lastp25type = 1; - sprintf (state->fsubtype, " LDU1 "); - state->numtdulc = 0; - processLDU1 (opts, state); - } - else if (strcmp (duid, "22") == 0) - { - // Logical Link Data Unit 2 - if (state->lastp25type != 1) - { - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr," Ignoring LDU2 not preceeded by LDU1\n"); - } - state->lastp25type = 0; - sprintf (state->fsubtype, " "); - } - else - { - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr," LDU2 "); - } - if (opts->mbe_out_dir[0] != 0) - { - if (opts->mbe_out_f == NULL) - { - openMbeOutFile (opts, state); - } - } - state->lastp25type = 2; - sprintf (state->fsubtype, " LDU2 "); - state->numtdulc = 0; - processLDU2 (opts, state); - } - } - else if (strcmp (duid, "33") == 0) - { - // Terminator with subsequent Link Control - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr," TDULC\n"); - } - if (opts->mbe_out_dir[0] != 0) - { - closeMbeOutFile (opts, state); - } - mbe_initMbeParms (state->cur_mp, state->prev_mp, state->prev_mp_enhanced); - state->lasttg = 0; - state->lastsrc = 0; - state->lastp25type = 0; - state->err_str[0] = 0; - sprintf (state->fsubtype, " TDULC "); - state->numtdulc++; - if ((opts->resume > 0) && (state->numtdulc > opts->resume)) - { - resumeScan (opts, state); - } - processTDULC (opts, state); - state->err_str[0] = 0; - } - else if (strcmp (duid, "03") == 0) - { - // Terminator without subsequent Link Control - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr," TDU\n"); - } - if (opts->mbe_out_dir[0] != 0) - { - closeMbeOutFile (opts, state); - } - mbe_initMbeParms (state->cur_mp, state->prev_mp, state->prev_mp_enhanced); - state->lasttg = 0; - state->lastsrc = 0; - state->lastp25type = 0; - state->err_str[0] = 0; - sprintf (state->fsubtype, " TDU "); - - processTDU (opts, state); - } - else if (strcmp (duid, "13") == 0) - { - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr," TSDU\n"); - } - if (opts->resume > 0) - { - resumeScan (opts, state); - } - state->lasttg = 0; - state->lastsrc = 0; - state->lastp25type = 3; - sprintf (state->fsubtype, " TSDU "); - - // Now processing NID - - skipDibit (opts, state, 328-25); - } - else if (strcmp (duid, "30") == 0) - { - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr," PDU\n"); - } - if (opts->resume > 0) - { - resumeScan (opts, state); - } - if (opts->mbe_out_dir[0] != 0) - { - if (opts->mbe_out_f == NULL) - { - openMbeOutFile (opts, state); - } - } - state->lastp25type = 4; - sprintf (state->fsubtype, " PDU "); - } - // try to guess based on previous frame if unknown type - else if (state->lastp25type == 1) - { - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr,"(LDU2) "); - } - if (opts->mbe_out_dir[0] != 0) - { - if (opts->mbe_out_f == NULL) - { - openMbeOutFile (opts, state); - } - } - //state->lastp25type = 0; - // Guess that the state is LDU2 - state->lastp25type = 2; - sprintf (state->fsubtype, "(LDU2) "); - state->numtdulc = 0; - processLDU2 (opts, state); - } - else if (state->lastp25type == 2) - { - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr,"(LDU1) "); - } - if (opts->mbe_out_dir[0] != 0) - { - if (opts->mbe_out_f == NULL) - { - openMbeOutFile (opts, state); - } - } - //state->lastp25type = 0; - // Guess that the state is LDU1 - state->lastp25type = 1; - sprintf (state->fsubtype, "(LDU1) "); - state->numtdulc = 0; - processLDU1 (opts, state); - } - else if (state->lastp25type == 3) - { - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr," (TSDU)\n"); - } - //state->lastp25type = 0; - // Guess that the state is TSDU - state->lastp25type = 3; - sprintf (state->fsubtype, "(TSDU) "); - - // Now processing NID - - skipDibit (opts, state, 328-25); - } - else if (state->lastp25type == 4) - { - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr," (PDU)\n"); - } - state->lastp25type = 0; - } - else - { - state->lastp25type = 0; - sprintf (state->fsubtype, " "); - if (opts->errorbars == 1) - { - printFrameInfo (opts, state); - fprintf (stderr," duid:%s *Unknown DUID*\n", duid); - } - } -} From c7e52ab4fe1d7335e6e5e15fd5fa59c776b0b38e Mon Sep 17 00:00:00 2001 From: lwvmobile <59371473+lwvmobile@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:57:28 -0500 Subject: [PATCH 06/10] Delete nxdn_data.c.bkp --- src/nxdn_data.c.bkp | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 src/nxdn_data.c.bkp diff --git a/src/nxdn_data.c.bkp b/src/nxdn_data.c.bkp deleted file mode 100644 index 5e212bd..0000000 --- a/src/nxdn_data.c.bkp +++ /dev/null @@ -1,41 +0,0 @@ -#include "dsd.h" -#include "nxdn_const.h"//going to test pushing data frames through, but not throught he processMBE portion, want to get those get frames - -void -processNXDNData (dsd_opts * opts, dsd_state * state) -{ - int i, dibit; - //dibit = getDibit (opts, state); - //fprintf (stderr, "D %c \n", dibit + 48); //adding to see what dumps exactly - if (opts->errorbars == 1) - { - fprintf (stderr, "DATA "); - //dibit = getDibit (opts, state); - //fprintf (stderr, "DE %c \n", dibit + 48); //adding to see what dumps exactly - } - - for (i = 0; i < 30; i++) - { - dibit = getDibit (opts, state); -#ifdef NXDN_DUMP - fprintf (stderr, "%c", dibit + 48); -#endif - } -#ifdef NXDN_DUMP - fprintf (stderr, " "); -#endif - - for (i = 0; i < 144; i++) - { - dibit = getDibit (opts, state); - //fprintf (stderr, "%c", dibit + 48); -#ifdef NXDN_DUMP - fprintf (stderr, "%c", dibit + 48); -#endif - } - - if (opts->errorbars == 1) - { - fprintf (stderr, "\n"); - } -} From a6c83a7fbbfd156eabbc69f19139633474cfd261 Mon Sep 17 00:00:00 2001 From: lwvmobile <59371473+lwvmobile@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:57:36 -0500 Subject: [PATCH 07/10] Delete nxdn_data.c.bkp2 --- src/nxdn_data.c.bkp2 | 72 -------------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 src/nxdn_data.c.bkp2 diff --git a/src/nxdn_data.c.bkp2 b/src/nxdn_data.c.bkp2 deleted file mode 100644 index fe3cddf..0000000 --- a/src/nxdn_data.c.bkp2 +++ /dev/null @@ -1,72 +0,0 @@ -#include "dsd.h" -#include "nxdn_const.h" //test making this just like voice, but not processing MBEframes - -void -processNXDNData (dsd_opts * opts, dsd_state * state) -{ - int i, j, dibit, k, l; - char ambe_fr2[4][24]; - const int *w, *x, *y, *z; - const char *pr; - - if (opts->errorbars == 1) - { - fprintf (stderr,"DATA e:"); - } - - for (i = 0; i < 30; i++) - { - dibit = getDibit (opts, state); -#ifdef NXDN_DUMP - fprintf (stderr,"%c", dibit + 48); -#endif - } -#ifdef NXDN_DUMP - fprintf (stderr," "); -#endif - - pr = nxdnpr; - for (j = 0; j < 4; j++) - { - w = nW; - x = nX; - y = nY; - z = nZ; - for (i = 0; i < 36; i++) - { - dibit = getDibit (opts, state); - //fprintf (stderr,"%c", dibit + 48); //remove later -#ifdef NXDN_DUMP - fprintf (stderr,"%c", dibit + 48); -#endif - ambe_fr2[*w][*x] = *pr ^ (1 & (dibit >> 1)); // bit 1 - pr++; - ambe_fr2[*y][*z] = (1 & dibit); // bit 0 - w++; - x++; - y++; - z++; - //dump this whole lot, figure out what it all means - //fprintf (stderr, "%s\n%s\n", ambe_fr, pr); - } - for (k = 0; k < 36; k++) //was 36 - { - for (l = 0; l < 36; l++) //was 36 - { - //fprintf (stderr, "%X%X", ambe_fr[k][l]); - //fprintf (stderr, "%X", ambe_fr2[k][l]); - } - //fprintf (stderr, "\n"); - } - //processMbeFrame (opts, state, NULL, ambe_fr, NULL); -#ifdef NXDN_DUMP - fprintf (stderr," "); -#endif - - } - //fprintf (stderr, "\nD%s\n%s\n", ambe_fr, pr); - if (opts->errorbars == 1) - { - fprintf (stderr,"\n"); - } -} From a239cd94fe3f0037c13a90a8534d500bcd741be3 Mon Sep 17 00:00:00 2001 From: lwvmobile <59371473+lwvmobile@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:57:44 -0500 Subject: [PATCH 08/10] Delete nxdn_voice.c.bkp3 --- src/nxdn_voice.c.bkp3 | 118 ------------------------------------------ 1 file changed, 118 deletions(-) delete mode 100644 src/nxdn_voice.c.bkp3 diff --git a/src/nxdn_voice.c.bkp3 b/src/nxdn_voice.c.bkp3 deleted file mode 100644 index 3c79ef4..0000000 --- a/src/nxdn_voice.c.bkp3 +++ /dev/null @@ -1,118 +0,0 @@ -#include "dsd.h" -#include "nxdn_const.h" - -void -processNXDNVoice (dsd_opts * opts, dsd_state * state) -{ - int i, j, dibit, k, l; - char ambe_fr[4][24]; - const int *w, *x, *y, *z; - const char *pr; - //borrow from LEH data - unsigned char sacch_raw[72] = {0}; - unsigned char sacch_decoded[32] = {0}; /* 26 bit + 6 bit CRC */ - unsigned char *pr2; //change this to pr2 to differentiate - uint8_t CrcIsGood = 0; - uint8_t StructureField = 0; - uint8_t RAN = 0; - uint8_t PartOfFrame = 0; - - if (opts->errorbars == 1) - { - fprintf (stderr,"VOICE e:"); - } - - for (i = 0; i < 30; i++) - { - dibit = getDibit (opts, state); -#ifdef NXDN_DUMP - fprintf (stderr,"%c", dibit + 48); -#endif - } -#ifdef NXDN_DUMP - fprintf (stderr," "); -#endif - - pr = nxdnpr; - pr2 = (unsigned char *)(&nxdnpr2[8]); //from LEH data - - for (j = 0; j < 4; j++) - { - w = nW; - x = nX; - y = nY; - z = nZ; - for (i = 0; i < 36; i++) - { - dibit = getDibit (opts, state); - //fprintf (stderr,"%c", dibit + 48); //remove later - if (i < 30){ - sacch_raw[(2*i)] = ((*pr2) & 1) ^ (1 & (dibit >> 1)); // bit 1 - sacch_raw[(2*i)+1] = (1 & dibit); // bit 0 - } - -#ifdef NXDN_DUMP - fprintf (stderr,"%c", dibit + 48); -#endif - ambe_fr[*w][*x] = *pr ^ (1 & (dibit >> 1)); // bit 1 - pr++; - ambe_fr[*y][*z] = (1 & dibit); // bit 0 - w++; - x++; - y++; - z++; - } - processMbeFrame (opts, state, NULL, ambe_fr, NULL); - //from LEH data - /* Decode the SACCH fields */ - CrcIsGood = NXDN_SACCH_raw_part_decode(sacch_raw, sacch_decoded); - StructureField = (sacch_decoded[0]<<1 | sacch_decoded[1]<<0) & 0x03; /* Compute the Structure Field (remove 2 first bits of the SR Information in the SACCH) */ - RAN = (sacch_decoded[2]<<5 | sacch_decoded[3]<<4 | sacch_decoded[4]<<3 | sacch_decoded[5]<<2 | sacch_decoded[6]<<1 | sacch_decoded[7]<<0) & 0x3F; /* Compute the RAN (6 last bits of the SR Information in the SACCH) */ - - /* Compute the Part of Frame according to the structure field */ - if (StructureField == 3) PartOfFrame = 0; - else if(StructureField == 2) PartOfFrame = 1; - else if(StructureField == 1) PartOfFrame = 2; - else if(StructureField == 0) PartOfFrame = 3; - else PartOfFrame = 0; /* Normally we should never go here */ - - /* Fill the SACCH structure */ - state->NxdnSacchRawPart[PartOfFrame].CrcIsGood = CrcIsGood; - state->NxdnSacchRawPart[PartOfFrame].StructureField = StructureField; - state->NxdnSacchRawPart[PartOfFrame].RAN = RAN; - - memcpy(state->NxdnSacchRawPart[PartOfFrame].Data, &sacch_decoded[8], 18); /* Copy the 18 bits of SACCH content */ - - //fprintf(stderr, "RAN=%02d - Part %d/4 ", RAN, PartOfFrame + 1); - if(CrcIsGood) - { - //fprintf (stderr, "RAN=%02d - Part %d/4 ", RAN, PartOfFrame + 1); - //fprintf (stderr, " (OK) - "); - state->nxdn_last_ran = RAN; //disable, try to grab this in voice instead - } - - else fprintf (stderr, "(CRC ERR) - "); - - if(PartOfFrame == 3) - { - /* Decode the entire SACCH content */ - NXDN_SACCH_Full_decode(opts, state); - } - - /* Reset the SACCH CRCs when all 4 voice frame - * SACCH spare parts have been received */ - if(PartOfFrame == 3) - { - /* Reset all CRCs of the SACCH */ - for(i = 0; i < 4; i++) state->NxdnSacchRawPart[i].CrcIsGood = 0; - } -#ifdef NXDN_DUMP - fprintf (stderr," "); -#endif - } - //fprintf (stderr, "\nV%c\n%c\n", ambe_fr, pr); - if (opts->errorbars == 1) - { - fprintf (stderr,"\n"); - } -} From c917c61b85284b18673d49ad8c44879a25ac4baa Mon Sep 17 00:00:00 2001 From: lwvmobile <59371473+lwvmobile@users.noreply.github.com> Date: Mon, 21 Feb 2022 13:11:07 -0500 Subject: [PATCH 09/10] Fix CMAKE set Fix CMAKE set Curses to Ncurses, need wide true --- CMakeLists.txt | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8ead6c..cb7cc61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,9 @@ project(dsd) cmake_minimum_required(VERSION 2.8.11) SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/") +#Set curses to ncurses, and wide true for ascii +set(CURSES_NEED_NCURSES TRUE) +set(CURSES_NEED_WIDE TRUE) include(git_revision) git_describe(GIT_TAG) @@ -11,42 +14,12 @@ find_package(MBE REQUIRED) find_package(ITPP REQUIRED) #find_package(LibPortAudio) #disabled for testing find_package(RTLSDR) -#more messing around -#find_package(Curses) -find_package(Curses REQUIRED) #making this required until I can fix all instances of it being called to ifdef lines +find_package(Curses REQUIRED) find_package(PULSEAUDIO) -set(CURSES_NEED_WIDE TRUE) #not quite sure where to put this - -#include_directories(SYSTEM ${LIBSNDFILE_INCLUDE_DIR} ${MBE_INCLUDE_DIR} ${ITPP_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIRS} ${CURSES_INCLUDE_DIR}) -#set(LIBS ${MBE_LIBRARY} ${LIBSNDFILE_LIBRARY} ${ITPP_LIBRARY} ${PULSEAUDIO_SIMPLE_LIBRARY} ${CURSES_LIBRARY}) -#remove CURSES from 'required' set up top AFTER switching all commands to ifdef in dsd_main, dsd_framesync, and dsd_ncurses.c -#also, figure out how to make it build for wide character support in Linux Mint etc, like this -- $(ncursesw5-config --cflags --libs) include_directories(SYSTEM ${LIBSNDFILE_INCLUDE_DIR} ${MBE_INCLUDE_DIR} ${ITPP_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIRS} ${CURSES_INCLUDE_DIR}) set(LIBS ${MBE_LIBRARY} ${LIBSNDFILE_LIBRARY} ${ITPP_LIBRARY} ${PULSEAUDIO_SIMPLE_LIBRARY} ${CURSES_LIBRARY}) - -#if(Curses_FOUND) -# set(CURSES_NEED_WIDE TRUE) -# include_directories(SYSTEM ${CURSES_INCLUDE_PATH}) -# list(APPEND LIBS ${CURSES_LIBRARY}) -# add_definitions(-DUSE_CURSES) -#endif(Curses_FOUND) - -#going to disable PortAudio, works just fine with padsp in Linux, -#hoping disabling this doesn't break OSX or cygwin, etc builds -#if(PORTAUDIO_FOUND) -# include_directories(SYSTEM ${PORTAUDIO_INCLUDE_DIRS}) -# list(APPEND LIBS ${PORTAUDIO_LIBRARIES}) -# add_definitions(-DUSE_PORTAUDIO) -#endif(PORTAUDIO_FOUND) - -#if(PULSEAUDIO_FOUND) ##I don't think this will be necessary -# include_directories(SYSTEM ${PULSEAUDIO_INCLUDE_DIRS}) -# list(APPEND LIBS ${PULSEAUDIO_LIBRARIES}) -# add_definitions(-DUSE_PULSEAUDIO) -#endif(PULSEAUDIO_FOUND) - if(RTLSDR_FOUND) find_package(Threads) include_directories(SYSTEM ${RTLSDR_INCLUDE_DIRS}) From 1a4440f1ab2e9e8f33d3e1b8f6d492613dd0fff5 Mon Sep 17 00:00:00 2001 From: lwvmobile <59371473+lwvmobile@users.noreply.github.com> Date: Mon, 21 Feb 2022 13:17:44 -0500 Subject: [PATCH 10/10] Add files via upload --- src/dsd_ncurses.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index 0175364..65b5dd8 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -144,7 +144,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) level = 0; //start each cycle with 0 erase(); //disabling until wide support can be built for LM, etc. $(ncursesw5-config --cflags --libs) - //printw ("%s \n", FM_bannerN[0]); //top line in white + printw ("%s \n", FM_bannerN[0]); //top line in white attron(COLOR_PAIR(4)); for (short int i = 1; i < 7; i++) //following lines in cyan { @@ -156,7 +156,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) printw ("| Digital Speech Decoder: Florida Man Edition\n"); printw ("| Github Build Version: %s \n", GIT_TAG); printw ("| mbelib version %s\n", versionstr); - printw ("| Press CTRL+C twice to exit\n"); + //printw ("| Press CTRL+C twice to exit\n"); printw ("------------------------------------------------------------------------------\n");