enhance debug logging to incorporate both file and line numbers (when provided by the compiler) and optionally implement LogDebugEx macro to also incorporate the caller identifying the function name; correct LogDebug uses in some cases that should have been LogMessage;

4.11f_maint
Bryan Biedenkapp 11 months ago
parent c68b99dc61
commit 64bcb56228

@ -2488,7 +2488,7 @@ uint8_t* HostBridge::generateRTPHeaders(uint8_t msgLen, uint16_t& rtpSeq)
if (timestamp != INVALID_TS) { if (timestamp != INVALID_TS) {
timestamp += (RTP_GENERIC_CLOCK_RATE / 50); timestamp += (RTP_GENERIC_CLOCK_RATE / 50);
if (m_debug) if (m_debug)
LogDebug(LOG_NET, "HostBridge::generateRTPHeaders() RTP, previous TS = %u, TS = %u, rtpSeq = %u", m_rtpTimestamp, timestamp, rtpSeq); LogDebugEx(LOG_NET, "HostBridge::generateRTPHeaders()", "RTP, previous TS = %u, TS = %u, rtpSeq = %u", m_rtpTimestamp, timestamp, rtpSeq);
m_rtpTimestamp = timestamp; m_rtpTimestamp = timestamp;
} }
@ -2507,7 +2507,7 @@ uint8_t* HostBridge::generateRTPHeaders(uint8_t msgLen, uint16_t& rtpSeq)
if (timestamp == INVALID_TS) { if (timestamp == INVALID_TS) {
if (m_debug) if (m_debug)
LogDebug(LOG_NET, "HostBridge::generateRTPHeaders() RTP, initial TS = %u, rtpSeq = %u", header.getTimestamp(), rtpSeq); LogDebugEx(LOG_NET, "HostBridge::generateRTPHeaders()", "RTP, initial TS = %u, rtpSeq = %u", header.getTimestamp(), rtpSeq);
m_rtpTimestamp = header.getTimestamp(); m_rtpTimestamp = header.getTimestamp();
} }
@ -2608,7 +2608,7 @@ void* HostBridge::threadAudioProcess(void* arg)
HostBridge* bridge = static_cast<HostBridge*>(th->obj); HostBridge* bridge = static_cast<HostBridge*>(th->obj);
if (bridge == nullptr) { if (bridge == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -2616,7 +2616,7 @@ void* HostBridge::threadAudioProcess(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -2737,7 +2737,7 @@ void* HostBridge::threadAudioProcess(void* arg)
Thread::sleep(1U); Thread::sleep(1U);
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -2760,7 +2760,7 @@ void* HostBridge::threadNetworkProcess(void* arg)
HostBridge* bridge = static_cast<HostBridge*>(th->obj); HostBridge* bridge = static_cast<HostBridge*>(th->obj);
if (bridge == nullptr) { if (bridge == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -2768,7 +2768,7 @@ void* HostBridge::threadNetworkProcess(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -2800,7 +2800,7 @@ void* HostBridge::threadNetworkProcess(void* arg)
Thread::sleep(1U); Thread::sleep(1U);
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -2823,7 +2823,7 @@ void* HostBridge::threadCallWatchdog(void* arg)
HostBridge* bridge = static_cast<HostBridge*>(th->obj); HostBridge* bridge = static_cast<HostBridge*>(th->obj);
if (bridge == nullptr) { if (bridge == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -2831,7 +2831,7 @@ void* HostBridge::threadCallWatchdog(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -2885,7 +2885,7 @@ void* HostBridge::threadCallWatchdog(void* arg)
Thread::sleep(5U); Thread::sleep(5U);
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }

@ -266,7 +266,7 @@ AES::AES(const AESKeyLength keyLength) {
uint8_t* AES::encryptECB(const uint8_t in[], uint32_t inLen, const uint8_t key[]) uint8_t* AES::encryptECB(const uint8_t in[], uint32_t inLen, const uint8_t key[])
{ {
if (inLen % BLOCK_BYTES_LEN != 0) { if (inLen % BLOCK_BYTES_LEN != 0) {
LogDebug(LOG_HOST, "AES::encryptECB() Plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); LogDebugEx(LOG_HOST, "AES::encryptECB()", "plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen);
return nullptr; return nullptr;
} }
@ -289,7 +289,7 @@ uint8_t* AES::encryptECB(const uint8_t in[], uint32_t inLen, const uint8_t key[]
uint8_t* AES::decryptECB(const uint8_t in[], uint32_t inLen, const uint8_t key[]) uint8_t* AES::decryptECB(const uint8_t in[], uint32_t inLen, const uint8_t key[])
{ {
if (inLen % BLOCK_BYTES_LEN != 0) { if (inLen % BLOCK_BYTES_LEN != 0) {
LogDebug(LOG_HOST, "AES::decryptECB() Plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); LogDebugEx(LOG_HOST, "AES::decryptECB()", "plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen);
return nullptr; return nullptr;
} }
@ -312,7 +312,7 @@ uint8_t* AES::decryptECB(const uint8_t in[], uint32_t inLen, const uint8_t key[]
uint8_t* AES::encryptCBC(const uint8_t in[], uint32_t inLen, const uint8_t key[], const uint8_t* iv) uint8_t* AES::encryptCBC(const uint8_t in[], uint32_t inLen, const uint8_t key[], const uint8_t* iv)
{ {
if (inLen % BLOCK_BYTES_LEN != 0) { if (inLen % BLOCK_BYTES_LEN != 0) {
LogDebug(LOG_HOST, "AES::encryptCBC() Plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); LogDebugEx(LOG_HOST, "AES::encryptCBC()", "plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen);
return nullptr; return nullptr;
} }
@ -339,7 +339,7 @@ uint8_t* AES::encryptCBC(const uint8_t in[], uint32_t inLen, const uint8_t key[]
uint8_t* AES::decryptCBC(const uint8_t in[], uint32_t inLen, const uint8_t key[], const uint8_t *iv) uint8_t* AES::decryptCBC(const uint8_t in[], uint32_t inLen, const uint8_t key[], const uint8_t *iv)
{ {
if (inLen % BLOCK_BYTES_LEN != 0) { if (inLen % BLOCK_BYTES_LEN != 0) {
LogDebug(LOG_HOST, "AES::decryptCBC() Plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); LogDebugEx(LOG_HOST, "AES::decryptCBC()", "plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen);
return nullptr; return nullptr;
} }
@ -366,7 +366,7 @@ uint8_t* AES::decryptCBC(const uint8_t in[], uint32_t inLen, const uint8_t key[]
uint8_t* AES::encryptCFB(const uint8_t in[], uint32_t inLen, const uint8_t key[], const uint8_t *iv) uint8_t* AES::encryptCFB(const uint8_t in[], uint32_t inLen, const uint8_t key[], const uint8_t *iv)
{ {
if (inLen % BLOCK_BYTES_LEN != 0) { if (inLen % BLOCK_BYTES_LEN != 0) {
LogDebug(LOG_HOST, "AES::encryptCFB() Plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); LogDebugEx(LOG_HOST, "AES::encryptCFB()", "plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen);
return nullptr; return nullptr;
} }
@ -394,7 +394,7 @@ uint8_t* AES::encryptCFB(const uint8_t in[], uint32_t inLen, const uint8_t key[]
uint8_t* AES::decryptCFB(const uint8_t in[], uint32_t inLen, const uint8_t key[], const uint8_t *iv) uint8_t* AES::decryptCFB(const uint8_t in[], uint32_t inLen, const uint8_t key[], const uint8_t *iv)
{ {
if (inLen % BLOCK_BYTES_LEN != 0) { if (inLen % BLOCK_BYTES_LEN != 0) {
LogDebug(LOG_HOST, "AES::decryptCFB() Plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen); LogDebugEx(LOG_HOST, "AES::decryptCFB()", "plaintext length must be divisible by %u, inLen = %u", BLOCK_BYTES_LEN, inLen);
return nullptr; return nullptr;
} }

@ -5,7 +5,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* Copyright (C) 2015,2016 Jonathan Naylor, G4KLX * Copyright (C) 2015,2016 Jonathan Naylor, G4KLX
* Copyright (C) 2018-2024 Bryan Biedenkapp, N2PLL * Copyright (C) 2018-2025 Bryan Biedenkapp, N2PLL
* *
*/ */
#include "Log.h" #include "Log.h"
@ -201,7 +201,7 @@ void LogFinalise()
/* Writes a new entry to the diagnostics log. */ /* Writes a new entry to the diagnostics log. */
void Log(uint32_t level, const char *module, const char* fmt, ...) void Log(uint32_t level, const char *module, const char* file, const int lineNo, const char* func, const char* fmt, ...)
{ {
assert(fmt != nullptr); assert(fmt != nullptr);
#if defined(CATCH2_TEST_COMPILATION) #if defined(CATCH2_TEST_COMPILATION)
@ -217,22 +217,83 @@ void Log(uint32_t level, const char *module, const char* fmt, ...)
::gettimeofday(&nowMillis, NULL); ::gettimeofday(&nowMillis, NULL);
if (module != nullptr) { if (module != nullptr) {
::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu (%s) ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, module); // level 1 is DEBUG
if (level == 1U) {
// if we have a file and line number -- add that to the log entry
if (file != nullptr && lineNo > 0) {
// if we have a function name add that to the log entry
if (func != nullptr) {
::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu (%s)[%s:%u][%s] ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, module, file, lineNo, func);
}
else {
::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu (%s)[%s:%u] ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, module, file, lineNo);
}
} else {
::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu (%s) ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, module);
}
} else {
::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu (%s) ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, module);
}
} }
else { else {
::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U); // level 1 is DEBUG
if (level == 1U) {
// if we have a file and line number -- add that to the log entry
if (file != nullptr && lineNo > 0) {
// if we have a function name add that to the log entry
if (func != nullptr) {
::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu [%s:%u][%s] ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, file, lineNo, func);
}
else {
::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu [%s:%u] ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, file, lineNo);
}
} else {
::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U);
}
} else {
::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U);
}
} }
} }
else { else {
if (module != nullptr) { if (module != nullptr) {
::sprintf(buffer, "%c: (%s) ", LEVELS[level], module); // level 1 is DEBUG
if (level == 1U) {
// if we have a file and line number -- add that to the log entry
if (file != nullptr && lineNo > 0) {
// if we have a function name add that to the log entry
if (func != nullptr) {
::sprintf(buffer, "%c: (%s)[%s:%u][%s] ", LEVELS[level], module, file, lineNo, func);
}
else {
::sprintf(buffer, "%c: (%s)[%s:%u] ", LEVELS[level], module, file, lineNo);
}
}
else {
::sprintf(buffer, "%c: (%s) ", LEVELS[level], module);
}
} else {
::sprintf(buffer, "%c: (%s) ", LEVELS[level], module);
}
} }
else { else {
if (level >= 9999U) { if (level >= 9999U) {
::sprintf(buffer, "U: "); ::sprintf(buffer, "U: ");
} }
else { else {
::sprintf(buffer, "%c: ", LEVELS[level]); // if we have a file and line number -- add that to the log entry
if (file != nullptr && lineNo > 0) {
// if we have a function name add that to the log entry
if (func != nullptr) {
::sprintf(buffer, "%c: [%s:%u][%s] ", LEVELS[level], file, lineNo, func);
}
else {
::sprintf(buffer, "%c: [%s:%u] ", LEVELS[level], file, lineNo);
}
}
else {
::sprintf(buffer, "%c: ", LEVELS[level]);
}
} }
} }
} }

@ -5,7 +5,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* Copyright (C) 2015,2016 Jonathan Naylor, G4KLX * Copyright (C) 2015,2016 Jonathan Naylor, G4KLX
* Copyright (C) 2018-2024 Bryan Biedenkapp, N2PLL * Copyright (C) 2018-2025 Bryan Biedenkapp, N2PLL
* *
*/ */
/** /**
@ -62,7 +62,16 @@
* *
* This is a variable argument function. * This is a variable argument function.
*/ */
#define LogDebug(_module, fmt, ...) Log(1U, _module, fmt, ##__VA_ARGS__) #define LogDebug(_module, fmt, ...) Log(1U, _module, __FILE__, __LINE__, nullptr, fmt, ##__VA_ARGS__)
/**
* @brief Macro helper to create a debug log entry.
* @param _module Name of module generating log entry.
* @param _func Name of function generating log entry.
* @param fmt String format.
*
* This is a variable argument function.
*/
#define LogDebugEx(_module, _func, fmt, ...) Log(1U, _module, __FILE__, __LINE__, _func, fmt, ##__VA_ARGS__)
/** /**
* @brief Macro helper to create a message log entry. * @brief Macro helper to create a message log entry.
* @param _module Name of module generating log entry. * @param _module Name of module generating log entry.
@ -70,7 +79,7 @@
* *
* This is a variable argument function. * This is a variable argument function.
*/ */
#define LogMessage(_module, fmt, ...) Log(2U, _module, fmt, ##__VA_ARGS__) #define LogMessage(_module, fmt, ...) Log(2U, _module, nullptr, 0, nullptr, fmt, ##__VA_ARGS__)
/** /**
* @brief Macro helper to create a informational log entry. * @brief Macro helper to create a informational log entry.
* @param _module Name of module generating log entry. * @param _module Name of module generating log entry.
@ -79,7 +88,7 @@
* This is a variable argument function. LogInfo() does not use a module * This is a variable argument function. LogInfo() does not use a module
* name when creating a log entry. * name when creating a log entry.
*/ */
#define LogInfo(fmt, ...) Log(3U, nullptr, fmt, ##__VA_ARGS__) #define LogInfo(fmt, ...) Log(3U, nullptr, nullptr, 0, nullptr, fmt, ##__VA_ARGS__)
/** /**
* @brief Macro helper to create a informational log entry with module name. * @brief Macro helper to create a informational log entry with module name.
* @param _module Name of module generating log entry. * @param _module Name of module generating log entry.
@ -87,7 +96,7 @@
* *
* This is a variable argument function. * This is a variable argument function.
*/ */
#define LogInfoEx(_module, fmt, ...) Log(3U, _module, fmt, ##__VA_ARGS__) #define LogInfoEx(_module, fmt, ...) Log(3U, _module, nullptr, 0, nullptr, fmt, ##__VA_ARGS__)
/** /**
* @brief Macro helper to create a warning log entry. * @brief Macro helper to create a warning log entry.
* @param _module Name of module generating log entry. * @param _module Name of module generating log entry.
@ -95,7 +104,7 @@
* *
* This is a variable argument function. * This is a variable argument function.
*/ */
#define LogWarning(_module, fmt, ...) Log(4U, _module, fmt, ##__VA_ARGS__) #define LogWarning(_module, fmt, ...) Log(4U, _module, nullptr, 0, nullptr, fmt, ##__VA_ARGS__)
/** /**
* @brief Macro helper to create a error log entry. * @brief Macro helper to create a error log entry.
* @param _module Name of module generating log entry. * @param _module Name of module generating log entry.
@ -103,7 +112,7 @@
* *
* This is a variable argument function. * This is a variable argument function.
*/ */
#define LogError(_module, fmt, ...) Log(5U, _module, fmt, ##__VA_ARGS__) #define LogError(_module, fmt, ...) Log(5U, _module, nullptr, 0, nullptr, fmt, ##__VA_ARGS__)
/** /**
* @brief Macro helper to create a fatal log entry. * @brief Macro helper to create a fatal log entry.
* @param _module Name of module generating log entry. * @param _module Name of module generating log entry.
@ -111,7 +120,7 @@
* *
* This is a variable argument function. * This is a variable argument function.
*/ */
#define LogFatal(_module, fmt, ...) Log(6U, _module, fmt, ##__VA_ARGS__) #define LogFatal(_module, fmt, ...) Log(6U, _module, nullptr, 0, nullptr, fmt, ##__VA_ARGS__)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Externs // Externs
@ -186,11 +195,14 @@ extern HOST_SW_API void LogFinalise();
* @brief Writes a new entry to the diagnostics log. * @brief Writes a new entry to the diagnostics log.
* @param level Log level for entry. * @param level Log level for entry.
* @param module Name of module generating log entry. * @param module Name of module generating log entry.
* @param file Name of source code file generating log entry.
* @param line Line number in source code file generating log entry.
* @param func Name of function generating log entry.
* @param fmt String format. * @param fmt String format.
* *
* This is a variable argument function. * This is a variable argument function. This shouldn't be called directly, utilize the LogXXXX macros above, instead.
*/ */
extern HOST_SW_API void Log(uint32_t level, const char* module, const char* fmt, ...); extern HOST_SW_API void Log(uint32_t level, const char* module, const char* file, const int lineNo, const char* func, const char* fmt, ...);
/** @} */ /** @} */
#endif // __LOG_H__ #endif // __LOG_H__

@ -82,7 +82,7 @@ public:
m_iPtr = 0U; m_iPtr = 0U;
} }
#if DEBUG_RINGBUFFER #if DEBUG_RINGBUFFER
LogDebug(LOG_HOST, "RingBuffer::addData(%s): iPtr_Before = %u, iPtr_After = %u, oPtr = %u, len = %u, len_Written = %u", m_name, iPtr_BeforeWrite, m_iPtr, m_oPtr, m_length, (m_iPtr - iPtr_BeforeWrite)); LogDebugEx(LOG_HOST, "RingBuffer::addData()", "(%s): iPtr_Before = %u, iPtr_After = %u, oPtr = %u, len = %u, len_Written = %u", m_name, iPtr_BeforeWrite, m_iPtr, m_oPtr, m_length, (m_iPtr - iPtr_BeforeWrite));
#endif #endif
return true; return true;
} }
@ -109,7 +109,7 @@ public:
m_oPtr = 0U; m_oPtr = 0U;
} }
#if DEBUG_RINGBUFFER #if DEBUG_RINGBUFFER
LogDebug(LOG_HOST, "RingBuffer::getData(%s): iPtr = %u, oPtr_Before = %u, oPtr_After = %u, len = %u, len_Read = %u", m_name, m_iPtr, oPtr_BeforeRead, m_oPtr, m_length, (m_oPtr - oPtr_BeforeRead)); LogDebugEx(LOG_HOST, "RingBuffer::getData()", "(%s): iPtr = %u, oPtr_Before = %u, oPtr_After = %u, len = %u, len_Read = %u", m_name, m_iPtr, oPtr_BeforeRead, m_oPtr, m_length, (m_oPtr - oPtr_BeforeRead));
#endif #endif
return true; return true;
} }

@ -5,7 +5,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* Copyright (C) 2009,2014,2015,2016 Jonathan Naylor, G4KLX * Copyright (C) 2009,2014,2015,2016 Jonathan Naylor, G4KLX
* Copyright (C) 2018-2024 Bryan Biedenkapp, N2PLL * Copyright (C) 2018-2025 Bryan Biedenkapp, N2PLL
* *
*/ */
#include "Utils.h" #include "Utils.h"
@ -72,7 +72,7 @@ void Utils::dump(int level, const std::string& title, const uint8_t* data, uint3
{ {
assert(data != nullptr); assert(data != nullptr);
::Log(level, "DUMP", "%s (len %u)", title.c_str(), length); ::Log(level, "DUMP", nullptr, 0, nullptr, "%s (len %u)", title.c_str(), length);
uint32_t offset = 0U; uint32_t offset = 0U;
@ -103,7 +103,7 @@ void Utils::dump(int level, const std::string& title, const uint8_t* data, uint3
output += '*'; output += '*';
#endif #endif
::Log(level, "DUMP", "%04X: %s", offset, output.c_str()); ::Log(level, "DUMP", nullptr, 0, nullptr, "%04X: %s", offset, output.c_str());
offset += 16U; offset += 16U;
@ -143,7 +143,7 @@ void Utils::symbols(const std::string& title, const uint8_t* data, uint32_t leng
{ {
assert(data != nullptr); assert(data != nullptr);
::Log(2U, "SYMBOLS", "%s (len %u)", title.c_str(), length); ::Log(2U, "SYMBOLS", nullptr, 0, nullptr, "%s (len %u)", title.c_str(), length);
uint32_t offset = 0U; uint32_t offset = 0U;
uint32_t count = 0U; uint32_t count = 0U;
@ -158,7 +158,7 @@ void Utils::symbols(const std::string& title, const uint8_t* data, uint32_t leng
microslotHeader += temp; microslotHeader += temp;
} }
::Log(2U, "SYMBOLS", "MCR: %s", microslotHeader.c_str()); ::Log(2U, "SYMBOLS", nullptr, 0, nullptr, "MCR: %s", microslotHeader.c_str());
uint32_t bufLen = length; uint32_t bufLen = length;
while (bufLen > 0U) { while (bufLen > 0U) {
@ -188,7 +188,7 @@ void Utils::symbols(const std::string& title, const uint8_t* data, uint32_t leng
symOffset += 9; symOffset += 9;
} }
::Log(2U, "SYMBOLS", "%03u: %s", count, output.c_str()); ::Log(2U, "SYMBOLS", nullptr, 0, nullptr, "%03u: %s", count, output.c_str());
offset += 18U; offset += 18U;
count += 2U; count += 2U;

@ -571,7 +571,7 @@ uint32_t AMBEFEC::regenerate(uint32_t& a, uint32_t& b, uint32_t& c) const
if (!valid) { if (!valid) {
uint32_t errsA = Utils::countBits32(data ^ a); uint32_t errsA = Utils::countBits32(data ^ a);
#if DEBUG_AMBEFEC #if DEBUG_AMBEFEC
LogDebug(LOG_HOST, "AMBEFEC::regnerate() invalid A block, errsA = %u, a = %6X, b = %6X, c = %6X", errsA, a, b, c); LogDebugEx(LOG_HOST, "AMBEFEC::regnerate()", "invalid A block, errsA = %u, a = %6X, b = %6X, c = %6X", errsA, a, b, c);
#endif #endif
a = 0xF00292U; a = 0xF00292U;
b = 0x0E0B20U; b = 0x0E0B20U;
@ -596,7 +596,7 @@ uint32_t AMBEFEC::regenerate(uint32_t& a, uint32_t& b, uint32_t& c) const
v = b ^ old_b; v = b ^ old_b;
uint32_t errsB = Utils::countBits32(v); uint32_t errsB = Utils::countBits32(v);
#if DEBUG_AMBEFEC #if DEBUG_AMBEFEC
LogDebug(LOG_HOST, "AMBEFEC::regnerate() errsA = %u, a = %6X, errsB = %u, b = %6X, c = %6X", errsA, a, errsB, b, c); LogDebugEx(LOG_HOST, "AMBEFEC::regnerate()", "errsA = %u, a = %6X, errsB = %u, b = %6X, c = %6X", errsA, a, errsB, b, c);
#endif #endif
if (errsA >= 4U || ((errsA + errsB) >= 6U && errsA >= 2U)) { if (errsA >= 4U || ((errsA + errsB) >= 6U && errsA >= 2U)) {
a = 0xF00292U; a = 0xF00292U;

@ -202,7 +202,7 @@ bool CRC::checkCCITT162(const uint8_t *in, uint32_t length)
#if DEBUG_CRC_CHECK #if DEBUG_CRC_CHECK
uint16_t inCrc = (in[length - 2U] << 8) | (in[length - 1U] << 0); uint16_t inCrc = (in[length - 2U] << 8) | (in[length - 1U] << 0);
LogDebug(LOG_HOST, "CRC::checkCCITT162(), crc = $%04X, in = $%04X, len = %u", crc16, inCrc, length); LogDebugEx(LOG_HOST, "CRC::checkCCITT162()", "crc = $%04X, in = $%04X, len = %u", crc16, inCrc, length);
#endif #endif
return crc8[0U] == in[length - 1U] && crc8[1U] == in[length - 2U]; return crc8[0U] == in[length - 1U] && crc8[1U] == in[length - 2U];
@ -228,7 +228,7 @@ void CRC::addCCITT162(uint8_t* in, uint32_t length)
crc16 = ~crc16; crc16 = ~crc16;
#if DEBUG_CRC_ADD #if DEBUG_CRC_ADD
LogDebug(LOG_HOST, "CRC::addCCITT162(), crc = $%04X, len = %u", crc16, length); LogDebugEx(LOG_HOST, "CRC::addCCITT162()", "crc = $%04X, len = %u", crc16, length);
#endif #endif
in[length - 1U] = crc8[0U]; in[length - 1U] = crc8[0U];
@ -256,7 +256,7 @@ bool CRC::checkCCITT161(const uint8_t *in, uint32_t length)
#if DEBUG_CRC_CHECK #if DEBUG_CRC_CHECK
uint16_t inCrc = (in[length - 2U] << 8) | (in[length - 1U] << 0); uint16_t inCrc = (in[length - 2U] << 8) | (in[length - 1U] << 0);
LogDebug(LOG_HOST, "CRC::checkCCITT161(), crc = $%04X, in = $%04X, len = %u", crc16, inCrc, length); LogDebugEx(LOG_HOST, "CRC::checkCCITT161()", "crc = $%04X, in = $%04X, len = %u", crc16, inCrc, length);
#endif #endif
return crc8[0U] == in[length - 2U] && crc8[1U] == in[length - 1U]; return crc8[0U] == in[length - 2U] && crc8[1U] == in[length - 1U];
@ -282,7 +282,7 @@ void CRC::addCCITT161(uint8_t* in, uint32_t length)
crc16 = ~crc16; crc16 = ~crc16;
#if DEBUG_CRC_ADD #if DEBUG_CRC_ADD
LogDebug(LOG_HOST, "CRC::addCCITT161(), crc = $%04X, len = %u", crc16, length); LogDebugEx(LOG_HOST, "CRC::addCCITT161()", "crc = $%04X, len = %u", crc16, length);
#endif #endif
in[length - 2U] = crc8[0U]; in[length - 2U] = crc8[0U];
@ -314,7 +314,7 @@ bool CRC::checkCRC32(const uint8_t *in, uint32_t length)
#if DEBUG_CRC_CHECK #if DEBUG_CRC_CHECK
uint32_t inCrc = (in[length - 4U] << 24) | (in[length - 3U] << 16) | (in[length - 2U] << 8) | (in[length - 1U] << 0); uint32_t inCrc = (in[length - 4U] << 24) | (in[length - 3U] << 16) | (in[length - 2U] << 8) | (in[length - 1U] << 0);
LogDebug(LOG_HOST, "CRC::checkCRC32(), crc = $%08X, in = $%08X, len = %u", crc32, inCrc, length); LogDebugEx(LOG_HOST, "CRC::checkCRC32()", "crc = $%08X, in = $%08X, len = %u", crc32, inCrc, length);
#endif #endif
return crc8[0U] == in[length - 1U] && crc8[1U] == in[length - 2U] && crc8[2U] == in[length - 3U] && crc8[3U] == in[length - 4U]; return crc8[0U] == in[length - 1U] && crc8[1U] == in[length - 2U] && crc8[2U] == in[length - 3U] && crc8[3U] == in[length - 4U];
@ -344,7 +344,7 @@ void CRC::addCRC32(uint8_t* in, uint32_t length)
crc32 &= 0xFFFFFFFFU; crc32 &= 0xFFFFFFFFU;
#if DEBUG_CRC_ADD #if DEBUG_CRC_ADD
LogDebug(LOG_HOST, "CRC::addCRC32(), crc = $%08X, len = %u", crc32, length); LogDebugEx(LOG_HOST, "CRC::addCRC32()", "crc = $%08X, len = %u", crc32, length);
#endif #endif
in[length - 1U] = crc8[0U]; in[length - 1U] = crc8[0U];
@ -365,7 +365,7 @@ uint8_t CRC::crc8(const uint8_t *in, uint32_t length)
crc = CRC8_TABLE[crc ^ in[i]]; crc = CRC8_TABLE[crc ^ in[i]];
#if DEBUG_CRC_CHECK #if DEBUG_CRC_CHECK
LogDebug(LOG_HOST, "CRC::crc8(), crc = $%02X, len = %u", crc, length); LogDebugEx(LOG_HOST, "CRC::crc8()", "crc = $%02X, len = %u", crc, length);
#endif #endif
return crc; return crc;
@ -389,7 +389,7 @@ bool CRC::checkCRC6(const uint8_t* in, uint32_t bitLength)
#if DEBUG_CRC_CHECK #if DEBUG_CRC_CHECK
uint32_t inCrc = temp[0U]; uint32_t inCrc = temp[0U];
LogDebug(LOG_HOST, "CRC::checkCRC6(), crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength); LogDebugEx(LOG_HOST, "CRC::checkCRC6()", "crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength);
#endif #endif
return crc == temp[0U]; return crc == temp[0U];
@ -411,7 +411,7 @@ uint8_t CRC::addCRC6(uint8_t* in, uint32_t bitLength)
} }
#if DEBUG_CRC_ADD #if DEBUG_CRC_ADD
LogDebug(LOG_HOST, "CRC::addCRC6(), crc = $%04X, bitlen = %u", crc[0U], bitLength); LogDebugEx(LOG_HOST, "CRC::addCRC6()", "crc = $%04X, bitlen = %u", crc[0U], bitLength);
#endif #endif
return crc[0U]; return crc[0U];
} }
@ -438,7 +438,7 @@ bool CRC::checkCRC12(const uint8_t* in, uint32_t bitLength)
#if DEBUG_CRC_CHECK #if DEBUG_CRC_CHECK
uint16_t inCrc = (temp2[0U] << 8) | (temp2[1U] << 0); uint16_t inCrc = (temp2[0U] << 8) | (temp2[1U] << 0);
LogDebug(LOG_HOST, "CRC:checkCRC12(), crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength); LogDebugEx(LOG_HOST, "CRC:checkCRC12()", "crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength);
#endif #endif
return temp1[0U] == temp2[0U] && temp1[1U] == temp2[1U]; return temp1[0U] == temp2[0U] && temp1[1U] == temp2[1U];
@ -463,7 +463,7 @@ uint16_t CRC::addCRC12(uint8_t* in, uint32_t bitLength)
} }
#if DEBUG_CRC_ADD #if DEBUG_CRC_ADD
LogDebug(LOG_HOST, "CRC::addCRC12(), crc = $%04X, bitlen = %u", crc, bitLength); LogDebugEx(LOG_HOST, "CRC::addCRC12()", "crc = $%04X, bitlen = %u", crc, bitLength);
#endif #endif
return crc; return crc;
} }
@ -490,7 +490,7 @@ bool CRC::checkCRC15(const uint8_t* in, uint32_t bitLength)
#if DEBUG_CRC_CHECK #if DEBUG_CRC_CHECK
uint16_t inCrc = (temp2[0U] << 8) | (temp2[1U] << 0); uint16_t inCrc = (temp2[0U] << 8) | (temp2[1U] << 0);
LogDebug(LOG_HOST, "CRC:checkCRC15(), crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength); LogDebugEx(LOG_HOST, "CRC:checkCRC15()", "crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength);
#endif #endif
return temp1[0U] == temp2[0U] && temp1[1U] == temp2[1U]; return temp1[0U] == temp2[0U] && temp1[1U] == temp2[1U];
@ -515,7 +515,7 @@ uint16_t CRC::addCRC15(uint8_t* in, uint32_t bitLength)
} }
#if DEBUG_CRC_ADD #if DEBUG_CRC_ADD
LogDebug(LOG_HOST, "CRC::addCRC15(), crc = $%04X, bitlen = %u", crc, bitLength); LogDebugEx(LOG_HOST, "CRC::addCRC15()", "crc = $%04X, bitlen = %u", crc, bitLength);
#endif #endif
return crc; return crc;
} }
@ -542,7 +542,7 @@ bool CRC::checkCRC16(const uint8_t* in, uint32_t bitLength)
#if DEBUG_CRC_CHECK #if DEBUG_CRC_CHECK
uint16_t inCrc = (temp2[0U] << 8) | (temp2[1U] << 0); uint16_t inCrc = (temp2[0U] << 8) | (temp2[1U] << 0);
LogDebug(LOG_HOST, "CRC:checkCRC16(), crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength); LogDebugEx(LOG_HOST, "CRC:checkCRC16()", "crc = $%04X, in = $%04X, bitlen = %u", crc, inCrc, bitLength);
#endif #endif
return temp1[0U] == temp2[0U] && temp1[1U] == temp2[1U]; return temp1[0U] == temp2[0U] && temp1[1U] == temp2[1U];
@ -567,7 +567,7 @@ uint16_t CRC::addCRC16(uint8_t* in, uint32_t bitLength)
} }
#if DEBUG_CRC_ADD #if DEBUG_CRC_ADD
LogDebug(LOG_HOST, "CRC::addCRC16(), crc = $%04X, bitlen = %u", crc, bitLength); LogDebugEx(LOG_HOST, "CRC::addCRC16()", "crc = $%04X, bitlen = %u", crc, bitLength);
#endif #endif
return crc; return crc;
} }

@ -155,7 +155,7 @@ bool RS634717::decode241213(uint8_t* data)
int ec = rs241213.decode(codeword); int ec = rs241213.decode(codeword);
#if DEBUG_RS #if DEBUG_RS
LogDebug(LOG_HOST, "RS634717::decode241213(), errors = %d", ec); LogDebugEx(LOG_HOST, "RS634717::decode241213()", "errors = %d", ec);
#endif #endif
offset = 0U; offset = 0U;
for (uint32_t i = 0U; i < 12U; i++, offset += 6) for (uint32_t i = 0U; i < 12U; i++, offset += 6)
@ -205,7 +205,7 @@ bool RS634717::decode24169(uint8_t* data)
int ec = rs24169.decode(codeword); int ec = rs24169.decode(codeword);
#if DEBUG_RS #if DEBUG_RS
LogDebug(LOG_HOST, "RS634717::decode24169(), errors = %d\n", ec); LogDebugEx(LOG_HOST, "RS634717::decode24169()", "errors = %d\n", ec);
#endif #endif
offset = 0U; offset = 0U;
for (uint32_t i = 0U; i < 16U; i++, offset += 6) for (uint32_t i = 0U; i < 16U; i++, offset += 6)
@ -255,7 +255,7 @@ bool RS634717::decode362017(uint8_t* data)
int ec = rs634717.decode(codeword); int ec = rs634717.decode(codeword);
#if DEBUG_RS #if DEBUG_RS
LogDebug(LOG_HOST, "RS634717::decode362017(), errors = %d\n", ec); LogDebugEx(LOG_HOST, "RS634717::decode362017()", "errors = %d\n", ec);
#endif #endif
offset = 0U; offset = 0U;
for (uint32_t i = 0U; i < 20U; i++, offset += 6) for (uint32_t i = 0U; i < 20U; i++, offset += 6)

@ -453,7 +453,7 @@ void Trellis::dibitsToBits(const uint8_t* dibits, uint8_t* payload) const
bool Trellis::fixCode34(uint8_t* points, uint32_t failPos, uint8_t* payload) const bool Trellis::fixCode34(uint8_t* points, uint32_t failPos, uint8_t* payload) const
{ {
#if DEBUG_TRELLIS #if DEBUG_TRELLIS
::LogDebug(LOG_HOST, "Trellis::fixCode34() failPos = %u, val = %01X", failPos, points[failPos]); ::LogDebugEx(LOG_HOST, "Trellis::fixCode34()", "failPos = %u, val = %01X", failPos, points[failPos]);
#endif #endif
for (unsigned j = 0U; j < 20U; j++) { for (unsigned j = 0U; j < 20U; j++) {
uint32_t bestPos = 0U; uint32_t bestPos = 0U;
@ -466,7 +466,7 @@ bool Trellis::fixCode34(uint8_t* points, uint32_t failPos, uint8_t* payload) con
uint32_t pos = checkCode34(points, tribits); uint32_t pos = checkCode34(points, tribits);
if (pos == 999U) { if (pos == 999U) {
#if DEBUG_TRELLIS #if DEBUG_TRELLIS
::LogDebug(LOG_HOST, "Trellis::fixCode34() fixed, failPos = %u, pos = %u, val = %01X", failPos, bestPos, bestVal); ::LogDebugEx(LOG_HOST, "Trellis::fixCode34()", "fixed, failPos = %u, pos = %u, val = %01X", failPos, bestPos, bestVal);
#endif #endif
tribitsToBits(tribits, payload); tribitsToBits(tribits, payload);
return true; return true;
@ -519,7 +519,7 @@ uint32_t Trellis::checkCode34(const uint8_t* points, uint8_t* tribits) const
bool Trellis::fixCode12(uint8_t* points, uint32_t failPos, uint8_t* payload) const bool Trellis::fixCode12(uint8_t* points, uint32_t failPos, uint8_t* payload) const
{ {
#if DEBUG_TRELLIS #if DEBUG_TRELLIS
::LogDebug(LOG_HOST, "Trellis::fixCode12() failPos = %u, val = %01X", failPos, points[failPos]); ::LogDebugEx(LOG_HOST, "Trellis::fixCode12()", "failPos = %u, val = %01X", failPos, points[failPos]);
#endif #endif
for (unsigned j = 0U; j < 20U; j++) { for (unsigned j = 0U; j < 20U; j++) {
uint32_t bestPos = 0U; uint32_t bestPos = 0U;
@ -532,7 +532,7 @@ bool Trellis::fixCode12(uint8_t* points, uint32_t failPos, uint8_t* payload) con
uint32_t pos = checkCode12(points, dibits); uint32_t pos = checkCode12(points, dibits);
if (pos == 999U) { if (pos == 999U) {
#if DEBUG_TRELLIS #if DEBUG_TRELLIS
::LogDebug(LOG_HOST, "Trellis::fixCode12() fixed, failPos = %u, pos = %u, val = %01X", failPos, bestPos, bestVal); ::LogDebugEx(LOG_HOST, "Trellis::fixCode12()", "fixed, failPos = %u, pos = %u, val = %01X", failPos, bestPos, bestVal);
#endif #endif
dibitsToBits(dibits, payload); dibitsToBits(dibits, payload);
return true; return true;

@ -338,7 +338,7 @@ namespace edac
return; return;
} }
#if DEBUG_RS #if DEBUG_RS
LogDebug(LOG_HOST, "reed_solomon_tabs::reed_solomon_tabs() RS(%d,*): initialized for %d symbols size, %d modulo table", SIZE, NN, MODS); LogDebugEx(LOG_HOST, "reed_solomon_tabs::reed_solomon_tabs()", "RS(%d,*): initialized for %d symbols size, %d modulo table", SIZE, NN, MODS);
#endif #endif
// Generate Galois field lookup tables // Generate Galois field lookup tables
index_of[0] = A0; // log(zero) = -inf index_of[0] = A0; // log(zero) = -inf
@ -478,7 +478,7 @@ namespace edac
return; return;
} }
#if DEBUG_RS #if DEBUG_RS
LogDebug(LOG_HOST, "reed_solomon::reed_solomon() RS(%d,%d): initialized for %d roots", SIZE, LOAD, NROOTS); LogDebugEx(LOG_HOST, "reed_solomon::reed_solomon()", "RS(%d,%d): initialized for %d roots", SIZE, LOAD, NROOTS);
#endif #endif
std::array<TYP, NROOTS + 1> tmppoly; // uninitialized std::array<TYP, NROOTS + 1> tmppoly; // uninitialized
@ -896,25 +896,25 @@ namespace edac
} }
if (count != no_eras) { if (count != no_eras) {
LogDebug(LOG_HOST, "reed_solomon::decode(): count = %d, no_eras = %d, lambda(x) is WRONG", count, no_eras); LogDebugEx(LOG_HOST, "reed_solomon::decode()", "count = %d, no_eras = %d, lambda(x) is WRONG", count, no_eras);
count = -1; count = -1;
goto finish; goto finish;
} }
if (count) { if (count) {
std::stringstream ss; std::stringstream ss;
ss << "reed_solomon::decode(): Erasure positions as determined by roots of Eras Loc Poly: "; ss << "Erasure positions as determined by roots of Eras Loc Poly: ";
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
ss << loc[i] << ' '; ss << loc[i] << ' ';
} }
LogDebug(LOG_HOST, "%s", ss.str().c_str()); LogDebugEx(LOG_HOST, "reed_solomon::decode()", "%s", ss.str().c_str());
ss.clear(); ss.clear();
ss << "reed_solomon::decode(): Erasure positions as determined by roots of eras_pos array: "; ss << "Erasure positions as determined by roots of eras_pos array: ";
for (int i = 0; i < no_eras; i++) { for (int i = 0; i < no_eras; i++) {
ss << eras_pos[i] << ' '; ss << eras_pos[i] << ' ';
} }
LogDebug(LOG_HOST, "%s", ss.str().c_str()); LogDebugEx(LOG_HOST, "reed_solomon::decode()", "%s", ss.str().c_str());
} }
#endif #endif
@ -1052,7 +1052,7 @@ namespace edac
#if DEBUG_RS #if DEBUG_RS
if (den == 0) { if (den == 0) {
LogDebug(LOG_HOST, "reed_solomon::decode(): ERROR: denominator = 0"); LogDebugEx(LOG_HOST, "reed_solomon::decode()", "ERROR: denominator = 0");
count = -1; count = -1;
goto finish; goto finish;
} }
@ -1066,9 +1066,9 @@ namespace edac
// correction location outside of the data and parity we've been provided! // correction location outside of the data and parity we've been provided!
#if DEBUG_RS #if DEBUG_RS
std::stringstream ss; std::stringstream ss;
ss << "reed_solomon::decode(): ERROR: RS(" << SIZE <<"," << LOAD << ") computed error location: " << loc[j] << ss << "ERROR: RS(" << SIZE <<"," << LOAD << ") computed error location: " << loc[j] <<
" within " << pad << " pad symbols, not within " << LOAD - pad << " data or " << NROOTS << " parity"; " within " << pad << " pad symbols, not within " << LOAD - pad << " data or " << NROOTS << " parity";
LogDebug(LOG_HOST, "%s", ss.str().c_str()); LogDebugEx(LOG_HOST, "reed_solomon::decode()", "%s", ss.str().c_str());
#endif #endif
count = -1; count = -1;
goto finish; goto finish;
@ -1098,7 +1098,7 @@ namespace edac
finish: finish:
#if DEBUG_RS #if DEBUG_RS
if (count > NROOTS) { if (count > NROOTS) {
LogDebug(LOG_HOST, "reed_solomon::decode(): ERROR: number of corrections %d exceeds NROOTS %d", count, NROOTS); LogDebugEx(LOG_HOST, "reed_solomon::decode()", "ERROR: number of corrections %d exceeds NROOTS %d", count, NROOTS);
} }
if (count > 0) { if (count > 0) {
@ -1114,8 +1114,8 @@ finish:
} }
std::stringstream ss; std::stringstream ss;
ss << "reed_solomon::decode(): e)rase, E)rror; count = " << count << ": " << std::endl << errors; ss << "e)rase, E)rror; count = " << count << ": " << std::endl << errors;
LogDebug(LOG_HOST, "%s", ss.str().c_str()); LogDebugEx(LOG_HOST, "reed_solomon::decode()", "%s", ss.str().c_str());
} }
#endif #endif
if (eras_pos != NULL) { if (eras_pos != NULL) {

@ -221,7 +221,7 @@ bool PeerListLookup::load()
m_table[id] = PeerId(id, alias, password, peerLink, false); m_table[id] = PeerId(id, alias, password, peerLink, false);
// Log depending on what was loaded // Log depending on what was loaded
LogDebug(LOG_HOST, "Loaded peer ID %u%s into peer ID lookup table, %s%s", id, LogMessage(LOG_HOST, "Loaded peer ID %u%s into peer ID lookup table, %s%s", id,
(!alias.empty() ? (" (" + alias + ")").c_str() : ""), (!alias.empty() ? (" (" + alias + ")").c_str() : ""),
(!password.empty() ? "using unique peer password" : "using master password"), (!password.empty() ? "using unique peer password" : "using master password"),
(peerLink) ? ", Peer-Link Enabled" : ""); (peerLink) ? ", Peer-Link Enabled" : "");
@ -242,8 +242,6 @@ bool PeerListLookup::load()
bool PeerListLookup::save() bool PeerListLookup::save()
{ {
LogDebug(LOG_HOST, "Saving peer lookup file to %s", m_filename.c_str());
if (m_filename.empty()) { if (m_filename.empty()) {
return false; return false;
} }
@ -254,6 +252,8 @@ bool PeerListLookup::save()
return false; return false;
} }
LogMessage(LOG_HOST, "Saving peer lookup file to %s", m_filename.c_str());
// Counter for lines written // Counter for lines written
unsigned int lines = 0; unsigned int lines = 0;

@ -195,11 +195,6 @@ bool RadioIdLookup::load()
} }
m_table[id] = RadioId(radioEnabled, false, alias, ipAddress); m_table[id] = RadioId(radioEnabled, false, alias, ipAddress);
/*if (alias != "") {
LogDebug(LOG_HOST, "Loaded RID %u (%s) into RID lookup table", id, parsed[2].c_str());
} else {
LogDebug(LOG_HOST, "Loaded RID %u into RID lookup table", id);
}*/
} }
} }
@ -218,8 +213,6 @@ bool RadioIdLookup::load()
bool RadioIdLookup::save() bool RadioIdLookup::save()
{ {
LogDebug(LOG_HOST, "Saving RID lookup file to %s", m_filename.c_str());
if (m_filename.empty()) { if (m_filename.empty()) {
return false; return false;
} }
@ -230,6 +223,8 @@ bool RadioIdLookup::save()
return false; return false;
} }
LogMessage(LOG_HOST, "Saving RID lookup file to %s", m_filename.c_str());
// Counter for lines written // Counter for lines written
unsigned int lines = 0; unsigned int lines = 0;

@ -358,10 +358,10 @@ bool TalkgroupRulesLookup::save()
for (auto entry : m_groupVoice) { for (auto entry : m_groupVoice) {
yaml::Node& gv = groupVoiceList.push_back(); yaml::Node& gv = groupVoiceList.push_back();
entry.getYaml(gv); entry.getYaml(gv);
//LogDebug(LOG_HOST, "Added TGID %s to yaml TG list", gv["name"].as<std::string>().c_str()); //LogDebugEx(LOG_HOST, "TalkgroupRulesLookup::save()", "Added TGID %s to yaml TG list", gv["name"].as<std::string>().c_str());
} }
//LogDebug(LOG_HOST, "Got final GroupVoiceList YAML size of %u", groupVoiceList.size()); //LogDebugEx(LOG_HOST, "TalkgroupRulesLookup::save()", "Got final GroupVoiceList YAML size of %u", groupVoiceList.size());
// Set the new rules // Set the new rules
newRules["groupVoice"] = groupVoiceList; newRules["groupVoice"] = groupVoiceList;
@ -373,7 +373,7 @@ bool TalkgroupRulesLookup::save()
} }
try { try {
//LogDebug(LOG_HOST, "Saving TGID file to %s", m_rulesFile.c_str()); LogMessage(LOG_HOST, "Saving talkgroup rules file to %s", m_rulesFile.c_str());
yaml::Serialize(newRules, m_rulesFile.c_str()); yaml::Serialize(newRules, m_rulesFile.c_str());
LogDebug(LOG_HOST, "Saved TGID config file to %s", m_rulesFile.c_str()); LogDebug(LOG_HOST, "Saved TGID config file to %s", m_rulesFile.c_str());
} }
@ -383,4 +383,4 @@ bool TalkgroupRulesLookup::save()
} }
return true; return true;
} }

