From 580f26a47859b0d33cc43a559e7ed742d6e9a47e Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Sun, 30 Jun 2024 12:51:23 -0400 Subject: [PATCH] convert dfsi to Doxygen documentation format; --- src/dfsi/ActivityLog.cpp | 45 +-- src/dfsi/ActivityLog.h | 41 ++- src/dfsi/Defines.h | 29 +- src/dfsi/Dfsi.cpp | 63 ++-- src/dfsi/Dfsi.h | 58 +++- src/dfsi/DfsiMain.cpp | 50 +-- src/dfsi/DfsiMain.h | 41 ++- src/dfsi/frames/BlockHeader.cpp | 48 +-- src/dfsi/frames/BlockHeader.h | 98 ++++-- src/dfsi/frames/ControlOctet.cpp | 45 +-- src/dfsi/frames/ControlOctet.h | 73 ++-- src/dfsi/frames/FrameDefines.h | 152 +++++---- src/dfsi/frames/Frames.h | 22 +- src/dfsi/frames/FullRateVoice.cpp | 68 ++-- src/dfsi/frames/FullRateVoice.h | 366 ++++++++++++--------- src/dfsi/frames/MotFullRateVoice.cpp | 78 ++--- src/dfsi/frames/MotFullRateVoice.h | 112 ++++--- src/dfsi/frames/MotStartOfStream.cpp | 47 +-- src/dfsi/frames/MotStartOfStream.h | 87 +++-- src/dfsi/frames/MotStartVoiceFrame.cpp | 52 ++- src/dfsi/frames/MotStartVoiceFrame.h | 107 +++--- src/dfsi/frames/MotVoiceHeader1.cpp | 52 ++- src/dfsi/frames/MotVoiceHeader1.h | 111 ++++--- src/dfsi/frames/MotVoiceHeader2.cpp | 52 ++- src/dfsi/frames/MotVoiceHeader2.h | 91 +++-- src/dfsi/frames/StartOfStream.cpp | 45 +-- src/dfsi/frames/StartOfStream.h | 69 ++-- src/dfsi/frames/fsc/FSCACK.cpp | 45 +-- src/dfsi/frames/fsc/FSCACK.h | 68 ++-- src/dfsi/frames/fsc/FSCConnect.cpp | 45 +-- src/dfsi/frames/fsc/FSCConnect.h | 64 ++-- src/dfsi/frames/fsc/FSCConnectResponse.cpp | 45 +-- src/dfsi/frames/fsc/FSCConnectResponse.h | 52 ++- src/dfsi/frames/fsc/FSCDisconnect.cpp | 32 +- src/dfsi/frames/fsc/FSCDisconnect.h | 38 ++- src/dfsi/frames/fsc/FSCHeartbeat.cpp | 32 +- src/dfsi/frames/fsc/FSCHeartbeat.h | 38 ++- src/dfsi/frames/fsc/FSCMessage.cpp | 45 +-- src/dfsi/frames/fsc/FSCMessage.h | 60 ++-- src/dfsi/frames/fsc/FSCResponse.cpp | 45 +-- src/dfsi/frames/fsc/FSCResponse.h | 52 ++- src/dfsi/network/CallData.cpp | 43 +-- src/dfsi/network/CallData.h | 103 ++++-- src/dfsi/network/DfsiPeerNetwork.cpp | 88 ++--- src/dfsi/network/DfsiPeerNetwork.h | 99 ++++-- src/dfsi/network/SerialService.cpp | 137 +++----- src/dfsi/network/SerialService.h | 138 ++++++-- src/fne/network/FNENetwork.h | 2 +- 48 files changed, 1816 insertions(+), 1557 deletions(-) diff --git a/src/dfsi/ActivityLog.cpp b/src/dfsi/ActivityLog.cpp index 7575051a..79bf2617 100644 --- a/src/dfsi/ActivityLog.cpp +++ b/src/dfsi/ActivityLog.cpp @@ -1,16 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* -*/ +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * + */ #include "ActivityLog.h" #include "common/network/BaseNetwork.h" #include "common/Log.h" // for CurrentLogFileLevel() and LogGetNetwork() @@ -51,10 +47,8 @@ static struct tm m_actTm; // Global Functions // --------------------------------------------------------------------------- -/// -/// Helper to open the activity log file, file handle. -/// -/// True, if log file is opened, otherwise false. +/* Helper to open the activity log file, file handle. */ + static bool ActivityLogOpen() { if (CurrentLogFileLevel() == 0U) @@ -83,11 +77,8 @@ static bool ActivityLogOpen() return m_actFpLog != nullptr; } -/// -/// Initializes the activity log. -/// -/// Full-path to the activity log file. -/// Prefix of the activity log file name. +/* Initializes the activity log. */ + bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot) { #if defined(CATCH2_TEST_COMPILATION) @@ -99,9 +90,8 @@ bool ActivityLogInitialise(const std::string& filePath, const std::string& fileR return ::ActivityLogOpen(); } -/// -/// Finalizes the activity log. -/// +/* Finalizes the activity log. */ + void ActivityLogFinalise() { #if defined(CATCH2_TEST_COMPILATION) @@ -111,11 +101,8 @@ void ActivityLogFinalise() ::fclose(m_actFpLog); } -/// -/// Writes a new entry to the activity log. -/// -/// This is a variable argument function. -/// Formatted string to write to activity log. +/* Writes a new entry to the activity log. */ + void ActivityLog(const char* msg, ...) { #if defined(CATCH2_TEST_COMPILATION) diff --git a/src/dfsi/ActivityLog.h b/src/dfsi/ActivityLog.h index d699c9b6..164bc511 100644 --- a/src/dfsi/ActivityLog.h +++ b/src/dfsi/ActivityLog.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * + */ /** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* -*/ + * @file ActivityLog.h + * @ingroup dfsi + * @file ActivityLog.cpp + * @ingroup dfsi + */ #if !defined(__ACTIVITY_LOG_H__) #define __ACTIVITY_LOG_H__ @@ -22,11 +24,22 @@ // Global Functions // --------------------------------------------------------------------------- -/// Initializes the activity log. +/** + * @brief Initializes the activity log. + * @param filePath File path for the log file. + * @param fileRoot Root name for log file. + */ extern HOST_SW_API bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot); -/// Finalizes the activity log. +/** + * @brief Finalizes the activity log. + */ extern HOST_SW_API void ActivityLogFinalise(); -/// Writes a new entry to the activity log. +/** + * @brief Writes a new entry to the activity log. + * @param msg String format. + * + * This is a variable argument function. + */ extern HOST_SW_API void ActivityLog(const char* msg, ...); #endif // __ACTIVITY_LOG_H__ diff --git a/src/dfsi/Defines.h b/src/dfsi/Defines.h index 2a0f5334..89418203 100644 --- a/src/dfsi/Defines.h +++ b/src/dfsi/Defines.h @@ -1,16 +1,21 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * + */ /** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* -*/ + * @defgroup dfsi DFSI V.24/UDP Software (dvmdfsi) + * @brief Digital Voice Modem - DFSI V.24/UDP Software + * @details TIA/V.24 standard interface application that connects to a V.24 interface board or UDP to allow for P25 DFSI communications with commercial P25 hardware. + * @ingroup dfsi + * + * @file Defines.h + * @ingroup dfsi + */ #if !defined(__DEFINES_H__) #define __DEFINES_H__ @@ -21,7 +26,7 @@ // --------------------------------------------------------------------------- #undef __PROG_NAME__ -#define __PROG_NAME__ "Digital Voice Modem (DVM) DFSI Peer" +#define __PROG_NAME__ "Digital Voice Modem (DVM) DFSI V.24/UDP Peer" #undef __EXE_NAME__ #define __EXE_NAME__ "dvmdfsi" diff --git a/src/dfsi/Dfsi.cpp b/src/dfsi/Dfsi.cpp index 64846bc1..bc001e71 100644 --- a/src/dfsi/Dfsi.cpp +++ b/src/dfsi/Dfsi.cpp @@ -1,17 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "Defines.h" #include "common/dmr/DMRDefines.h" #include "common/p25/P25Utils.h" @@ -45,10 +41,8 @@ using namespace lookups; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a new instance of the HostTest class. -/// -/// Full-path to the configuration file. +/* Initializes a new instance of the HostTest class. */ + Dfsi::Dfsi(const std::string& confFile) : m_confFile(confFile), m_conf(), @@ -65,15 +59,12 @@ Dfsi::Dfsi(const std::string& confFile) : /* stub */ } -/// -/// Finalizes a instance of the HostTest class. -/// +/* Finalizes a instance of the HostTest class. */ + Dfsi::~Dfsi() = default; -/// -/// Executes the main FNE processing loop. -/// -/// Zero if successful, otherwise error occurred. +/* Executes the main FNE processing loop. */ + int Dfsi::run() { bool ret = false; @@ -204,9 +195,7 @@ int Dfsi::run() StopWatch stopWatch; stopWatch.start(); - /// - /// main execution loop - /// + // main execution loop while (!g_killed) { uint32_t ms = stopWatch.elapsed(); @@ -279,10 +268,8 @@ int Dfsi::run() // Private Class Members // --------------------------------------------------------------------------- -/// -/// Reads basic configuration parameters from the YAML configuration file. -/// -/// +/* Reads basic configuration parameters from the YAML configuration file. */ + bool Dfsi::readParams() { // No basic config params right now @@ -290,10 +277,8 @@ bool Dfsi::readParams() return true; } -/// -/// Initializes peer network connectivity. -/// -/// +/* Initializes peer network connectivity. */ + bool Dfsi::createPeerNetwork() { yaml::Node networkConf = m_conf["network"]; @@ -376,12 +361,8 @@ bool Dfsi::createPeerNetwork() return true; } -/// -/// Initializes serial V24 network. -/// -/// -/// -/// +/* Initializes serial V.24 network. */ + bool Dfsi::createSerialNetwork(uint32_t p25BufferSize, uint16_t callTimeout) { // Read serial config diff --git a/src/dfsi/Dfsi.h b/src/dfsi/Dfsi.h index 9ad74115..71d0d2f2 100644 --- a/src/dfsi/Dfsi.h +++ b/src/dfsi/Dfsi.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * + */ /** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* -*/ + * @file Dfsi.h + * @ingroup dfsi + * @file Dfsi.cpp + * @ingroup dfsi + */ #if !defined(__DFSI_H__) #define __DFSI_H__ @@ -28,17 +30,28 @@ // --------------------------------------------------------------------------- // Class Declaration -// This class implements the core service logic. // --------------------------------------------------------------------------- +/** + * @brief This class implements the core service logic. + * @ingroup dfsi + */ class HOST_SW_API Dfsi { public: - /// Initializes a new instance of the HostTest class. + /** + * @brief Initializes a new instance of the HostTest class. + * @param confFile Full-path to the configuration file. + */ Dfsi(const std::string& confFile); - /// Finalizes a instance of the HostTest class. + /** + * @brief Finalizes a instance of the HostTest class. + */ ~Dfsi(); - /// Executes the main host processing loop. + /** + * @brief Executes the main host processing loop. + * @returns int Zero if successful, otherwise error occurred. + */ int run(); private: @@ -61,11 +74,20 @@ private: network::SerialService* m_serial; - /// Reads basic configuration parameters from the INI. + /** + * @brief Reads basic configuration parameters from the INI. + * @returns bool True, if configuration was read successfully, otherwise false. + */ bool readParams(); - /// Initializes peer network connectivity. + /** + * @brief Initializes peer network connectivity. + * @returns bool True, if network connectivity was initialized, otherwise false. + */ bool createPeerNetwork(); - /// Initializes serial V24 network. + /** + * @brief Initializes serial V.24 network. + * @returns bool True, if serial connectivity was initialized, otherwise false. + */ bool createSerialNetwork(uint32_t p25BufferSize, uint16_t callTimeout); }; diff --git a/src/dfsi/DfsiMain.cpp b/src/dfsi/DfsiMain.cpp index 0c64b442..fde71371 100644 --- a/src/dfsi/DfsiMain.cpp +++ b/src/dfsi/DfsiMain.cpp @@ -1,17 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "Defines.h" #include "common/Log.h" #include "dfsi/ActivityLog.h" @@ -57,10 +53,8 @@ uint8_t* g_gitHashBytes = nullptr; // --------------------------------------------------------------------------- #if !defined(CATCH2_TEST_COMPILATION) -/// -/// Internal signal handler. -/// -/// +/* Internal signal handler. */ + static void sigHandler(int signum) { g_signal = signum; @@ -68,11 +62,8 @@ static void sigHandler(int signum) } #endif -/// -/// Helper to print a fatal error message and exit. -/// -/// This is a variable argument function. -/// Message. +/* Helper to print a fatal error message and exit. */ + void fatal(const char* msg, ...) { char buffer[400U]; @@ -89,11 +80,8 @@ void fatal(const char* msg, ...) exit(EXIT_FAILURE); } -/// -/// Helper to pring usage the command line arguments. (And optionally an error.) -/// -/// Error message. -/// Error message arguments. +/* Helper to pring usage the command line arguments. (And optionally an error.) */ + void usage(const char* message, const char* arg) { ::fprintf(stdout, __PROG_NAME__ " %s (built %s)\r\n", __VER__, __BUILD__); @@ -122,12 +110,8 @@ void usage(const char* message, const char* arg) exit(EXIT_FAILURE); } -/// -/// Helper to validate the command line arguments. -/// -/// Argument count. -/// Array of argument strings. -/// Count of remaining unprocessed arguments. +/* Helper to validate the command line arguments. */ + int checkArgs(int argc, char* argv[]) { int i, p = 0; diff --git a/src/dfsi/DfsiMain.h b/src/dfsi/DfsiMain.h index 83ad38bd..92e8990f 100644 --- a/src/dfsi/DfsiMain.h +++ b/src/dfsi/DfsiMain.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * + */ /** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* -*/ + * @file DfsiMain.h + * @ingroup dfsi + * @file DfsiMain.cpp + * @ingroup dfsi + */ #if !defined(__DFSI_MAIN_H__) #define __DFSI_MAIN_H__ @@ -22,20 +24,37 @@ // Externs // --------------------------------------------------------------------------- +/** @brief */ extern int g_signal; +/** @brief */ extern std::string g_progExe; +/** @brief */ extern std::string g_iniFile; +/** @brief */ extern std::string g_lockFile; +/** @brief (Global) Flag indicating foreground operation. */ extern bool g_foreground; +/** @brief (Global) Flag indicating the FNE should stop immediately. */ extern bool g_killed; +/** @brief */ extern std::string g_masterAddress; +/** @brief */ extern uint16_t g_masterPort; +/** @brief */ extern uint32_t g_peerId; extern uint8_t* g_gitHashBytes; +/** + * @brief Helper to trigger a fatal error message. This will cause the program to terminate + * immediately with an error message. + * + * @param msg String format. + * + * This is a variable argument function. + */ extern HOST_SW_API void fatal(const char* msg, ...); #endif // __DFSI_MAIN_H__ \ No newline at end of file diff --git a/src/dfsi/frames/BlockHeader.cpp b/src/dfsi/frames/BlockHeader.cpp index 7bf30d4c..eaf5d52a 100644 --- a/src/dfsi/frames/BlockHeader.cpp +++ b/src/dfsi/frames/BlockHeader.cpp @@ -1,17 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/BlockHeader.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -27,9 +22,8 @@ using namespace p25::dfsi; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the BlockHeader class. -/// +/* Initializes a instance of the BlockHeader class. */ + BlockHeader::BlockHeader() : m_payloadType(false), m_blockLength(BlockType::UNDEFINED) @@ -37,11 +31,8 @@ BlockHeader::BlockHeader() : /* stub */ } -/// -/// Initializes a instance of the BlockHeader class. -/// -/// -/// +/* Initializes a instance of the BlockHeader class. */ + BlockHeader::BlockHeader(uint8_t* data, bool verbose) : m_payloadType(false), m_blockLength(BlockType::UNDEFINED) @@ -49,12 +40,8 @@ BlockHeader::BlockHeader(uint8_t* data, bool verbose) : decode(data, verbose); } -/// -/// Decode a block header frame. -/// -/// -/// -/// +/* Decode a block header frame. */ + bool BlockHeader::decode(const uint8_t* data, bool verbose) { assert(data != nullptr); @@ -78,11 +65,8 @@ bool BlockHeader::decode(const uint8_t* data, bool verbose) return true; } -/// -/// Encode a block header frame. -/// -/// -/// +/* Encode a block header frame. */ + void BlockHeader::encode(uint8_t* data, bool verbose) { assert(data != nullptr); diff --git a/src/dfsi/frames/BlockHeader.h b/src/dfsi/frames/BlockHeader.h index e75798da..47274fb4 100644 --- a/src/dfsi/frames/BlockHeader.h +++ b/src/dfsi/frames/BlockHeader.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file BlockHeader.h + * @ingroup dfsi_frames + * @file BlockHeader.cpp + * @ingroup dfsi_frames + */ #if !defined(__BLOCK_HEADER_H__) #define __BLOCK_HEADER_H__ @@ -26,47 +28,73 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // Implements a DFSI block header packet. - // - // Compact Form - // Byte 0 - // Bit 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+ - // |E| BT | - // +-+-+-+-+-+-+-+-+ - // - // Verbose Form - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // |E| BT | TSO | BL | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // --------------------------------------------------------------------------- + /** + * @brief Implements a DFSI block header packet. + * \code{.unparsed} + * Compact Form + * Byte 0 + * Bit 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+ + * |E| BT | + * +-+-+-+-+-+-+-+-+ + * + * Verbose Form + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * |E| BT | TSO | BL | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * \endcode + * @ingroup dfsi_frames + */ class HOST_SW_API BlockHeader { public: static const uint8_t LENGTH = 1; static const uint8_t VERBOSE_LENGTH = 4; - /// Initializes a copy instance of the BlockHeader class. + /** + * @brief Initializes a copy instance of the BlockHeader class. + */ BlockHeader(); - /// Initializes a copy instance of the BlockHeader class. + /** + * @brief Initializes a copy instance of the BlockHeader class. + * @param data Buffer to containing BlockHeader to decode. + * @param verbose Flag indicating verbose form of BlockHeader. + */ BlockHeader(uint8_t* data, bool verbose = false); - /// Decode a block header frame. + /** + * @brief Decode a block header frame. + * @param[in] data Buffer to containing BlockHeader to decode. + * @param verbose Flag indicating verbose form of BlockHeader. + */ bool decode(const uint8_t* data, bool verbose = false); - /// Encode a block header frame. + /** + * @brief Encode a block header frame. + * @param[out] data Buffer to encode a BlockHeader. + * @param verbose Flag indicating verbose form of BlockHeader. + */ void encode(uint8_t *data, bool verbose = false); public: - /// Payload type. - /// This simple boolean marks this header as either IANA standard, or profile specific. + /** + * @brief Payload type. + * This simple boolean marks this header as either IANA standard, or profile specific. + */ __PROPERTY(bool, payloadType, PayloadType); - /// Block type. + /** + * @brief Block type. + */ __PROPERTY(BlockType::E, blockType, BlockType); - /// Timestamp Offset. + /** + * @brief Timestamp Offset. + */ __PROPERTY(uint16_t, timestampOffset, TimestampOffset); - /// Block length. + /** + * @brief Block length. + */ __PROPERTY(uint16_t, blockLength, BlockLength); }; } // namespace dfsi diff --git a/src/dfsi/frames/ControlOctet.cpp b/src/dfsi/frames/ControlOctet.cpp index e3337152..264561b6 100644 --- a/src/dfsi/frames/ControlOctet.cpp +++ b/src/dfsi/frames/ControlOctet.cpp @@ -1,17 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/ControlOctet.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -27,9 +22,8 @@ using namespace p25::dfsi; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the ControlOctet class. -/// +/* Initializes a instance of the ControlOctet class. */ + ControlOctet::ControlOctet() : m_signal(false), m_compact(true), @@ -38,10 +32,8 @@ ControlOctet::ControlOctet() : /* stub */ } -/// -/// Initializes a instance of the ControlOctet class. -/// -/// +/* Initializes a instance of the ControlOctet class. */ + ControlOctet::ControlOctet(uint8_t* data) : m_signal(false), m_compact(true), @@ -50,11 +42,8 @@ ControlOctet::ControlOctet(uint8_t* data) : decode(data); } -/// -/// Decode a control octet frame. -/// -/// -/// +/* Decode a control octet frame. */ + bool ControlOctet::decode(const uint8_t* data) { assert(data != nullptr); @@ -66,10 +55,8 @@ bool ControlOctet::decode(const uint8_t* data) return true; } -/// -/// Encode a control octet frame. -/// -/// +/* Encode a control octet frame. */ + void ControlOctet::encode(uint8_t* data) { assert(data != nullptr); diff --git a/src/dfsi/frames/ControlOctet.h b/src/dfsi/frames/ControlOctet.h index ea8e6309..d6396513 100644 --- a/src/dfsi/frames/ControlOctet.h +++ b/src/dfsi/frames/ControlOctet.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file ControlOctet.h + * @ingroup dfsi_frames + * @file ControlOctet.cpp + * @ingroup dfsi_frames + */ #if !defined(__CONTROL_OCTET_H__) #define __CONTROL_OCTET_H__ @@ -26,35 +28,56 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // Implements a DFSI control octet packet. - // - // Byte 0 - // Bit 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+ - // |S|C| BHC | - // +-+-+-+-+-+-+-+-+ // --------------------------------------------------------------------------- + /** + * @brief Implements a DFSI control octet packet. + * \code{.unparsed} + * Byte 0 + * Bit 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+ + * |S|C| BHC | + * +-+-+-+-+-+-+-+-+ + * \endcode + * @ingroup dfsi_frames + */ class HOST_SW_API ControlOctet { public: static const uint8_t LENGTH = 1; - /// Initializes a copy instance of the ControlOctet class. + /** + * @brief Initializes a copy instance of the ControlOctet class. + */ ControlOctet(); - /// Initializes a copy instance of the ControlOctet class. + /** + * @brief Initializes a copy instance of the ControlOctet class. + * @param data Buffer to containing ControlOctet to decode. + */ ControlOctet(uint8_t* data); - /// Decode a control octet frame. + /** + * @brief Decode a control octet frame. + * @param[in] data Buffer to containing ControlOctet to decode. + */ bool decode(const uint8_t* data); - /// Encode a control octet frame. + /** + * @brief Encode a control octet frame. + * @param[out] data Buffer to encode a ControlOctet. + */ void encode(uint8_t* data); public: - /// + /** + * @brief + */ __PROPERTY(bool, signal, Signal); - /// Indicates a compact (1) or verbose (0) block header. + /** + * @brief Indicates a compact (1) or verbose (0) block header. + */ __PROPERTY(bool, compact, Compact); - /// Number of block headers following this control octet. + /** + * @brief Number of block headers following this control octet. + */ __PROPERTY(uint8_t, blockHeaderCnt, BlockHeaderCnt); }; } // namespace dfsi diff --git a/src/dfsi/frames/FrameDefines.h b/src/dfsi/frames/FrameDefines.h index 4318f5c1..9ca2ad6c 100644 --- a/src/dfsi/frames/FrameDefines.h +++ b/src/dfsi/frames/FrameDefines.h @@ -1,17 +1,25 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @defgroup dfsi_frames DFSI Data Frames + * @brief Implementation for the DFSI data frames. + * @ingroup dfsi + * + * @defgroup dfsi_fsc_frames DFSI Control Frames + * @brief Implementation for the DFSI control frames. + * @ingroup dfsi_frames + * + * @file FrameDefines.h + * @ingroup dfsi_frames + */ #if !defined(__FRAME_DEFINES_H__) #define __FRAME_DEFINES_H__ @@ -25,121 +33,109 @@ namespace p25 // Constants // --------------------------------------------------------------------------- - /// - /// Control Service Message. - /// + /** + * @addtogroup dfsi_frames + * @{ + */ + + /** @brief FSC Control Service Message.*/ namespace FSCMessageType { - // FSC Control Service Message Enumeration + /** @brief FSC Control Service Message.*/ enum E : uint8_t { - FSC_CONNECT = 0, // Establish connection with FSS. - FSC_HEARTBEAT = 1, // Heartbeat/Connectivity Maintenance. - FSC_ACK = 2, // Control Service Ack. + FSC_CONNECT = 0, //! Establish connection with FSS. + FSC_HEARTBEAT = 1, //! Heartbeat/Connectivity Maintenance. + FSC_ACK = 2, //! Control Service Ack. - FSC_DISCONNECT = 9, // Detach Control Service. + FSC_DISCONNECT = 9, //! Detach Control Service. - FSC_INVALID = 127, // Invalid Control Message. + FSC_INVALID = 127, //! Invalid Control Message. }; } - /// - /// ACK/NAK Codes - /// + /** @brief FSC ACK/NAK Codes. */ namespace FSCAckResponseCode { - // FSC ACK/NAK Code Enumeration + /** @brief FSC ACK/NAK Codes. */ enum E : uint8_t { - CONTROL_ACK = 0, // Acknowledgement. - CONTROL_NAK = 1, // Unspecified Negative Acknowledgement. - CONTROL_NAK_CONNECTED = 2, // Server is connected to some other host. - CONTROL_NAK_M_UNSUPP = 3, // Unsupported Manufactuerer Message. - CONTROL_NAK_V_UNSUPP = 4, // Unsupported Message Version. - CONTROL_NAK_F_UNSUPP = 5, // Unsupported Function. - CONTROL_NAK_PARMS = 6, // Bad / Unsupported Command Parameters. - CONTROL_NAK_BUSY = 7 // FSS is currently busy with a function. + CONTROL_ACK = 0, //! Acknowledgement. + CONTROL_NAK = 1, //! Unspecified Negative Acknowledgement. + CONTROL_NAK_CONNECTED = 2, //! Server is connected to some other host. + CONTROL_NAK_M_UNSUPP = 3, //! Unsupported Manufactuerer Message. + CONTROL_NAK_V_UNSUPP = 4, //! Unsupported Message Version. + CONTROL_NAK_F_UNSUPP = 5, //! Unsupported Function. + CONTROL_NAK_PARMS = 6, //! Bad / Unsupported Command Parameters. + CONTROL_NAK_BUSY = 7 //! FSS is currently busy with a function. }; } - /// - /// DFSI Block Types - /// + /** @brief DFSI Block Types */ namespace BlockType { - // DFSI Block Types Enumeration + /** @brief DFSI Block Types */ enum E : uint8_t { - FULL_RATE_VOICE = 0, // + FULL_RATE_VOICE = 0, //! Full Rate Voice - VOICE_HEADER_P1 = 6, // - VOICE_HEADER_P2 = 7, // + VOICE_HEADER_P1 = 6, //! Voice Header 1 + VOICE_HEADER_P2 = 7, //! Voice Header 2 - START_OF_STREAM = 9, // - END_OF_STREAM = 10, // + START_OF_STREAM = 9, //! Start of Stream + END_OF_STREAM = 10, //! End of Stream - UNDEFINED = 127 // + UNDEFINED = 127 //! Undefined }; } - /// - /// - /// + /** @brief RT/RT Flag */ namespace RTFlag { - // + /** @brief RT/RT Flag */ enum E : uint8_t { - ENABLED = 0x02U, // - DISABLED = 0x04U // + ENABLED = 0x02U, //! RT/RT Enabled + DISABLED = 0x04U //! RT/RT Disabled }; } - /// - /// - /// + /** @brief Start/Stop Flag */ namespace StartStopFlag { - // + /** @brief Start/Stop Flag */ enum E : uint8_t { - START = 0x0CU, // - STOP = 0x25U // + START = 0x0CU, //! Start + STOP = 0x25U //! Stop }; } - /// - /// - /// + /** @brief V.24 Data Stream Type */ namespace StreamTypeFlag { - // + /** @brief V.24 Data Stream Type */ enum E : uint8_t { - VOICE = 0x0BU // + VOICE = 0x0BU //! Voice }; } - /// - /// - /// + /** @brief RSSI Data Validity */ namespace RssiValidityFlag { - // + /** @brief RSSI Data Validity */ enum E : uint8_t { - INVALID = 0x00U, // - VALID = 0x1A // + INVALID = 0x00U, //! Invalid + VALID = 0x1A //! Valid }; } - /// - /// - /// + /** @brief V.24 Data Source */ namespace SourceFlag { - // + /** @brief V.24 Data Source */ enum E : uint8_t { - DIU = 0x00U, // - QUANTAR = 0x02U // + DIU = 0x00U, //! DIU + QUANTAR = 0x02U //! Quantar }; } - /// - /// - /// + /** @brief */ namespace ICWFlag { - // + /** @brief */ enum E : uint8_t { - DIU = 0x00U, // - QUANTAR = 0x1B // + DIU = 0x00U, //! DIU + QUANTAR = 0x1B //! Quantar }; } + /** @} */ } // namespace dfsi } // namespace p25 diff --git a/src/dfsi/frames/Frames.h b/src/dfsi/frames/Frames.h index f9ba0c8c..45ebd1c3 100644 --- a/src/dfsi/frames/Frames.h +++ b/src/dfsi/frames/Frames.h @@ -1,17 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #if !defined(__DFSI_FRAMES_H__) #define __DFSI_FRAMES_H__ diff --git a/src/dfsi/frames/FullRateVoice.cpp b/src/dfsi/frames/FullRateVoice.cpp index c6b0e295..9008a799 100644 --- a/src/dfsi/frames/FullRateVoice.cpp +++ b/src/dfsi/frames/FullRateVoice.cpp @@ -1,17 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/FullRateVoice.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -28,9 +23,8 @@ using namespace p25::dfsi::defines; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the FullRateVoice class. -/// +/* Initializes a instance of the FullRateVoice class. */ + FullRateVoice::FullRateVoice() : imbeData(nullptr), additionalData(nullptr), @@ -45,10 +39,8 @@ FullRateVoice::FullRateVoice() : ::memset(imbeData, 0x00U, IMBE_BUF_LEN); } -/// -/// Initializes a instance of the FullRateVoice class. -/// -/// +/* Initializes a instance of the FullRateVoice class. */ + FullRateVoice::FullRateVoice(uint8_t* data) : imbeData(nullptr), additionalData(nullptr), @@ -62,9 +54,8 @@ FullRateVoice::FullRateVoice(uint8_t* data) : decode(data); } -/// -/// Finalizes a instance of the FullRateVoice class. -/// +/* Finalizes a instance of the FullRateVoice class. */ + FullRateVoice::~FullRateVoice() { if (imbeData != nullptr) @@ -73,11 +64,8 @@ FullRateVoice::~FullRateVoice() delete[] additionalData; } -/// -/// Decode a full rate voice frame. -/// -/// -/// +/* Decode a full rate voice frame. */ + bool FullRateVoice::decode(const uint8_t* data) { assert(data != nullptr); @@ -117,10 +105,8 @@ bool FullRateVoice::decode(const uint8_t* data) return true; } -/// -/// Encode a full rate voice frame. -/// -/// +/* Encode a full rate voice frame. */ + void FullRateVoice::encode(uint8_t* data) { assert(data != nullptr); @@ -150,10 +136,8 @@ void FullRateVoice::encode(uint8_t* data) // Private Class Members // --------------------------------------------------------------------------- -/// -/// -/// -/// +/* Helper indicating if the frame is voice 3 through 8. */ + bool FullRateVoice::isVoice3thru8() { if ( (m_frameType == DFSIFrameType::LDU1_VOICE3) || (m_frameType == DFSIFrameType::LDU1_VOICE4) || (m_frameType == DFSIFrameType::LDU1_VOICE5) || @@ -164,10 +148,8 @@ bool FullRateVoice::isVoice3thru8() } } -/// -/// -/// -/// +/* Helper indicating if the frame is voice 12 through 17. */ + bool FullRateVoice::isVoice12thru17() { if ( (m_frameType == DFSIFrameType::LDU2_VOICE12) || (m_frameType == DFSIFrameType::LDU2_VOICE13) || (m_frameType == DFSIFrameType::LDU2_VOICE14) || @@ -178,10 +160,8 @@ bool FullRateVoice::isVoice12thru17() } } -/// -/// -/// -/// +/* Helper indicating if the frame is voice 9 or 10. */ + bool FullRateVoice::isVoice9or10() { if ( (m_frameType == DFSIFrameType::LDU1_VOICE9) || (m_frameType == DFSIFrameType::LDU2_VOICE10) ) { diff --git a/src/dfsi/frames/FullRateVoice.h b/src/dfsi/frames/FullRateVoice.h index 99539028..a9d2e945 100644 --- a/src/dfsi/frames/FullRateVoice.h +++ b/src/dfsi/frames/FullRateVoice.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file FullRateVoice.h + * @ingroup dfsi_frames + * @file FullRateVoice.cpp + * @ingroup dfsi_frames + */ #if !defined(__FULL_RATE_VOICE_H__) #define __FULL_RATE_VOICE_H__ @@ -27,187 +29,225 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // Implements a P25 full rate voice packet. - // - // CAI Frames 1, 2, 10 and 11. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | FT | U0(b11-0) | U1(b11-0) | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | U2(b10-0) | U3(b11-0) | U4(b10-3) | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | Et | Er |M|L|E| E1 |SF | B | - // | | | | |4| | | | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // - // CAI Frames 3 - 8. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | FT | U0(b11-0) | U1(b11-0) | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | U2(b10-0) | U3(b11-0) | U4(b10-3) | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | Et | Er |M|L|E| E1 |SF | B | LC0,4,8 | LC1,5,9 | LC2, | - // | | | | |4| | | | | | 6,10 | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | | LC3,7,11 |R| Status | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // - // CAI Frames 12 - 17. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | FT | U0(b11-0) | U1(b11-0) | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | U2(b10-0) | U3(b11-0) | U4(b10-3) | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | Et | Er |M|L|E| E1 |SF | B | ES0,4,8 | ES1,5,9 | ES2, | - // | | | | |4| | | | | | 6,10 | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | | ES3,7,11 |R| Status | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // - // CAI Frames 9 and 10. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | FT | U0(b11-0) | U1(b11-0) | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | U2(b10-0) | U3(b11-0) | U4(b10-3) | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | Et | Er |M|L|E| E1 |SF | B | LSD0,2 | LSD1,3 | - // | | | | |4| | | | | | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | Rsvd |Si |Sj | - // +=+=+=+=+=+=+=+=+ - // - // Because the TIA.102-BAHA spec represents the "message vectors" as - // 16-bit units (U0 - U7) this makes understanding the layout of the - // buffer ... difficult for the 8-bit aligned minded. The following is - // the layout with 8-bit aligned IMBE blocks instead of message vectors: - // - // CAI Frames 1, 2, 10 and 11. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | FT | IMBE 1 | IMBE 2 | IMBE 3 | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | Et | Er |M|L|E| E1 |SF | B | - // | | | | |4| | | | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // - // CAI Frames 3 - 8. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | FT | IMBE 1 | IMBE 2 | IMBE 3 | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | Et | Er |M|L|E| E1 |SF | B | Link Ctrl | Link Ctrl | - // | | | | |4| | | | | | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | Link Ctrl |R| Status | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // - // CAI Frames 12 - 17. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | FT | IMBE 1 | IMBE 2 | IMBE 3 | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | Et | Er |M|L|E| E1 |SF | B | Enc Sync | Enc Sync | - // | | | | |4| | | | | | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | Enc Sync |R| Status | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // - // CAI Frames 9 and 10. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | FT | IMBE 1 | IMBE 2 | IMBE 3 | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | Et | Er |M|L|E| E1 |SF | B | LSD0,2 | LSD1,3 | - // | | | | |4| | | | | | - // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ - // | Rsvd |Si |Sj | - // +=+=+=+=+=+=+=+=+ // --------------------------------------------------------------------------- + /** + * @brief Implements a P25 full rate voice packet. + * \code{.unparsed} + * CAI Frames 1, 2, 10 and 11. + * + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | FT | U0(b11-0) | U1(b11-0) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | U2(b10-0) | U3(b11-0) | U4(b10-3) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | Et | Er |M|L|E| E1 |SF | B | + * | | | | |4| | | | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * + * CAI Frames 3 - 8. + * + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | FT | U0(b11-0) | U1(b11-0) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | U2(b10-0) | U3(b11-0) | U4(b10-3) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | Et | Er |M|L|E| E1 |SF | B | LC0,4,8 | LC1,5,9 | LC2, | + * | | | | |4| | | | | | 6,10 | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | | LC3,7,11 |R| Status | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * + * CAI Frames 12 - 17. + * + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | FT | U0(b11-0) | U1(b11-0) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | U2(b10-0) | U3(b11-0) | U4(b10-3) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | Et | Er |M|L|E| E1 |SF | B | ES0,4,8 | ES1,5,9 | ES2, | + * | | | | |4| | | | | | 6,10 | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | | ES3,7,11 |R| Status | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * + * CAI Frames 9 and 10. + * + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | FT | U0(b11-0) | U1(b11-0) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | U2(b10-0) | U3(b11-0) | U4(b10-3) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | Et | Er |M|L|E| E1 |SF | B | LSD0,2 | LSD1,3 | + * | | | | |4| | | | | | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | Rsvd |Si |Sj | + * +=+=+=+=+=+=+=+=+ + * + * Because the TIA.102-BAHA spec represents the "message vectors" as + * 16-bit units (U0 - U7) this makes understanding the layout of the + * buffer ... difficult for the 8-bit aligned minded. The following is + * the layout with 8-bit aligned IMBE blocks instead of message vectors: + * + * CAI Frames 1, 2, 10 and 11. + * + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | FT | IMBE 1 | IMBE 2 | IMBE 3 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | Et | Er |M|L|E| E1 |SF | B | + * | | | | |4| | | | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * + * CAI Frames 3 - 8. + * + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | FT | IMBE 1 | IMBE 2 | IMBE 3 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | Et | Er |M|L|E| E1 |SF | B | Link Ctrl | Link Ctrl | + * | | | | |4| | | | | | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | Link Ctrl |R| Status | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * + * CAI Frames 12 - 17. + * + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | FT | IMBE 1 | IMBE 2 | IMBE 3 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | Et | Er |M|L|E| E1 |SF | B | Enc Sync | Enc Sync | + * | | | | |4| | | | | | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | Enc Sync |R| Status | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * + * CAI Frames 9 and 10. + * + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | FT | IMBE 1 | IMBE 2 | IMBE 3 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | Et | Er |M|L|E| E1 |SF | B | LSD0,2 | LSD1,3 | + * | | | | |4| | | | | | + * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ + * | Rsvd |Si |Sj | + * +=+=+=+=+=+=+=+=+ + * \endcode + * @ingroup dfsi_frames + */ class HOST_SW_API FullRateVoice { public: static const uint8_t LENGTH = 18; static const uint8_t ADDITIONAL_LENGTH = 4; static const uint8_t IMBE_BUF_LEN = 11; - /// Initializes a copy instance of the FullRateVoice class. + /** + * @brief Initializes a copy instance of the FullRateVoice class. + */ FullRateVoice(); - /// Initializes a copy instance of the FullRateVoice class. + /** + * @brief Initializes a copy instance of the FullRateVoice class. + * @param data Buffer to containing FullRateVoice to decode. + */ FullRateVoice(uint8_t* data); - /// Finalizes a instance of the FullRateVoice class. + /** + * @brief Finalizes a instance of the FullRateVoice class. + */ ~FullRateVoice(); - /// Decode a full rate voice frame. + /** + * @brief Decode a full rate voice frame. + * @param[in] data Buffer to containing FullRateVoice to decode. + */ bool decode(const uint8_t* data); - /// Encode a full rate voice frame. + /** + * @brief Encode a full rate voice frame. + * @param[out] data Buffer to encode a FullRateVoice. + */ void encode(uint8_t* data); public: uint8_t* imbeData; // ?? - this should probably be private with getters/setters uint8_t* additionalData; // ?? - this should probably be private with getters/setters - /// Frame Type. + /** + * @brief Frame Type. + */ __PROPERTY(defines::DFSIFrameType::E, frameType, FrameType); - /// Total errors detected in the frame. + /** + * @brief Total errors detected in the frame. + */ __PROPERTY(uint8_t, totalErrors, TotalErrors); - /// Flag indicating the frame should be muted. + /** + * @brief Flag indicating the frame should be muted. + */ __PROPERTY(bool, muteFrame, MuteFrame); - /// Flag indicating the frame was lost. + /** + * @brief Flag indicating the frame was lost. + */ __PROPERTY(bool, lostFrame, LostFrame); - /// Superframe Counter. + /** + * @brief Superframe Counter. + */ __PROPERTY(uint8_t, superframeCnt, SuperframeCnt); - /// Busy Status. + /** + * @brief Busy Status. + */ __PROPERTY(uint8_t, busy, Busy); private: - /// + /** + * @brief Helper indicating if the frame is voice 3 through 8. + * @returns bool True, if frame is voice 3 through 8, otherwise false. + */ bool isVoice3thru8(); - /// + /** + * @brief Helper indicating if the frame is voice 12 through 17. + * @returns bool True, if frame is voice 12 through 17, otherwise false. + */ bool isVoice12thru17(); - /// + /** + * @brief Helper indicating if the frame is voice 9 or 10. + * @returns bool True, if frame is voice 9, or 10, otherwise false. + */ bool isVoice9or10(); }; } // namespace dfsi diff --git a/src/dfsi/frames/MotFullRateVoice.cpp b/src/dfsi/frames/MotFullRateVoice.cpp index 108ccfdf..403bebed 100644 --- a/src/dfsi/frames/MotFullRateVoice.cpp +++ b/src/dfsi/frames/MotFullRateVoice.cpp @@ -1,18 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/MotFullRateVoice.h" #include "common/p25/P25Defines.h" #include "common/p25/dfsi/DFSIDefines.h" @@ -31,9 +26,8 @@ using namespace p25::dfsi::defines; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the MotFullRateVoice class. -/// +/* Initializes a instance of the MotFullRateVoice class. */ + MotFullRateVoice::MotFullRateVoice() : imbeData(nullptr), additionalData(nullptr), @@ -44,10 +38,8 @@ MotFullRateVoice::MotFullRateVoice() : ::memset(imbeData, 0x00U, RAW_IMBE_LENGTH_BYTES); } -/// -/// Initializes a instance of the MotFullRateVoice class. -/// -/// +/* Initializes a instance of the MotFullRateVoice class. */ + MotFullRateVoice::MotFullRateVoice(uint8_t* data) { // set our pointers to null since it doesn't get initialized otherwise @@ -57,9 +49,8 @@ MotFullRateVoice::MotFullRateVoice(uint8_t* data) decode(data); } -/// -/// Finalizes a instance of the MotFullRateVoice class. -/// +/* Finalizes a instance of the MotFullRateVoice class. */ + MotFullRateVoice::~MotFullRateVoice() { if (imbeData != nullptr) @@ -68,10 +59,8 @@ MotFullRateVoice::~MotFullRateVoice() delete[] additionalData; } -/// -/// -/// -/// +/* */ + uint32_t MotFullRateVoice::size() { uint32_t length = 0; @@ -91,12 +80,8 @@ uint32_t MotFullRateVoice::size() return length; } -/// -/// Decode a full rate voice frame. -/// -/// -/// -/// +/* Decode a full rate voice frame. */ + bool MotFullRateVoice::decode(const uint8_t* data, bool shortened) { assert(data != nullptr); @@ -139,11 +124,8 @@ bool MotFullRateVoice::decode(const uint8_t* data, bool shortened) return true; } -/// -/// Encode a full rate voice frame. -/// -/// -/// +/* Encode a full rate voice frame. */ + void MotFullRateVoice::encode(uint8_t* data, bool shortened) { assert(data != nullptr); @@ -185,10 +167,8 @@ void MotFullRateVoice::encode(uint8_t* data, bool shortened) // Private Class Members // --------------------------------------------------------------------------- -/// -/// -/// -/// +/* Helper indicating if the frame is voice 1, 2, 10 or 11. */ + bool MotFullRateVoice::isVoice1or2or10or11() { if ( (m_frameType == DFSIFrameType::LDU1_VOICE1) || (m_frameType == DFSIFrameType::LDU1_VOICE2) || @@ -199,10 +179,8 @@ bool MotFullRateVoice::isVoice1or2or10or11() } } -/// -/// -/// -/// +/* Helper indicating if the frame is voice 2 or 11. */ + bool MotFullRateVoice::isVoice2or11() { if ( (m_frameType == DFSIFrameType::LDU1_VOICE2) || (m_frameType == DFSIFrameType::LDU2_VOICE11) ) { @@ -212,10 +190,8 @@ bool MotFullRateVoice::isVoice2or11() } } -/// -/// -/// -/// +/* Helper indicating if the frame is voice 9 or 18. */ + bool MotFullRateVoice::isVoice9or18() { if ( (m_frameType == DFSIFrameType::LDU1_VOICE9) || (m_frameType == DFSIFrameType::LDU2_VOICE18) ) { diff --git a/src/dfsi/frames/MotFullRateVoice.h b/src/dfsi/frames/MotFullRateVoice.h index 6442f924..4ce8ee66 100644 --- a/src/dfsi/frames/MotFullRateVoice.h +++ b/src/dfsi/frames/MotFullRateVoice.h @@ -1,17 +1,19 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file MotFullRateVoice.h + * @ingroup dfsi_frames + * @file MotFullRateVoice.cpp + * @ingroup dfsi_frames + */ #if !defined(__MOT_FULL_RATE_VOICE_H__) #define __MOT_FULL_RATE_VOICE_H__ @@ -28,58 +30,92 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // Implements a P25 Motorola full rate voice packet. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | FT | Addtl Data | Addtl Data | Addtl Data | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | Reserved | IMBE 1 | IMBE 2 | IMBE 3 | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | Src Flag | - // +=+=+=+=+=+=+=+=+ // --------------------------------------------------------------------------- + /** + * @brief Implements a P25 Motorola full rate voice packet. + * \code{.unparsed} + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | FT | Addtl Data | Addtl Data | Addtl Data | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Reserved | IMBE 1 | IMBE 2 | IMBE 3 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Src Flag | + * +=+=+=+=+=+=+=+=+ + * \endcode + * @ingroup dfsi_frames + */ class HOST_SW_API MotFullRateVoice { public: static const uint8_t LENGTH = 17; static const uint8_t SHORTENED_LENGTH = 13; static const uint8_t ADDITIONAL_LENGTH = 4; - /// Initializes a copy instance of the MotFullRateVoice class. + /** + * @brief Initializes a copy instance of the MotFullRateVoice class. + */ MotFullRateVoice(); - /// Initializes a copy instance of the MotFullRateVoice class. + /** + * @brief Initializes a copy instance of the MotFullRateVoice class. + * @param data Buffer to containing MotFullRateVoice to decode. + */ MotFullRateVoice(uint8_t* data); - /// Finalizes a instance of the MotFullRateVoice class. + /** + * @brief Finalizes a instance of the MotFullRateVoice class. + */ ~MotFullRateVoice(); - /// + /** + * @brief + */ uint32_t size(); - /// Decode a full rate voice frame. + /** + * @brief Decode a full rate voice frame. + * @param[in] data Buffer to containing MotFullRateVoice to decode. + * @param shortened Flag indicating this is a shortened frame. + */ bool decode(const uint8_t* data, bool shortened = false); - /// Encode a full rate voice frame. + /** + * @brief Encode a full rate voice frame. + * @param[out] data Buffer to encode a MotFullRateVoice. + * @param shortened Flag indicating this is a shortened frame. + */ void encode(uint8_t* data, bool shortened = false); public: uint8_t* imbeData; // ?? - this should probably be private with getters/setters uint8_t* additionalData; // ?? - this should probably be private with getters/setters - /// Frame Type. + /** + * @brief Frame Type. + */ __PROPERTY(defines::DFSIFrameType::E, frameType, FrameType); - /// + /** + * @brief V.24 Data Source. + */ __PROPERTY(SourceFlag::E, source, Source); private: - /// + /** + * @brief Helper indicating if the frame is voice 1, 2, 10 or 11. + * @returns bool True, if frame is voice 1, 2, 10, or 11, otherwise false. + */ bool isVoice1or2or10or11(); - /// + /** + * @brief Helper indicating if the frame is voice 2 or 11. + * @returns bool True, if frame is voice 2, or 11, otherwise false. + */ bool isVoice2or11(); - /// + /** + * @brief Helper indicating if the frame is voice 9 or 18. + * @returns bool True, if frame is voice 9, or 18, otherwise false. + */ bool isVoice9or18(); }; } // namespace dfsi diff --git a/src/dfsi/frames/MotStartOfStream.cpp b/src/dfsi/frames/MotStartOfStream.cpp index aad685bc..aa3516ff 100644 --- a/src/dfsi/frames/MotStartOfStream.cpp +++ b/src/dfsi/frames/MotStartOfStream.cpp @@ -1,18 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/MotStartOfStream.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -29,9 +24,8 @@ using namespace p25::dfsi::defines; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the MotStartOfStream class. -/// +/* Initializes a instance of the MotStartOfStream class. */ + MotStartOfStream::MotStartOfStream() : m_marker(FIXED_MARKER), m_rt(RTFlag::DISABLED), @@ -41,10 +35,8 @@ MotStartOfStream::MotStartOfStream() : /* stub */ } -/// -/// Initializes a instance of the MotStartOfStream class. -/// -/// +/* Initializes a instance of the MotStartOfStream class. */ + MotStartOfStream::MotStartOfStream(uint8_t* data) : m_marker(FIXED_MARKER), m_rt(RTFlag::DISABLED), @@ -54,11 +46,8 @@ MotStartOfStream::MotStartOfStream(uint8_t* data) : decode(data); } -/// -/// Decode a start of stream frame. -/// -/// -/// +/* Decode a start of stream frame. */ + bool MotStartOfStream::decode(const uint8_t* data) { assert(data != nullptr); @@ -70,10 +59,8 @@ bool MotStartOfStream::decode(const uint8_t* data) return true; } -/// -/// Encode a start of stream frame. -/// -/// +/* Encode a start of stream frame. */ + void MotStartOfStream::encode(uint8_t* data) { assert(data != nullptr); diff --git a/src/dfsi/frames/MotStartOfStream.h b/src/dfsi/frames/MotStartOfStream.h index 05956763..0f3ee54b 100644 --- a/src/dfsi/frames/MotStartOfStream.h +++ b/src/dfsi/frames/MotStartOfStream.h @@ -1,17 +1,19 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file MotStartVoiceFrame.h + * @ingroup dfsi_frames + * @file MotStartVoiceFrame.cpp + * @ingroup dfsi_frames + */ #if !defined(__MOT_START_OF_STREAM_H__) #define __MOT_START_OF_STREAM_H__ @@ -27,42 +29,65 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // Implements a P25 Motorola start of stream packet. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | Fixed Mark | RT Mode Flag | Start/Stop | Type Flag | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | Reserved | - // + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | | - // +-+-+-+-+-+-+-+-+ // --------------------------------------------------------------------------- + /** + * @brief Implements a P25 Motorola start of stream packet. + * \code{.unparsed} + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Fixed Mark | RT Mode Flag | Start/Stop | Type Flag | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Reserved | + * + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | | + * +-+-+-+-+-+-+-+-+ + * \endcode + * @ingroup dfsi_frames + */ class HOST_SW_API MotStartOfStream { public: static const uint8_t LENGTH = 10; static const uint8_t FIXED_MARKER = 0x02; - /// Initializes a copy instance of the MotStartOfStream class. + /** + * @brief Initializes a copy instance of the MotStartOfStream class. + */ MotStartOfStream(); - /// Initializes a copy instance of the MotStartOfStream class. + /** + * @brief Initializes a copy instance of the MotStartOfStream class. + * @param data Buffer to containing MotStartOfStream to decode. + */ MotStartOfStream(uint8_t* data); - /// Decode a start of stream frame. + /** + * @brief Decode a start of stream frame. + * @param[in] data Buffer to containing MotStartOfStream to decode. + */ bool decode(const uint8_t* data); - /// Encode a start of stream frame. + /** + * @brief Encode a start of stream frame. + * @param[out] data Buffer to encode a MotStartOfStream. + */ void encode(uint8_t* data); public: - /// + /** + * @brief + */ __PROPERTY(uint8_t, marker, Marker); - /// + /** + * @brief RT/RT Flag. + */ __PROPERTY(RTFlag::E, rt, RT); - /// + /** + * @brief Start/Stop. + */ __PROPERTY(StartStopFlag::E, startStop, StartStop); - /// + /** + * @brief Stream Type. + */ __PROPERTY(StreamTypeFlag::E, streamType, StreamType); }; } // namespace dfsi diff --git a/src/dfsi/frames/MotStartVoiceFrame.cpp b/src/dfsi/frames/MotStartVoiceFrame.cpp index fba1d42f..4519e189 100644 --- a/src/dfsi/frames/MotStartVoiceFrame.cpp +++ b/src/dfsi/frames/MotStartVoiceFrame.cpp @@ -1,18 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/MotStartVoiceFrame.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -29,9 +24,8 @@ using namespace p25::dfsi::defines; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the MotStartVoiceFrame class. -/// +/* Initializes a instance of the MotStartVoiceFrame class. */ + MotStartVoiceFrame::MotStartVoiceFrame() : startOfStream(nullptr), fullRateVoice(nullptr), @@ -45,10 +39,8 @@ MotStartVoiceFrame::MotStartVoiceFrame() : fullRateVoice = new MotFullRateVoice(); } -/// -/// Initializes a instance of the MotStartVoiceFrame class. -/// -/// +/* Initializes a instance of the MotStartVoiceFrame class. */ + MotStartVoiceFrame::MotStartVoiceFrame(uint8_t* data) : startOfStream(nullptr), fullRateVoice(nullptr), @@ -61,9 +53,8 @@ MotStartVoiceFrame::MotStartVoiceFrame(uint8_t* data) : decode(data); } -/// -/// Finalizes a instance of the MotStartVoiceFrame class. -/// +/* Finalizes a instance of the MotStartVoiceFrame class. */ + MotStartVoiceFrame::~MotStartVoiceFrame() { if (startOfStream != nullptr) @@ -72,11 +63,8 @@ MotStartVoiceFrame::~MotStartVoiceFrame() delete fullRateVoice; } -/// -/// Decode a start voice frame. -/// -/// -/// +/* Decode a start voice frame. */ + bool MotStartVoiceFrame::decode(const uint8_t* data) { assert(data != nullptr); @@ -115,10 +103,8 @@ bool MotStartVoiceFrame::decode(const uint8_t* data) return true; } -/// -/// Encode a start voice frame. -/// -/// +/* Encode a start voice frame. */ + void MotStartVoiceFrame::encode(uint8_t* data) { assert(data != nullptr); diff --git a/src/dfsi/frames/MotStartVoiceFrame.h b/src/dfsi/frames/MotStartVoiceFrame.h index 1813d151..200af8be 100644 --- a/src/dfsi/frames/MotStartVoiceFrame.h +++ b/src/dfsi/frames/MotStartVoiceFrame.h @@ -1,17 +1,19 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file MotStartVoiceFrame.h + * @ingroup dfsi_frames + * @file MotStartVoiceFrame.cpp + * @ingroup dfsi_frames + */ #if !defined(__MOT_START_VOICE_FRAME_H__) #define __MOT_START_VOICE_FRAME_H__ @@ -29,54 +31,81 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // Implements a P25 Motorola voice frame 1/10 start. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | Encoded Motorola Start of Stream | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | ICW Flag ? | RSSI | RSSI Valid | RSSI | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | Adj MM ? | Full Rate Voice Frame | - // +-+-+-+-+-+-+-+-+ + - // | | - // + + - // | | - // + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | | - // +=+=+=+=+=+=+=+=+ // --------------------------------------------------------------------------- + /** + * @brief Implements a P25 Motorola voice frame 1/10 start. + * \code{.unparsed} + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Encoded Motorola Start of Stream | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ICW Flag ? | RSSI | RSSI Valid | RSSI | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Adj MM ? | Full Rate Voice Frame | + * +-+-+-+-+-+-+-+-+ + + * | | + * + + + * | | + * + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | | + * +=+=+=+=+=+=+=+=+ + * \endcode + * @ingroup dfsi_frames + */ class HOST_SW_API MotStartVoiceFrame { public: static const uint8_t LENGTH = 22; - /// Initializes a copy instance of the MotStartVoiceFrame class. + /** + * @brief Initializes a copy instance of the MotStartVoiceFrame class. + */ MotStartVoiceFrame(); - /// Initializes a copy instance of the MotStartVoiceFrame class. + /** + * @brief Initializes a copy instance of the MotStartVoiceFrame class. + * @param data Buffer to containing MotStartVoiceFrame to decode. + */ MotStartVoiceFrame(uint8_t* data); - /// Finalizes a instance of the MotStartVoiceFrame class. + /** + * @brief Finalizes a instance of the MotStartVoiceFrame class. + */ ~MotStartVoiceFrame(); - /// Decode a start voice frame. + /** + * @brief Decode a start voice frame. + * @param[in] data Buffer to containing MotStartVoiceFrame to decode. + */ bool decode(const uint8_t* data); - /// Encode a start voice frame. + /** + * @brief Encode a start voice frame. + * @param[out] data Buffer to encode a MotStartVoiceFrame. + */ void encode(uint8_t* data); public: MotStartOfStream* startOfStream; // ?? - this should probably be private with getters/setters MotFullRateVoice* fullRateVoice; // ?? - this should probably be private with getters/setters - /// + /** + * @brief + */ __PROPERTY(ICWFlag::E, icw, ICW); - /// + /** + * @brief RSSI Value. + */ __PROPERTY(uint8_t, rssi, RSSI); - /// + /** + * @brief Flag indicating whether or not the RSSI field is valid. + */ __PROPERTY(RssiValidityFlag::E, rssiValidity, RSSIValidity); - /// + /** + * @brief + */ __PROPERTY(uint8_t, nRssi, NRSSI); - /// + /** + * @brief + */ __PROPERTY(uint8_t, adjMM, AdjMM); }; } // namespace dfsi diff --git a/src/dfsi/frames/MotVoiceHeader1.cpp b/src/dfsi/frames/MotVoiceHeader1.cpp index 4177ba5b..3490d82b 100644 --- a/src/dfsi/frames/MotVoiceHeader1.cpp +++ b/src/dfsi/frames/MotVoiceHeader1.cpp @@ -1,18 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/MotVoiceHeader1.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -29,9 +24,8 @@ using namespace p25::dfsi::defines; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the MotVoiceHeader1 class. -/// +/* Initializes a instance of the MotVoiceHeader1 class. */ + MotVoiceHeader1::MotVoiceHeader1() : header(nullptr), startOfStream(nullptr), @@ -46,10 +40,8 @@ MotVoiceHeader1::MotVoiceHeader1() : ::memset(header, 0x00U, HCW_LENGTH); } -/// -/// Initializes a instance of the MotVoiceHeader1 class. -/// -/// +/* Initializes a instance of the MotVoiceHeader1 class. */ + MotVoiceHeader1::MotVoiceHeader1(uint8_t* data) : header(nullptr), startOfStream(nullptr), @@ -61,9 +53,8 @@ MotVoiceHeader1::MotVoiceHeader1(uint8_t* data) : decode(data); } -/// -/// Finalizes a instance of the MotVoiceHeader1 class. -/// +/* Finalizes a instance of the MotVoiceHeader1 class. */ + MotVoiceHeader1::~MotVoiceHeader1() { if (startOfStream != nullptr) @@ -72,11 +63,8 @@ MotVoiceHeader1::~MotVoiceHeader1() delete[] header; } -/// -/// Decode a voice header 1 frame. -/// -/// -/// +/* Decode a voice header 1 frame. */ + bool MotVoiceHeader1::decode(const uint8_t* data) { assert(data != nullptr); @@ -109,10 +97,8 @@ bool MotVoiceHeader1::decode(const uint8_t* data) return true; } -/// -/// Encode a voice header 1 frame. -/// -/// +/* Encode a voice header 1 frame. */ + void MotVoiceHeader1::encode(uint8_t* data) { assert(data != nullptr); diff --git a/src/dfsi/frames/MotVoiceHeader1.h b/src/dfsi/frames/MotVoiceHeader1.h index 943d9487..93b6079f 100644 --- a/src/dfsi/frames/MotVoiceHeader1.h +++ b/src/dfsi/frames/MotVoiceHeader1.h @@ -1,17 +1,19 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file MotVoiceHeader1.h + * @ingroup dfsi_frames + * @file MotVoiceHeader1.cpp + * @ingroup dfsi_frames + */ #if !defined(__MOT_VOICE_HEADER_1_H__) #define __MOT_VOICE_HEADER_1_H__ @@ -28,57 +30,82 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // Implements a P25 Motorola voice header frame 1. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | Encoded Motorola Start of Stream | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | ICW Flag ? | RSSI | RSSI Valid | RSSI | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | Header Control Word | - // + + - // | | - // + + - // | | - // + + - // | | - // + + - // | | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | Src Flag | - // +-+-+-+-+-+-+-+-+ // --------------------------------------------------------------------------- + /** + * @brief Implements a P25 Motorola voice header frame 1. + * \code{.unparsed} + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Encoded Motorola Start of Stream | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ICW Flag ? | RSSI | RSSI Valid | RSSI | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Header Control Word | + * + + + * | | + * + + + * | | + * + + + * | | + * + + + * | | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Src Flag | + * +-+-+-+-+-+-+-+-+ + * \endcode + * @ingroup dfsi_frames + */ class HOST_SW_API MotVoiceHeader1 { public: static const uint8_t LENGTH = 30; static const uint8_t HCW_LENGTH = 21; - /// Initializes a copy instance of the MotVoiceHeader1 class. + /** + * @brief Initializes a copy instance of the MotVoiceHeader1 class. + */ MotVoiceHeader1(); - /// Initializes a copy instance of the MotVoiceHeader1 class. + /** + * @brief Initializes a copy instance of the MotVoiceHeader1 class. + * @param data Buffer to containing MotVoiceHeader1 to decode. + */ MotVoiceHeader1(uint8_t* data); - /// Finalizes a instance of the MotVoiceHeader1 class. + /** + * @brief Finalizes a instance of the MotVoiceHeader1 class. + */ ~MotVoiceHeader1(); - /// Decode a voice header 1 frame. + /** + * @brief Decode a voice header 1 frame. + * @param[in] data Buffer to containing MotVoiceHeader1 to decode. + */ bool decode(const uint8_t* data); - /// Encode a voice header 1 frame. + /** + * @brief Encode a voice header 1 frame. + * @param[out] data Buffer to encode a MotVoiceHeader1. + */ void encode(uint8_t* data); public: uint8_t* header; // ?? - this should probably be private with getters/setters MotStartOfStream* startOfStream; // ?? - this should probably be private with getters/setters - /// + /** + * @brief + */ __PROPERTY(ICWFlag::E, icw, ICW); - /// + /** + * @brief RSSI Value. + */ __PROPERTY(uint8_t, rssi, RSSI); - /// + /** + * @brief Flag indicating whether or not the RSSI field is valid. + */ __PROPERTY(RssiValidityFlag::E, rssiValidity, RSSIValidity); - /// + /** + * @brief + */ __PROPERTY(uint8_t, nRssi, NRSSI); }; } // namespace dfsi diff --git a/src/dfsi/frames/MotVoiceHeader2.cpp b/src/dfsi/frames/MotVoiceHeader2.cpp index d4fec192..e44f0457 100644 --- a/src/dfsi/frames/MotVoiceHeader2.cpp +++ b/src/dfsi/frames/MotVoiceHeader2.cpp @@ -1,18 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/MotVoiceHeader2.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -29,9 +24,8 @@ using namespace p25::dfsi::defines; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the MotVoiceHeader2 class. -/// +/* Initializes a instance of the MotVoiceHeader2 class. */ + MotVoiceHeader2::MotVoiceHeader2() : header(nullptr), m_source(SourceFlag::QUANTAR) @@ -40,10 +34,8 @@ MotVoiceHeader2::MotVoiceHeader2() : ::memset(header, 0x00U, HCW_LENGTH); } -/// -/// Initializes a instance of the MotVoiceHeader2 class. -/// -/// +/* Initializes a instance of the MotVoiceHeader2 class. */ + MotVoiceHeader2::MotVoiceHeader2(uint8_t* data) : header(nullptr), m_source(SourceFlag::QUANTAR) @@ -51,20 +43,16 @@ MotVoiceHeader2::MotVoiceHeader2(uint8_t* data) : decode(data); } -/// -/// Finalizes a instance of the MotVoiceHeader2 class. -/// +/* Finalizes a instance of the MotVoiceHeader2 class. */ + MotVoiceHeader2::~MotVoiceHeader2() { if (header != nullptr) delete[] header; } -/// -/// Decode a voice header 2 frame. -/// -/// -/// +/* Decode a voice header 2 frame. */ + bool MotVoiceHeader2::decode(const uint8_t* data) { assert(data != nullptr); @@ -82,10 +70,8 @@ bool MotVoiceHeader2::decode(const uint8_t* data) return true; } -/// -/// Encode a voice header 2 frame. -/// -/// +/* Encode a voice header 2 frame. */ + void MotVoiceHeader2::encode(uint8_t* data) { assert(data != nullptr); diff --git a/src/dfsi/frames/MotVoiceHeader2.h b/src/dfsi/frames/MotVoiceHeader2.h index 09c3ca7b..d26c626b 100644 --- a/src/dfsi/frames/MotVoiceHeader2.h +++ b/src/dfsi/frames/MotVoiceHeader2.h @@ -1,17 +1,19 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file MotVoiceHeader2.h + * @ingroup dfsi_frames + * @file MotVoiceHeader2.cpp + * @ingroup dfsi_frames + */ #if !defined(__MOT_VOICE_HEADER_2_H__) #define __MOT_VOICE_HEADER_2_H__ @@ -28,46 +30,65 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // Implements a P25 Motorola voice header frame 2. - // - // Byte 0 1 2 3 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | Header Control Word | - // + + - // | | - // + + - // | | - // + + - // | | - // + + - // | | - // + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | | Reserved | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // --------------------------------------------------------------------------- + /** + * @brief Implements a P25 Motorola voice header frame 2. + * \code{.unparsed} + * Byte 0 1 2 3 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Header Control Word | + * + + + * | | + * + + + * | | + * + + + * | | + * + + + * | | + * + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | | Reserved | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * \endcode + * @ingroup dfsi_frames + */ class HOST_SW_API MotVoiceHeader2 { public: static const uint8_t LENGTH = 22; static const uint8_t HCW_LENGTH = 20; - /// Initializes a copy instance of the MotVoiceHeader2 class. + /** + * @brief Initializes a copy instance of the MotVoiceHeader2 class. + */ MotVoiceHeader2(); - /// Initializes a copy instance of the MotVoiceHeader2 class. + /** + * @brief Initializes a copy instance of the MotVoiceHeader2 class. + * @param data Buffer to containing MotVoiceHeader2 to decode. + */ MotVoiceHeader2(uint8_t* data); - /// Finalizes a instance of the MotVoiceHeader2 class. + /** + * @brief Finalizes a instance of the MotVoiceHeader2 class. + */ ~MotVoiceHeader2(); - /// Decode a voice header 2 frame. + /** + * @brief Decode a voice header 2 frame. + * @param[in] data Buffer to containing MotVoiceHeader2 to decode. + */ bool decode(const uint8_t* data); - /// Encode a voice header 2 frame. + /** + * @brief Encode a voice header 2 frame. + * @param[out] data Buffer to encode a MotVoiceHeader2. + */ void encode(uint8_t* data); public: uint8_t* header; // ?? - this should probably be a private with getters/setters - /// + /** + * @brief V.24 Data Source. + */ __PROPERTY(SourceFlag::E, source, Source); }; } // namespace dfsi diff --git a/src/dfsi/frames/StartOfStream.cpp b/src/dfsi/frames/StartOfStream.cpp index 005052f3..5eac7015 100644 --- a/src/dfsi/frames/StartOfStream.cpp +++ b/src/dfsi/frames/StartOfStream.cpp @@ -1,17 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/StartOfStream.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -27,9 +22,8 @@ using namespace p25::dfsi; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the StartOfStream class. -/// +/* Initializes a instance of the StartOfStream class. */ + StartOfStream::StartOfStream() : m_nid(0U), m_errorCount(0U) @@ -37,10 +31,8 @@ StartOfStream::StartOfStream() : /* stub */ } -/// -/// Initializes a instance of the StartOfStream class. -/// -/// +/* Initializes a instance of the StartOfStream class. */ + StartOfStream::StartOfStream(uint8_t* data) : m_nid(0U), m_errorCount(0U) @@ -48,11 +40,8 @@ StartOfStream::StartOfStream(uint8_t* data) : decode(data); } -/// -/// Decode a start of stream frame. -/// -/// -/// +/* Decode a start of stream frame. */ + bool StartOfStream::decode(const uint8_t* data) { assert(data != nullptr); @@ -63,10 +52,8 @@ bool StartOfStream::decode(const uint8_t* data) return true; } -/// -/// Encode a start of stream frame. -/// -/// +/* Encode a start of stream frame. */ + void StartOfStream::encode(uint8_t* data) { assert(data != nullptr); diff --git a/src/dfsi/frames/StartOfStream.h b/src/dfsi/frames/StartOfStream.h index 6606d812..1004b04a 100644 --- a/src/dfsi/frames/StartOfStream.h +++ b/src/dfsi/frames/StartOfStream.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file StartOfStream.h + * @ingroup dfsi_frames + * @file StartOfStream.cpp + * @ingroup dfsi_frames + */ #if !defined(__START_OF_STREAM_H__) #define __START_OF_STREAM_H__ @@ -26,33 +28,52 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // Implements a P25 DFSI start of stream packet. - // - // Byte 0 1 2 - // Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | NID | Rsvd | Err C | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // --------------------------------------------------------------------------- + /** + * @brief Implements a P25 DFSI start of stream packet. + * \code{.unparsed} + * Byte 0 1 2 + * Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | NID | Rsvd | Err C | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * \endcode + * @ingroup dfsi_frames + */ class HOST_SW_API StartOfStream { public: static const uint8_t LENGTH = 4; - /// Initializes a copy instance of the StartOfStream class. + /** + * @brief Initializes a copy instance of the StartOfStream class. + */ StartOfStream(); - /// Initializes a copy instance of the StartOfStream class. + /** + * @brief Initializes a copy instance of the StartOfStream class. + * @param data Buffer to containing StartOfStream to decode. + */ StartOfStream(uint8_t* data); - /// Decode a start of stream frame. + /** + * @brief Decode a start of stream frame. + * @param[in] data Buffer to containing StartOfStream to decode. + */ bool decode(const uint8_t* data); - /// Encode a start of stream frame. + /** + * @brief Encode a start of stream frame. + * @param[out] data Buffer to encode a StartOfStream. + */ void encode(uint8_t* data); public: - /// Network Identifier. + /** + * @brief Network Identifier. + */ __PROPERTY(uint16_t, nid, NID); - /// Error count. + /** + * @brief Error count. + */ __PROPERTY(uint8_t, errorCount, ErrorCount); }; } // namespace dfsi diff --git a/src/dfsi/frames/fsc/FSCACK.cpp b/src/dfsi/frames/fsc/FSCACK.cpp index ba641101..a3502f6d 100644 --- a/src/dfsi/frames/fsc/FSCACK.cpp +++ b/src/dfsi/frames/fsc/FSCACK.cpp @@ -1,17 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/fsc/FSCACK.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -27,9 +22,8 @@ using namespace p25::dfsi::fsc; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the FSCACK class. -/// +/* Initializes a instance of the FSCACK class. */ + FSCACK::FSCACK() : FSCMessage(), m_ackMessageId(FSCMessageType::FSC_INVALID), m_ackVersion(1U), @@ -40,10 +34,8 @@ FSCACK::FSCACK() : FSCMessage(), m_messageId = FSCMessageType::FSC_ACK; } -/// -/// Initializes a instance of the FSCACK class. -/// -/// +/* Initializes a instance of the FSCACK class. */ + FSCACK::FSCACK(uint8_t* data) : FSCMessage(data), m_ackMessageId(FSCMessageType::FSC_INVALID), m_ackVersion(1U), @@ -54,11 +46,8 @@ FSCACK::FSCACK(uint8_t* data) : FSCMessage(data), decode(data); } -/// -/// Decode a FSC ACK frame. -/// -/// -/// +/* Decode a FSC ACK frame. */ + bool FSCACK::decode(const uint8_t* data) { assert(data != nullptr); @@ -86,10 +75,8 @@ bool FSCACK::decode(const uint8_t* data) return true; } -/// -/// Encode a FSC ACK frame. -/// -/// +/* Encode a FSC ACK frame. */ + void FSCACK::encode(uint8_t* data) { assert(data != nullptr); diff --git a/src/dfsi/frames/fsc/FSCACK.h b/src/dfsi/frames/fsc/FSCACK.h index 2ea5490f..1ba7081f 100644 --- a/src/dfsi/frames/fsc/FSCACK.h +++ b/src/dfsi/frames/fsc/FSCACK.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file FSCACK.h + * @ingroup dfsi_fsc_frames + * @file FSCACK.cpp + * @ingroup dfsi_fsc_frames + */ #if !defined(__FSC_ACK_H__) #define __FSC_ACK_H__ @@ -29,35 +31,59 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // // --------------------------------------------------------------------------- + /** + * @brief Implements the FSC Acknowledgement Message. + * @ingroup dfsi_fsc_frames + */ class HOST_SW_API FSCACK : public FSCMessage { public: static const uint8_t LENGTH = 6; - /// Initializes a copy instance of the FSCACK class. + /** + * @brief Initializes a copy instance of the FSCACK class. + */ FSCACK(); - /// Initializes a copy instance of the FSCACK class. + /** + * @brief Initializes a copy instance of the FSCACK class. + * @param data Buffer to containing FSCACK to decode. + */ FSCACK(uint8_t* data); - /// Decode a FSC ACK frame. + /** + * @brief Decode a FSC ACK frame. + * @param[in] data Buffer to containing FSCACK to decode. + */ bool decode(const uint8_t* data) override; - /// Encode a FSC ACK frame. + /** + * @brief Encode a FSC ACK frame. + * @param[out] data Buffer to encode a FSCACK. + */ void encode(uint8_t* data) override; public: uint8_t* responseData; // ?? - this should probably be private with getters/setters - /// Acknowledged Message ID. + /** + * @brief Acknowledged Message ID. + */ __PROPERTY(FSCMessageType::E, ackMessageId, AckMessageId); - /// Acknowledged Message Version. + /** + * @brief Acknowledged Message Version. + */ __READONLY_PROPERTY(uint8_t, ackVersion, AckVersion); - /// + /** + * @brief + */ __READONLY_PROPERTY(uint8_t, ackCorrelationTag, AckCorrelationTag); - /// Response code. + /** + * @brief Response code. + */ __PROPERTY(FSCAckResponseCode::E, responseCode, ResponseCode); - /// Response Data Length. + /** + * @brief Response Data Length. + */ __PROPERTY(uint8_t, respLength, ResponseLength); }; } // namespace fsc diff --git a/src/dfsi/frames/fsc/FSCConnect.cpp b/src/dfsi/frames/fsc/FSCConnect.cpp index bf2feff8..b58dbf80 100644 --- a/src/dfsi/frames/fsc/FSCConnect.cpp +++ b/src/dfsi/frames/fsc/FSCConnect.cpp @@ -1,17 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/fsc/FSCConnect.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -27,9 +22,8 @@ using namespace p25::dfsi::fsc; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the FSCConnect class. -/// +/* Initializes a instance of the FSCConnect class. */ + FSCConnect::FSCConnect() : FSCMessage(), m_vcBasePort(0U), m_vcSSRC(0U), @@ -39,10 +33,8 @@ FSCConnect::FSCConnect() : FSCMessage(), m_messageId = FSCMessageType::FSC_CONNECT; } -/// -/// Initializes a instance of the FSCConnect class. -/// -/// +/* Initializes a instance of the FSCConnect class. */ + FSCConnect::FSCConnect(uint8_t* data) : FSCMessage(data), m_vcBasePort(0U), m_vcSSRC(0U), @@ -52,11 +44,8 @@ FSCConnect::FSCConnect(uint8_t* data) : FSCMessage(data), decode(data); } -/// -/// Decode a FSC connect frame. -/// -/// -/// +/* Decode a FSC connect frame. */ + bool FSCConnect::decode(const uint8_t* data) { assert(data != nullptr); @@ -70,10 +59,8 @@ bool FSCConnect::decode(const uint8_t* data) return true; } -/// -/// Encode a FSC connect frame. -/// -/// +/* Encode a FSC connect frame. */ + void FSCConnect::encode(uint8_t* data) { assert(data != nullptr); diff --git a/src/dfsi/frames/fsc/FSCConnect.h b/src/dfsi/frames/fsc/FSCConnect.h index 76c9757c..8ef34f59 100644 --- a/src/dfsi/frames/fsc/FSCConnect.h +++ b/src/dfsi/frames/fsc/FSCConnect.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file FSCConnect.h + * @ingroup dfsi_fsc_frames + * @file FSCConnect.cpp + * @ingroup dfsi_fsc_frames + */ #if !defined(__FSC_CONNECT_H__) #define __FSC_CONNECT_H__ @@ -29,31 +31,53 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // // --------------------------------------------------------------------------- + /** + * @brief Implements the FSC Connect Message. + * @ingroup dfsi_fsc_frames + */ class HOST_SW_API FSCConnect : public FSCMessage { public: static const uint8_t LENGTH = 11; - /// Initializes a copy instance of the FSCConnect class. + /** + * @brief Initializes a copy instance of the FSCConnect class. + */ FSCConnect(); - /// Initializes a copy instance of the FSCConnect class. + /** + * @brief Initializes a copy instance of the FSCConnect class. + * @param data Buffer to containing FSCConnect to decode. + */ FSCConnect(uint8_t* data); - /// Decode a FSC connect frame. + /** + * @brief Decode a FSC connect frame. + * @param[in] data Buffer to containing FSCConnect to decode. + */ bool decode(const uint8_t* data) override; - /// Encode a FSC connect frame. + /** + * @brief Encode a FSC connect frame. + * @param[out] data Buffer to encode a FSCConnect. + */ void encode(uint8_t* data) override; public: - /// Voice Conveyance RTP Port. + /** + * @brief Voice Conveyance RTP Port. + */ __PROPERTY(uint16_t, vcBasePort, VCBasePort); - /// SSRC Identifier for all RTP transmissions. + /** + * @brief SSRC Identifier for all RTP transmissions. + */ __PROPERTY(uint32_t, vcSSRC, VCSSRC); - /// Fixed Station Heartbeat Period. + /** + * @brief Fixed Station Heartbeat Period. + */ __PROPERTY(uint8_t, fsHeartbeatPeriod, FSHeartbeatPeriod); - /// Host Heartbeat Period. + /** + * @brief Host Heartbeat Period. + */ __PROPERTY(uint8_t, hostHeartbeatPeriod, HostHeartbeatPeriod); }; } // namespace fsc diff --git a/src/dfsi/frames/fsc/FSCConnectResponse.cpp b/src/dfsi/frames/fsc/FSCConnectResponse.cpp index 68f0dd56..812e2b7f 100644 --- a/src/dfsi/frames/fsc/FSCConnectResponse.cpp +++ b/src/dfsi/frames/fsc/FSCConnectResponse.cpp @@ -1,17 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/fsc/FSCConnectResponse.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -27,30 +22,24 @@ using namespace p25::dfsi::fsc; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the FSCConnectResponse class. -/// +/* Initializes a instance of the FSCConnectResponse class. */ + FSCConnectResponse::FSCConnectResponse() : FSCResponse(), m_vcBasePort(0U) { /* stub */ } -/// -/// Initializes a instance of the FSCConnectResponse class. -/// -/// +/* Initializes a instance of the FSCConnectResponse class. */ + FSCConnectResponse::FSCConnectResponse(uint8_t* data) : FSCResponse(data), m_vcBasePort(0U) { decode(data); } -/// -/// Decode a FSC connect frame. -/// -/// -/// +/* Decode a FSC connect frame. */ + bool FSCConnectResponse::decode(const uint8_t* data) { assert(data != nullptr); @@ -61,10 +50,8 @@ bool FSCConnectResponse::decode(const uint8_t* data) return true; } -/// -/// Encode a FSC connect frame. -/// -/// +/* Encode a FSC connect frame. */ + void FSCConnectResponse::encode(uint8_t* data) { assert(data != nullptr); diff --git a/src/dfsi/frames/fsc/FSCConnectResponse.h b/src/dfsi/frames/fsc/FSCConnectResponse.h index 8a4bda99..6645a5f6 100644 --- a/src/dfsi/frames/fsc/FSCConnectResponse.h +++ b/src/dfsi/frames/fsc/FSCConnectResponse.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file FSCConnectResponse.h + * @ingroup dfsi_fsc_frames + * @file FSCConnectResponse.cpp + * @ingroup dfsi_fsc_frames + */ #if !defined(__FSC_CONNECT_RESPONSE_H__) #define __FSC_CONNECT_RESPONSE_H__ @@ -29,25 +31,41 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // // --------------------------------------------------------------------------- + /** + * @brief Implements the FSC Connect Response Message. + * @ingroup dfsi_fsc_frames + */ class HOST_SW_API FSCConnectResponse : public FSCResponse { public: static const uint8_t LENGTH = 3; - /// Initializes a copy instance of the FSCConnectResponse class. + /** + * @brief Initializes a copy instance of the FSCConnectResponse class. + */ FSCConnectResponse(); - /// Initializes a copy instance of the FSCConnectResponse class. + /** + * @brief Initializes a copy instance of the FSCConnectResponse class. + * @param data Buffer to containing FSCConnectResponse to decode. + */ FSCConnectResponse(uint8_t* data); - /// Decode a FSC connect response frame. + /** + * @brief Decode a FSC connect response frame. + * @param[in] data Buffer to containing FSCConnectResponse to decode. + */ bool decode(const uint8_t* data) override; - /// Encode a FSC connect response frame. + /** + * @brief Encode a FSC connect response frame. + * @param[out] data Buffer to encode a FSCConnectResponse. + */ void encode(uint8_t* data) override; public: - /// Voice Conveyance RTP Port. + /** + * @brief Voice Conveyance RTP Port. + */ __PROPERTY(uint16_t, vcBasePort, VCBasePort); }; } // namespace fsc diff --git a/src/dfsi/frames/fsc/FSCDisconnect.cpp b/src/dfsi/frames/fsc/FSCDisconnect.cpp index b23b4b09..862a59e5 100644 --- a/src/dfsi/frames/fsc/FSCDisconnect.cpp +++ b/src/dfsi/frames/fsc/FSCDisconnect.cpp @@ -1,17 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/fsc/FSCDisconnect.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -27,18 +22,15 @@ using namespace p25::dfsi::fsc; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the FSCDisconnect class. -/// +/* Initializes a instance of the FSCDisconnect class. */ + FSCDisconnect::FSCDisconnect() : FSCMessage() { m_messageId = FSCMessageType::FSC_DISCONNECT; } -/// -/// Initializes a instance of the FSCDisconnect class. -/// -/// +/* Initializes a instance of the FSCDisconnect class. */ + FSCDisconnect::FSCDisconnect(uint8_t* data) : FSCMessage(data) { decode(data); diff --git a/src/dfsi/frames/fsc/FSCDisconnect.h b/src/dfsi/frames/fsc/FSCDisconnect.h index e01f00c0..51f12309 100644 --- a/src/dfsi/frames/fsc/FSCDisconnect.h +++ b/src/dfsi/frames/fsc/FSCDisconnect.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file FSCDisconnect.h + * @ingroup dfsi_fsc_frames + * @file FSCDisconnect.cpp + * @ingroup dfsi_fsc_frames + */ #if !defined(__FSC_DISCONNECT_H__) #define __FSC_DISCONNECT_H__ @@ -29,16 +31,24 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // // --------------------------------------------------------------------------- + /** + * @brief Implements the FSC Disconnect Message. + * @ingroup dfsi_fsc_frames + */ class HOST_SW_API FSCDisconnect : public FSCMessage { public: static const uint8_t LENGTH = 3; - /// Initializes a copy instance of the FSCDisconnect class. + /** + * @brief Initializes a copy instance of the FSCDisconnect class. + */ FSCDisconnect(); - /// Initializes a copy instance of the FSCDisconnect class. + /** + * @brief Initializes a copy instance of the FSCDisconnect class. + * @param data Buffer to containing FSCDisconnect to decode. + */ FSCDisconnect(uint8_t* data); }; } // namespace fsc diff --git a/src/dfsi/frames/fsc/FSCHeartbeat.cpp b/src/dfsi/frames/fsc/FSCHeartbeat.cpp index c677d43d..a2c67dd4 100644 --- a/src/dfsi/frames/fsc/FSCHeartbeat.cpp +++ b/src/dfsi/frames/fsc/FSCHeartbeat.cpp @@ -1,17 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/fsc/FSCHeartbeat.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -27,18 +22,15 @@ using namespace p25::dfsi::fsc; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the FSCHeartbeat class. -/// +/* Initializes a instance of the FSCHeartbeat class. */ + FSCHeartbeat::FSCHeartbeat() : FSCMessage() { m_messageId = FSCMessageType::FSC_HEARTBEAT; } -/// -/// Initializes a instance of the FSCHeartbeat class. -/// -/// +/* Initializes a instance of the FSCHeartbeat class. */ + FSCHeartbeat::FSCHeartbeat(uint8_t* data) : FSCMessage(data) { decode(data); diff --git a/src/dfsi/frames/fsc/FSCHeartbeat.h b/src/dfsi/frames/fsc/FSCHeartbeat.h index 6e63532c..d3f1e91b 100644 --- a/src/dfsi/frames/fsc/FSCHeartbeat.h +++ b/src/dfsi/frames/fsc/FSCHeartbeat.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file FSCHeartbeat.h + * @ingroup dfsi_fsc_frames + * @file FSCHeartbeat.cpp + * @ingroup dfsi_fsc_frames + */ #if !defined(__FSC_HEARTBEAT_H__) #define __FSC_HEARTBEAT_H__ @@ -29,16 +31,24 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // // --------------------------------------------------------------------------- + /** + * @brief Implements the FSC Heartbeat Message. + * @ingroup dfsi_fsc_frames + */ class HOST_SW_API FSCHeartbeat : public FSCMessage { public: static const uint8_t LENGTH = 3; - /// Initializes a copy instance of the FSCHeartbeat class. + /** + * @brief Initializes a copy instance of the FSCHeartbeat class. + */ FSCHeartbeat(); - /// Initializes a copy instance of the FSCHeartbeat class. + /** + * @brief Initializes a copy instance of the FSCHeartbeat class. + * @param data Buffer to containing FSCHeartbeat to decode. + */ FSCHeartbeat(uint8_t* data); }; } // namespace fsc diff --git a/src/dfsi/frames/fsc/FSCMessage.cpp b/src/dfsi/frames/fsc/FSCMessage.cpp index b7a0b8d7..f884eb59 100644 --- a/src/dfsi/frames/fsc/FSCMessage.cpp +++ b/src/dfsi/frames/fsc/FSCMessage.cpp @@ -1,17 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/fsc/FSCMessage.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -27,9 +22,8 @@ using namespace p25::dfsi::fsc; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the FSCMessage class. -/// +/* Initializes a instance of the FSCMessage class. */ + FSCMessage::FSCMessage() : m_messageId(FSCMessageType::FSC_INVALID), m_version(1U), @@ -38,10 +32,8 @@ FSCMessage::FSCMessage() : /* stub */ } -/// -/// Initializes a instance of the FSCMessage class. -/// -/// +/* Initializes a instance of the FSCMessage class. */ + FSCMessage::FSCMessage(uint8_t* data) : m_messageId(FSCMessageType::FSC_INVALID), m_version(1U), @@ -50,11 +42,8 @@ FSCMessage::FSCMessage(uint8_t* data) : decode(data); } -/// -/// Decode a FSC message frame. -/// -/// -/// +/* Decode a FSC message frame. */ + bool FSCMessage::decode(const uint8_t* data) { assert(data != nullptr); @@ -68,10 +57,8 @@ bool FSCMessage::decode(const uint8_t* data) return true; } -/// -/// Encode a FSC message frame. -/// -/// +/* Encode a FSC message frame. */ + void FSCMessage::encode(uint8_t* data) { assert(data != nullptr); diff --git a/src/dfsi/frames/fsc/FSCMessage.h b/src/dfsi/frames/fsc/FSCMessage.h index 90d4d265..8f0e4db0 100644 --- a/src/dfsi/frames/fsc/FSCMessage.h +++ b/src/dfsi/frames/fsc/FSCMessage.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file FSCMessage.h + * @ingroup dfsi_fsc_frames + * @file FSCMessage.cpp + * @ingroup dfsi_fsc_frames + */ #if !defined(__FSC_MESSAGE_H__) #define __FSC_MESSAGE_H__ @@ -28,29 +30,49 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // // --------------------------------------------------------------------------- + /** + * @brief Base class FSC messages derive from. + * @ingroup dfsi_fsc_frames + */ class HOST_SW_API FSCMessage { public: static const uint8_t LENGTH = 3; - /// Initializes a copy instance of the FSCMessage class. + /** + * @brief Initializes a copy instance of the FSCMessage class. + */ FSCMessage(); - /// Initializes a copy instance of the FSCMessage class. + /** + * @brief Initializes a copy instance of the FSCMessage class. + * @param data Buffer to containing FSCMessage to decode. + */ FSCMessage(uint8_t* data); - /// Decode a FSC message frame. + /** + * @brief Decode a FSC message frame. + * @param[in] data Buffer to containing FSCMessage to decode. + */ virtual bool decode(const uint8_t* data); - /// Encode a FSC message frame. + /** + * @brief Encode a FSC message frame. + * @param[out] data Buffer to encode a FSCMessage. + */ virtual void encode(uint8_t* data); public: - /// Message ID. + /** + * @brief Message ID. + */ __PROTECTED_PROPERTY(FSCMessageType::E, messageId, MessageId); - /// Message Version. + /** + * @brief Message Version. + */ __PROTECTED_READONLY_PROPERTY(uint8_t, version, Version); - /// + /** + * @brief + */ __PROTECTED_READONLY_PROPERTY(uint8_t, correlationTag, CorrelationTag); }; } // namespace fsc diff --git a/src/dfsi/frames/fsc/FSCResponse.cpp b/src/dfsi/frames/fsc/FSCResponse.cpp index c578b94a..d2145ed6 100644 --- a/src/dfsi/frames/fsc/FSCResponse.cpp +++ b/src/dfsi/frames/fsc/FSCResponse.cpp @@ -1,17 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "frames/fsc/FSCResponse.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -27,30 +22,24 @@ using namespace p25::dfsi::fsc; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a instance of the FSCResponse class. -/// +/* Initializes a instance of the FSCResponse class. */ + FSCResponse::FSCResponse() : m_version(1U) { /* stub */ } -/// -/// Initializes a instance of the FSCResponse class. -/// -/// +/* Initializes a instance of the FSCResponse class. */ + FSCResponse::FSCResponse(uint8_t* data) : m_version(1U) { decode(data); } -/// -/// Decode a FSC message frame. -/// -/// -/// +/* Decode a FSC message frame. */ + bool FSCResponse::decode(const uint8_t* data) { assert(data != nullptr); @@ -60,10 +49,8 @@ bool FSCResponse::decode(const uint8_t* data) return true; } -/// -/// Encode a FSC message frame. -/// -/// +/* Encode a FSC message frame. */ + void FSCResponse::encode(uint8_t* data) { assert(data != nullptr); diff --git a/src/dfsi/frames/fsc/FSCResponse.h b/src/dfsi/frames/fsc/FSCResponse.h index b324a9f8..a5bb191b 100644 --- a/src/dfsi/frames/fsc/FSCResponse.h +++ b/src/dfsi/frames/fsc/FSCResponse.h @@ -1,16 +1,18 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - DFSI Peer Application -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI Peer Application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file FSCResponse.h + * @ingroup dfsi_fsc_frames + * @file FSCResponse.cpp + * @ingroup dfsi_fsc_frames + */ #if !defined(__FSC_RESPONSE_H__) #define __FSC_RESPONSE_H__ @@ -28,25 +30,41 @@ namespace p25 { // --------------------------------------------------------------------------- // Class Declaration - // // --------------------------------------------------------------------------- + /** + * @brief Base class FSC response messages derive from. + * @ingroup dfsi_fsc_frames + */ class HOST_SW_API FSCResponse { public: static const uint8_t LENGTH = 1; - /// Initializes a copy instance of the FSCResponse class. + /** + * @brief Initializes a copy instance of the FSCResponse class. + */ FSCResponse(); - /// Initializes a copy instance of the FSCResponse class. + /** + * @brief Initializes a copy instance of the FSCResponse class. + * @param data Buffer to containing FSCResponse to decode. + */ FSCResponse(uint8_t* data); - /// Decode a FSC message frame. + /** + * @brief Decode a FSC message frame. + * @param[in] data Buffer to containing FSCResponse to decode. + */ virtual bool decode(const uint8_t* data); - /// Encode a FSC message frame. + /** + * @brief Encode a FSC message frame. + * @param[out] data Buffer to encode a FSCResponse. + */ virtual void encode(uint8_t* data); public: - /// Response Version. + /** + * @brief Response Version. + */ __PROTECTED_READONLY_PROPERTY(uint8_t, version, Version); }; } // namespace fsc diff --git a/src/dfsi/network/CallData.cpp b/src/dfsi/network/CallData.cpp index 3b10c3f9..4f853c0e 100644 --- a/src/dfsi/network/CallData.cpp +++ b/src/dfsi/network/CallData.cpp @@ -1,19 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* -* Borrowed from work by Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * + */ #include "CallData.h" using namespace network; @@ -26,9 +19,8 @@ using namespace dfsi; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a new instance of the VoiceCallData class. -/// +/* Initializes a new instance of the VoiceCallData class. */ + VoiceCallData::VoiceCallData() : srcId(0U), dstId(0U), @@ -58,9 +50,8 @@ VoiceCallData::VoiceCallData() : ::memset(netLDU2, 0x00U, 9U * 25U); } -/// -/// Finalizes a instance of the VoiceCallData class. -/// +/* Finalizes a instance of the VoiceCallData class. */ + VoiceCallData::~VoiceCallData() { delete[] mi; @@ -70,9 +61,8 @@ VoiceCallData::~VoiceCallData() delete[] netLDU2; } -/// -/// Reset call data to defaults. -/// +/* Reset call data to defaults. */ + void VoiceCallData::resetCallData() { srcId = 0U; @@ -99,9 +89,8 @@ void VoiceCallData::resetCallData() streamId = 0U; } -/// -/// Generate a new stream ID for a call. -/// +/* Generate a new stream ID for a call. */ + void VoiceCallData::newStreamId() { std::uniform_int_distribution dist(DVM_RAND_MIN, DVM_RAND_MAX); diff --git a/src/dfsi/network/CallData.h b/src/dfsi/network/CallData.h index df47c8aa..4fa2917f 100644 --- a/src/dfsi/network/CallData.h +++ b/src/dfsi/network/CallData.h @@ -1,22 +1,21 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * + */ /** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* -* Borrowed from work by Bryan Biedenkapp, N2PLL -* -*/ + * @file CallData.h + * @ingroup dfsi_network + * @file CallData.cpp + * @ingroup dfsi_network + */ #if !defined(__DFSI_CALL_DATA_H__) #define __DFSI_CALL_DATA_H__ -// DVM Includes #include "Defines.h" #include "common/edac/RS634717.h" #include "common/network/RawFrameQueue.h" @@ -34,53 +33,115 @@ #include "host/modem/port/IModemPort.h" #include "host/modem/port/UARTPort.h" -// CPP includes #include namespace network { // --------------------------------------------------------------------------- // Class Declaration - // Represents an on-going call. // --------------------------------------------------------------------------- + /** + * @brief Represents an on-going call. + * @ingroup dfsi_network + */ class HOST_SW_API VoiceCallData { public: - /// Initializes a new instance of the VoiceCallData class. + /** + * @brief Initializes a new instance of the VoiceCallData class. + */ VoiceCallData(); - /// Initializes a new instance of the VoiceCallData class. + /** + * @brief Initializes a new instance of the VoiceCallData class. + */ ~VoiceCallData(); - /// Reset call data to defaults. + /** + * @brief Reset call data to defaults. + */ void resetCallData(); - /// Generate a new stream ID for a call. + /** + * @brief Generate a new stream ID for a call. + */ void newStreamId(); - // Call Data + /** @name Call Data */ + /** + * @brief Source Radio ID. + */ uint32_t srcId; + /** + * @brief Destination ID. + */ uint32_t dstId; + /** + * @brief Link Control Opcode. + */ uint8_t lco; + /** + * @brief Manufacturer ID. + */ uint8_t mfId; + /** + * @brief Call Service Options. + */ uint8_t serviceOptions; + /** + * @brief Low Speed Data 1. + */ uint8_t lsd1; + /** + * @brief Low Speed Data 2. + */ uint8_t lsd2; + /** + * @brief Encryption Message Indicator. + */ uint8_t* mi; + /** + * @brief Encryption Algorithm ID. + */ uint8_t algoId; + /** + * @brief Encryption Key ID. + */ uint32_t kId; + /** + * @brief Voice Header 1. + */ uint8_t* VHDR1; + /** + * @brief Voice Header 2. + */ uint8_t* VHDR2; + /** + * @brief FNE Network LDU1 Buffer. + */ uint8_t* netLDU1; + /** + * @brief FNE Network LDU2 Buffer. + */ uint8_t* netLDU2; + /** + * @brief Sequence Number. + */ uint32_t seqNo; + /** + * @brief + */ uint8_t n; + /** + * @brief Stream ID. + */ uint32_t streamId; + /** @} */ private: // Used for stream ID generation diff --git a/src/dfsi/network/DfsiPeerNetwork.cpp b/src/dfsi/network/DfsiPeerNetwork.cpp index a5a93e4c..2332622f 100644 --- a/src/dfsi/network/DfsiPeerNetwork.cpp +++ b/src/dfsi/network/DfsiPeerNetwork.cpp @@ -1,17 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "dfsi/Defines.h" #include "common/network/json/json.h" #include "common/p25/dfsi/DFSIDefines.h" @@ -27,24 +23,8 @@ using namespace network; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a new instance of the PeerNetwork class. -/// -/// Network Hostname/IP address to connect to. -/// Network port number. -/// -/// Unique ID on the network. -/// Network authentication password. -/// Flag indicating full-duplex operation. -/// Flag indicating whether network debug is enabled. -/// Flag indicating whether DMR is enabled. -/// Flag indicating whether P25 is enabled. -/// Flag indicating whether NXDN is enabled. -/// Flag indicating whether DMR slot 1 is enabled for network traffic. -/// Flag indicating whether DMR slot 2 is enabled for network traffic. -/// Flag indicating that the system activity logs will be sent to the network. -/// Flag indicating that the system diagnostic logs will be sent to the network. -/// Flag indicating that the system will accept radio ID and talkgroup ID lookups from the network. +/* Initializes a new instance of the PeerNetwork class. */ + DfsiPeerNetwork::DfsiPeerNetwork(const std::string& address, uint16_t port, uint16_t localPort, uint32_t peerId, const std::string& password, bool duplex, bool debug, bool dmr, bool p25, bool nxdn, bool slot1, bool slot2, bool allowActivityTransfer, bool allowDiagnosticTransfer, bool updateLookup, bool saveLookup) : Network(address, port, localPort, peerId, password, duplex, debug, dmr, p25, nxdn, slot1, slot2, allowActivityTransfer, allowDiagnosticTransfer, updateLookup, saveLookup) @@ -54,14 +34,8 @@ DfsiPeerNetwork::DfsiPeerNetwork(const std::string& address, uint16_t port, uint assert(!password.empty()); } -/// -/// Writes P25 LDU1 frame data to the network. -/// -/// -/// -/// -/// -/// +/* Writes P25 LDU1 frame data to the network. */ + bool DfsiPeerNetwork::writeP25LDU1(const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data, P25DEF::FrameType::E frameType) { if (m_status != NET_STAT_RUNNING && m_status != NET_STAT_MST_RUNNING) @@ -82,13 +56,8 @@ bool DfsiPeerNetwork::writeP25LDU1(const p25::lc::LC& control, const p25::data:: return writeMaster({ NET_FUNC::PROTOCOL, NET_SUBFUNC::PROTOCOL_SUBFUNC_P25 }, message.get(), messageLength, pktSeq(resetSeq), m_p25StreamId); } -/// -/// Writes P25 LDU2 frame data to the network. -/// -/// -/// -/// -/// +/* Writes P25 LDU2 frame data to the network. */ + bool DfsiPeerNetwork::writeP25LDU2(const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data) { if (m_status != NET_STAT_RUNNING && m_status != NET_STAT_MST_RUNNING) @@ -113,10 +82,8 @@ bool DfsiPeerNetwork::writeP25LDU2(const p25::lc::LC& control, const p25::data:: // Protected Class Members // --------------------------------------------------------------------------- -/// -/// Writes configuration to the network. -/// -/// +/* Writes configuration to the network. */ + bool DfsiPeerNetwork::writeConfig() { if (m_loginStreamId == 0U) { @@ -178,15 +145,8 @@ bool DfsiPeerNetwork::writeConfig() // Private Class Members // --------------------------------------------------------------------------- -/// -/// Creates an P25 LDU1 frame message. -/// -/// -/// -/// -/// -/// -/// +/* Creates an P25 LDU1 frame message. */ + UInt8Array DfsiPeerNetwork::createP25_LDU1Message_Raw(uint32_t& length, const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data, P25DEF::FrameType::E frameType) { @@ -260,14 +220,8 @@ UInt8Array DfsiPeerNetwork::createP25_LDU1Message_Raw(uint32_t& length, const p2 return UInt8Array(buffer); } -/// -/// Creates an P25 LDU2 frame message. -/// -/// -/// -/// -/// -/// +/* Creates an P25 LDU2 frame message. */ + UInt8Array DfsiPeerNetwork::createP25_LDU2Message_Raw(uint32_t& length, const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data) { diff --git a/src/dfsi/network/DfsiPeerNetwork.h b/src/dfsi/network/DfsiPeerNetwork.h index 6a12b34b..c24160fb 100644 --- a/src/dfsi/network/DfsiPeerNetwork.h +++ b/src/dfsi/network/DfsiPeerNetwork.h @@ -1,17 +1,19 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ /** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ + * @file DfsiPeerNetwork.h + * @ingroup dfsi_network + * @file DfsiPeerNetwork.cpp + * @ingroup dfsi_network + */ #if !defined(__DFSI_PEER_NETWORK_H__) #define __DFSI_PEER_NETWORK_H__ @@ -25,30 +27,89 @@ namespace network { // --------------------------------------------------------------------------- // Class Declaration - // Implements the core peer networking logic. // --------------------------------------------------------------------------- + /** + * @brief Implements the core peer networking logic. + * @ingroup dfsi_network + */ class HOST_SW_API DfsiPeerNetwork : public Network { public: - /// Initializes a new instance of the PeerNetwork class. + /** + * @brief Initializes a new instance of the PeerNetwork class. + * @param address Network Hostname/IP address to connect to. + * @param port Network port number. + * @param local + * @param peerId Unique ID on the network. + * @param password Network authentication password. + * @param duplex Flag indicating full-duplex operation. + * @param debug Flag indicating whether network debug is enabled. + * @param dmr Flag indicating whether DMR is enabled. + * @param p25 Flag indicating whether P25 is enabled. + * @param nxdn Flag indicating whether NXDN is enabled. + * @param slot1 Flag indicating whether DMR slot 1 is enabled for network traffic. + * @param slot2 Flag indicating whether DMR slot 2 is enabled for network traffic. + * @param allowActivityTransfer Flag indicating that the system activity logs will be sent to the network. + * @param allowDiagnosticTransfer Flag indicating that the system diagnostic logs will be sent to the network. + * @param updateLookup Flag indicating that the system will accept radio ID and talkgroup ID lookups from the network. + */ DfsiPeerNetwork(const std::string& address, uint16_t port, uint16_t localPort, uint32_t peerId, const std::string& password, bool duplex, bool debug, bool dmr, bool p25, bool nxdn, bool slot1, bool slot2, bool allowActivityTransfer, bool allowDiagnosticTransfer, bool updateLookup, bool saveLookup); - /// Writes P25 LDU1 frame data to the network. + /** + * @brief Writes P25 LDU1 frame data to the network. + * @param[in] control Instance of p25::lc::LC containing link control data. + * @param[in] lsd Instance of p25::data::LowSpeedData containing low speed data. + * @param[in] data Buffer containing P25 LDU1 data to send. + * @param[in] frameType DVM P25 frame type. + * @returns bool True, if message was sent, otherwise false. + */ bool writeP25LDU1(const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data, P25DEF::FrameType::E frameType) override; - /// Writes P25 LDU2 frame data to the network. + /** + * @brief Writes P25 LDU2 frame data to the network. + * @param[in] control Instance of p25::lc::LC containing link control data. + * @param[in] lsd Instance of p25::data::LowSpeedData containing low speed data. + * @param[in] data Buffer containing P25 LDU2 data to send. + * @returns bool True, if message was sent, otherwise false. + */ bool writeP25LDU2(const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data) override; protected: - /// Writes configuration to the network. + /** + * @brief Writes configuration to the network. + * @returns bool True, if configuration was sent, otherwise false. + */ bool writeConfig() override; private: - /// Creates an P25 LDU1 frame message. + /** + * @brief Creates an P25 LDU1 frame message. + * + * The data packed into a P25 LDU1 frame message is near standard DFSI messaging, just instead of + * 9 individual frames, they are packed into a single message one right after another. + * + * @param[out] length Length of network message buffer. + * @param[in] control Instance of p25::lc::LC containing link control data. + * @param[in] lsd Instance of p25::data::LowSpeedData containing low speed data. + * @param[in] data Buffer containing P25 LDU1 data to send. + * @param[in] frameType DVM P25 frame type. + * @returns UInt8Array Buffer containing the built network message. + */ UInt8Array createP25_LDU1Message_Raw(uint32_t& length, const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data, P25DEF::FrameType::E frameType); - /// Creates an P25 LDU2 frame message. + /** + * @brief Creates an P25 LDU2 frame message. + * + * The data packed into a P25 LDU2 frame message is near standard DFSI messaging, just instead of + * 9 individual frames, they are packed into a single message one right after another. + * + * @param[out] length Length of network message buffer. + * @param[in] control Instance of p25::lc::LC containing link control data. + * @param[in] lsd Instance of p25::data::LowSpeedData containing low speed data. + * @param[in] data Buffer containing P25 LDU2 data to send. + * @returns UInt8Array Buffer containing the built network message. + */ UInt8Array createP25_LDU2Message_Raw(uint32_t& length, const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data); }; diff --git a/src/dfsi/network/SerialService.cpp b/src/dfsi/network/SerialService.cpp index 8ed6e387..dd25e5a9 100644 --- a/src/dfsi/network/SerialService.cpp +++ b/src/dfsi/network/SerialService.cpp @@ -1,22 +1,15 @@ // SPDX-License-Identifier: GPL-2.0-only -/** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* Copyright (C) 2024 Bryan Biedenkapp, N2PLL -* -*/ - +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ #include "common/p25/lc/tdulc/TDULCFactory.h" - #include "network/SerialService.h" - #include "dfsi/ActivityLog.h" using namespace network; @@ -30,21 +23,8 @@ using namespace dfsi; // Public Class Members // --------------------------------------------------------------------------- -/// -/// Initializes a new instance of the SerialService class. -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// +/* Initializes a new instance of the SerialService class. */ + SerialService::SerialService(std::string& portType, const std::string& portName, uint32_t baudrate, bool rtrt, bool diu, uint16_t jitter, DfsiPeerNetwork* network, uint32_t p25TxQueueSize, uint32_t p25RxQueueSize, uint16_t callTimeout, bool debug, bool trace) : m_portName(portName), @@ -99,9 +79,8 @@ SerialService::SerialService(std::string& portType, const std::string& portName, m_msgBuffer = new uint8_t[BUFFER_LENGTH]; } -/// -/// Finalizes a instance of the SerialService class. -/// +/* Finalizes a instance of the SerialService class. */ + SerialService::~SerialService() { if (m_port != nullptr) { @@ -118,10 +97,8 @@ SerialService::~SerialService() delete m_rxVoiceCallData; } -/// -/// Updates the timer by the passed number of milliseconds. -/// -/// +/* Updates the timer by the passed number of milliseconds. */ + void SerialService::clock(uint32_t ms) { // Get now @@ -229,10 +206,8 @@ void SerialService::clock(uint32_t ms) } } -/// -/// Opens connection to the serial interface. -/// -/// True, if connection is established, otherwise false. +/* Opens connection to the serial interface. */ + bool SerialService::open() { LogInfoEx(LOG_SERIAL, "Opening port %s at %u baud", m_portName.c_str(), m_baudrate); @@ -249,18 +224,16 @@ bool SerialService::open() return true; } -/// -/// Closes connection to the serial interface. -/// +/* Closes connection to the serial interface. */ + void SerialService::close() { LogInfoEx(LOG_SERIAL, "Closing port"); m_port->close(); } -/// -/// Process P25 data from the peer network and send to writeP25Frame() -/// +/* Process P25 data from the peer network and send to writeP25Frame() */ + void SerialService::processP25FromNet(UInt8Array p25Buffer, uint32_t length) { // If there's a local call in progress, ignore the frames @@ -550,11 +523,8 @@ void SerialService::processP25FromNet(UInt8Array p25Buffer, uint32_t length) } } -/// -/// Retrieve and process a P25 frame from the rx P25 queue -/// -/// This function pieces together LDU1/LDU2 messages from individual DFSI frames received over the serial port -/// It's called multiple times before an LDU is sent, and each time adds more data pieces to the LDUs +/* Retrieve and process a P25 frame from the rx P25 queue */ + void SerialService::processP25ToNet() { @@ -1015,9 +985,8 @@ void SerialService::processP25ToNet() // Private Class Members // --------------------------------------------------------------------------- -/// Read a data message from the serial port -/// This is borrowed from the Modem::getResponse() function -/// Response type +/* Read a data message from the serial port */ + RESP_TYPE_DVM SerialService::readSerial() { // Flag for a 16-bit (i.e. 2-byte) length @@ -1180,10 +1149,8 @@ RESP_TYPE_DVM SerialService::readSerial() return RTM_OK; } -/// Called from clock thread, checks for an available P25 frame to write and sends it based on jitter timing requirements -/// Very similar to the readP25Frame function below -/// -/// Note: the length encoded at the start does not include the length, tag, or timestamp bytes +/* Called from clock thread, checks for an available P25 frame to write and sends it based on jitter timing requirements */ + int SerialService::writeSerial() { /** @@ -1255,11 +1222,8 @@ int SerialService::writeSerial() return 0U; } -/// -/// Gets a frame of P25 data from the RX queue -/// -/// The data buffer to populate -/// The size of the P25 data retreived, including the leading data tag +/* Gets a frame of P25 data from the RX queue */ + uint32_t SerialService::readP25Frame(uint8_t* data) { @@ -1301,15 +1265,8 @@ uint32_t SerialService::readP25Frame(uint8_t* data) return 0U; } -/// -/// Break apart a P25 LDU and add to the TX queue, timed appropriately -/// -/// DUID flag for the LDU -/// Link Control data -/// LDU data -/// -/// This is very similar to the C# Mot_DFSISendFrame functions, we don't implement the TIA DFSI sendframe in serial -/// because the only devices we connect to over serial V24 are Moto +/* Break apart a P25 LDU and add to the TX queue, timed appropriately */ + void SerialService::writeP25Frame(DUID::E duid, dfsi::LC& lc, uint8_t* ldu) { // Sanity check @@ -1659,10 +1616,8 @@ void SerialService::writeP25Frame(DUID::E duid, dfsi::LC& lc, uint8_t* ldu) } } -/// -/// Send a start of stream sequence (HDU, etc) to the connected serial V24 device -/// -/// Link control data object +/* Send a start of stream sequence (HDU, etc) to the connected serial V.24 device */ + void SerialService::startOfStream(const LC& lc) { // Flag that we have a network call in progress @@ -1759,10 +1714,8 @@ void SerialService::startOfStream(const LC& lc) addTxToQueue(buffer2, vhdr2.LENGTH, SERIAL_TX_TYPE::NONIMBE); } -/// -/// Send an end of stream sequence (TDU, etc) to the connected serial V24 device -/// -/// Link control data object +/* Send an end of stream sequence (TDU, etc) to the connected serial V.24 device */ + void SerialService::endOfStream() { // Create the new end of stream (which looks like a start of stream with the stop flag) @@ -1786,16 +1739,13 @@ void SerialService::endOfStream() m_netCallInProgress = false; } -/// -/// Helper to add a V24 dataframe to the P25 TX queue with the proper timestamp and formatting -/// -/// Data array to send -/// Length of data in array -/// Type of message to send (used for proper jitter clocking) +/* Helper to add a V24 dataframe to the P25 TX queue with the proper timestamp and formatting */ + void SerialService::addTxToQueue(uint8_t* data, uint16_t len, SERIAL_TX_TYPE msgType) { // If the port isn't connected, just return - if (m_port == nullptr) { return; } + if (m_port == nullptr) + return; // Get current time in ms uint64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); @@ -1865,11 +1815,8 @@ void SerialService::addTxToQueue(uint8_t* data, uint16_t len, SERIAL_TX_TYPE msg m_lastP25Tx = msgTime; } -/// -/// Helper to insert IMBE silence frames for missing audio. -/// -/// -/// +/* Helper to insert IMBE silence frames for missing audio. */ + void SerialService::insertMissingAudio(uint8_t *data, uint32_t& lost) { if (data[10U] == 0x00U) { @@ -1945,6 +1892,8 @@ void SerialService::insertMissingAudio(uint8_t *data, uint32_t& lost) } } +/* */ + void SerialService::printDebug(const uint8_t* buffer, uint16_t len) { if (m_msgDoubleLength && buffer[3U] == CMD_DEBUG_DUMP) { diff --git a/src/dfsi/network/SerialService.h b/src/dfsi/network/SerialService.h index 65122b46..4d2849a2 100644 --- a/src/dfsi/network/SerialService.h +++ b/src/dfsi/network/SerialService.h @@ -1,21 +1,25 @@ // SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - DFSI V.24/UDP Software + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2024 Patrick McDonnell, W3AXL + * + */ /** -* Digital Voice Modem - Modem Host Software -* GPLv2 Open Source. Use is subject to license terms. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* @package DVM / DFSI peer application -* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) -* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) -* -* Copyright (C) 2024 Patrick McDonnell, W3AXL -* -*/ - + * @defgroup dfsi_network DFSI Networking/Serial Communications + * @brief Implementation for the DFSI networking and serial communications. + * @ingroup dfsi + * + * @file SerialService.h + * @ingroup dfsi_network + * @file SerialService.cpp + * @ingroup dfsi_network + */ #if !defined(__SERIAL_SERVICE_H__) #define __SERIAL_SERVICE_H__ -// DVM Includes #include "Defines.h" #include "common/edac/RS634717.h" #include "common/network/RawFrameQueue.h" @@ -35,7 +39,6 @@ #include "host/modem/port/UARTPort.h" #include "host/modem/port/ModemNullPort.h" -// System Includes #include #include #include @@ -49,7 +52,10 @@ using namespace dfsi; namespace network { - // DFSI serial tx flags used to determine proper jitter handling of data in ringbuffer + /** + * @brief DFSI serial tx flags used to determine proper jitter handling of data in ringbuffer. + * @ingroup dfsi_network + */ enum SERIAL_TX_TYPE { NONIMBE, IMBE @@ -57,29 +63,65 @@ namespace network // --------------------------------------------------------------------------- // Class Declaration - // Serial V24 service // --------------------------------------------------------------------------- + /** + * @brief Implements the serial V.24 communications service. + * @ingroup dfsi_network + */ class HOST_SW_API SerialService { public: - /// Initializes an instance of the SerialService class. + /** + * @brief Initializes an instance of the SerialService class. + * @param portType Serial port type. + * @param portName Serial port device name. + * @param baudrate Baud rate. + * @param rtrt Flag indicating whether or not RT/RT is enabled. + * @param diu Flag indicating whether or not V.24 communications are to a DIU. + * @param jitter + * @param network Instance of the DfsiPeerNetwork class. + * @param p25TxQueueSize Ringbuffer size for the P25 transmit queue. + * @param p25RxQueueSize Ringbuffer size for the P24 receive queue. + * @param callTimeout + * @param debug Flag indicating whether verbose debug logging is enabled. + * @param trace Flag indicating whether verbose trace logging is enabled. + */ SerialService(std::string& portType, const std::string& portName, uint32_t baudrate, bool rtrt, bool diu, uint16_t jitter, DfsiPeerNetwork* network, uint32_t p25TxQueueSize, uint32_t p25RxQueueSize, uint16_t callTimeout, bool debug, bool trace); - /// Finalizes an instance of the SerialService class. + /** + * @brief Finalizes an instance of the SerialService class. + */ ~SerialService(); - /// Updates the serial interface by the passed number of milliseconds. + /** + * @brief Updates the serial interface by the passed number of milliseconds. + * @param ms Number of milliseconds. + */ void clock(uint32_t ms); - /// Opens connection to the serial interface. + /** + * @brief Opens connection to the serial interface. + * @returns bool True, if serial interface has started, otherwise false. + */ bool open(); - /// Closes connection to the serial interface. + /** + * @brief Closes connection to the serial interface. + */ void close(); - // Handle P25 data from network to V24 + /** + * @brief Process data frames from the network. + * @param p25Buffer Buffer containing the network frame. + * @param length Length of the buffer. + */ void processP25FromNet(UInt8Array p25Buffer, uint32_t length); - // Handle P25 data from V24 to network + /** + * @brief Process data frames from the V.24 serial interface. + * + * This function pieces together LDU1/LDU2 messages from individual DFSI frames received over the serial port. It's + * called multiple times before an LDU is sent, and each time adds more data pieces to the LDUs. + */ void processP25ToNet(); private: @@ -142,22 +184,66 @@ namespace network VoiceCallData* m_rxVoiceCallData; // Functions called by clock() to read/write from/to the serial port + /** + * @brief Read a data message from the serial interface. + * @return RESP_TYPE_DVM + */ RESP_TYPE_DVM readSerial(); + /** + * @brief Helper to write data from the P25 Tx queue to the serial interface. + * + * Very similar to the readP25Frame function. + * + * Note: the length encoded at the start does not include the length, tag, or timestamp bytes. + * + * @return int Actual number of bytes written to the serial interface. + */ int writeSerial(); + /** + * @brief Gets a frame of P25 data from the RX queue. + * @param data Buffer containing P25 data. + * @return uint32_t Size of the P25 data buffer, including leading data tag. + */ uint32_t readP25Frame(uint8_t* data); + /** + * @brief Process a P25 LDU and add to the TX queue, timed appropriately. + * @param duid DUID. + * @param lc Instance of the dfsi::LC class. + * @param ldu Buffer containing LDU data. + */ void writeP25Frame(P25DEF::DUID::E duid, dfsi::LC& lc, uint8_t* ldu); - // Helpers for TX stream data + /** + * @brief Send a start of stream sequence (HDU, etc) to the connected serial V24 device. + * @param lc Instance of the p25::LC class. + */ void startOfStream(const LC& lc); + /** + * @brief Send an end of stream sequence (TDU, etc) to the connected serial V24 device. + */ void endOfStream(); - // Helper for timing TX data appropriately based on frame type + /** + * @brief Helper to add a V.24 dataframe to the P25 Tx queue with the proper timestamp and formatting. + * @param data Buffer containing V.24 data frame to send. + * @param len Length of buffer. + * @param msgType Type of message to send (used for proper jitter clocking). + */ void addTxToQueue(uint8_t* data, uint16_t length, SERIAL_TX_TYPE msgType); - /// Helper to insert IMBE silence frames for missing audio. + /** + * @brief Helper to insert IMBE silence frames for missing audio. + * @param data Buffer containing frame data. + * @param[out] lost Count of lost IMBE frames. + */ void insertMissingAudio(uint8_t* data, uint32_t& lost); + /** + * @brief + * @param buffer + * @param length + */ void printDebug(const uint8_t* buffer, uint16_t length); }; } // namespace network diff --git a/src/fne/network/FNENetwork.h b/src/fne/network/FNENetwork.h index 208f3613..38bbdb4f 100644 --- a/src/fne/network/FNENetwork.h +++ b/src/fne/network/FNENetwork.h @@ -361,7 +361,7 @@ namespace network void setPresharedKey(const uint8_t* presharedKey); /** - * @brief Process a data frames from the network. + * @brief Process data frames from the network. */ void processNetwork();