diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2213c70d..30a9ee0c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -99,16 +99,6 @@ file(GLOB common_INCLUDE "src/common/*.h" ) -# Digital mode options and other compilation features -add_definitions(-DENABLE_DMR) -message(CHECK_START "DMR Digital Mode - enabled") - -add_definitions(-DENABLE_P25) -message(CHECK_START "P25 Digital Mode - enabled") - -add_definitions(-DENABLE_NXDN) -message(CHECK_START "NXDN Digital Mode - enabled") - if (ENABLE_TUI_SUPPORT) option(ENABLE_SETUP_TUI "Enable interactive setup TUI" on) if (ENABLE_SETUP_TUI) diff --git a/src/common/Defines.h b/src/common/Defines.h index 9ac96a2b..d7bcf42b 100644 --- a/src/common/Defines.h +++ b/src/common/Defines.h @@ -39,10 +39,6 @@ #include #include -#if !defined(ENABLE_DMR) && !defined(ENABLE_P25) && !defined(ENABLE_NXDN) -#error "No protocol support compiled in? Must enable at least one: ENABLE_DMR, ENABLE_P25 and/or ENABLE_NXDN." -#endif - // --------------------------------------------------------------------------- // Types // --------------------------------------------------------------------------- diff --git a/src/common/Utils.h b/src/common/Utils.h index 33af3ee4..e9428694 100644 --- a/src/common/Utils.h +++ b/src/common/Utils.h @@ -30,26 +30,6 @@ #include -// --------------------------------------------------------------------------- -// Constants -// --------------------------------------------------------------------------- - -#if defined(ENABLE_DMR) -#define DESCR_DMR "DMR, " -#else -#define DESCR_DMR "" -#endif -#if defined(ENABLE_P25) -#define DESCR_P25 "P25, " -#else -#define DESCR_P25 "" -#endif -#if defined(ENABLE_NXDN) -#define DESCR_NXDN "NXDN, " -#else -#define DESCR_NXDN "" -#endif - // --------------------------------------------------------------------------- // Class Declaration // Implements various helper utilities. diff --git a/src/fne/FNEMain.cpp b/src/fne/FNEMain.cpp index b12c789a..def79e51 100644 --- a/src/fne/FNEMain.cpp +++ b/src/fne/FNEMain.cpp @@ -46,26 +46,6 @@ using namespace lookups; #include #include -// --------------------------------------------------------------------------- -// Constants -// --------------------------------------------------------------------------- - -#if defined(ENABLE_DMR) -#define DESCR_DMR "DMR, " -#else -#define DESCR_DMR "" -#endif -#if defined(ENABLE_P25) -#define DESCR_P25 "P25, " -#else -#define DESCR_P25 "" -#endif -#if defined(ENABLE_NXDN) -#define DESCR_NXDN "NXDN, " -#else -#define DESCR_NXDN "" -#endif - // --------------------------------------------------------------------------- // Macros // --------------------------------------------------------------------------- @@ -130,7 +110,7 @@ void fatal(const char* msg, ...) /// Error message arguments. void usage(const char* message, const char* arg) { - ::fprintf(stdout, __PROG_NAME__ " %s (" DESCR_DMR DESCR_P25 DESCR_NXDN "CW Id, Network) (built %s)\n", __VER__, __BUILD__); + ::fprintf(stdout, __PROG_NAME__ " %s (built %s)\r\n", __VER__, __BUILD__); ::fprintf(stdout, "Copyright (c) 2017-2024 Bryan Biedenkapp, N2PLL and DVMProject (https://github.com/dvmproject) Authors.\n"); ::fprintf(stdout, "Portions Copyright (c) 2015-2021 by Jonathan Naylor, G4KLX and others\n\n"); if (message != nullptr) { @@ -189,7 +169,7 @@ int checkArgs(int argc, char* argv[]) p += 2; } else if (IS("-v")) { - ::fprintf(stdout, __PROG_NAME__ " %s (" DESCR_DMR DESCR_P25 DESCR_NXDN "CW Id, Network) (built %s)\n", __VER__, __BUILD__); + ::fprintf(stdout, __PROG_NAME__ " %s (built %s)\r\n", __VER__, __BUILD__); ::fprintf(stdout, "Copyright (c) 2017-2024 Bryan Biedenkapp, N2PLL and DVMProject (https://github.com/dvmproject) Authors.\n"); ::fprintf(stdout, "Portions Copyright (c) 2015-2021 by Jonathan Naylor, G4KLX and others\n"); if (argc == 2) diff --git a/src/fne/HostFNE.cpp b/src/fne/HostFNE.cpp index d5dd07a2..e8edf223 100644 --- a/src/fne/HostFNE.cpp +++ b/src/fne/HostFNE.cpp @@ -153,7 +153,7 @@ int HostFNE::run() ::close(STDERR_FILENO); } - ::LogInfo(__PROG_NAME__ " %s (" DESCR_DMR DESCR_P25 DESCR_NXDN "CW Id, Network) (built %s)", __VER__, __BUILD__); + ::LogInfo(__PROG_NAME__ " %s (built %s)", __VER__, __BUILD__); ::LogInfo("Copyright (c) 2017-2024 Bryan Biedenkapp, N2PLL and DVMProject (https://github.com/dvmproject) Authors."); ::LogInfo("Portions Copyright (c) 2015-2021 by Jonathan Naylor, G4KLX and others"); ::LogInfo(">> Fixed Network Equipment"); diff --git a/src/fne/network/FNENetwork.cpp b/src/fne/network/FNENetwork.cpp index 6a389565..1092fc84 100644 --- a/src/fne/network/FNENetwork.cpp +++ b/src/fne/network/FNENetwork.cpp @@ -231,13 +231,11 @@ void FNENetwork::clock(uint32_t ms) // validate peer (simple validation really) if (connection.connected() && connection.address() == ip) { -#if defined(ENABLE_DMR) if (m_dmrEnabled) { if (m_tagDMR != nullptr) { m_tagDMR->processFrame(buffer.get(), length, peerId, rtpHeader.getSequence(), streamId); } } -#endif // defined(ENABLE_DMR) } } } @@ -248,13 +246,11 @@ void FNENetwork::clock(uint32_t ms) // validate peer (simple validation really) if (connection.connected() && connection.address() == ip) { -#if defined(ENABLE_P25) if (m_p25Enabled) { if (m_tagP25 != nullptr) { m_tagP25->processFrame(buffer.get(), length, peerId, rtpHeader.getSequence(), streamId); } } -#endif // defined(ENABLE_P25) } } } @@ -265,13 +261,11 @@ void FNENetwork::clock(uint32_t ms) // validate peer (simple validation really) if (connection.connected() && connection.address() == ip) { -#if defined(ENABLE_NXDN) if (m_nxdnEnabled) { if (m_tagNXDN != nullptr) { m_tagNXDN->processFrame(buffer.get(), length, peerId, rtpHeader.getSequence(), streamId); } } -#endif // defined(ENABLE_NXDN) } } } @@ -588,26 +582,20 @@ void FNENetwork::clock(uint32_t ms) } } else { -#if defined(ENABLE_DMR) // if the DMR handler has parrot frames to playback, playback a frame if (m_tagDMR->hasParrotFrames()) { m_tagDMR->playbackParrot(); } -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) // if the P25 handler has parrot frames to playback, playback a frame if (m_tagP25->hasParrotFrames()) { m_tagP25->playbackParrot(); } -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) // if the NXDN handler has parrot frames to playback, playback a frame if (m_tagNXDN->hasParrotFrames()) { m_tagNXDN->playbackParrot(); } -#endif // defined(ENABLE_NXDN) } return; diff --git a/src/host/Host.Config.cpp b/src/host/Host.Config.cpp index 0fb2bae9..b9c3452d 100644 --- a/src/host/Host.Config.cpp +++ b/src/host/Host.Config.cpp @@ -64,21 +64,9 @@ bool Host::readParams() } yaml::Node protocolConf = m_conf["protocols"]; -#if defined(ENABLE_DMR) m_dmrEnabled = protocolConf["dmr"]["enable"].as(false); -#else - m_dmrEnabled = false; // hardcode to false when no DMR support is compiled in -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) m_p25Enabled = protocolConf["p25"]["enable"].as(false); -#else - m_p25Enabled = false; // hardcode to false when no P25 support is compiled in -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) m_nxdnEnabled = protocolConf["nxdn"]["enable"].as(false); -#else - m_nxdnEnabled = false; // hardcode to false when no NXDN support is compiled in -#endif // defined(ENABLE_NXDN) yaml::Node systemConf = m_conf["system"]; m_duplex = systemConf["duplex"].as(true); diff --git a/src/host/Host.cpp b/src/host/Host.cpp index 44973fd9..736cb8a0 100644 --- a/src/host/Host.cpp +++ b/src/host/Host.cpp @@ -224,7 +224,7 @@ int Host::run() ::close(STDERR_FILENO); } - ::LogInfo(__PROG_NAME__ " %s (" DESCR_DMR DESCR_P25 DESCR_NXDN "CW Id, Network) (built %s)", __VER__, __BUILD__); + ::LogInfo(__PROG_NAME__ " %s (built %s)", __VER__, __BUILD__); ::LogInfo("Copyright (c) 2017-2024 Bryan Biedenkapp, N2PLL and DVMProject (https://github.com/dvmproject) Authors."); ::LogInfo("Portions Copyright (c) 2015-2021 by Jonathan Naylor, G4KLX and others"); ::LogInfo(">> Modem Controller"); @@ -359,7 +359,6 @@ int Host::run() Timer dmrBeaconIntervalTimer(1000U); std::unique_ptr dmr = nullptr; -#if defined(ENABLE_DMR) LogInfo("DMR Parameters"); LogInfo(" Enabled: %s", m_dmrEnabled ? "yes" : "no"); if (m_dmrEnabled) { @@ -446,13 +445,11 @@ int Host::run() LogInfo(" Debug: yes"); } } -#endif // defined(ENABLE_DMR) // initialize P25 Timer p25BcastIntervalTimer(1000U); std::unique_ptr p25 = nullptr; -#if defined(ENABLE_P25) LogInfo("P25 Parameters"); LogInfo(" Enabled: %s", m_p25Enabled ? "yes" : "no"); if (m_p25Enabled) { @@ -517,13 +514,11 @@ int Host::run() LogInfo(" Debug: yes"); } } -#endif // defined(ENABLE_P25) // initialize NXDN Timer nxdnBcastIntervalTimer(1000U); std::unique_ptr nxdn = nullptr; -#if defined(ENABLE_NXDN) LogInfo("NXDN Parameters"); LogInfo(" Enabled: %s", m_nxdnEnabled ? "yes" : "no"); if (m_nxdnEnabled) { @@ -581,10 +576,9 @@ int Host::run() LogInfo(" Debug: yes"); } } -#endif // defined(ENABLE_NXDN) if (!m_dmrEnabled && !m_p25Enabled && !m_nxdnEnabled) { - ::LogError(LOG_HOST, "No modes enabled? DMR, P25 and/or NXDN must be enabled!"); + ::LogError(LOG_HOST, "No protocols enabled? DMR, P25 and/or NXDN must be enabled!"); g_killed = true; } @@ -669,38 +663,30 @@ int Host::run() if (!g_killed) { // fixed mode will force a state change if (m_fixedMode) { -#if defined(ENABLE_DMR) if (dmr != nullptr) setState(STATE_DMR); -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) + if (p25 != nullptr) setState(STATE_P25); -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) + if (nxdn != nullptr) setState(STATE_NXDN); -#endif // defined(ENABLE_NXDN) } else { -#if defined(ENABLE_DMR) if (m_dmrCtrlChannel) { m_fixedMode = true; setState(STATE_DMR); } -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) + if (m_p25CtrlChannel) { m_fixedMode = true; setState(STATE_P25); } -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) + if (m_nxdnCtrlChannel) { m_fixedMode = true; setState(STATE_NXDN); } -#endif // defined(ENABLE_NXDN) setState(STATE_IDLE); } @@ -767,7 +753,6 @@ int Host::run() // setup protocol processor threads /** Digital Mobile Radio */ ThreadFunc dmrFrameWriteThread([&, this]() { -#if defined(ENABLE_DMR) if (g_killed) return; @@ -822,14 +807,12 @@ int Host::run() Thread::sleep(m_idleTickDelay); } } -#endif // defined(ENABLE_DMR) }); dmrFrameWriteThread.run(); dmrFrameWriteThread.setName("dmr:frame-w"); /** Project 25 */ ThreadFunc p25FrameWriteThread([&, this]() { -#if defined(ENABLE_P25) if (g_killed) return; @@ -864,14 +847,12 @@ int Host::run() Thread::sleep(m_idleTickDelay); } } -#endif // defined(ENABLE_P25) }); p25FrameWriteThread.run(); p25FrameWriteThread.setName("p25:frame-w"); /** Next Generation Digital Narrowband */ ThreadFunc nxdnFrameWriteThread([&, this]() { -#if defined(ENABLE_NXDN) if (g_killed) return; @@ -906,7 +887,6 @@ int Host::run() Thread::sleep(m_idleTickDelay); } } -#endif // defined(ENABLE_NXDN) }); nxdnFrameWriteThread.run(); nxdnFrameWriteThread.setName("nxdn:frame-w"); @@ -966,7 +946,6 @@ int Host::run() // ------------------------------------------------------ /** Digital Mobile Radio */ -#if defined(ENABLE_DMR) if (dmr != nullptr) { // read DMR slot 1 frames from modem readFramesDMR1(dmr.get(), [&, this]() { @@ -1010,9 +989,8 @@ int Host::run() } }); } -#endif // defined(ENABLE_DMR) + /** Project 25 */ -#if defined(ENABLE_P25) if (p25 != nullptr) { // read P25 frames from modem readFramesP25(p25.get(), [&, this]() { @@ -1028,8 +1006,8 @@ int Host::run() } }); } -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) + + /** Next Generation Digital Narrowband */ if (nxdn != nullptr) { // read NXDN frames from modem readFramesNXDN(nxdn.get(), [&, this]() { @@ -1045,7 +1023,6 @@ int Host::run() } }); } -#endif // defined(ENABLE_NXDN) // ------------------------------------------------------ // -- Network, DMR, and P25 Clocking -- @@ -1054,18 +1031,12 @@ int Host::run() if (m_network != nullptr) m_network->clock(ms); -#if defined(ENABLE_DMR) if (dmr != nullptr) dmr->clock(ms); -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) if (p25 != nullptr) p25->clock(ms); -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) if (nxdn != nullptr) nxdn->clock(ms); -#endif // defined(ENABLE_NXDN) // ------------------------------------------------------ // -- Timer Clocking -- @@ -1123,7 +1094,6 @@ int Host::run() } /** Digial Mobile Radio */ -#if defined(ENABLE_DMR) if (dmr != nullptr) { if (m_dmrTSCCData && m_dmrCtrlChannel) { if (m_state != STATE_DMR) @@ -1189,10 +1159,8 @@ int Host::run() m_dmrTXTimer.stop(); } } -#endif // defined(ENABLE_DMR) /** Project 25 */ -#if defined(ENABLE_P25) if (p25 != nullptr) { if (m_p25CCData) { p25BcastIntervalTimer.clock(ms); @@ -1245,10 +1213,8 @@ int Host::run() } } } -#endif // defined(ENABLE_P25) /** Next Generation Digital Narrowband */ -#if defined(ENABLE_NXDN) if (nxdn != nullptr) { if (m_nxdnCCData) { nxdnBcastIntervalTimer.clock(ms); @@ -1312,7 +1278,6 @@ int Host::run() } } } -#endif // defined(ENABLE_NXDN) if (g_killed) { // shutdown writer threads @@ -1320,7 +1285,6 @@ int Host::run() p25FrameWriteThread.wait(); nxdnFrameWriteThread.wait(); -#if defined(ENABLE_DMR) if (dmr != nullptr) { if (m_dmrCtrlChannel) { if (!hasTxShutdown) { @@ -1335,9 +1299,7 @@ int Host::run() dmrBeaconIntervalTimer.stop(); } } -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) if (p25 != nullptr) { if (m_p25CtrlChannel) { if (!hasTxShutdown) { @@ -1351,9 +1313,7 @@ int Host::run() p25BcastIntervalTimer.stop(); } } -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) if (nxdn != nullptr) { if (m_nxdnCtrlChannel) { if (!hasTxShutdown) { @@ -1367,7 +1327,6 @@ int Host::run() nxdnBcastIntervalTimer.stop(); } } -#endif // defined(ENABLE_NXDN) hasTxShutdown = true; if (!m_modem->hasTX()) { diff --git a/src/host/HostMain.cpp b/src/host/HostMain.cpp index 02b742b9..75b679a0 100644 --- a/src/host/HostMain.cpp +++ b/src/host/HostMain.cpp @@ -50,26 +50,6 @@ using namespace lookups; #include #include -// --------------------------------------------------------------------------- -// Constants -// --------------------------------------------------------------------------- - -#if defined(ENABLE_DMR) -#define DESCR_DMR "DMR, " -#else -#define DESCR_DMR "" -#endif -#if defined(ENABLE_P25) -#define DESCR_P25 "P25, " -#else -#define DESCR_P25 "" -#endif -#if defined(ENABLE_NXDN) -#define DESCR_NXDN "NXDN, " -#else -#define DESCR_NXDN "" -#endif - // --------------------------------------------------------------------------- // Macros // --------------------------------------------------------------------------- @@ -146,7 +126,7 @@ void fatal(const char* msg, ...) /// Error message arguments. void usage(const char* message, const char* arg) { - ::fprintf(stdout, __PROG_NAME__ " %s (" DESCR_DMR DESCR_P25 DESCR_NXDN "CW Id, Network) (built %s)\n", __VER__, __BUILD__); + ::fprintf(stdout, __PROG_NAME__ " %s (built %s)\r\n", __VER__, __BUILD__); ::fprintf(stdout, "Copyright (c) 2017-2024 Bryan Biedenkapp, N2PLL and DVMProject (https://github.com/dvmproject) Authors.\n"); ::fprintf(stdout, "Portions Copyright (c) 2015-2021 by Jonathan Naylor, G4KLX and others\n\n"); if (message != nullptr) { @@ -261,7 +241,7 @@ int checkArgs(int argc, char* argv[]) p += 2; } else if (IS("-v")) { - ::fprintf(stdout, __PROG_NAME__ " %s (" DESCR_DMR DESCR_P25 DESCR_NXDN "CW Id, Network) (built %s)\n", __VER__, __BUILD__); + ::fprintf(stdout, __PROG_NAME__ " %s (built %s)\r\n", __VER__, __BUILD__); ::fprintf(stdout, "Copyright (c) 2017-2024 Bryan Biedenkapp, N2PLL and DVMProject (https://github.com/dvmproject) Authors.\n"); ::fprintf(stdout, "Portions Copyright (c) 2015-2021 by Jonathan Naylor, G4KLX and others\n"); if (argc == 2) diff --git a/src/host/calibrate/HostCal.cpp b/src/host/calibrate/HostCal.cpp index 0146ea9e..7c510746 100644 --- a/src/host/calibrate/HostCal.cpp +++ b/src/host/calibrate/HostCal.cpp @@ -87,7 +87,7 @@ int HostCal::run(int argc, char **argv) return 1; } - ::LogInfo(__PROG_NAME__ " %s (" DESCR_DMR DESCR_P25 DESCR_NXDN "CW Id, Network) (built %s)", __VER__, __BUILD__); + ::LogInfo(__PROG_NAME__ " %s (built %s)", __VER__, __BUILD__); ::LogInfo("Copyright (c) 2017-2024 Bryan Biedenkapp, N2PLL and DVMProject (https://github.com/dvmproject) Authors."); ::LogInfo("Portions Copyright (c) 2015-2021 by Jonathan Naylor, G4KLX and others"); ::LogInfo(">> Modem Calibration"); @@ -646,7 +646,7 @@ int HostCal::run(int argc, char **argv) printStatus(); break; case 'V': - ::LogInfo(__PROG_NAME__ " %s (" DESCR_DMR DESCR_P25 DESCR_NXDN "CW Id, Network) (built %s)", __VER__, __BUILD__); + ::LogInfo(__PROG_NAME__ " %s (built %s)", __VER__, __BUILD__); ::LogInfo("Copyright (c) 2017-2024 Bryan Biedenkapp, N2PLL and DVMProject (https://github.com/dvmproject) Authors."); ::LogInfo("Portions Copyright (c) 2015-2021 by Jonathan Naylor, G4KLX and others"); break; diff --git a/src/host/modem/Modem.cpp b/src/host/modem/Modem.cpp index 9008040b..d967ab5e 100644 --- a/src/host/modem/Modem.cpp +++ b/src/host/modem/Modem.cpp @@ -653,177 +653,177 @@ void Modem::clock(uint32_t ms) /** Digital Mobile Radio */ case CMD_DMR_DATA1: { -#if defined(ENABLE_DMR) - //if (m_trace) - // Utils::dump(1U, "RX DMR Data 1", m_buffer, m_length); + if (m_dmrEnabled) { + //if (m_trace) + // Utils::dump(1U, "RX DMR Data 1", m_buffer, m_length); - if (m_rspDoubleLength) { - LogError(LOG_MODEM, "CMD_DMR_DATA1 double length?; len = %u", m_length); - break; - } + if (m_rspDoubleLength) { + LogError(LOG_MODEM, "CMD_DMR_DATA1 double length?; len = %u", m_length); + break; + } - uint8_t data = m_length - 2U; - m_rxDMRQueue1.addData(&data, 1U); + uint8_t data = m_length - 2U; + m_rxDMRQueue1.addData(&data, 1U); - if (m_buffer[3U] == (dmr::DMR_SYNC_DATA | dmr::DT_TERMINATOR_WITH_LC)) - data = TAG_EOT; - else - data = TAG_DATA; - m_rxDMRQueue1.addData(&data, 1U); + if (m_buffer[3U] == (dmr::DMR_SYNC_DATA | dmr::DT_TERMINATOR_WITH_LC)) + data = TAG_EOT; + else + data = TAG_DATA; + m_rxDMRQueue1.addData(&data, 1U); - m_rxDMRQueue1.addData(m_buffer + 3U, m_length - 3U); -#endif // defined(ENABLE_DMR) + m_rxDMRQueue1.addData(m_buffer + 3U, m_length - 3U); + } } break; case CMD_DMR_DATA2: { -#if defined(ENABLE_DMR) - //if (m_trace) - // Utils::dump(1U, "RX DMR Data 2", m_buffer, m_length); + if (m_dmrEnabled) { + //if (m_trace) + // Utils::dump(1U, "RX DMR Data 2", m_buffer, m_length); - if (m_rspDoubleLength) { - LogError(LOG_MODEM, "CMD_DMR_DATA2 double length?; len = %u", m_length); - break; - } + if (m_rspDoubleLength) { + LogError(LOG_MODEM, "CMD_DMR_DATA2 double length?; len = %u", m_length); + break; + } - uint8_t data = m_length - 2U; - m_rxDMRQueue2.addData(&data, 1U); + uint8_t data = m_length - 2U; + m_rxDMRQueue2.addData(&data, 1U); - if (m_buffer[3U] == (dmr::DMR_SYNC_DATA | dmr::DT_TERMINATOR_WITH_LC)) - data = TAG_EOT; - else - data = TAG_DATA; - m_rxDMRQueue2.addData(&data, 1U); + if (m_buffer[3U] == (dmr::DMR_SYNC_DATA | dmr::DT_TERMINATOR_WITH_LC)) + data = TAG_EOT; + else + data = TAG_DATA; + m_rxDMRQueue2.addData(&data, 1U); - m_rxDMRQueue2.addData(m_buffer + 3U, m_length - 3U); -#endif // defined(ENABLE_DMR) + m_rxDMRQueue2.addData(m_buffer + 3U, m_length - 3U); + } } break; case CMD_DMR_LOST1: { -#if defined(ENABLE_DMR) - //if (m_trace) - // Utils::dump(1U, "RX DMR Lost 1", m_buffer, m_length); + if (m_dmrEnabled) { + //if (m_trace) + // Utils::dump(1U, "RX DMR Lost 1", m_buffer, m_length); - if (m_rspDoubleLength) { - LogError(LOG_MODEM, "CMD_DMR_LOST1 double length?; len = %u", m_length); - break; - } + if (m_rspDoubleLength) { + LogError(LOG_MODEM, "CMD_DMR_LOST1 double length?; len = %u", m_length); + break; + } - uint8_t data = 1U; - m_rxDMRQueue1.addData(&data, 1U); + uint8_t data = 1U; + m_rxDMRQueue1.addData(&data, 1U); - data = TAG_LOST; - m_rxDMRQueue1.addData(&data, 1U); -#endif // defined(ENABLE_DMR) + data = TAG_LOST; + m_rxDMRQueue1.addData(&data, 1U); + } } break; case CMD_DMR_LOST2: { -#if defined(ENABLE_DMR) - //if (m_trace) - // Utils::dump(1U, "RX DMR Lost 2", m_buffer, m_length); + if (m_dmrEnabled) { + //if (m_trace) + // Utils::dump(1U, "RX DMR Lost 2", m_buffer, m_length); - if (m_rspDoubleLength) { - LogError(LOG_MODEM, "CMD_DMR_LOST2 double length?; len = %u", m_length); - break; - } + if (m_rspDoubleLength) { + LogError(LOG_MODEM, "CMD_DMR_LOST2 double length?; len = %u", m_length); + break; + } - uint8_t data = 1U; - m_rxDMRQueue2.addData(&data, 1U); + uint8_t data = 1U; + m_rxDMRQueue2.addData(&data, 1U); - data = TAG_LOST; - m_rxDMRQueue2.addData(&data, 1U); -#endif // defined(ENABLE_DMR) + data = TAG_LOST; + m_rxDMRQueue2.addData(&data, 1U); + } } break; /** Project 25 */ case CMD_P25_DATA: { -#if defined(ENABLE_P25) - //if (m_trace) - // Utils::dump(1U, "RX P25 Data", m_buffer, m_length); + if (m_p25Enabled) { + //if (m_trace) + // Utils::dump(1U, "RX P25 Data", m_buffer, m_length); - if (m_rspDoubleLength) { - LogError(LOG_MODEM, "CMD_P25_DATA double length?; len = %u", m_length); - break; - } + if (m_rspDoubleLength) { + LogError(LOG_MODEM, "CMD_P25_DATA double length?; len = %u", m_length); + break; + } - uint8_t data = m_length - 2U; - m_rxP25Queue.addData(&data, 1U); + uint8_t data = m_length - 2U; + m_rxP25Queue.addData(&data, 1U); - data = TAG_DATA; - m_rxP25Queue.addData(&data, 1U); + data = TAG_DATA; + m_rxP25Queue.addData(&data, 1U); - m_rxP25Queue.addData(m_buffer + 3U, m_length - 3U); -#endif // defined(ENABLE_P25) + m_rxP25Queue.addData(m_buffer + 3U, m_length - 3U); + } } break; case CMD_P25_LOST: { -#if defined(ENABLE_P25) - //if (m_trace) - // Utils::dump(1U, "RX P25 Lost", m_buffer, m_length); + if (m_p25Enabled) { + //if (m_trace) + // Utils::dump(1U, "RX P25 Lost", m_buffer, m_length); - if (m_rspDoubleLength) { - LogError(LOG_MODEM, "CMD_P25_LOST double length?; len = %u", m_length); - break; - } + if (m_rspDoubleLength) { + LogError(LOG_MODEM, "CMD_P25_LOST double length?; len = %u", m_length); + break; + } - uint8_t data = 1U; - m_rxP25Queue.addData(&data, 1U); + uint8_t data = 1U; + m_rxP25Queue.addData(&data, 1U); - data = TAG_LOST; - m_rxP25Queue.addData(&data, 1U); -#endif // defined(ENABLE_P25) + data = TAG_LOST; + m_rxP25Queue.addData(&data, 1U); + } } break; /** Next Generation Digital Narrowband */ case CMD_NXDN_DATA: { -#if defined(ENABLE_NXDN) - //if (m_trace) - // Utils::dump(1U, "RX NXDN Data", m_buffer, m_length); + if (m_nxdnEnabled) { + //if (m_trace) + // Utils::dump(1U, "RX NXDN Data", m_buffer, m_length); - if (m_rspDoubleLength) { - LogError(LOG_MODEM, "CMD_NXDN_DATA double length?; len = %u", m_length); - break; - } + if (m_rspDoubleLength) { + LogError(LOG_MODEM, "CMD_NXDN_DATA double length?; len = %u", m_length); + break; + } - uint8_t data = m_length - 2U; - m_rxNXDNQueue.addData(&data, 1U); + uint8_t data = m_length - 2U; + m_rxNXDNQueue.addData(&data, 1U); - data = TAG_DATA; - m_rxNXDNQueue.addData(&data, 1U); + data = TAG_DATA; + m_rxNXDNQueue.addData(&data, 1U); - m_rxNXDNQueue.addData(m_buffer + 3U, m_length - 3U); -#endif // defined(ENABLE_NXDN) + m_rxNXDNQueue.addData(m_buffer + 3U, m_length - 3U); + } } break; case CMD_NXDN_LOST: { -#if defined(ENABLE_NXDN) - //if (m_trace) - // Utils::dump(1U, "RX NXDN Lost", m_buffer, m_length); + if (m_nxdnEnabled) { + //if (m_trace) + // Utils::dump(1U, "RX NXDN Lost", m_buffer, m_length); - if (m_rspDoubleLength) { - LogError(LOG_MODEM, "CMD_NXDN_LOST double length?; len = %u", m_length); - break; - } + if (m_rspDoubleLength) { + LogError(LOG_MODEM, "CMD_NXDN_LOST double length?; len = %u", m_length); + break; + } - uint8_t data = 1U; - m_rxNXDNQueue.addData(&data, 1U); + uint8_t data = 1U; + m_rxNXDNQueue.addData(&data, 1U); - data = TAG_LOST; - m_rxNXDNQueue.addData(&data, 1U); -#endif // defined(ENABLE_NXDN) + data = TAG_LOST; + m_rxNXDNQueue.addData(&data, 1U); + } } break; @@ -1250,23 +1250,23 @@ void Modem::clearNXDNFrame() /// Length of data to write. void Modem::injectDMRFrame1(const uint8_t* data, uint32_t length) { -#if defined(ENABLE_DMR) assert(data != nullptr); assert(length > 0U); - if (m_trace) - Utils::dump(1U, "Injected DMR Slot 1 Data", data, length); + if (m_dmrEnabled) { + if (m_trace) + Utils::dump(1U, "Injected DMR Slot 1 Data", data, length); - uint8_t val = length; - m_rxDMRQueue1.addData(&val, 1U); + uint8_t val = length; + m_rxDMRQueue1.addData(&val, 1U); - val = TAG_DATA; - m_rxDMRQueue1.addData(&val, 1U); - val = dmr::DMR_SYNC_VOICE & dmr::DMR_SYNC_DATA; // valid sync - m_rxDMRQueue1.addData(&val, 1U); + val = TAG_DATA; + m_rxDMRQueue1.addData(&val, 1U); + val = dmr::DMR_SYNC_VOICE & dmr::DMR_SYNC_DATA; // valid sync + m_rxDMRQueue1.addData(&val, 1U); - m_rxDMRQueue1.addData(data, length); -#endif // defined(ENABLE_DMR) + m_rxDMRQueue1.addData(data, length); + } } /// @@ -1276,23 +1276,23 @@ void Modem::injectDMRFrame1(const uint8_t* data, uint32_t length) /// Length of data to write. void Modem::injectDMRFrame2(const uint8_t* data, uint32_t length) { -#if defined(ENABLE_DMR) assert(data != nullptr); assert(length > 0U); - if (m_trace) - Utils::dump(1U, "Injected DMR Slot 2 Data", data, length); + if (m_dmrEnabled) { + if (m_trace) + Utils::dump(1U, "Injected DMR Slot 2 Data", data, length); - uint8_t val = length; - m_rxDMRQueue2.addData(&val, 1U); + uint8_t val = length; + m_rxDMRQueue2.addData(&val, 1U); - val = TAG_DATA; - m_rxDMRQueue2.addData(&val, 1U); - val = dmr::DMR_SYNC_VOICE & dmr::DMR_SYNC_DATA; // valid sync - m_rxDMRQueue2.addData(&val, 1U); + val = TAG_DATA; + m_rxDMRQueue2.addData(&val, 1U); + val = dmr::DMR_SYNC_VOICE & dmr::DMR_SYNC_DATA; // valid sync + m_rxDMRQueue2.addData(&val, 1U); - m_rxDMRQueue2.addData(data, length); -#endif // defined(ENABLE_DMR) + m_rxDMRQueue2.addData(data, length); + } } /// @@ -1302,23 +1302,23 @@ void Modem::injectDMRFrame2(const uint8_t* data, uint32_t length) /// Length of data to write. void Modem::injectP25Frame(const uint8_t* data, uint32_t length) { -#if defined(ENABLE_P25) assert(data != nullptr); assert(length > 0U); - if (m_trace) - Utils::dump(1U, "Injected P25 Data", data, length); + if (m_p25Enabled) { + if (m_trace) + Utils::dump(1U, "Injected P25 Data", data, length); - uint8_t val = length; - m_rxP25Queue.addData(&val, 1U); + uint8_t val = length; + m_rxP25Queue.addData(&val, 1U); - val = TAG_DATA; - m_rxP25Queue.addData(&val, 1U); - val = 0x01U; // valid sync - m_rxP25Queue.addData(&val, 1U); + val = TAG_DATA; + m_rxP25Queue.addData(&val, 1U); + val = 0x01U; // valid sync + m_rxP25Queue.addData(&val, 1U); - m_rxP25Queue.addData(data, length); -#endif // defined(ENABLE_P25) + m_rxP25Queue.addData(data, length); + } } /// @@ -1328,23 +1328,23 @@ void Modem::injectP25Frame(const uint8_t* data, uint32_t length) /// Length of data to write. void Modem::injectNXDNFrame(const uint8_t* data, uint32_t length) { -#if defined(ENABLE_NXDN) assert(data != nullptr); assert(length > 0U); - if (m_trace) - Utils::dump(1U, "Injected NXDN Data", data, length); + if (m_nxdnEnabled) { + if (m_trace) + Utils::dump(1U, "Injected NXDN Data", data, length); - uint8_t val = length; - m_rxNXDNQueue.addData(&val, 1U); + uint8_t val = length; + m_rxNXDNQueue.addData(&val, 1U); - val = TAG_DATA; - m_rxNXDNQueue.addData(&val, 1U); - val = 0x01U; // valid sync - m_rxNXDNQueue.addData(&val, 1U); + val = TAG_DATA; + m_rxNXDNQueue.addData(&val, 1U); + val = 0x01U; // valid sync + m_rxNXDNQueue.addData(&val, 1U); - m_rxNXDNQueue.addData(data, length); -#endif // defined(ENABLE_NXDN) + m_rxNXDNQueue.addData(data, length); + } } /// @@ -1355,53 +1355,54 @@ void Modem::injectNXDNFrame(const uint8_t* data, uint32_t length) /// True, if data is written, otherwise false. bool Modem::writeDMRFrame1(const uint8_t* data, uint32_t length) { -#if defined(ENABLE_DMR) assert(data != nullptr); assert(length > 0U); - const uint8_t MAX_LENGTH = 40U; + if (m_dmrEnabled) { + const uint8_t MAX_LENGTH = 40U; - if (data[0U] != TAG_DATA && data[0U] != TAG_EOT) - return false; - if (length > MAX_LENGTH) { - LogError(LOG_MODEM, "Modem::writeDMRData1(); request data to write >%u?, len = %u", MAX_LENGTH, length); - Utils::dump(1U, "Modem::writeDMRData1(); Attmpted Data", data, length); - return false; - } + if (data[0U] != TAG_DATA && data[0U] != TAG_EOT) + return false; + if (length > MAX_LENGTH) { + LogError(LOG_MODEM, "Modem::writeDMRData1(); request data to write >%u?, len = %u", MAX_LENGTH, length); + Utils::dump(1U, "Modem::writeDMRData1(); Attmpted Data", data, length); + return false; + } - uint8_t buffer[MAX_LENGTH]; + uint8_t buffer[MAX_LENGTH]; - buffer[0U] = DVM_FRAME_START; - buffer[1U] = length + 2U; - buffer[2U] = CMD_DMR_DATA1; + buffer[0U] = DVM_FRAME_START; + buffer[1U] = length + 2U; + buffer[2U] = CMD_DMR_DATA1; - ::memcpy(buffer + 3U, data + 1U, length - 1U); + ::memcpy(buffer + 3U, data + 1U, length - 1U); - uint8_t len = length + 2U; + uint8_t len = length + 2U; - // write or buffer DMR slot 1 data to air interface - if (m_dmrSpace1 >= length) { - if (m_debug) - LogDebug(LOG_MODEM, "Modem::writeDMRData1(); immediate write (len %u)", length); - //if (m_trace) - // Utils::dump(1U, "Immediate TX DMR Data 1", buffer, len); + // write or buffer DMR slot 1 data to air interface + if (m_dmrSpace1 >= length) { + if (m_debug) + LogDebug(LOG_MODEM, "Modem::writeDMRData1(); immediate write (len %u)", length); + //if (m_trace) + // Utils::dump(1U, "Immediate TX DMR Data 1", buffer, len); - int ret = write(buffer, len); - if (ret != int(len)) { - LogError(LOG_MODEM, "Error writing DMR slot 1 data"); + int ret = write(buffer, len); + if (ret != int(len)) { + LogError(LOG_MODEM, "Error writing DMR slot 1 data"); + return false; + } + + m_dmrSpace1 -= length; + } + else { return false; } - m_dmrSpace1 -= length; - } + return true; + } else { return false; } - - return true; -#else - return false; -#endif // defined(ENABLE_DMR) } /// @@ -1412,53 +1413,54 @@ bool Modem::writeDMRFrame1(const uint8_t* data, uint32_t length) /// True, if data is written, otherwise false. bool Modem::writeDMRFrame2(const uint8_t* data, uint32_t length) { -#if defined(ENABLE_DMR) assert(data != nullptr); assert(length > 0U); - const uint8_t MAX_LENGTH = 40U; + if (m_dmrEnabled) { + const uint8_t MAX_LENGTH = 40U; - if (data[0U] != TAG_DATA && data[0U] != TAG_EOT) - return false; - if (length > MAX_LENGTH) { - LogError(LOG_MODEM, "Modem::writeDMRData2(); request data to write >%u?, len = %u", MAX_LENGTH, length); - Utils::dump(1U, "Modem::writeDMRData2(); Attmpted Data", data, length); - return false; - } + if (data[0U] != TAG_DATA && data[0U] != TAG_EOT) + return false; + if (length > MAX_LENGTH) { + LogError(LOG_MODEM, "Modem::writeDMRData2(); request data to write >%u?, len = %u", MAX_LENGTH, length); + Utils::dump(1U, "Modem::writeDMRData2(); Attmpted Data", data, length); + return false; + } - uint8_t buffer[MAX_LENGTH]; + uint8_t buffer[MAX_LENGTH]; - buffer[0U] = DVM_FRAME_START; - buffer[1U] = length + 2U; - buffer[2U] = CMD_DMR_DATA2; + buffer[0U] = DVM_FRAME_START; + buffer[1U] = length + 2U; + buffer[2U] = CMD_DMR_DATA2; - ::memcpy(buffer + 3U, data + 1U, length - 1U); + ::memcpy(buffer + 3U, data + 1U, length - 1U); - uint8_t len = length + 2U; + uint8_t len = length + 2U; + + // write or buffer DMR slot 2 data to air interface + if (m_dmrSpace2 >= length) { + if (m_debug) + LogDebug(LOG_MODEM, "Modem::writeDMRData2(); immediate write (len %u)", length); + //if (m_trace) + // Utils::dump(1U, "Immediate TX DMR Data 2", buffer, len); - // write or buffer DMR slot 2 data to air interface - if (m_dmrSpace2 >= length) { - if (m_debug) - LogDebug(LOG_MODEM, "Modem::writeDMRData2(); immediate write (len %u)", length); - //if (m_trace) - // Utils::dump(1U, "Immediate TX DMR Data 2", buffer, len); + int ret = write(buffer, len); + if (ret != int(len)) { + LogError(LOG_MODEM, "Error writing DMR slot 2 data"); + return false; + } - int ret = write(buffer, len); - if (ret != int(len)) { - LogError(LOG_MODEM, "Error writing DMR slot 2 data"); + m_dmrSpace2 -= length; + } + else { return false; } - m_dmrSpace2 -= length; + return true; } else { return false; } - - return true; -#else - return false; -#endif // defined(ENABLE_DMR) } /// @@ -1469,53 +1471,54 @@ bool Modem::writeDMRFrame2(const uint8_t* data, uint32_t length) /// True, if data is written, otherwise false. bool Modem::writeP25Frame(const uint8_t* data, uint32_t length) { -#if defined(ENABLE_P25) assert(data != nullptr); assert(length > 0U); - const uint8_t MAX_LENGTH = 250U; + if (m_p25Enabled) { + const uint8_t MAX_LENGTH = 250U; - if (data[0U] != TAG_DATA && data[0U] != TAG_EOT) - return false; - if (length > MAX_LENGTH) { - LogError(LOG_MODEM, "Modem::writeP25Data(); request data to write >%u?, len = %u", MAX_LENGTH, length); - Utils::dump(1U, "Modem::writeP25Data(); Attmpted Data", data, length); - return false; - } + if (data[0U] != TAG_DATA && data[0U] != TAG_EOT) + return false; + if (length > MAX_LENGTH) { + LogError(LOG_MODEM, "Modem::writeP25Data(); request data to write >%u?, len = %u", MAX_LENGTH, length); + Utils::dump(1U, "Modem::writeP25Data(); Attmpted Data", data, length); + return false; + } - uint8_t buffer[MAX_LENGTH]; + uint8_t buffer[MAX_LENGTH]; - buffer[0U] = DVM_FRAME_START; - buffer[1U] = length + 2U; - buffer[2U] = CMD_P25_DATA; + buffer[0U] = DVM_FRAME_START; + buffer[1U] = length + 2U; + buffer[2U] = CMD_P25_DATA; + + ::memcpy(buffer + 3U, data + 1U, length - 1U); - ::memcpy(buffer + 3U, data + 1U, length - 1U); + uint8_t len = length + 2U; - uint8_t len = length + 2U; + // write or buffer P25 data to air interface + if (m_p25Space >= length) { + if (m_debug) + LogDebug(LOG_MODEM, "Modem::writeP25Data(); immediate write (len %u)", length); + //if (m_trace) + // Utils::dump(1U, "Immediate TX P25 Data", buffer, len); - // write or buffer P25 data to air interface - if (m_p25Space >= length) { - if (m_debug) - LogDebug(LOG_MODEM, "Modem::writeP25Data(); immediate write (len %u)", length); - //if (m_trace) - // Utils::dump(1U, "Immediate TX P25 Data", buffer, len); + int ret = write(buffer, len); + if (ret != int(len)) { + LogError(LOG_MODEM, "Error writing P25 data"); + return false; + } - int ret = write(buffer, len); - if (ret != int(len)) { - LogError(LOG_MODEM, "Error writing P25 data"); + m_p25Space -= length; + } + else { return false; } - m_p25Space -= length; + return true; } else { return false; } - - return true; -#else - return false; -#endif // defined(ENABLE_P25) } /// @@ -1526,53 +1529,54 @@ bool Modem::writeP25Frame(const uint8_t* data, uint32_t length) /// True, if data is written, otherwise false. bool Modem::writeNXDNFrame(const uint8_t* data, uint32_t length) { -#if defined(ENABLE_NXDN) assert(data != nullptr); assert(length > 0U); const uint8_t MAX_LENGTH = 250U; - if (data[0U] != TAG_DATA && data[0U] != TAG_EOT) - return false; - if (length > MAX_LENGTH) { - LogError(LOG_MODEM, "Modem::writeNXDNData(); request data to write >%u?, len = %u", MAX_LENGTH, length); - Utils::dump(1U, "Modem::writeNXDNData(); Attmpted Data", data, length); - return false; - } + if (m_nxdnEnabled) { + if (data[0U] != TAG_DATA && data[0U] != TAG_EOT) + return false; + if (length > MAX_LENGTH) { + LogError(LOG_MODEM, "Modem::writeNXDNData(); request data to write >%u?, len = %u", MAX_LENGTH, length); + Utils::dump(1U, "Modem::writeNXDNData(); Attmpted Data", data, length); + return false; + } - uint8_t buffer[MAX_LENGTH]; + uint8_t buffer[MAX_LENGTH]; - buffer[0U] = DVM_FRAME_START; - buffer[1U] = length + 2U; - buffer[2U] = CMD_NXDN_DATA; + buffer[0U] = DVM_FRAME_START; + buffer[1U] = length + 2U; + buffer[2U] = CMD_NXDN_DATA; - ::memcpy(buffer + 3U, data + 1U, length - 1U); + ::memcpy(buffer + 3U, data + 1U, length - 1U); - uint8_t len = length + 2U; + uint8_t len = length + 2U; + + // write or buffer NXDN data to air interface + if (m_nxdnSpace >= length) { + if (m_debug) + LogDebug(LOG_MODEM, "Modem::writeNXDNData(); immediate write (len %u)", length); + //if (m_trace) + // Utils::dump(1U, "Immediate TX NXDN Data", buffer, len); - // write or buffer NXDN data to air interface - if (m_nxdnSpace >= length) { - if (m_debug) - LogDebug(LOG_MODEM, "Modem::writeNXDNData(); immediate write (len %u)", length); - //if (m_trace) - // Utils::dump(1U, "Immediate TX NXDN Data", buffer, len); + int ret = write(buffer, len); + if (ret != int(len)) { + LogError(LOG_MODEM, "Error writing NXDN data"); + return false; + } - int ret = write(buffer, len); - if (ret != int(len)) { - LogError(LOG_MODEM, "Error writing NXDN data"); + m_nxdnSpace -= length; + } + else { return false; } - m_nxdnSpace -= length; + return true; } else { return false; } - - return true; -#else - return false; -#endif // defined(ENABLE_NXDN) } /// @@ -1582,25 +1586,26 @@ bool Modem::writeNXDNFrame(const uint8_t* data, uint32_t length) /// True, if DMR transmit started, otherwise false. bool Modem::writeDMRStart(bool tx) { -#if defined(ENABLE_DMR) - if (tx && m_tx) - return true; - if (!tx && !m_tx) - return true; + if (m_dmrEnabled) { + if (tx && m_tx) + return true; + if (!tx && !m_tx) + return true; - uint8_t buffer[4U]; + uint8_t buffer[4U]; - buffer[0U] = DVM_FRAME_START; - buffer[1U] = 4U; - buffer[2U] = CMD_DMR_START; - buffer[3U] = tx ? 0x01U : 0x00U; + buffer[0U] = DVM_FRAME_START; + buffer[1U] = 4U; + buffer[2U] = CMD_DMR_START; + buffer[3U] = tx ? 0x01U : 0x00U; #if DEBUG_MODEM - Utils::dump(1U, "Modem::writeDMRStart(), Written", buffer, 4U); + Utils::dump(1U, "Modem::writeDMRStart(), Written", buffer, 4U); #endif - return write(buffer, 4U) == 4; -#else - return false; -#endif // defined(ENABLE_DMR) + return write(buffer, 4U) == 4; + } + else { + return false; + } } /// @@ -1610,30 +1615,31 @@ bool Modem::writeDMRStart(bool tx) /// True, if DMR LC is written, otherwise false. bool Modem::writeDMRShortLC(const uint8_t* lc) { -#if defined(ENABLE_DMR) assert(lc != nullptr); - uint8_t buffer[12U]; + if (m_dmrEnabled) { + uint8_t buffer[12U]; - buffer[0U] = DVM_FRAME_START; - buffer[1U] = 12U; - buffer[2U] = CMD_DMR_SHORTLC; - buffer[3U] = lc[0U]; - buffer[4U] = lc[1U]; - buffer[5U] = lc[2U]; - buffer[6U] = lc[3U]; - buffer[7U] = lc[4U]; - buffer[8U] = lc[5U]; - buffer[9U] = lc[6U]; - buffer[10U] = lc[7U]; - buffer[11U] = lc[8U]; + buffer[0U] = DVM_FRAME_START; + buffer[1U] = 12U; + buffer[2U] = CMD_DMR_SHORTLC; + buffer[3U] = lc[0U]; + buffer[4U] = lc[1U]; + buffer[5U] = lc[2U]; + buffer[6U] = lc[3U]; + buffer[7U] = lc[4U]; + buffer[8U] = lc[5U]; + buffer[9U] = lc[6U]; + buffer[10U] = lc[7U]; + buffer[11U] = lc[8U]; #if DEBUG_MODEM - Utils::dump(1U, "Modem::writeDMRShortLC(), Written", buffer, 12U); + Utils::dump(1U, "Modem::writeDMRShortLC(), Written", buffer, 12U); #endif - return write(buffer, 12U) == 12; -#else - return false; -#endif // defined(ENABLE_DMR) + return write(buffer, 12U) == 12; + } + else { + return false; + } } /// @@ -1643,20 +1649,21 @@ bool Modem::writeDMRShortLC(const uint8_t* lc) /// True, if DMR abort is written, otherwise false. bool Modem::writeDMRAbort(uint32_t slotNo) { -#if defined(ENABLE_DMR) - uint8_t buffer[4U]; + if (m_dmrEnabled) { + uint8_t buffer[4U]; - buffer[0U] = DVM_FRAME_START; - buffer[1U] = 4U; - buffer[2U] = CMD_DMR_ABORT; - buffer[3U] = slotNo; + buffer[0U] = DVM_FRAME_START; + buffer[1U] = 4U; + buffer[2U] = CMD_DMR_ABORT; + buffer[3U] = slotNo; #if DEBUG_MODEM - Utils::dump(1U, "Modem::writeDMRAbort(), Written", buffer, 4U); + Utils::dump(1U, "Modem::writeDMRAbort(), Written", buffer, 4U); #endif - return write(buffer, 4U) == 4; -#else - return false; -#endif // defined(ENABLE_DMR) + return write(buffer, 4U) == 4; + } + else { + return false; + } } /// @@ -1666,27 +1673,28 @@ bool Modem::writeDMRAbort(uint32_t slotNo) /// True, if set flag is written, otherwise false. bool Modem::setDMRIgnoreCACH_AT(uint8_t slotNo) { -#if defined(ENABLE_DMR) - uint8_t buffer[4U]; + if (m_dmrEnabled) { + uint8_t buffer[4U]; - buffer[0U] = DVM_FRAME_START; - buffer[1U] = 4U; - buffer[2U] = CMD_DMR_CACH_AT_CTRL; - buffer[3U] = slotNo; + buffer[0U] = DVM_FRAME_START; + buffer[1U] = 4U; + buffer[2U] = CMD_DMR_CACH_AT_CTRL; + buffer[3U] = slotNo; - // are we on a protocol version 3 firmware? - if (m_protoVer >= 3U) { + // are we on a protocol version 3 firmware? + if (m_protoVer >= 3U) { #if DEBUG_MODEM - Utils::dump(1U, "Modem::setDMRIgnoreCACH_AT(), Written", buffer, 4U); + Utils::dump(1U, "Modem::setDMRIgnoreCACH_AT(), Written", buffer, 4U); #endif - return write(buffer, 4U) == 4; - } else { - LogWarning(LOG_MODEM, "Modem::setDMRIgnoreCACH_AT(), ignoring CACH AT for slot %u is not supported on this modem!", slotNo); + return write(buffer, 4U) == 4; + } else { + LogWarning(LOG_MODEM, "Modem::setDMRIgnoreCACH_AT(), ignoring CACH AT for slot %u is not supported on this modem!", slotNo); + return false; + } + } + else { return false; } -#else - return false; -#endif // defined(ENABLE_DMR) } /// @@ -1911,14 +1919,10 @@ bool Modem::writeConfig() if (m_cosLockout) buffer[4U] |= 0x04U; -#if defined(ENABLE_DMR) if (m_dmrEnabled) buffer[4U] |= 0x02U; -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) if (m_p25Enabled) buffer[4U] |= 0x08U; -#endif // defined(ENABLE_P25) if (m_fdmaPreamble > MAX_FDMA_PREAMBLE) { LogWarning(LOG_P25, "oversized FDMA preamble count, reducing to maximum %u", MAX_FDMA_PREAMBLE); @@ -1952,10 +1956,8 @@ bool Modem::writeConfig() if (m_protoVer >= 3U) { lengthToWrite = 24U; -#if defined(ENABLE_NXDN) if (m_nxdnEnabled) buffer[4U] |= 0x10U; -#endif // defined(ENABLE_NXDN) buffer[18U] = (uint8_t)(m_nxdnTXLevel * 2.55F + 0.5F); diff --git a/src/host/network/Network.cpp b/src/host/network/Network.cpp index 71340fa3..e2e133bf 100644 --- a/src/host/network/Network.cpp +++ b/src/host/network/Network.cpp @@ -301,7 +301,6 @@ void Network::clock(uint32_t ms) case NET_FUNC_PROTOCOL: { if (fneHeader.getSubFunction() == NET_PROTOCOL_SUBFUNC_DMR) { // Encapsulated DMR data frame -#if defined(ENABLE_DMR) if (m_enabled && m_dmrEnabled) { uint32_t slotNo = (buffer[15U] & 0x80U) == 0x80U ? 2U : 1U; if (m_rxDMRStreamId[slotNo] == 0U) { @@ -327,10 +326,8 @@ void Network::clock(uint32_t ms) m_rxDMRData.addData(&len, 1U); m_rxDMRData.addData(buffer.get(), len); } -#endif // defined(ENABLE_DMR) } else if (fneHeader.getSubFunction() == NET_PROTOCOL_SUBFUNC_P25) { // Encapsulated P25 data frame -#if defined(ENABLE_P25) if (m_enabled && m_p25Enabled) { if (m_rxP25StreamId == 0U) { m_rxP25StreamId = streamId; @@ -355,10 +352,8 @@ void Network::clock(uint32_t ms) m_rxP25Data.addData(&len, 1U); m_rxP25Data.addData(buffer.get(), len); } -#endif // defined(ENABLE_P25) } else if (fneHeader.getSubFunction() == NET_PROTOCOL_SUBFUNC_NXDN) { // Encapsulated NXDN data frame -#if defined(ENABLE_NXDN) if (m_enabled && m_nxdnEnabled) { if (m_rxNXDNStreamId == 0U) { m_rxNXDNStreamId = streamId; @@ -383,7 +378,6 @@ void Network::clock(uint32_t ms) m_rxNXDNData.addData(&len, 1U); m_rxNXDNData.addData(buffer.get(), len); } -#endif // defined(ENABLE_NXDN) } else { Utils::dump("Unknown protocol opcode from the master", buffer.get(), length); diff --git a/src/host/network/RESTAPI.cpp b/src/host/network/RESTAPI.cpp index 47f0de8f..12d8515a 100644 --- a/src/host/network/RESTAPI.cpp +++ b/src/host/network/RESTAPI.cpp @@ -468,7 +468,7 @@ void RESTAPI::restAPI_GetVersion(const HTTPPayload& request, HTTPPayload& reply, json::object response = json::object(); setResponseDefaultStatus(response); - response["version"].set(std::string((__PROG_NAME__ " " __VER__ " (" DESCR_DMR DESCR_P25 DESCR_NXDN "CW Id, Network) (built " __BUILD__ ")"))); + response["version"].set(std::string((__PROG_NAME__ " " __VER__ " (built " __BUILD__ ")"))); reply.payload(response); } @@ -704,7 +704,6 @@ void RESTAPI::restAPI_PutModemMode(const HTTPPayload& request, HTTPPayload& repl reply.payload(response); } -#if defined(ENABLE_DMR) else if (mode == MODE_OPT_FDMR) { if (m_dmr != nullptr) { m_host->m_fixedMode = true; @@ -720,8 +719,6 @@ void RESTAPI::restAPI_PutModemMode(const HTTPPayload& request, HTTPPayload& repl errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) else if (mode == MODE_OPT_FP25) { if (m_p25 != nullptr) { m_host->m_fixedMode = true; @@ -737,8 +734,6 @@ void RESTAPI::restAPI_PutModemMode(const HTTPPayload& request, HTTPPayload& repl errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) else if (mode == MODE_OPT_FNXDN) { if (m_nxdn != nullptr) { m_host->m_fixedMode = true; @@ -754,7 +749,6 @@ void RESTAPI::restAPI_PutModemMode(const HTTPPayload& request, HTTPPayload& repl errorPayload(reply, "NXDN mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#endif // defined(ENABLE_NXDN) else { errorPayload(reply, "invalid mode"); } @@ -837,7 +831,6 @@ void RESTAPI::restAPI_PutSetSupervisor(const HTTPPayload& request, HTTPPayload& switch (state) { case STATE_DMR: -#if defined(ENABLE_DMR) { if (m_dmr != nullptr) { m_dmr->setSupervisor(enable); @@ -846,14 +839,8 @@ void RESTAPI::restAPI_PutSetSupervisor(const HTTPPayload& request, HTTPPayload& errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "DMR operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_DMR) break; case STATE_P25: -#if defined(ENABLE_P25) { if (m_p25 != nullptr) { m_p25->setSupervisor(enable); @@ -862,14 +849,8 @@ void RESTAPI::restAPI_PutSetSupervisor(const HTTPPayload& request, HTTPPayload& errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "P25 operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_P25) break; case STATE_NXDN: -#if defined(ENABLE_NXDN) { if (m_nxdn != nullptr) { m_nxdn->setSupervisor(enable); @@ -878,11 +859,6 @@ void RESTAPI::restAPI_PutSetSupervisor(const HTTPPayload& request, HTTPPayload& errorPayload(reply, "NXDN mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "NXDN operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_NXDN) break; default: errorPayload(reply, "invalid mode"); @@ -932,7 +908,6 @@ void RESTAPI::restAPI_PutPermitTG(const HTTPPayload& request, HTTPPayload& reply switch (state) { case STATE_DMR: -#if defined(ENABLE_DMR) { // validate slot is a integer within the JSON blob if (!req["slot"].is()) { @@ -954,14 +929,8 @@ void RESTAPI::restAPI_PutPermitTG(const HTTPPayload& request, HTTPPayload& reply errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "DMR operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_DMR) break; case STATE_P25: -#if defined(ENABLE_P25) { if (m_p25 != nullptr) { m_p25->permittedTG(dstId); @@ -970,14 +939,8 @@ void RESTAPI::restAPI_PutPermitTG(const HTTPPayload& request, HTTPPayload& reply errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "P25 operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_P25) break; case STATE_NXDN: -#if defined(ENABLE_NXDN) { if (m_nxdn != nullptr) { m_nxdn->permittedTG(dstId); @@ -986,11 +949,6 @@ void RESTAPI::restAPI_PutPermitTG(const HTTPPayload& request, HTTPPayload& reply errorPayload(reply, "NXDN mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "NXDN operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_NXDN) break; default: errorPayload(reply, "invalid mode"); @@ -1064,7 +1022,6 @@ void RESTAPI::restAPI_PutGrantTG(const HTTPPayload& request, HTTPPayload& reply, switch (state) { case STATE_DMR: -#if defined(ENABLE_DMR) { // validate slot is a integer within the JSON blob if (!req["slot"].is()) { @@ -1086,14 +1043,8 @@ void RESTAPI::restAPI_PutGrantTG(const HTTPPayload& request, HTTPPayload& reply, errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "DMR operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_DMR) break; case STATE_P25: -#if defined(ENABLE_P25) { if (m_p25 != nullptr) { m_p25->grantTG(srcId, dstId, !unitToUnit); @@ -1102,14 +1053,8 @@ void RESTAPI::restAPI_PutGrantTG(const HTTPPayload& request, HTTPPayload& reply, errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "P25 operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_P25) break; case STATE_NXDN: -#if defined(ENABLE_NXDN) { if (m_nxdn != nullptr) { m_nxdn->grantTG(srcId, dstId, !unitToUnit); @@ -1118,11 +1063,6 @@ void RESTAPI::restAPI_PutGrantTG(const HTTPPayload& request, HTTPPayload& reply, errorPayload(reply, "NXDN mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "NXDN operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_NXDN) break; default: errorPayload(reply, "invalid mode"); @@ -1142,21 +1082,17 @@ void RESTAPI::restAPI_GetReleaseGrants(const HTTPPayload& request, HTTPPayload& } errorPayload(reply, "OK", HTTPPayload::OK); -#if defined(ENABLE_DMR) if (m_dmr != nullptr) { m_dmr->affiliations().releaseGrant(0, true); } -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) + if (m_p25 != nullptr) { m_p25->affiliations().releaseGrant(0, true); } -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) + if (m_nxdn != nullptr) { m_nxdn->affiliations().releaseGrant(0, true); } -#endif // defined(ENABLE_NXDN) } /// @@ -1172,21 +1108,17 @@ void RESTAPI::restAPI_GetReleaseAffs(const HTTPPayload& request, HTTPPayload& re } errorPayload(reply, "OK", HTTPPayload::OK); -#if defined(ENABLE_DMR) if (m_dmr != nullptr) { m_dmr->affiliations().clearGroupAff(0, true); } -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) + if (m_p25 != nullptr) { m_p25->affiliations().clearGroupAff(0, true); } -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) + if (m_nxdn != nullptr) { m_nxdn->affiliations().clearGroupAff(0, true); } -#endif // defined(ENABLE_NXDN) } /// @@ -1238,7 +1170,6 @@ void RESTAPI::restAPI_PutReleaseGrant(const HTTPPayload& request, HTTPPayload& r switch (state) { case STATE_DMR: -#if defined(ENABLE_DMR) { // validate slot is a integer within the JSON blob if (!req["slot"].is()) { @@ -1260,14 +1191,8 @@ void RESTAPI::restAPI_PutReleaseGrant(const HTTPPayload& request, HTTPPayload& r errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "DMR operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_DMR) break; case STATE_P25: -#if defined(ENABLE_P25) { if (m_p25 != nullptr) { m_p25->releaseGrantTG(dstId); @@ -1276,14 +1201,8 @@ void RESTAPI::restAPI_PutReleaseGrant(const HTTPPayload& request, HTTPPayload& r errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "P25 operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_P25) break; case STATE_NXDN: -#if defined(ENABLE_NXDN) { if (m_nxdn != nullptr) { m_nxdn->releaseGrantTG(dstId); @@ -1292,11 +1211,6 @@ void RESTAPI::restAPI_PutReleaseGrant(const HTTPPayload& request, HTTPPayload& r errorPayload(reply, "NXDN mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "NXDN operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_NXDN) break; default: errorPayload(reply, "invalid mode"); @@ -1352,7 +1266,6 @@ void RESTAPI::restAPI_PutTouchGrant(const HTTPPayload& request, HTTPPayload& rep switch (state) { case STATE_DMR: -#if defined(ENABLE_DMR) { // validate slot is a integer within the JSON blob if (!req["slot"].is()) { @@ -1374,14 +1287,8 @@ void RESTAPI::restAPI_PutTouchGrant(const HTTPPayload& request, HTTPPayload& rep errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "DMR operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_DMR) break; case STATE_P25: -#if defined(ENABLE_P25) { if (m_p25 != nullptr) { m_p25->touchGrantTG(dstId); @@ -1390,14 +1297,8 @@ void RESTAPI::restAPI_PutTouchGrant(const HTTPPayload& request, HTTPPayload& rep errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "P25 operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_P25) break; case STATE_NXDN: -#if defined(ENABLE_NXDN) { if (m_nxdn != nullptr) { m_nxdn->touchGrantTG(dstId); @@ -1406,11 +1307,6 @@ void RESTAPI::restAPI_PutTouchGrant(const HTTPPayload& request, HTTPPayload& rep errorPayload(reply, "NXDN mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); } } -#else - { - errorPayload(reply, "NXDN operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); - } -#endif // defined(ENABLE_NXDN) break; default: errorPayload(reply, "invalid mode"); @@ -1490,7 +1386,6 @@ void RESTAPI::restAPI_GetAffList(const HTTPPayload& request, HTTPPayload& reply, std::unordered_map globalAffTable = std::unordered_map(); -#if defined(ENABLE_DMR) if (m_dmr != nullptr) { std::unordered_map affTable = m_dmr->affiliations().grpAffTable(); for (auto entry : affTable) { @@ -1504,8 +1399,7 @@ void RESTAPI::restAPI_GetAffList(const HTTPPayload& request, HTTPPayload& reply, } } } -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) + if (m_p25 != nullptr) { std::unordered_map affTable = m_p25->affiliations().grpAffTable(); for (auto entry : affTable) { @@ -1519,8 +1413,7 @@ void RESTAPI::restAPI_GetAffList(const HTTPPayload& request, HTTPPayload& reply, } } } -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) + if (m_nxdn != nullptr) { std::unordered_map affTable = m_nxdn->affiliations().grpAffTable(); for (auto entry : affTable) { @@ -1534,7 +1427,6 @@ void RESTAPI::restAPI_GetAffList(const HTTPPayload& request, HTTPPayload& reply, } } } -#endif // defined(ENABLE_NXDN) json::array affs = json::array(); if (globalAffTable.size() > 0) { @@ -1570,7 +1462,6 @@ void RESTAPI::restAPI_GetDMRBeacon(const HTTPPayload& request, HTTPPayload& repl return; } -#if defined(ENABLE_DMR) errorPayload(reply, "OK", HTTPPayload::OK); if (m_dmr != nullptr) { if (m_host->m_dmrBeacons) { @@ -1585,9 +1476,6 @@ void RESTAPI::restAPI_GetDMRBeacon(const HTTPPayload& request, HTTPPayload& repl errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "DMR operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_DMR) } /// @@ -1604,7 +1492,7 @@ void RESTAPI::restAPI_GetDMRDebug(const HTTPPayload& request, HTTPPayload& reply json::object response = json::object(); setResponseDefaultStatus(response); -#if defined(ENABLE_DMR) + errorPayload(reply, "OK", HTTPPayload::OK); if (m_dmr != nullptr) { if (match.size() <= 1) { @@ -1629,9 +1517,6 @@ void RESTAPI::restAPI_GetDMRDebug(const HTTPPayload& request, HTTPPayload& reply errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "DMR operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_DMR) } /// @@ -1648,7 +1533,7 @@ void RESTAPI::restAPI_GetDMRDumpCSBK(const HTTPPayload& request, HTTPPayload& re json::object response = json::object(); setResponseDefaultStatus(response); -#if defined(ENABLE_DMR) + errorPayload(reply, "OK", HTTPPayload::OK); if (m_dmr != nullptr) { if (match.size() <= 1) { @@ -1670,9 +1555,6 @@ void RESTAPI::restAPI_GetDMRDumpCSBK(const HTTPPayload& request, HTTPPayload& re errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "DMR operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_DMR) } /// @@ -1691,7 +1573,7 @@ void RESTAPI::restAPI_PutDMRRID(const HTTPPayload& request, HTTPPayload& reply, if (!parseRequestBody(request, reply, req)) { return; } -#if defined(ENABLE_DMR) + if (m_dmr == nullptr) { errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; @@ -1746,9 +1628,6 @@ void RESTAPI::restAPI_PutDMRRID(const HTTPPayload& request, HTTPPayload& reply, errorPayload(reply, "invalid command"); return; } -#else - errorPayload(reply, "DMR operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_DMR) } /// @@ -1762,7 +1641,7 @@ void RESTAPI::restAPI_GetDMRCCEnable(const HTTPPayload& request, HTTPPayload& re if (!validateAuth(request, reply)) { return; } -#if defined(ENABLE_DMR) + errorPayload(reply, "OK", HTTPPayload::OK); if (m_dmr != nullptr) { if (m_host->m_dmrTSCCData) { @@ -1786,9 +1665,6 @@ void RESTAPI::restAPI_GetDMRCCEnable(const HTTPPayload& request, HTTPPayload& re errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "DMR operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_DMR) } /// @@ -1802,7 +1678,7 @@ void RESTAPI::restAPI_GetDMRCCBroadcast(const HTTPPayload& request, HTTPPayload& if (!validateAuth(request, reply)) { return; } -#if defined(ENABLE_DMR) + errorPayload(reply, "OK", HTTPPayload::OK); if (m_dmr != nullptr) { m_host->m_dmrTSCCData = !m_host->m_dmrTSCCData; @@ -1812,9 +1688,6 @@ void RESTAPI::restAPI_GetDMRCCBroadcast(const HTTPPayload& request, HTTPPayload& errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "DMR operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_DMR) } /// @@ -1833,7 +1706,7 @@ void RESTAPI::restAPI_PutTSCCPayloadActivate(const HTTPPayload& request, HTTPPay if (!parseRequestBody(request, reply, req)) { return; } -#if defined(ENABLE_DMR) + if (m_dmr == nullptr) { errorPayload(reply, "DMR mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; @@ -1900,9 +1773,6 @@ void RESTAPI::restAPI_PutTSCCPayloadActivate(const HTTPPayload& request, HTTPPay m_dmr->tsccActivateSlot(slot, dstId, srcId, group, voice); } -#else - errorPayload(reply, "DMR operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_DMR) } /* @@ -1921,7 +1791,6 @@ void RESTAPI::restAPI_GetP25CC(const HTTPPayload& request, HTTPPayload& reply, c return; } -#if defined(ENABLE_P25) errorPayload(reply, "OK", HTTPPayload::OK); if (m_p25 != nullptr) { if (m_host->m_p25CCData) { @@ -1936,9 +1805,6 @@ void RESTAPI::restAPI_GetP25CC(const HTTPPayload& request, HTTPPayload& reply, c errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "P25 operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_P25) } /// @@ -1955,7 +1821,7 @@ void RESTAPI::restAPI_GetP25Debug(const HTTPPayload& request, HTTPPayload& reply json::object response = json::object(); setResponseDefaultStatus(response); -#if defined(ENABLE_P25) + errorPayload(reply, "OK", HTTPPayload::OK); if (m_dmr != nullptr) { if (match.size() <= 1) { @@ -1980,9 +1846,6 @@ void RESTAPI::restAPI_GetP25Debug(const HTTPPayload& request, HTTPPayload& reply errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "P25 operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_P25) } /// @@ -1999,7 +1862,7 @@ void RESTAPI::restAPI_GetP25DumpTSBK(const HTTPPayload& request, HTTPPayload& re json::object response = json::object(); setResponseDefaultStatus(response); -#if defined(ENABLE_P25) + errorPayload(reply, "OK", HTTPPayload::OK); if (m_p25 != nullptr) { if (match.size() <= 1) { @@ -2021,9 +1884,6 @@ void RESTAPI::restAPI_GetP25DumpTSBK(const HTTPPayload& request, HTTPPayload& re errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "P25 operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_P25) } /// @@ -2042,7 +1902,7 @@ void RESTAPI::restAPI_PutP25RID(const HTTPPayload& request, HTTPPayload& reply, if (!parseRequestBody(request, reply, req)) { return; } -#if defined(ENABLE_P25) + if (m_p25 == nullptr) { errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; @@ -2122,9 +1982,6 @@ void RESTAPI::restAPI_PutP25RID(const HTTPPayload& request, HTTPPayload& reply, errorPayload(reply, "invalid command"); return; } -#else - errorPayload(reply, "P25 operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_P25) } /// @@ -2138,7 +1995,7 @@ void RESTAPI::restAPI_GetP25CCEnable(const HTTPPayload& request, HTTPPayload& re if (!validateAuth(request, reply)) { return; } -#if defined(ENABLE_P25) + errorPayload(reply, "OK", HTTPPayload::OK); if (m_p25 != nullptr) { if (m_host->m_p25CCData) { @@ -2167,9 +2024,6 @@ void RESTAPI::restAPI_GetP25CCEnable(const HTTPPayload& request, HTTPPayload& re errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "P25 operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_P25) } /// @@ -2183,7 +2037,7 @@ void RESTAPI::restAPI_GetP25CCBroadcast(const HTTPPayload& request, HTTPPayload& if (!validateAuth(request, reply)) { return; } -#if defined(ENABLE_P25) + errorPayload(reply, "OK", HTTPPayload::OK); if (m_p25 != nullptr) { if (m_host->m_p25CCData) { @@ -2208,9 +2062,6 @@ void RESTAPI::restAPI_GetP25CCBroadcast(const HTTPPayload& request, HTTPPayload& errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "P25 operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_P25) } /// @@ -2229,7 +2080,7 @@ void RESTAPI::restAPI_PutP25RawTSBK(const HTTPPayload& request, HTTPPayload& rep if (!parseRequestBody(request, reply, req)) { return; } -#if defined(ENABLE_P25) + if (m_p25 == nullptr) { errorPayload(reply, "P25 mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; @@ -2268,9 +2119,6 @@ void RESTAPI::restAPI_PutP25RawTSBK(const HTTPPayload& request, HTTPPayload& rep } m_p25->control()->writeRF_TSDU_Raw(tsbk); -#else - errorPayload(reply, "P25 operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_P25) } /* @@ -2289,7 +2137,6 @@ void RESTAPI::restAPI_GetNXDNCC(const HTTPPayload& request, HTTPPayload& reply, return; } -#if defined(ENABLE_NXDN) errorPayload(reply, "OK", HTTPPayload::OK); if (m_nxdn != nullptr) { if (m_host->m_nxdnCCData) { @@ -2304,9 +2151,6 @@ void RESTAPI::restAPI_GetNXDNCC(const HTTPPayload& request, HTTPPayload& reply, errorPayload(reply, "NXDN mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "NXDN operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_NXDN) } /// @@ -2323,7 +2167,7 @@ void RESTAPI::restAPI_GetNXDNDebug(const HTTPPayload& request, HTTPPayload& repl json::object response = json::object(); setResponseDefaultStatus(response); -#if defined(ENABLE_NXDN) + errorPayload(reply, "OK", HTTPPayload::OK); if (m_dmr != nullptr) { if (match.size() <= 1) { @@ -2348,9 +2192,6 @@ void RESTAPI::restAPI_GetNXDNDebug(const HTTPPayload& request, HTTPPayload& repl errorPayload(reply, "NXDN mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "NXDN operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_NXDN) } /// @@ -2367,7 +2208,7 @@ void RESTAPI::restAPI_GetNXDNDumpRCCH(const HTTPPayload& request, HTTPPayload& r json::object response = json::object(); setResponseDefaultStatus(response); -#if defined(ENABLE_NXDN) + errorPayload(reply, "OK", HTTPPayload::OK); if (m_p25 != nullptr) { if (match.size() <= 1) { @@ -2389,9 +2230,6 @@ void RESTAPI::restAPI_GetNXDNDumpRCCH(const HTTPPayload& request, HTTPPayload& r errorPayload(reply, "NXDN mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "NXDN operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_NXDN) } /// @@ -2405,7 +2243,7 @@ void RESTAPI::restAPI_GetNXDNCCEnable(const HTTPPayload& request, HTTPPayload& r if (!validateAuth(request, reply)) { return; } -#if defined(ENABLE_NXDN) + errorPayload(reply, "OK", HTTPPayload::OK); if (m_nxdn != nullptr) { if (m_host->m_nxdnCCData) { @@ -2434,7 +2272,4 @@ void RESTAPI::restAPI_GetNXDNCCEnable(const HTTPPayload& request, HTTPPayload& r errorPayload(reply, "NXDN mode is not enabled", HTTPPayload::SERVICE_UNAVAILABLE); return; } -#else - errorPayload(reply, "NXDN operations are unavailable", HTTPPayload::SERVICE_UNAVAILABLE); -#endif // defined(ENABLE_NXDN) } diff --git a/src/host/setup/HostSetup.cpp b/src/host/setup/HostSetup.cpp index 1233c3d4..7a553c57 100644 --- a/src/host/setup/HostSetup.cpp +++ b/src/host/setup/HostSetup.cpp @@ -196,7 +196,7 @@ int HostSetup::run(int argc, char** argv) return 1; } - ::LogInfo(__PROG_NAME__ " %s (" DESCR_DMR DESCR_P25 DESCR_NXDN "CW Id, Network) (built %s)", __VER__, __BUILD__); + ::LogInfo(__PROG_NAME__ " %s (built %s)", __VER__, __BUILD__); ::LogInfo("Copyright (c) 2017-2024 Bryan Biedenkapp, N2PLL and DVMProject (https://github.com/dvmproject) Authors."); ::LogInfo("Portions Copyright (c) 2015-2021 by Jonathan Naylor, G4KLX and others"); ::LogInfo(">> Modem Setup"); diff --git a/src/host/setup/SiteParamSetWnd.h b/src/host/setup/SiteParamSetWnd.h index e229707f..633ecf47 100644 --- a/src/host/setup/SiteParamSetWnd.h +++ b/src/host/setup/SiteParamSetWnd.h @@ -61,33 +61,23 @@ private: FLabel m_cwTimeLabel{"CW Interval: ", this}; FSpinBox m_cwTime{this}; -#if defined(ENABLE_DMR) FLabel m_dmrColorCodeLabel{"DMR CC: ", this}; FSpinBox m_dmrColorCode{this}; -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) FLabel m_p25NACLabel{"P25 NAC: ", this}; FLineEdit m_p25NAC{this}; -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) FLabel m_nxdnRANLabel{"NXDN RAN: ", this}; FSpinBox m_nxdnRAN{this}; -#endif // defined(ENABLE_NXDN) FLabel m_siteIdLabel{"Site ID: ", this}; FLineEdit m_siteId{this}; -#if defined(ENABLE_DMR) FLabel m_dmrNetIdLabel{"DMR Net. ID: ", this}; FLineEdit m_dmrNetId{this}; -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) FLabel m_p25NetIdLabel{"P25 Net. ID: ", this}; FLineEdit m_p25NetId{this}; FLabel m_p25SysIdLabel{"P25 System ID: ", this}; FLineEdit m_p25SysId{this}; FLabel m_p25RfssIdLabel{"P25 RFSS ID: ", this}; FLineEdit m_p25RfssId{this}; -#endif // defined(ENABLE_P25) /// /// @@ -149,7 +139,6 @@ private: m_siteParams.setEmphasis(); m_siteParams.setAlignment(Align::Center); -#if defined(ENABLE_DMR) uint32_t dmrColorCode = rfssConfig["colorCode"].as(2U); m_dmrColorCodeLabel.setGeometry(FPoint(2, 9), FSize(8, 1)); m_dmrColorCode.setGeometry(FPoint(12, 9), FSize(8, 1)); @@ -159,9 +148,7 @@ private: m_dmrColorCode.addCallback("changed", [&]() { m_setup->m_conf["system"]["config"]["colorCode"] = __INT_STR(m_dmrColorCode.getValue()); }); -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) m_p25NACLabel.setGeometry(FPoint(23, 9), FSize(10, 1)); m_p25NAC.setGeometry(FPoint(33, 9), FSize(8, 1)); m_p25NAC.setText(m_setup->m_conf["system"]["config"]["nac"].as("1").c_str()); @@ -174,9 +161,7 @@ private: m_setup->m_conf["system"]["config"]["nac"] = __INT_HEX_STR(nac); }); -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) uint32_t nxdnRAN = rfssConfig["ran"].as(1U); m_nxdnRANLabel.setGeometry(FPoint(42, 9), FSize(10, 1)); m_nxdnRAN.setGeometry(FPoint(53, 9), FSize(8, 1)); @@ -186,7 +171,6 @@ private: m_nxdnRAN.addCallback("changed", [&]() { m_setup->m_conf["system"]["config"]["ran"] = __INT_STR(m_nxdnRAN.getValue()); }); -#endif // defined(ENABLE_NXDN) m_siteIdLabel.setGeometry(FPoint(2, 10), FSize(20, 1)); m_siteId.setGeometry(FPoint(23, 10), FSize(10, 1)); @@ -201,7 +185,6 @@ private: m_setup->m_conf["system"]["config"]["siteId"] = __INT_HEX_STR(id); }); -#if defined(ENABLE_DMR) m_dmrNetIdLabel.setGeometry(FPoint(2, 11), FSize(20, 1)); m_dmrNetId.setGeometry(FPoint(23, 11), FSize(10, 1)); m_dmrNetId.setText(rfssConfig["dmrNetId"].as("1").c_str()); @@ -214,9 +197,7 @@ private: m_setup->m_conf["system"]["config"]["dmrNetId"] = __INT_HEX_STR(id); }); -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) m_p25NetIdLabel.setGeometry(FPoint(2, 12), FSize(20, 1)); m_p25NetId.setGeometry(FPoint(23, 12), FSize(10, 1)); m_p25NetId.setText(rfssConfig["netId"].as("1").c_str()); @@ -255,7 +236,6 @@ private: m_setup->m_conf["system"]["config"]["rfssId"] = __INT_HEX_STR(id); }); -#endif // defined(ENABLE_P25) } CloseWndBase::initControls(); diff --git a/src/host/setup/SystemConfigSetWnd.h b/src/host/setup/SystemConfigSetWnd.h index d43241cb..fbac8232 100644 --- a/src/host/setup/SystemConfigSetWnd.h +++ b/src/host/setup/SystemConfigSetWnd.h @@ -73,15 +73,9 @@ private: FSpinBox m_rfTalkgroup{this}; FCheckBox m_fixedMode{"Fixed Mode", this}; -#if defined(ENABLE_DMR) FCheckBox m_dmrEnabled{"DMR", this}; -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) FCheckBox m_p25Enabled{"P25", this}; -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) FCheckBox m_nxdnEnabled{"NXDN", this}; -#endif // defined(ENABLE_NXDN) /// /// @@ -207,7 +201,6 @@ private: m_setup->m_conf["system"]["fixedMode"] = __BOOL_STR(m_fixedMode.isChecked()); }); -#if defined(ENABLE_DMR) bool dmrEnabled = m_setup->m_conf["protocols"]["dmr"]["enable"].as(true); m_dmrEnabled.setGeometry(FPoint(2, 17), FSize(10, 1)); @@ -215,8 +208,7 @@ private: m_dmrEnabled.addCallback("toggled", [&]() { m_setup->m_conf["protocols"]["dmr"]["enable"] = __BOOL_STR(m_dmrEnabled.isChecked()); }); -#endif // defined(ENABLE_DMR) -#if defined(ENABLE_P25) + bool p25Enabled = m_setup->m_conf["protocols"]["p25"]["enable"].as(true); m_p25Enabled.setGeometry(FPoint(12, 17), FSize(10, 1)); @@ -224,8 +216,7 @@ private: m_p25Enabled.addCallback("toggled", [&]() { m_setup->m_conf["protocols"]["p25"]["enable"] = __BOOL_STR(m_p25Enabled.isChecked()); }); -#endif // defined(ENABLE_P25) -#if defined(ENABLE_NXDN) + bool nxdnEnabled = m_setup->m_conf["protocols"]["nxdn"]["enable"].as(true); m_nxdnEnabled.setGeometry(FPoint(22, 17), FSize(10, 1)); @@ -233,7 +224,6 @@ private: m_nxdnEnabled.addCallback("toggled", [&]() { m_setup->m_conf["protocols"]["nxdn"]["enable"] = __BOOL_STR(m_nxdnEnabled.isChecked()); }); -#endif // defined(ENABLE_NXDN) } CloseWndBase::initControls(); diff --git a/src/monitor/MonitorMain.cpp b/src/monitor/MonitorMain.cpp index 48fee8e3..e0ea8861 100644 --- a/src/monitor/MonitorMain.cpp +++ b/src/monitor/MonitorMain.cpp @@ -212,7 +212,7 @@ int main(int argc, char** argv) return 1; } - ::LogInfo(__PROG_NAME__ " %s (" DESCR_DMR DESCR_P25 DESCR_NXDN "CW Id, Network) (built %s)", __VER__, __BUILD__); + ::LogInfo(__PROG_NAME__ " %s (built %s)", __VER__, __BUILD__); ::LogInfo("Copyright (c) 2017-2024 Bryan Biedenkapp, N2PLL and DVMProject (https://github.com/dvmproject) Authors."); ::LogInfo("Portions Copyright (c) 2015-2021 by Jonathan Naylor, G4KLX and others"); ::LogInfo(">> Host Monitor");