@ -211,7 +211,7 @@ uint8_t* FrameQueue::generateMessage(const uint8_t* message, uint32_t length, ui
if (timestamp != INVALID_TS) { if (timestamp != INVALID_TS) {
timestamp += (RTP_GENERIC_CLOCK_RATE / 133); timestamp += (RTP_GENERIC_CLOCK_RATE / 133);
if (m_debug) if (m_debug)
LogDebug(LOG_NET, "FrameQueue::generateMessage() RTP streamId = %u, previous TS = %u, TS = %u, rtpSeq = %u", streamId, m_streamTimestamps[streamId], timestamp, rtpSeq); LogDebugEx(LOG_NET, "FrameQueue::generateMessage()", "RTP streamId = %u, previous TS = %u, TS = %u, rtpSeq = %u", streamId, m_streamTimestamps[streamId], timestamp, rtpSeq);
m_streamTimestamps[streamId] = timestamp; m_streamTimestamps[streamId] = timestamp;
} }
} }
@ -232,7 +232,7 @@ uint8_t* FrameQueue::generateMessage(const uint8_t* message, uint32_t length, ui
if (streamId != 0U && timestamp == INVALID_TS && rtpSeq != RTP_END_OF_CALL_SEQ) { if (streamId != 0U && timestamp == INVALID_TS && rtpSeq != RTP_END_OF_CALL_SEQ) {
if (m_debug) if (m_debug)
LogDebug(LOG_NET, "FrameQueue::generateMessage() RTP streamId = %u, initial TS = %u, rtpSeq = %u", streamId, header.getTimestamp(), rtpSeq); LogDebugEx(LOG_NET, "FrameQueue::generateMessage()", "RTP streamId = %u, initial TS = %u, rtpSeq = %u", streamId, header.getTimestamp(), rtpSeq);
m_streamTimestamps[streamId] = header.getTimestamp(); m_streamTimestamps[streamId] = header.getTimestamp();
} }
@ -241,7 +241,7 @@ uint8_t* FrameQueue::generateMessage(const uint8_t* message, uint32_t length, ui
auto entry = m_streamTimestamps.find(streamId); auto entry = m_streamTimestamps.find(streamId);
if (entry != m_streamTimestamps.end()) { if (entry != m_streamTimestamps.end()) {
if (m_debug) if (m_debug)
LogDebug(LOG_NET, "FrameQueue::generateMessage() RTP streamId = %u, rtpSeq = %u", streamId, rtpSeq); LogDebugEx(LOG_NET, "FrameQueue::generateMessage()", "RTP streamId = %u, rtpSeq = %u", streamId, rtpSeq);
m_streamTimestamps.erase(streamId); m_streamTimestamps.erase(streamId);
} }
} }

@ -322,9 +322,9 @@ namespace network
void handleRequest(const Request& request, Reply& reply) void handleRequest(const Request& request, Reply& reply)
{ {
for (auto header : request.headers.headers()) for (auto header : request.headers.headers())
::LogDebug(LOG_REST, "DebugRequestDispatcher::handleRequest() header = %s, value = %s", header.name.c_str(), header.value.c_str()); ::LogDebugEx(LOG_REST, "DebugRequestDispatcher::handleRequest()", "header = %s, value = %s", header.name.c_str(), header.value.c_str());
::LogDebug(LOG_REST, "DebugRequestDispatcher::handleRequest() content = %s", request.content.c_str()); ::LogDebugEx(LOG_REST, "DebugRequestDispatcher::handleRequest()", "content = %s", request.content.c_str());
} }
}; };

@ -97,7 +97,7 @@ namespace network
*/ */
void add(const std::string& name, const std::string& value) void add(const std::string& name, const std::string& value)
{ {
//::LogDebug(LOG_REST, "HTTPHeaders::add(), header = %s, value = %s", name.c_str(), value.c_str()); //::LogDebugEx(LOG_REST, "HTTPHeaders::add()", "header = %s, value = %s", name.c_str(), value.c_str());
for (auto& header : m_headers) { for (auto& header : m_headers) {
if (::strtolower(header.name) == ::strtolower(name)) { if (::strtolower(header.name) == ::strtolower(name)) {
header.value = value; header.value = value;
@ -107,7 +107,7 @@ namespace network
m_headers.push_back(Header(name, value)); m_headers.push_back(Header(name, value));
//for (auto header : m_headers) //for (auto header : m_headers)
// ::LogDebug(LOG_REST, "HTTPHeaders::add() m_headers.header = %s, m_headers.value = %s", header.name.c_str(), header.value.c_str()); // ::LogDebugEx(LOG_REST, "HTTPHeaders::add()", "m_headers.header = %s, m_headers.value = %s", header.name.c_str(), header.value.c_str());
} }
/** /**
* @brief Helper to remove a HTTP header. * @brief Helper to remove a HTTP header.

@ -358,7 +358,7 @@ HTTPLexer::ResultType HTTPLexer::consume(HTTPPayload& req, char input)
case EXPECTING_NEWLINE_3: case EXPECTING_NEWLINE_3:
if (input == '\n') { if (input == '\n') {
for (auto header : m_headers) { for (auto header : m_headers) {
//::LogDebug(LOG_REST, "HTTPLexer::consume(), header = %s, value = %s", header.name.c_str(), header.value.c_str()); //::LogDebugEx(LOG_REST, "HTTPLexer::consume()", "header = %s, value = %s", header.name.c_str(), header.value.c_str());
req.headers.add(header.name, header.value); req.headers.add(header.name, header.value);
} }

@ -279,7 +279,7 @@ std::vector<asio::const_buffer> HTTPPayload::toBuffers()
// copy URI and erase zero terminator // copy URI and erase zero terminator
uri.erase(std::find(uri.begin(), uri.end(), '\0'), uri.end()); uri.erase(std::find(uri.begin(), uri.end(), '\0'), uri.end());
#if DEBUG_HTTP_PAYLOAD #if DEBUG_HTTP_PAYLOAD
::LogDebug(LOG_REST, "HTTPPayload::toBuffers() method = %s, uri = %s", method.c_str(), uri.c_str()); ::LogDebugEx(LOG_REST, "HTTPPayload::toBuffers()", "method = %s, uri = %s", method.c_str(), uri.c_str());
#endif #endif
buffers.push_back(asio::buffer(method)); buffers.push_back(asio::buffer(method));
buffers.push_back(asio::buffer(misc_strings::request_method_separator)); buffers.push_back(asio::buffer(misc_strings::request_method_separator));
@ -295,7 +295,7 @@ std::vector<asio::const_buffer> HTTPPayload::toBuffers()
for (std::size_t i = 0; i < headers.size(); ++i) { for (std::size_t i = 0; i < headers.size(); ++i) {
HTTPHeaders::Header& h = headers.m_headers[i]; HTTPHeaders::Header& h = headers.m_headers[i];
#if DEBUG_HTTP_PAYLOAD #if DEBUG_HTTP_PAYLOAD
::LogDebug(LOG_REST, "HTTPPayload::toBuffers() header = %s, value = %s", h.name.c_str(), h.value.c_str()); ::LogDebugEx(LOG_REST, "HTTPPayload::toBuffers()", "header = %s, value = %s", h.name.c_str(), h.value.c_str());
#endif #endif
buffers.push_back(asio::buffer(h.name)); buffers.push_back(asio::buffer(h.name));
@ -309,9 +309,9 @@ std::vector<asio::const_buffer> HTTPPayload::toBuffers()
buffers.push_back(asio::buffer(content)); buffers.push_back(asio::buffer(content));
#if DEBUG_HTTP_PAYLOAD #if DEBUG_HTTP_PAYLOAD
::LogDebug(LOG_REST, "HTTPPayload::toBuffers() content = %s", content.c_str()); ::LogDebugEx(LOG_REST, "HTTPPayload::toBuffers()", "content = %s", content.c_str());
for (auto buffer : buffers) for (auto buffer : buffers)
Utils::dump("buffer[]", (uint8_t*)buffer.data(), buffer.size()); Utils::dump("[HTTPPayload::toBuffers()] buffer[]", (uint8_t*)buffer.data(), buffer.size());
#endif #endif
return buffers; return buffers;

@ -86,7 +86,7 @@ bool LICH::decode(const uint8_t* data)
m_lich = lich[0U]; m_lich = lich[0U];
#if DEBUG_NXDN_LICH #if DEBUG_NXDN_LICH
LogDebug(LOG_NXDN, "LICH::decode(), m_lich = %02X", m_lich); LogDebugEx(LOG_NXDN, "LICH::decode()", "m_lich = %02X", m_lich);
#endif #endif
bool newParity = getParity(); bool newParity = getParity();
@ -121,7 +121,7 @@ void LICH::encode(uint8_t* data)
m_lich |= (m_outbound ? 0x01U : 0x00U) << 1; m_lich |= (m_outbound ? 0x01U : 0x00U) << 1;
#if DEBUG_NXDN_LICH #if DEBUG_NXDN_LICH
LogDebug(LOG_NXDN, "LICH::encode(), m_lich = %02X", m_lich); LogDebugEx(LOG_NXDN, "LICH::encode()", "m_lich = %02X", m_lich);
#endif #endif
bool parity = getParity(); bool parity = getParity();

@ -405,8 +405,8 @@ void LC::encodeLDU1(uint8_t* data, const uint8_t* imbe)
} }
#if DEBUG_P25_DFSI #if DEBUG_P25_DFSI
LogDebug(LOG_P25, "LC::encodeLDU1(), frameType = $%02X", m_frameType); LogDebugEx(LOG_P25, "LC::encodeLDU1()", "frameType = $%02X", m_frameType);
Utils::dump(2U, "LC::encodeLDU1(), DFSI LDU1 Frame", dfsiFrame, frameLength); Utils::dump(2U, "[LC::encodeLDU1()] DFSI LDU1 Frame", dfsiFrame, frameLength);
#endif #endif
::memcpy(data, dfsiFrame, frameLength); ::memcpy(data, dfsiFrame, frameLength);
@ -646,8 +646,8 @@ void LC::encodeLDU2(uint8_t* data, const uint8_t* imbe)
} }
#if DEBUG_P25_DFSI #if DEBUG_P25_DFSI
LogDebug(LOG_P25, "LC::encodeLDU2(), frameType = $%02X", m_frameType); LogDebugEx(LOG_P25, "LC::encodeLDU2()", "frameType = $%02X", m_frameType);
Utils::dump(2U, "LC::encodeLDU2(), DFSI LDU2 Frame", dfsiFrame, frameLength); Utils::dump(2U, "[LC::encodeLDU2()] DFSI LDU2 Frame", dfsiFrame, frameLength);
#endif #endif
::memcpy(data, dfsiFrame, frameLength); ::memcpy(data, dfsiFrame, frameLength);

@ -114,8 +114,8 @@ bool AMBT::decode(const data::DataHeader& dataHeader, const data::DataBlock* blo
} }
if (m_verbose) { if (m_verbose) {
LogDebug(LOG_P25, "AMBT::decode(), mfId = $%02X, lco = $%02X, ambt8 = $%02X, ambt9 = $%02X", m_mfId, m_lco, dataHeader.getAMBTField8(), dataHeader.getAMBTField9()); LogDebugEx(LOG_P25, "AMBT::decode()", "mfId = $%02X, lco = $%02X, ambt8 = $%02X, ambt9 = $%02X", m_mfId, m_lco, dataHeader.getAMBTField8(), dataHeader.getAMBTField9());
Utils::dump(2U, "AMBT::decode(), pduUserData", pduUserData, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()); Utils::dump(2U, "[AMBT::decode()] pduUserData", pduUserData, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow());
} }
return true; return true;

@ -608,7 +608,7 @@ void* HostFNE::threadMasterNetwork(void* arg)
HostFNE* fne = static_cast<HostFNE*>(th->obj); HostFNE* fne = static_cast<HostFNE*>(th->obj);
if (fne == nullptr) { if (fne == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -616,7 +616,7 @@ void* HostFNE::threadMasterNetwork(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -628,7 +628,7 @@ void* HostFNE::threadMasterNetwork(void* arg)
} }
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -651,7 +651,7 @@ void* HostFNE::threadDiagNetwork(void* arg)
HostFNE* fne = static_cast<HostFNE*>(th->obj); HostFNE* fne = static_cast<HostFNE*>(th->obj);
if (fne == nullptr) { if (fne == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -664,7 +664,7 @@ void* HostFNE::threadDiagNetwork(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -676,7 +676,7 @@ void* HostFNE::threadDiagNetwork(void* arg)
} }
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -842,7 +842,7 @@ void* HostFNE::threadVirtualNetworking(void* arg)
HostFNE* fne = static_cast<HostFNE*>(th->obj); HostFNE* fne = static_cast<HostFNE*>(th->obj);
if (fne == nullptr) { if (fne == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -855,7 +855,7 @@ void* HostFNE::threadVirtualNetworking(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -887,7 +887,7 @@ void* HostFNE::threadVirtualNetworking(void* arg)
} }
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -906,7 +906,7 @@ void* HostFNE::threadVirtualNetworkingClock(void* arg)
HostFNE* fne = static_cast<HostFNE*>(th->obj); HostFNE* fne = static_cast<HostFNE*>(th->obj);
if (fne == nullptr) { if (fne == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -919,7 +919,7 @@ void* HostFNE::threadVirtualNetworkingClock(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -947,7 +947,7 @@ void* HostFNE::threadVirtualNetworkingClock(void* arg)
} }
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }

@ -653,7 +653,7 @@ bool RESTAPI::validateAuth(const HTTPPayload& request, HTTPPayload& reply)
std::string host = request.headers.find("RemoteHost"); std::string host = request.headers.find("RemoteHost");
std::string headerToken = request.headers.find("X-DVM-Auth-Token"); std::string headerToken = request.headers.find("X-DVM-Auth-Token");
#if DEBUG_HTTP_PAYLOAD #if DEBUG_HTTP_PAYLOAD
::LogDebug(LOG_REST, "RESTAPI::validateAuth() token, host = %s, token = %s", host.c_str(), headerToken.c_str()); ::LogDebugEx(LOG_REST, "RESTAPI::validateAuth()", "token, host = %s, token = %s", host.c_str(), headerToken.c_str());
#endif #endif
if (headerToken.empty()) { if (headerToken.empty()) {
errorPayload(reply, "no authentication token", HTTPPayload::UNAUTHORIZED); errorPayload(reply, "no authentication token", HTTPPayload::UNAUTHORIZED);
@ -662,11 +662,11 @@ bool RESTAPI::validateAuth(const HTTPPayload& request, HTTPPayload& reply)
for (auto& token : m_authTokens) { for (auto& token : m_authTokens) {
#if DEBUG_HTTP_PAYLOAD #if DEBUG_HTTP_PAYLOAD
::LogDebug(LOG_REST, "RESTAPI::validateAuth() valid list, host = %s, token = %s", token.first.c_str(), std::to_string(token.second).c_str()); ::LogDebugEx(LOG_REST, "RESTAPI::validateAuth()", "valid list, host = %s, token = %s", token.first.c_str(), std::to_string(token.second).c_str());
#endif #endif
if (token.first.compare(host) == 0) { if (token.first.compare(host) == 0) {
#if DEBUG_HTTP_PAYLOAD #if DEBUG_HTTP_PAYLOAD
::LogDebug(LOG_REST, "RESTAPI::validateAuth() storedToken = %s, passedToken = %s", std::to_string(token.second).c_str(), headerToken.c_str()); ::LogDebugEx(LOG_REST, "RESTAPI::validateAuth()", "storedToken = %s, passedToken = %s", std::to_string(token.second).c_str(), headerToken.c_str());
#endif #endif
if (std::to_string(token.second).compare(headerToken) == 0) { if (std::to_string(token.second).compare(headerToken) == 0) {
return true; return true;

@ -49,7 +49,7 @@ void* Host::threadDMRReader1(void* arg)
Host* host = static_cast<Host*>(th->obj); Host* host = static_cast<Host*>(th->obj);
if (host == nullptr) { if (host == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -57,7 +57,7 @@ void* Host::threadDMRReader1(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -159,7 +159,7 @@ void* Host::threadDMRReader1(void* arg)
} }
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -182,7 +182,7 @@ void* Host::threadDMRWriter1(void* arg)
Host* host = static_cast<Host*>(th->obj); Host* host = static_cast<Host*>(th->obj);
if (host == nullptr) { if (host == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -190,7 +190,7 @@ void* Host::threadDMRWriter1(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -288,7 +288,7 @@ void* Host::threadDMRWriter1(void* arg)
} }
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -311,7 +311,7 @@ void* Host::threadDMRReader2(void* arg)
Host* host = static_cast<Host*>(th->obj); Host* host = static_cast<Host*>(th->obj);
if (host == nullptr) { if (host == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -319,7 +319,7 @@ void* Host::threadDMRReader2(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -420,7 +420,7 @@ void* Host::threadDMRReader2(void* arg)
} }
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -443,7 +443,7 @@ void* Host::threadDMRWriter2(void* arg)
Host* host = static_cast<Host*>(th->obj); Host* host = static_cast<Host*>(th->obj);
if (host == nullptr) { if (host == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -451,7 +451,7 @@ void* Host::threadDMRWriter2(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -549,7 +549,7 @@ void* Host::threadDMRWriter2(void* arg)
} }
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }

@ -36,7 +36,7 @@ void* Host::threadNXDNReader(void* arg)
Host* host = static_cast<Host*>(th->obj); Host* host = static_cast<Host*>(th->obj);
if (host == nullptr) { if (host == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -44,7 +44,7 @@ void* Host::threadNXDNReader(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -108,7 +108,7 @@ void* Host::threadNXDNReader(void* arg)
} }
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -131,7 +131,7 @@ void* Host::threadNXDNWriter(void* arg)
Host* host = static_cast<Host*>(th->obj); Host* host = static_cast<Host*>(th->obj);
if (host == nullptr) { if (host == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -139,7 +139,7 @@ void* Host::threadNXDNWriter(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -224,7 +224,7 @@ void* Host::threadNXDNWriter(void* arg)
} }
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }

@ -37,7 +37,7 @@ void* Host::threadP25Reader(void* arg)
Host* host = static_cast<Host*>(th->obj); Host* host = static_cast<Host*>(th->obj);
if (host == nullptr) { if (host == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -45,7 +45,7 @@ void* Host::threadP25Reader(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -150,7 +150,7 @@ void* Host::threadP25Reader(void* arg)
} }
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -173,7 +173,7 @@ void* Host::threadP25Writer(void* arg)
Host* host = static_cast<Host*>(th->obj); Host* host = static_cast<Host*>(th->obj);
if (host == nullptr) { if (host == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -181,7 +181,7 @@ void* Host::threadP25Writer(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -309,7 +309,7 @@ void* Host::threadP25Writer(void* arg)
} }
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }

@ -1697,7 +1697,7 @@ void* Host::threadModem(void* arg)
Host* host = static_cast<Host*>(th->obj); Host* host = static_cast<Host*>(th->obj);
if (host == nullptr) { if (host == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -1705,7 +1705,7 @@ void* Host::threadModem(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -1734,7 +1734,7 @@ void* Host::threadModem(void* arg)
Thread::sleep(m_idleTickDelay); Thread::sleep(m_idleTickDelay);
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -1757,7 +1757,7 @@ void* Host::threadWatchdog(void* arg)
Host* host = static_cast<Host*>(th->obj); Host* host = static_cast<Host*>(th->obj);
if (host == nullptr) { if (host == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -1765,7 +1765,7 @@ void* Host::threadWatchdog(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -1949,7 +1949,7 @@ void* Host::threadWatchdog(void* arg)
Thread::sleep(m_idleTickDelay); Thread::sleep(m_idleTickDelay);
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -1972,7 +1972,7 @@ void* Host::threadSiteData(void* arg)
Host* host = static_cast<Host*>(th->obj); Host* host = static_cast<Host*>(th->obj);
if (host == nullptr) { if (host == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -1980,7 +1980,7 @@ void* Host::threadSiteData(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -2018,7 +2018,7 @@ void* Host::threadSiteData(void* arg)
Thread::sleep(m_idleTickDelay); Thread::sleep(m_idleTickDelay);
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }
@ -2041,7 +2041,7 @@ void* Host::threadPresence(void* arg)
Host* host = static_cast<Host*>(th->obj); Host* host = static_cast<Host*>(th->obj);
if (host == nullptr) { if (host == nullptr) {
g_killed = true; g_killed = true;
LogDebug(LOG_HOST, "[FAIL] %s", threadName.c_str()); LogError(LOG_HOST, "[FAIL] %s", threadName.c_str());
} }
if (g_killed) { if (g_killed) {
@ -2049,7 +2049,7 @@ void* Host::threadPresence(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -2125,7 +2125,7 @@ void* Host::threadPresence(void* arg)
Thread::sleep(m_idleTickDelay); Thread::sleep(m_idleTickDelay);
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }

@ -1103,7 +1103,7 @@ void Slot::addFrame(const uint8_t *data, bool net, bool imm)
fifoSpace = m_modem->getDMRSpace2(); fifoSpace = m_modem->getDMRSpace2();
} }
//LogDebug(LOG_DMR, "Slot %u, addFrame() fifoSpace = %u", m_slotNo, fifoSpace); //LogDebugEx(LOG_DMR, "Slot::addFrame()", "Slot %u, fifoSpace = %u", m_slotNo, fifoSpace);
// is this immediate data? // is this immediate data?
if (imm) { if (imm) {
@ -1506,7 +1506,7 @@ void Slot::writeRF_ControlData(uint16_t frameCnt, uint8_t n)
bool grp = m_affiliations->isGroup(dstId); bool grp = m_affiliations->isGroup(dstId);
if (m_debug) { if (m_debug) {
LogDebug(LOG_DMR, "writeRF_ControlData, frameCnt = %u, seq = %u, late entry, dstId = %u, srcId = %u", frameCnt, n, dstId, srcId); LogDebugEx(LOG_DMR, "Slot::writeRF_ControlData()", "frameCnt = %u, seq = %u, late entry, dstId = %u, srcId = %u", frameCnt, n, dstId, srcId);
} }
m_control->writeRF_CSBK_Grant_LateEntry(dstId, srcId, grp); m_control->writeRF_CSBK_Grant_LateEntry(dstId, srcId, grp);
@ -1709,8 +1709,8 @@ void Slot::setShortLC_TSCC(SiteData siteData, uint16_t counter)
lc[3U] = (uint8_t)((lcValue >> 0) & 0xFFU); lc[3U] = (uint8_t)((lcValue >> 0) & 0xFFU);
lc[4U] = edac::CRC::crc8(lc, 4U); lc[4U] = edac::CRC::crc8(lc, 4U);
//LogDebug(LOG_DMR, "setShortLC_TSCC, netId = %02X, siteId = %02X", siteData.netId(), siteData.siteId()); //LogDebugEx(LOG_DMR, "Slot::setShortLC_TSCC()", "netId = %02X, siteId = %02X", siteData.netId(), siteData.siteId());
//Utils::dump(1U, "shortLC_TSCC", lc, 5U); //Utils::dump(1U, "[Slot::shortLC_TSCC()]", lc, 5U);
uint8_t sLC[9U]; uint8_t sLC[9U];
@ -1769,8 +1769,8 @@ void Slot::setShortLC_Payload(SiteData siteData, uint16_t counter)
lc[3U] = (uint8_t)((lcValue >> 0) & 0xFFU); lc[3U] = (uint8_t)((lcValue >> 0) & 0xFFU);
lc[4U] = edac::CRC::crc8(lc, 4U); lc[4U] = edac::CRC::crc8(lc, 4U);
//LogDebug(LOG_DMR, "setShortLC_Payload, netId = %02X, siteId = %02X", siteData.netId(), siteData.siteId()); //LogDebugEx(LOG_DMR, "Slot::setShortLC_Payload()", "netId = %02X, siteId = %02X", siteData.netId(), siteData.siteId());
//Utils::dump(1U, "setShortLC_Payload", lc, 5U); //Utils::dump(1U, "[Slot::setShortLC_Payload()]", lc, 5U);
uint8_t sLC[9U]; uint8_t sLC[9U];

@ -36,7 +36,7 @@ DMRAffiliationLookup::~DMRAffiliationLookup() = default;
bool DMRAffiliationLookup::grantCh(uint32_t dstId, uint32_t srcId, uint32_t grantTimeout, bool grp, bool netGranted) bool DMRAffiliationLookup::grantCh(uint32_t dstId, uint32_t srcId, uint32_t grantTimeout, bool grp, bool netGranted)
{ {
::LogDebug(LOG_HOST, "%s, DMRAffiliationLookup::grantCh() use grantChSlot() BUGBUG"); ::LogDebugEx(LOG_HOST, "%s", "DMRAffiliationLookup::grantCh()", "use grantChSlot() BUGBUG");
return false; return false;
} }

@ -581,7 +581,7 @@ void Modem::clock(uint32_t ms)
m_rxDMRQueue1.addData(m_buffer + 3U, m_length - 3U); m_rxDMRQueue1.addData(m_buffer + 3U, m_length - 3U);
if (m_trace) if (m_trace)
Utils::dump(1U, "Modem::clock() RX DMR Data 1", m_buffer + 3U, m_length - 3U); Utils::dump(1U, "[Modem::clock()] RX DMR Data 1", m_buffer + 3U, m_length - 3U);
} }
} }
break; break;
@ -607,7 +607,7 @@ void Modem::clock(uint32_t ms)
m_rxDMRQueue2.addData(m_buffer + 3U, m_length - 3U); m_rxDMRQueue2.addData(m_buffer + 3U, m_length - 3U);
if (m_trace) if (m_trace)
Utils::dump(1U, "Modem::clock() RX DMR Data 2", m_buffer + 3U, m_length - 3U); Utils::dump(1U, "[Modem::clock()] RX DMR Data 2", m_buffer + 3U, m_length - 3U);
} }
} }
break; break;
@ -669,7 +669,7 @@ void Modem::clock(uint32_t ms)
m_rxP25Queue.addData(m_buffer + (cmdOffset + 1U), m_length - (cmdOffset + 1U)); m_rxP25Queue.addData(m_buffer + (cmdOffset + 1U), m_length - (cmdOffset + 1U));
if (m_trace) if (m_trace)
Utils::dump(1U, "Modem::clock() RX P25 Data", m_buffer + (cmdOffset + 1U), m_length - (cmdOffset + 1U)); Utils::dump(1U, "[Modem::clock()] RX P25 Data", m_buffer + (cmdOffset + 1U), m_length - (cmdOffset + 1U));
} }
} }
break; break;
@ -712,7 +712,7 @@ void Modem::clock(uint32_t ms)
m_rxNXDNQueue.addData(m_buffer + 3U, m_length - 3U); m_rxNXDNQueue.addData(m_buffer + 3U, m_length - 3U);
if (m_trace) if (m_trace)
Utils::dump(1U, "Modem::clock() RX NXDN Data", m_buffer + 3U, m_length - 3U); Utils::dump(1U, "[Modem::clock()] RX NXDN Data", m_buffer + 3U, m_length - 3U);
} }
} }
break; break;
@ -834,9 +834,9 @@ void Modem::clock(uint32_t ms)
m_p25Space = m_buffer[10U] * (P25DEF::P25_LDU_FRAME_LENGTH_BYTES); m_p25Space = m_buffer[10U] * (P25DEF::P25_LDU_FRAME_LENGTH_BYTES);
if (m_dumpModemStatus) { if (m_dumpModemStatus) {
LogDebug(LOG_MODEM, "Modem::clock(), CMD_GET_STATUS, isHotspot = %u, dmr = %u / %u, p25 = %u / %u, nxdn = %u / %u, modemState = %u, tx = %u, adcOverflow = %u, rxOverflow = %u, txOverflow = %u, dacOverflow = %u, dmrSpace1 = %u, dmrSpace2 = %u, p25Space = %u, nxdnSpace = %u", LogDebugEx(LOG_MODEM, "Modem::clock()", "CMD_GET_STATUS, isHotspot = %u, dmr = %u / %u, p25 = %u / %u, nxdn = %u / %u, modemState = %u, tx = %u, adcOverflow = %u, rxOverflow = %u, txOverflow = %u, dacOverflow = %u, dmrSpace1 = %u, dmrSpace2 = %u, p25Space = %u, nxdnSpace = %u",
m_isHotspot, dmrEnable, m_dmrEnabled, p25Enable, m_p25Enabled, nxdnEnable, m_nxdnEnabled, m_modemState, m_tx, adcOverflow, rxOverflow, txOverflow, dacOverflow, m_dmrSpace1, m_dmrSpace2, m_p25Space, m_nxdnSpace); m_isHotspot, dmrEnable, m_dmrEnabled, p25Enable, m_p25Enabled, nxdnEnable, m_nxdnEnabled, m_modemState, m_tx, adcOverflow, rxOverflow, txOverflow, dacOverflow, m_dmrSpace1, m_dmrSpace2, m_p25Space, m_nxdnSpace);
LogDebug(LOG_MODEM, "Modem::clock(), CMD_GET_STATUS, rxDMRData1 size = %u, len = %u, free = %u; rxDMRData2 size = %u, len = %u, free = %u, rxP25Data size = %u, len = %u, free = %u, rxNXDNData size = %u, len = %u, free = %u", LogDebugEx(LOG_MODEM, "Modem::clock()", "CMD_GET_STATUS, rxDMRData1 size = %u, len = %u, free = %u; rxDMRData2 size = %u, len = %u, free = %u, rxP25Data size = %u, len = %u, free = %u, rxNXDNData size = %u, len = %u, free = %u",
m_rxDMRQueue1.length(), m_rxDMRQueue1.dataSize(), m_rxDMRQueue1.freeSpace(), m_rxDMRQueue2.length(), m_rxDMRQueue2.dataSize(), m_rxDMRQueue2.freeSpace(), m_rxDMRQueue1.length(), m_rxDMRQueue1.dataSize(), m_rxDMRQueue1.freeSpace(), m_rxDMRQueue2.length(), m_rxDMRQueue2.dataSize(), m_rxDMRQueue2.freeSpace(),
m_rxP25Queue.length(), m_rxP25Queue.dataSize(), m_rxP25Queue.freeSpace(), m_rxNXDNQueue.length(), m_rxNXDNQueue.dataSize(), m_rxNXDNQueue.freeSpace()); m_rxP25Queue.length(), m_rxP25Queue.dataSize(), m_rxP25Queue.freeSpace(), m_rxNXDNQueue.length(), m_rxNXDNQueue.dataSize(), m_rxNXDNQueue.freeSpace());
} }
@ -907,7 +907,7 @@ void Modem::clock(uint32_t ms)
void Modem::close() void Modem::close()
{ {
LogDebug(LOG_MODEM, "Closing the modem"); LogMessage(LOG_MODEM, "Closing the modem");
m_port->close(); m_port->close();
m_gotModemStatus = false; m_gotModemStatus = false;
@ -928,7 +928,7 @@ uint32_t Modem::peekDMRFrame1Length()
uint8_t len = 0U; uint8_t len = 0U;
m_rxDMRQueue1.peek(&len, 1U); m_rxDMRQueue1.peek(&len, 1U);
#if DEBUG_MODEM #if DEBUG_MODEM
LogDebug(LOG_MODEM, "Modem::peekDMRFrame1Length() len = %u, dataSize = %u", len, m_rxDMRQueue1.dataSize()); LogDebugEx(LOG_MODEM, "Modem::peekDMRFrame1Length()", "len = %u, dataSize = %u", len, m_rxDMRQueue1.dataSize());
#endif #endif
// this ensures we never get in a situation where we have length stuck on the queue // this ensures we never get in a situation where we have length stuck on the queue
if (m_rxDMRQueue1.dataSize() == 1U && len > m_rxDMRQueue1.dataSize()) { if (m_rxDMRQueue1.dataSize() == 1U && len > m_rxDMRQueue1.dataSize()) {
@ -982,7 +982,7 @@ uint32_t Modem::peekDMRFrame2Length()
uint8_t len = 0U; uint8_t len = 0U;
m_rxDMRQueue2.peek(&len, 1U); m_rxDMRQueue2.peek(&len, 1U);
#if DEBUG_MODEM #if DEBUG_MODEM
LogDebug(LOG_MODEM, "Modem::peekDMRFrame2Length() len = %u, dataSize = %u", len, m_rxDMRQueue2.dataSize()); LogDebugEx(LOG_MODEM, "Modem::peekDMRFrame2Length()", "len = %u, dataSize = %u", len, m_rxDMRQueue2.dataSize());
#endif #endif
// this ensures we never get in a situation where we have length stuck on the queue // this ensures we never get in a situation where we have length stuck on the queue
if (m_rxDMRQueue2.dataSize() == 1U && len > m_rxDMRQueue2.dataSize()) { if (m_rxDMRQueue2.dataSize() == 1U && len > m_rxDMRQueue2.dataSize()) {
@ -1040,7 +1040,7 @@ uint32_t Modem::peekP25FrameLength()
uint16_t len = 0U; uint16_t len = 0U;
len = (length[0U] << 8) + length[1U]; len = (length[0U] << 8) + length[1U];
#if DEBUG_MODEM #if DEBUG_MODEM
LogDebug(LOG_MODEM, "Modem::peekP25FrameLength() len = %u, dataSize = %u", len, m_rxP25Queue.dataSize()); LogDebugEx(LOG_MODEM, "Modem::peekP25FrameLength()", "len = %u, dataSize = %u", len, m_rxP25Queue.dataSize());
#endif #endif
// this ensures we never get in a situation where we have length stuck on the queue // this ensures we never get in a situation where we have length stuck on the queue
if (m_rxP25Queue.dataSize() == 2U && len > m_rxP25Queue.dataSize()) { if (m_rxP25Queue.dataSize() == 2U && len > m_rxP25Queue.dataSize()) {
@ -1098,7 +1098,7 @@ uint32_t Modem::peekNXDNFrameLength()
uint8_t len = 0U; uint8_t len = 0U;
m_rxNXDNQueue.peek(&len, 1U); m_rxNXDNQueue.peek(&len, 1U);
#if DEBUG_MODEM #if DEBUG_MODEM
LogDebug(LOG_MODEM, "Modem::peekNXDNFrameLength() len = %u, dataSize = %u", len, m_rxNXDNQueue.dataSize()); LogDebugEx(LOG_MODEM, "Modem::peekNXDNFrameLength()", "len = %u, dataSize = %u", len, m_rxNXDNQueue.dataSize());
#endif #endif
// this ensures we never get in a situation where we have length stuck on the queue // this ensures we never get in a situation where we have length stuck on the queue
if (m_rxNXDNQueue.dataSize() == 1U && len > m_rxNXDNQueue.dataSize()) { if (m_rxNXDNQueue.dataSize() == 1U && len > m_rxNXDNQueue.dataSize()) {
@ -1222,7 +1222,7 @@ void Modem::clearDMRFrame1()
buffer[1U] = 3U; buffer[1U] = 3U;
buffer[2U] = CMD_DMR_CLEAR1; buffer[2U] = CMD_DMR_CLEAR1;
#if DEBUG_MODEM #if DEBUG_MODEM
Utils::dump(1U, "Modem::clearDMRFrame1(), Written", buffer, 3U); Utils::dump(1U, "[Modem::clearDMRFrame1()] Written", buffer, 3U);
#endif #endif
write(buffer, 3U); write(buffer, 3U);
Thread::sleep(5); // 5ms delay Thread::sleep(5); // 5ms delay
@ -1238,7 +1238,7 @@ void Modem::clearDMRFrame2()
buffer[1U] = 3U; buffer[1U] = 3U;
buffer[2U] = CMD_DMR_CLEAR2; buffer[2U] = CMD_DMR_CLEAR2;
#if DEBUG_MODEM #if DEBUG_MODEM
Utils::dump(1U, "Modem::clearDMRFrame2(), Written", buffer, 3U); Utils::dump(1U, "[Modem::clearDMRFrame2()] Written", buffer, 3U);
#endif #endif
write(buffer, 3U); write(buffer, 3U);
Thread::sleep(5); // 5ms delay Thread::sleep(5); // 5ms delay
@ -1254,7 +1254,7 @@ void Modem::clearP25Frame()
buffer[1U] = 3U; buffer[1U] = 3U;
buffer[2U] = CMD_P25_CLEAR; buffer[2U] = CMD_P25_CLEAR;
#if DEBUG_MODEM #if DEBUG_MODEM
Utils::dump(1U, "Modem::clearP25Data(), Written", buffer, 3U); Utils::dump(1U, "[Modem::clearP25Data()] Written", buffer, 3U);
#endif #endif
write(buffer, 3U); write(buffer, 3U);
Thread::sleep(5); // 5ms delay Thread::sleep(5); // 5ms delay
@ -1270,7 +1270,7 @@ void Modem::clearNXDNFrame()
buffer[1U] = 3U; buffer[1U] = 3U;
buffer[2U] = CMD_NXDN_CLEAR; buffer[2U] = CMD_NXDN_CLEAR;
#if DEBUG_MODEM #if DEBUG_MODEM
Utils::dump(1U, "Modem::clearNXDNFrame(), Written", buffer, 3U); Utils::dump(1U, "[Modem::clearNXDNFrame()] Written", buffer, 3U);
#endif #endif
write(buffer, 3U); write(buffer, 3U);
Thread::sleep(5); // 5ms delay Thread::sleep(5); // 5ms delay
@ -1382,7 +1382,7 @@ bool Modem::writeDMRFrame1(const uint8_t* data, uint32_t length)
return false; return false;
if (length > MAX_LENGTH) { if (length > MAX_LENGTH) {
LogError(LOG_MODEM, "Modem::writeDMRData1(); request data to write >%u?, len = %u", MAX_LENGTH, 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); Utils::dump(1U, "[Modem::writeDMRData1()] Attmpted Data", data, length);
return false; return false;
} }
@ -1399,9 +1399,9 @@ bool Modem::writeDMRFrame1(const uint8_t* data, uint32_t length)
// write or buffer DMR slot 1 data to air interface // write or buffer DMR slot 1 data to air interface
if (m_dmrSpace1 >= length) { if (m_dmrSpace1 >= length) {
if (m_debug) if (m_debug)
LogDebug(LOG_MODEM, "Modem::writeDMRData1(); immediate write (len %u)", length); LogDebugEx(LOG_MODEM, "Modem::writeDMRData1()", "immediate write (len %u)", length);
if (m_trace) if (m_trace)
Utils::dump(1U, "Modem::writeDMRData1() Immediate TX DMR Data 1", buffer + 3U, length - 1U); Utils::dump(1U, "[Modem::writeDMRData1()] Immediate TX DMR Data 1", buffer + 3U, length - 1U);
int ret = write(buffer, len); int ret = write(buffer, len);
if (ret != int(len)) { if (ret != int(len)) {
@ -1453,9 +1453,9 @@ bool Modem::writeDMRFrame2(const uint8_t* data, uint32_t length)
// write or buffer DMR slot 2 data to air interface // write or buffer DMR slot 2 data to air interface
if (m_dmrSpace2 >= length) { if (m_dmrSpace2 >= length) {
if (m_debug) if (m_debug)
LogDebug(LOG_MODEM, "Modem::writeDMRData2(); immediate write (len %u)", length); LogDebugEx(LOG_MODEM, "Modem::writeDMRData2()", "immediate write (len %u)", length);
if (m_trace) if (m_trace)
Utils::dump(1U, "Modem::writeDMRData2() Immediate TX DMR Data 2", buffer + 3U, length - 1U); Utils::dump(1U, "[Modem::writeDMRData2()] Immediate TX DMR Data 2", buffer + 3U, length - 1U);
int ret = write(buffer, len); int ret = write(buffer, len);
if (ret != int(len)) { if (ret != int(len)) {
@ -1493,7 +1493,7 @@ bool Modem::writeP25Frame(const uint8_t* data, uint32_t length)
return false; return false;
if (length > MAX_LENGTH) { if (length > MAX_LENGTH) {
LogError(LOG_MODEM, "Modem::writeP25Data(); request data to write >%u?, len = %u", MAX_LENGTH, 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); Utils::dump(1U, "[Modem::writeP25Data()] Attmpted Data", data, length);
return false; return false;
} }
@ -1519,9 +1519,9 @@ bool Modem::writeP25Frame(const uint8_t* data, uint32_t length)
// write or buffer P25 data to air interface // write or buffer P25 data to air interface
if (m_p25Space >= length) { if (m_p25Space >= length) {
if (m_debug) if (m_debug)
LogDebug(LOG_MODEM, "Modem::writeP25Data(); immediate write (len %u)", length); LogDebugEx(LOG_MODEM, "Modem::writeP25Data()", "immediate write (len %u)", length);
if (m_trace) if (m_trace)
Utils::dump(1U, "Modem::writeP25Data() Immediate TX P25 Data", buffer + 3U, length - 3U); Utils::dump(1U, "[Modem::writeP25Data()] Immediate TX P25 Data", buffer + 3U, length - 3U);
int ret = write(buffer, len); int ret = write(buffer, len);
if (ret != int(len)) { if (ret != int(len)) {
@ -1556,7 +1556,7 @@ bool Modem::writeNXDNFrame(const uint8_t* data, uint32_t length)
return false; return false;
if (length > MAX_LENGTH) { if (length > MAX_LENGTH) {
LogError(LOG_MODEM, "Modem::writeNXDNData(); request data to write >%u?, len = %u", MAX_LENGTH, 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); Utils::dump(1U, "[Modem::writeNXDNData()] Attmpted Data", data, length);
return false; return false;
} }
@ -1573,9 +1573,9 @@ bool Modem::writeNXDNFrame(const uint8_t* data, uint32_t length)
// write or buffer NXDN data to air interface // write or buffer NXDN data to air interface
if (m_nxdnSpace >= length) { if (m_nxdnSpace >= length) {
if (m_debug) if (m_debug)
LogDebug(LOG_MODEM, "Modem::writeNXDNData(); immediate write (len %u)", length); LogDebugEx(LOG_MODEM, "Modem::writeNXDNData()", "immediate write (len %u)", length);
if (m_trace) if (m_trace)
Utils::dump(1U, "Modem::writeNXDNData() Immediate TX NXDN Data", buffer + 3U, length - 1U); Utils::dump(1U, "[Modem::writeNXDNData()] Immediate TX NXDN Data", buffer + 3U, length - 1U);
int ret = write(buffer, len); int ret = write(buffer, len);
if (ret != int(len)) { if (ret != int(len)) {
@ -1613,7 +1613,7 @@ bool Modem::writeDMRStart(bool tx)
buffer[2U] = CMD_DMR_START; buffer[2U] = CMD_DMR_START;
buffer[3U] = tx ? 0x01U : 0x00U; buffer[3U] = tx ? 0x01U : 0x00U;
#if DEBUG_MODEM #if DEBUG_MODEM
Utils::dump(1U, "Modem::writeDMRStart(), Written", buffer, 4U); Utils::dump(1U, "[Modem::writeDMRStart()] Written", buffer, 4U);
#endif #endif
return write(buffer, 4U) == 4; return write(buffer, 4U) == 4;
} }
@ -1644,7 +1644,7 @@ bool Modem::writeDMRShortLC(const uint8_t* lc)
buffer[10U] = lc[7U]; buffer[10U] = lc[7U];
buffer[11U] = lc[8U]; buffer[11U] = lc[8U];
#if DEBUG_MODEM #if DEBUG_MODEM
Utils::dump(1U, "Modem::writeDMRShortLC(), Written", buffer, 12U); Utils::dump(1U, "[Modem::writeDMRShortLC()] Written", buffer, 12U);
#endif #endif
return write(buffer, 12U) == 12; return write(buffer, 12U) == 12;
} }
@ -1665,7 +1665,7 @@ bool Modem::writeDMRAbort(uint32_t slotNo)
buffer[2U] = CMD_DMR_ABORT; buffer[2U] = CMD_DMR_ABORT;
buffer[3U] = slotNo; buffer[3U] = slotNo;
#if DEBUG_MODEM #if DEBUG_MODEM
Utils::dump(1U, "Modem::writeDMRAbort(), Written", buffer, 4U); Utils::dump(1U, "[Modem::writeDMRAbort()] Written", buffer, 4U);
#endif #endif
return write(buffer, 4U) == 4; return write(buffer, 4U) == 4;
} }
@ -1689,7 +1689,7 @@ bool Modem::setDMRIgnoreCACH_AT(uint8_t slotNo)
// are we on a protocol version 3 firmware? // are we on a protocol version 3 firmware?
if (m_protoVer >= 3U) { if (m_protoVer >= 3U) {
#if DEBUG_MODEM #if DEBUG_MODEM
Utils::dump(1U, "Modem::setDMRIgnoreCACH_AT(), Written", buffer, 4U); Utils::dump(1U, "[Modem::setDMRIgnoreCACH_AT()] Written", buffer, 4U);
#endif #endif
return write(buffer, 4U) == 4; return write(buffer, 4U) == 4;
} else { } else {
@ -1734,7 +1734,7 @@ bool Modem::setState(DVM_STATE state)
buffer[2U] = CMD_SET_MODE; buffer[2U] = CMD_SET_MODE;
buffer[3U] = state; buffer[3U] = state;
#if DEBUG_MODEM #if DEBUG_MODEM
Utils::dump(1U, "Modem::setState(), Written", buffer, 4U); Utils::dump(1U, "[Modem::setState()] Written", buffer, 4U);
#endif #endif
return write(buffer, 4U) == 4; return write(buffer, 4U) == 4;
} }
@ -1876,7 +1876,7 @@ bool Modem::getStatus()
buffer[1U] = 3U; buffer[1U] = 3U;
buffer[2U] = CMD_GET_STATUS; buffer[2U] = CMD_GET_STATUS;
//LogDebug(LOG_MODEM, "getStatus(), polling modem status"); //LogDebugEx(LOG_MODEM, "Modem::getStatus()", "polling modem status");
return write(buffer, 3U) == 3; return write(buffer, 3U) == 3;
} }
@ -2372,7 +2372,7 @@ RESP_TYPE_DVM Modem::getResponse()
{ {
m_rspDoubleLength = false; m_rspDoubleLength = false;
//LogDebug(LOG_MODEM, "Modem::getResponse(), checking if we have data"); //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "checking if we have data");
// get the start of the frame or nothing at all // get the start of the frame or nothing at all
if (m_rspState == RESP_START) { if (m_rspState == RESP_START) {
@ -2384,13 +2384,13 @@ RESP_TYPE_DVM Modem::getResponse()
} }
if (ret == 0) { if (ret == 0) {
//LogDebug(LOG_MODEM, "Modem::getResponse(), no data available"); //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "no data available");
return RTM_TIMEOUT; return RTM_TIMEOUT;
} }
if (m_buffer[0U] != DVM_SHORT_FRAME_START && if (m_buffer[0U] != DVM_SHORT_FRAME_START &&
m_buffer[0U] != DVM_LONG_FRAME_START) { m_buffer[0U] != DVM_LONG_FRAME_START) {
//LogError(LOG_MODEM, "Modem::getResponse(), illegal response, first byte not a frame start; byte = %02X", m_buffer[0U]); //LogErrorEx(LOG_MODEM, "Modem::getResponse()", "illegal response, first byte not a frame start; byte = %02X", m_buffer[0U]);
::memset(m_buffer, 0x00U, BUFFER_LENGTH); ::memset(m_buffer, 0x00U, BUFFER_LENGTH);
m_rspState = RESP_START; m_rspState = RESP_START;
return RTM_ERROR; return RTM_ERROR;
@ -2400,12 +2400,12 @@ RESP_TYPE_DVM Modem::getResponse()
m_rspDoubleLength = true; m_rspDoubleLength = true;
} }
//LogDebug(LOG_MODEM, "Modem::getResponse(), RESP_START"); //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "RESP_START");
m_rspState = RESP_LENGTH1; m_rspState = RESP_LENGTH1;
} }
//LogDebug(LOG_MODEM, "Modem::getResponse(), getting frame length 1/2, rspDoubleLength = %u", m_rspDoubleLength); //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "getting frame length 1/2, rspDoubleLength = %u", m_rspDoubleLength);
// get the length of the frame, 1/2 // get the length of the frame, 1/2
if (m_rspState == RESP_LENGTH1) { if (m_rspState == RESP_LENGTH1) {
int ret = m_port->read(m_buffer + 1U, 1U); int ret = m_port->read(m_buffer + 1U, 1U);
@ -2432,12 +2432,12 @@ RESP_TYPE_DVM Modem::getResponse()
m_length = m_buffer[1U]; m_length = m_buffer[1U];
} }
//LogDebug(LOG_MODEM, "Modem::getResponse(), RESP_LENGTH1, len = %u", m_length); //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "RESP_LENGTH1, len = %u", m_length);
m_rspOffset = 2U; m_rspOffset = 2U;
} }
//LogDebug(LOG_MODEM, "Modem::getResponse(), getting frame length 2/2"); //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "getting frame length 2/2");
// get the length of the frame, 2/2 // get the length of the frame, 2/2
if (m_rspState == RESP_LENGTH2) { if (m_rspState == RESP_LENGTH2) {
int ret = m_port->read(m_buffer + 2U, 1U); int ret = m_port->read(m_buffer + 2U, 1U);
@ -2453,13 +2453,13 @@ RESP_TYPE_DVM Modem::getResponse()
m_length = (m_length + (m_buffer[2U] & 0xFFU)); m_length = (m_length + (m_buffer[2U] & 0xFFU));
m_rspState = RESP_TYPE; m_rspState = RESP_TYPE;
//LogDebug(LOG_MODEM, "Modem::getResponse(), RESP_LENGTH2, len = %u", m_length); //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "RESP_LENGTH2, len = %u", m_length);
m_rspDoubleLength = true; m_rspDoubleLength = true;
m_rspOffset = 3U; m_rspOffset = 3U;
} }
//LogDebug(LOG_MODEM, "Modem::getResponse(), getting frame type"); //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "getting frame type");
// get the frame type // get the frame type
if (m_rspState == RESP_TYPE) { if (m_rspState == RESP_TYPE) {
int ret = m_port->read(m_buffer + m_rspOffset, 1U); int ret = m_port->read(m_buffer + m_rspOffset, 1U);
@ -2474,18 +2474,18 @@ RESP_TYPE_DVM Modem::getResponse()
m_rspType = (DVM_COMMANDS)m_buffer[m_rspOffset]; m_rspType = (DVM_COMMANDS)m_buffer[m_rspOffset];
//LogDebug(LOG_MODEM, "Modem::getResponse(), RESP_TYPE, len = %u, type = %u", m_length, m_rspType); //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "RESP_TYPE, len = %u, type = %u", m_length, m_rspType);
m_rspState = RESP_DATA; m_rspState = RESP_DATA;
m_rspOffset++; m_rspOffset++;
} }
//LogDebug(LOG_MODEM, "Modem::getResponse(), getting frame data"); //LogDebugEx(LOG_MODEM, "Modem::getResponse()", "getting frame data");
// get the frame data // get the frame data
if (m_rspState == RESP_DATA) { if (m_rspState == RESP_DATA) {
if (m_respTrace) if (m_respTrace)
LogDebug(LOG_MODEM, "Modem::getResponse(), RESP_DATA, len = %u, offset = %u, type = %02X", m_length, m_rspOffset, m_rspType); LogDebugEx(LOG_MODEM, "Modem::getResponse()", "RESP_DATA, len = %u, offset = %u, type = %02X", m_length, m_rspOffset, m_rspType);
while (m_rspOffset < m_length) { while (m_rspOffset < m_length) {
int ret = m_port->read(m_buffer + m_rspOffset, m_length - m_rspOffset); int ret = m_port->read(m_buffer + m_rspOffset, m_length - m_rspOffset);
@ -2503,7 +2503,7 @@ RESP_TYPE_DVM Modem::getResponse()
} }
if (m_respTrace) if (m_respTrace)
Utils::dump(1U, "Modem::getResponse() Buffer", m_buffer, m_length); Utils::dump(1U, "[Modem::getResponse()] Buffer", m_buffer, m_length);
} }
m_rspState = RESP_START; m_rspState = RESP_START;

@ -320,9 +320,9 @@ void ModemV24::clock(uint32_t ms)
m_p25Space = m_buffer[10U] * (P25DEF::P25_LDU_FRAME_LENGTH_BYTES); m_p25Space = m_buffer[10U] * (P25DEF::P25_LDU_FRAME_LENGTH_BYTES);
if (m_dumpModemStatus) { if (m_dumpModemStatus) {
LogDebug(LOG_MODEM, "ModemV24::clock(), CMD_GET_STATUS, isHotspot = %u, v24Connected = %u, dmr = %u / %u, p25 = %u / %u, nxdn = %u / %u, modemState = %u, tx = %u, adcOverflow = %u, rxOverflow = %u, txOverflow = %u, dacOverflow = %u, dmrSpace1 = %u, dmrSpace2 = %u, p25Space = %u, nxdnSpace = %u", LogDebugEx(LOG_MODEM, "ModemV24::clock()", "CMD_GET_STATUS, isHotspot = %u, v24Connected = %u, dmr = %u / %u, p25 = %u / %u, nxdn = %u / %u, modemState = %u, tx = %u, adcOverflow = %u, rxOverflow = %u, txOverflow = %u, dacOverflow = %u, dmrSpace1 = %u, dmrSpace2 = %u, p25Space = %u, nxdnSpace = %u",
m_isHotspot, m_v24Connected, dmrEnable, m_dmrEnabled, p25Enable, m_p25Enabled, nxdnEnable, m_nxdnEnabled, m_modemState, m_tx, adcOverflow, rxOverflow, txOverflow, dacOverflow, m_dmrSpace1, m_dmrSpace2, m_p25Space, m_nxdnSpace); m_isHotspot, m_v24Connected, dmrEnable, m_dmrEnabled, p25Enable, m_p25Enabled, nxdnEnable, m_nxdnEnabled, m_modemState, m_tx, adcOverflow, rxOverflow, txOverflow, dacOverflow, m_dmrSpace1, m_dmrSpace2, m_p25Space, m_nxdnSpace);
LogDebug(LOG_MODEM, "ModemV24::clock(), CMD_GET_STATUS, rxDMRData1 size = %u, len = %u, free = %u; rxDMRData2 size = %u, len = %u, free = %u, rxP25Data size = %u, len = %u, free = %u, rxNXDNData size = %u, len = %u, free = %u", LogDebugEx(LOG_MODEM, "ModemV24::clock()", "CMD_GET_STATUS, rxDMRData1 size = %u, len = %u, free = %u; rxDMRData2 size = %u, len = %u, free = %u, rxP25Data size = %u, len = %u, free = %u, rxNXDNData size = %u, len = %u, free = %u",
m_rxDMRQueue1.length(), m_rxDMRQueue1.dataSize(), m_rxDMRQueue1.freeSpace(), m_rxDMRQueue2.length(), m_rxDMRQueue2.dataSize(), m_rxDMRQueue2.freeSpace(), m_rxDMRQueue1.length(), m_rxDMRQueue1.dataSize(), m_rxDMRQueue1.freeSpace(), m_rxDMRQueue2.length(), m_rxDMRQueue2.dataSize(), m_rxDMRQueue2.freeSpace(),
m_rxP25Queue.length(), m_rxP25Queue.dataSize(), m_rxP25Queue.freeSpace(), m_rxNXDNQueue.length(), m_rxNXDNQueue.dataSize(), m_rxNXDNQueue.freeSpace()); m_rxP25Queue.length(), m_rxP25Queue.dataSize(), m_rxP25Queue.freeSpace(), m_rxNXDNQueue.length(), m_rxNXDNQueue.dataSize(), m_rxNXDNQueue.freeSpace());
} }
@ -409,7 +409,7 @@ void ModemV24::clock(uint32_t ms)
void ModemV24::close() void ModemV24::close()
{ {
LogDebug(LOG_MODEM, "Closing the modem"); LogMessage(LOG_MODEM, "Closing the modem");
m_port->close(); m_port->close();
m_gotModemStatus = false; m_gotModemStatus = false;
@ -1553,9 +1553,9 @@ void ModemV24::queueP25Frame(uint8_t* data, uint16_t len, SERIAL_TX_TYPE msgType
assert(len > 0U); assert(len > 0U);
if (m_debug) if (m_debug)
LogDebug(LOG_MODEM, "ModemV24::queueP25Frame() msgType = $%02X", msgType); LogDebugEx(LOG_MODEM, "ModemV24::queueP25Frame()", "msgType = $%02X", msgType);
if (m_trace) if (m_trace)
Utils::dump(1U, "ModemV24::queueP25Frame() data", data, len); Utils::dump(1U, "[ModemV24::queueP25Frame()] data", data, len);
// get current time in ms // get current time in ms
uint64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(); uint64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();

@ -759,7 +759,7 @@ uint8_t* V24UDPPort::generateMessage(const uint8_t* message, uint32_t length, ui
if (timestamp != INVALID_TS) { if (timestamp != INVALID_TS) {
timestamp += (RTP_GENERIC_CLOCK_RATE / 133); timestamp += (RTP_GENERIC_CLOCK_RATE / 133);
if (m_debug) if (m_debug)
LogDebug(LOG_NET, "V24UDPPort::generateMessage() RTP streamId = %u, previous TS = %u, TS = %u, rtpSeq = %u", streamId, m_timestamp, timestamp, rtpSeq); LogDebugEx(LOG_NET, "V24UDPPort::generateMessage()", "RTP streamId = %u, previous TS = %u, TS = %u, rtpSeq = %u", streamId, m_timestamp, timestamp, rtpSeq);
m_timestamp = timestamp; m_timestamp = timestamp;
} }
@ -779,20 +779,20 @@ uint8_t* V24UDPPort::generateMessage(const uint8_t* message, uint32_t length, ui
if (streamId != 0U && timestamp == INVALID_TS && rtpSeq != RTP_END_OF_CALL_SEQ) { if (streamId != 0U && timestamp == INVALID_TS && rtpSeq != RTP_END_OF_CALL_SEQ) {
if (m_debug) if (m_debug)
LogDebug(LOG_NET, "V24UDPPort::generateMessage() RTP streamId = %u, initial TS = %u, rtpSeq = %u", streamId, header.getTimestamp(), rtpSeq); LogDebugEx(LOG_NET, "V24UDPPort::generateMessage()", "RTP streamId = %u, initial TS = %u, rtpSeq = %u", streamId, header.getTimestamp(), rtpSeq);
m_timestamp = header.getTimestamp(); m_timestamp = header.getTimestamp();
} }
if (streamId != 0U && rtpSeq == RTP_END_OF_CALL_SEQ) { if (streamId != 0U && rtpSeq == RTP_END_OF_CALL_SEQ) {
m_timestamp = INVALID_TS; m_timestamp = INVALID_TS;
if (m_debug) if (m_debug)
LogDebug(LOG_NET, "V24UDPPort::generateMessage() RTP streamId = %u, rtpSeq = %u", streamId, rtpSeq); LogDebugEx(LOG_NET, "V24UDPPort::generateMessage()", "RTP streamId = %u, rtpSeq = %u", streamId, rtpSeq);
} }
::memcpy(buffer + RTP_HEADER_LENGTH_BYTES, message, length); ::memcpy(buffer + RTP_HEADER_LENGTH_BYTES, message, length);
if (m_debug) if (m_debug)
Utils::dump(1U, "V24UDPPort::generateMessage() Buffered Message", buffer, bufferLen); Utils::dump(1U, "[V24UDPPort::generateMessage()] Buffered Message", buffer, bufferLen);
if (outBufferLen != nullptr) { if (outBufferLen != nullptr) {
*outBufferLen = bufferLen; *outBufferLen = bufferLen;

@ -226,7 +226,7 @@ void Network::clock(uint32_t ms)
} }
if (m_debug) { if (m_debug) {
LogDebug(LOG_NET, "RTP, peerId = %u, seq = %u, streamId = %u, func = %02X, subFunc = %02X", fneHeader.getPeerId(), rtpHeader.getSequence(), LogDebugEx(LOG_NET, "Network::clock()", "RTP, peerId = %u, seq = %u, streamId = %u, func = %02X, subFunc = %02X", fneHeader.getPeerId(), rtpHeader.getSequence(),
fneHeader.getStreamId(), fneHeader.getFunction(), fneHeader.getSubFunction()); fneHeader.getStreamId(), fneHeader.getFunction(), fneHeader.getSubFunction());
} }
@ -280,7 +280,7 @@ void Network::clock(uint32_t ms)
} }
if (m_debug) if (m_debug)
Utils::dump(1U, "Network Received, DMR", buffer.get(), length); Utils::dump(1U, "[Network::clock()] Network Received, DMR", buffer.get(), length);
if (length > 255) if (length > 255)
LogError(LOG_NET, "DMR Stream %u, frame oversized? this shouldn't happen, pktSeq = %u, len = %u", streamId, m_pktSeq, length); LogError(LOG_NET, "DMR Stream %u, frame oversized? this shouldn't happen, pktSeq = %u, len = %u", streamId, m_pktSeq, length);
@ -308,7 +308,7 @@ void Network::clock(uint32_t ms)
} }
if (m_debug) if (m_debug)
Utils::dump(1U, "Network Received, P25", buffer.get(), length); Utils::dump(1U, "[Network::clock()] Network Received, P25", buffer.get(), length);
if (length > 255) if (length > 255)
LogError(LOG_NET, "P25 Stream %u, frame oversized? this shouldn't happen, pktSeq = %u, len = %u", streamId, m_pktSeq, length); LogError(LOG_NET, "P25 Stream %u, frame oversized? this shouldn't happen, pktSeq = %u, len = %u", streamId, m_pktSeq, length);
@ -336,7 +336,7 @@ void Network::clock(uint32_t ms)
} }
if (m_debug) if (m_debug)
Utils::dump(1U, "Network Received, NXDN", buffer.get(), length); Utils::dump(1U, "[Network::clock()] Network Received, NXDN", buffer.get(), length);
if (length > 255) if (length > 255)
LogError(LOG_NET, "NXDN Stream %u, frame oversized? this shouldn't happen, pktSeq = %u, len = %u", streamId, m_pktSeq, length); LogError(LOG_NET, "NXDN Stream %u, frame oversized? this shouldn't happen, pktSeq = %u, len = %u", streamId, m_pktSeq, length);
@ -548,7 +548,7 @@ void Network::clock(uint32_t ms)
{ {
switch (m_status) { switch (m_status) {
case NET_STAT_WAITING_LOGIN: case NET_STAT_WAITING_LOGIN:
LogDebug(LOG_NET, "PEER %u RPTL ACK, performing login exchange, remotePeerId = %u", m_peerId, rtpHeader.getSSRC()); LogMessage(LOG_NET, "PEER %u RPTL ACK, performing login exchange, remotePeerId = %u", m_peerId, rtpHeader.getSSRC());
::memcpy(m_salt, buffer.get() + 6U, sizeof(uint32_t)); ::memcpy(m_salt, buffer.get() + 6U, sizeof(uint32_t));
writeAuthorisation(); writeAuthorisation();
@ -558,7 +558,7 @@ void Network::clock(uint32_t ms)
m_retryTimer.start(); m_retryTimer.start();
break; break;
case NET_STAT_WAITING_AUTHORISATION: case NET_STAT_WAITING_AUTHORISATION:
LogDebug(LOG_NET, "PEER %u RPTK ACK, performing configuration exchange, remotePeerId = %u", m_peerId, rtpHeader.getSSRC()); LogMessage(LOG_NET, "PEER %u RPTK ACK, performing configuration exchange, remotePeerId = %u", m_peerId, rtpHeader.getSSRC());
writeConfig(); writeConfig();

@ -349,7 +349,7 @@ bool RESTAPI::validateAuth(const HTTPPayload& request, HTTPPayload& reply)
std::string host = request.headers.find("RemoteHost"); std::string host = request.headers.find("RemoteHost");
std::string headerToken = request.headers.find("X-DVM-Auth-Token"); std::string headerToken = request.headers.find("X-DVM-Auth-Token");
#if DEBUG_HTTP_PAYLOAD #if DEBUG_HTTP_PAYLOAD
::LogDebug(LOG_REST, "RESTAPI::validateAuth() token, host = %s, token = %s", host.c_str(), headerToken.c_str()); ::LogDebugEx(LOG_REST, "RESTAPI::validateAuth()", "token, host = %s, token = %s", host.c_str(), headerToken.c_str());
#endif #endif
if (headerToken.empty()) { if (headerToken.empty()) {
errorPayload(reply, "no authentication token", HTTPPayload::UNAUTHORIZED); errorPayload(reply, "no authentication token", HTTPPayload::UNAUTHORIZED);
@ -358,11 +358,11 @@ bool RESTAPI::validateAuth(const HTTPPayload& request, HTTPPayload& reply)
for (auto& token : m_authTokens) { for (auto& token : m_authTokens) {
#if DEBUG_HTTP_PAYLOAD #if DEBUG_HTTP_PAYLOAD
::LogDebug(LOG_REST, "RESTAPI::validateAuth() valid list, host = %s, token = %s", token.first.c_str(), std::to_string(token.second).c_str()); ::LogDebugEx(LOG_REST, "RESTAPI::validateAuth()", "valid list, host = %s, token = %s", token.first.c_str(), std::to_string(token.second).c_str());
#endif #endif
if (token.first.compare(host) == 0) { if (token.first.compare(host) == 0) {
#if DEBUG_HTTP_PAYLOAD #if DEBUG_HTTP_PAYLOAD
::LogDebug(LOG_REST, "RESTAPI::validateAuth() storedToken = %s, passedToken = %s", std::to_string(token.second).c_str(), headerToken.c_str()); ::LogDebugEx(LOG_REST, "RESTAPI::validateAuth()", "storedToken = %s, passedToken = %s", std::to_string(token.second).c_str(), headerToken.c_str());
#endif #endif
if (std::to_string(token.second).compare(headerToken) == 0) { if (std::to_string(token.second).compare(headerToken) == 0) {
return true; return true;
@ -1006,7 +1006,7 @@ void RESTAPI::restAPI_PutRegisterCCVC(const HTTPPayload& request, HTTPPayload& r
uint32_t peerId = req["peerId"].get<uint32_t>(); uint32_t peerId = req["peerId"].get<uint32_t>();
// LogDebug(LOG_REST, "restAPI_PutRegisterCCVC(): callback, channelNo = %u, peerId = %u", channelNo, peerId); // LogDebugEx(LOG_REST, "RESTAPI::restAPI_PutRegisterCCVC()", "callback, channelNo = %u, peerId = %u", channelNo, peerId);
// validate restAddress is a string within the JSON blob // validate restAddress is a string within the JSON blob
if (!req["restAddress"].is<std::string>()) { if (!req["restAddress"].is<std::string>()) {
@ -1087,7 +1087,7 @@ void RESTAPI::restAPI_PutReleaseGrant(const HTTPPayload& request, HTTPPayload& r
return; return;
} }
// LogDebug(LOG_REST, "restAPI_PutReleaseGrant(): callback, state = %u, dstId = %u", state, dstId); // LogDebugEx(LOG_REST, "RESTAPI::restAPI_PutReleaseGrant()", "callback, state = %u, dstId = %u", state, dstId);
switch (state) { switch (state) {
case STATE_DMR: case STATE_DMR:
@ -1179,7 +1179,7 @@ void RESTAPI::restAPI_PutTouchGrant(const HTTPPayload& request, HTTPPayload& rep
return; return;
} }
// LogDebug(LOG_REST, "restAPI_PutTouchGrant(): callback, state = %u, dstId = %u", state, dstId); // LogDebugEx(LOG_REST, "RESTAPI::restAPI_PutTouchGrant()", "callback, state = %u, dstId = %u", state, dstId);
switch (state) { switch (state) {
case STATE_DMR: case STATE_DMR:

@ -877,7 +877,7 @@ void Control::addFrame(const uint8_t *data, bool net, bool imm)
uint32_t fifoSpace = m_modem->getNXDNSpace(); uint32_t fifoSpace = m_modem->getNXDNSpace();
//LogDebug(LOG_NXDN, "addFrame() fifoSpace = %u", fifoSpace); //LogDebugEx(LOG_NXDN, "Control::addFrame()", "fifoSpace = %u", fifoSpace);
// is this immediate data? // is this immediate data?
if (imm) { if (imm) {

@ -398,7 +398,7 @@ void ControlSignaling::writeRF_ControlData(uint8_t frameCnt, uint8_t n, bool adj
do do
{ {
if (m_debug) { if (m_debug) {
LogDebug(LOG_NXDN, "writeRF_ControlData, frameCnt = %u, seq = %u", frameCnt, n); LogDebugEx(LOG_NXDN, "ControlSignaling::writeRF_ControlData()", "frameCnt = %u, seq = %u", frameCnt, n);
} }
switch (n) switch (n)

@ -1194,7 +1194,7 @@ void Control::addFrame(const uint8_t* data, uint32_t length, bool net, bool imm)
uint32_t fifoSpace = m_modem->getP25Space(); uint32_t fifoSpace = m_modem->getP25Space();
//LogDebug(LOG_P25, "addFrame() fifoSpace = %u", fifoSpace); // LogDebugEx(LOG_P25, "Control::addFrame()", "fifoSpace = %u", fifoSpace);
// is this immediate data? // is this immediate data?
if (imm) { if (imm) {
@ -1689,10 +1689,6 @@ void Control::writeRF_Nulls()
data[0U] = modem::TAG_EOT; data[0U] = modem::TAG_EOT;
data[1U] = 0x00U; data[1U] = 0x00U;
if (m_debug) {
LogDebug(LOG_P25, "writeRF_Nulls()");
}
addFrame(data, NULLS_LENGTH_BYTES + 2U); addFrame(data, NULLS_LENGTH_BYTES + 2U);
} }

@ -1784,7 +1784,7 @@ void ControlSignaling::writeRF_ControlData(uint8_t frameCnt, uint8_t n, bool adj
} }
if (m_debug) { if (m_debug) {
LogDebug(LOG_P25, "writeRF_ControlData, mbfCnt = %u, frameCnt = %u, seq = %u, adjSS = %u", m_mbfCnt, frameCnt, n, adjSS); LogDebugEx(LOG_P25, "ControlSignaling::writeRF_ControlData()", "mbfCnt = %u, frameCnt = %u, seq = %u, adjSS = %u", m_mbfCnt, frameCnt, n, adjSS);
} }
// bryanb: this is just a simple counter because we treat the SYNC_BCST as unlocked // bryanb: this is just a simple counter because we treat the SYNC_BCST as unlocked
@ -1877,7 +1877,7 @@ void ControlSignaling::writeRF_ControlData(uint8_t frameCnt, uint8_t n, bool adj
queueRF_TSBK_Ctrl(TSBKO::OSP_RFSS_STS_BCAST); queueRF_TSBK_Ctrl(TSBKO::OSP_RFSS_STS_BCAST);
queueRF_TSBK_Ctrl(TSBKO::OSP_NET_STS_BCAST); queueRF_TSBK_Ctrl(TSBKO::OSP_NET_STS_BCAST);
if (m_debug) { if (m_debug) {
LogDebug(LOG_P25, "writeRF_ControlData, have 1 pad 2, mbfCnt = %u", m_mbfCnt); LogDebugEx(LOG_P25, "ControlSignaling::writeRF_ControlData()]", "have 1 pad 2, mbfCnt = %u", m_mbfCnt);
} }
} }
@ -1892,7 +1892,7 @@ void ControlSignaling::writeRF_ControlData(uint8_t frameCnt, uint8_t n, bool adj
} }
if (m_debug) { if (m_debug) {
LogDebug(LOG_P25, "writeRF_ControlData, have 2 pad 1, mbfCnt = %u", m_mbfCnt); LogDebugEx(LOG_P25, "ControlSignaling::writeRF_ControlData()", "have 2 pad 1, mbfCnt = %u", m_mbfCnt);
} }
} }

@ -533,7 +533,7 @@ void* HostWS::threadWebSocket(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -542,7 +542,7 @@ void* HostWS::threadWebSocket(void* arg)
ws->m_wsServer.start_accept(); ws->m_wsServer.start_accept();
ws->m_wsServer.run(); ws->m_wsServer.run();
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }

@ -887,7 +887,7 @@ private:
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -909,7 +909,7 @@ private:
} }
wnd->m_threadStopped = true; wnd->m_threadStopped = true;
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }

@ -286,7 +286,7 @@ void* threadNetworkPump(void* arg)
return nullptr; return nullptr;
} }
LogDebug(LOG_HOST, "[ OK ] %s", threadName.c_str()); LogMessage(LOG_HOST, "[ OK ] %s", threadName.c_str());
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
::pthread_setname_np(th->thread, threadName.c_str()); ::pthread_setname_np(th->thread, threadName.c_str());
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
@ -985,7 +985,7 @@ void* threadNetworkPump(void* arg)
Thread::sleep(1U); Thread::sleep(1U);
} }
LogDebug(LOG_HOST, "[STOP] %s", threadName.c_str()); LogMessage(LOG_HOST, "[STOP] %s", threadName.c_str());
delete th; delete th;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.