convert dfsi to Doxygen documentation format;

pull/61/head
Bryan Biedenkapp 2 years ago
parent 2756e47f65
commit 580f26a478

@ -1,16 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - Modem Host Software * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI peer application * Copyright (C) 2024 Patrick McDonnell, W3AXL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) *
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) */
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
*
*/
#include "ActivityLog.h" #include "ActivityLog.h"
#include "common/network/BaseNetwork.h" #include "common/network/BaseNetwork.h"
#include "common/Log.h" // for CurrentLogFileLevel() and LogGetNetwork() #include "common/Log.h" // for CurrentLogFileLevel() and LogGetNetwork()
@ -51,10 +47,8 @@ static struct tm m_actTm;
// Global Functions // Global Functions
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Helper to open the activity log file, file handle. */
/// Helper to open the activity log file, file handle.
/// </summary>
/// <returns>True, if log file is opened, otherwise false.
static bool ActivityLogOpen() static bool ActivityLogOpen()
{ {
if (CurrentLogFileLevel() == 0U) if (CurrentLogFileLevel() == 0U)
@ -83,11 +77,8 @@ static bool ActivityLogOpen()
return m_actFpLog != nullptr; return m_actFpLog != nullptr;
} }
/// <summary> /* Initializes the activity log. */
/// Initializes the activity log.
/// </summary>
/// <param name="filePath">Full-path to the activity log file.</param>
/// <param name="fileRoot">Prefix of the activity log file name.</param>
bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot) bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot)
{ {
#if defined(CATCH2_TEST_COMPILATION) #if defined(CATCH2_TEST_COMPILATION)
@ -99,9 +90,8 @@ bool ActivityLogInitialise(const std::string& filePath, const std::string& fileR
return ::ActivityLogOpen(); return ::ActivityLogOpen();
} }
/// <summary> /* Finalizes the activity log. */
/// Finalizes the activity log.
/// </summary>
void ActivityLogFinalise() void ActivityLogFinalise()
{ {
#if defined(CATCH2_TEST_COMPILATION) #if defined(CATCH2_TEST_COMPILATION)
@ -111,11 +101,8 @@ void ActivityLogFinalise()
::fclose(m_actFpLog); ::fclose(m_actFpLog);
} }
/// <summary> /* Writes a new entry to the activity log. */
/// Writes a new entry to the activity log.
/// </summary>
/// <remarks>This is a variable argument function.</remarks>
/// <param name="msg">Formatted string to write to activity log.</param>
void ActivityLog(const char* msg, ...) void ActivityLog(const char* msg, ...)
{ {
#if defined(CATCH2_TEST_COMPILATION) #if defined(CATCH2_TEST_COMPILATION)

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file ActivityLog.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file ActivityLog.cpp
* * @ingroup dfsi
* @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
*
*/
#if !defined(__ACTIVITY_LOG_H__) #if !defined(__ACTIVITY_LOG_H__)
#define __ACTIVITY_LOG_H__ #define __ACTIVITY_LOG_H__
@ -22,11 +24,22 @@
// Global Functions // Global Functions
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary>Initializes the activity log.</summary> /**
* @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); extern HOST_SW_API bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot);
/// <summary>Finalizes the activity log.</summary> /**
* @brief Finalizes the activity log.
*/
extern HOST_SW_API void ActivityLogFinalise(); extern HOST_SW_API void ActivityLogFinalise();
/// <summary>Writes a new entry to the activity log.</summary> /**
* @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, ...); extern HOST_SW_API void ActivityLog(const char* msg, ...);
#endif // __ACTIVITY_LOG_H__ #endif // __ACTIVITY_LOG_H__

@ -1,16 +1,21 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @defgroup dfsi DFSI V.24/UDP Software (dvmdfsi)
* GPLv2 Open Source. Use is subject to license terms. * @brief Digital Voice Modem - DFSI V.24/UDP Software
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @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
* @package DVM / DFSI peer application *
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * @file Defines.h
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) * @ingroup dfsi
* */
* Copyright (C) 2024 Patrick McDonnell, W3AXL
*
*/
#if !defined(__DEFINES_H__) #if !defined(__DEFINES_H__)
#define __DEFINES_H__ #define __DEFINES_H__
@ -21,7 +26,7 @@
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
#undef __PROG_NAME__ #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__ #undef __EXE_NAME__
#define __EXE_NAME__ "dvmdfsi" #define __EXE_NAME__ "dvmdfsi"

@ -1,17 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - Modem Host Software * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI peer application * Copyright (C) 2024 Patrick McDonnell, W3AXL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) *
* */
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "Defines.h" #include "Defines.h"
#include "common/dmr/DMRDefines.h" #include "common/dmr/DMRDefines.h"
#include "common/p25/P25Utils.h" #include "common/p25/P25Utils.h"
@ -45,10 +41,8 @@ using namespace lookups;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a new instance of the HostTest class. */
/// Initializes a new instance of the HostTest class.
/// </summary>
/// <param name="confFile">Full-path to the configuration file.</param>
Dfsi::Dfsi(const std::string& confFile) : Dfsi::Dfsi(const std::string& confFile) :
m_confFile(confFile), m_confFile(confFile),
m_conf(), m_conf(),
@ -65,15 +59,12 @@ Dfsi::Dfsi(const std::string& confFile) :
/* stub */ /* stub */
} }
/// <summary> /* Finalizes a instance of the HostTest class. */
/// Finalizes a instance of the HostTest class.
/// </summary>
Dfsi::~Dfsi() = default; Dfsi::~Dfsi() = default;
/// <summary> /* Executes the main FNE processing loop. */
/// Executes the main FNE processing loop.
/// </summary>
/// <returns>Zero if successful, otherwise error occurred.</returns>
int Dfsi::run() int Dfsi::run()
{ {
bool ret = false; bool ret = false;
@ -204,9 +195,7 @@ int Dfsi::run()
StopWatch stopWatch; StopWatch stopWatch;
stopWatch.start(); stopWatch.start();
/// // main execution loop
/// main execution loop
///
while (!g_killed) { while (!g_killed) {
uint32_t ms = stopWatch.elapsed(); uint32_t ms = stopWatch.elapsed();
@ -279,10 +268,8 @@ int Dfsi::run()
// Private Class Members // Private Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Reads basic configuration parameters from the YAML configuration file. */
/// Reads basic configuration parameters from the YAML configuration file.
/// </summary>
/// <returns></returns>
bool Dfsi::readParams() bool Dfsi::readParams()
{ {
// No basic config params right now // No basic config params right now
@ -290,10 +277,8 @@ bool Dfsi::readParams()
return true; return true;
} }
/// <summary> /* Initializes peer network connectivity. */
/// Initializes peer network connectivity.
/// </summary>
/// <returns></returns>
bool Dfsi::createPeerNetwork() bool Dfsi::createPeerNetwork()
{ {
yaml::Node networkConf = m_conf["network"]; yaml::Node networkConf = m_conf["network"];
@ -376,12 +361,8 @@ bool Dfsi::createPeerNetwork()
return true; return true;
} }
/// <summary> /* Initializes serial V.24 network. */
/// Initializes serial V24 network.
/// </summary>
/// <param name="p25BufferSize"></param>
/// <param name="callTimeout"></param>
/// <returns></returns>
bool Dfsi::createSerialNetwork(uint32_t p25BufferSize, uint16_t callTimeout) bool Dfsi::createSerialNetwork(uint32_t p25BufferSize, uint16_t callTimeout)
{ {
// Read serial config // Read serial config

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file Dfsi.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file Dfsi.cpp
* * @ingroup dfsi
* @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
*
*/
#if !defined(__DFSI_H__) #if !defined(__DFSI_H__)
#define __DFSI_H__ #define __DFSI_H__
@ -28,17 +30,28 @@
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
// This class implements the core service logic.
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/**
* @brief This class implements the core service logic.
* @ingroup dfsi
*/
class HOST_SW_API Dfsi { class HOST_SW_API Dfsi {
public: public:
/// <summary>Initializes a new instance of the HostTest class.</summary> /**
* @brief Initializes a new instance of the HostTest class.
* @param confFile Full-path to the configuration file.
*/
Dfsi(const std::string& confFile); Dfsi(const std::string& confFile);
/// <summary>Finalizes a instance of the HostTest class.</summary> /**
* @brief Finalizes a instance of the HostTest class.
*/
~Dfsi(); ~Dfsi();
/// <summary>Executes the main host processing loop.</summary> /**
* @brief Executes the main host processing loop.
* @returns int Zero if successful, otherwise error occurred.
*/
int run(); int run();
private: private:
@ -61,11 +74,20 @@ private:
network::SerialService* m_serial; network::SerialService* m_serial;
/// <summary>Reads basic configuration parameters from the INI.</summary> /**
* @brief Reads basic configuration parameters from the INI.
* @returns bool True, if configuration was read successfully, otherwise false.
*/
bool readParams(); bool readParams();
/// <summary>Initializes peer network connectivity.</summary> /**
* @brief Initializes peer network connectivity.
* @returns bool True, if network connectivity was initialized, otherwise false.
*/
bool createPeerNetwork(); bool createPeerNetwork();
/// <summary>Initializes serial V24 network.</summary> /**
* @brief Initializes serial V.24 network.
* @returns bool True, if serial connectivity was initialized, otherwise false.
*/
bool createSerialNetwork(uint32_t p25BufferSize, uint16_t callTimeout); bool createSerialNetwork(uint32_t p25BufferSize, uint16_t callTimeout);
}; };

@ -1,17 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - Modem Host Software * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI peer application * Copyright (C) 2024 Patrick McDonnell, W3AXL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) *
* */
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "Defines.h" #include "Defines.h"
#include "common/Log.h" #include "common/Log.h"
#include "dfsi/ActivityLog.h" #include "dfsi/ActivityLog.h"
@ -57,10 +53,8 @@ uint8_t* g_gitHashBytes = nullptr;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
#if !defined(CATCH2_TEST_COMPILATION) #if !defined(CATCH2_TEST_COMPILATION)
/// <summary> /* Internal signal handler. */
/// Internal signal handler.
/// </summary>
/// <param name="signum"></param>
static void sigHandler(int signum) static void sigHandler(int signum)
{ {
g_signal = signum; g_signal = signum;
@ -68,11 +62,8 @@ static void sigHandler(int signum)
} }
#endif #endif
/// <summary> /* Helper to print a fatal error message and exit. */
/// Helper to print a fatal error message and exit.
/// </summary>
/// <remarks>This is a variable argument function.</remarks>
/// <param name="msg">Message.</param>
void fatal(const char* msg, ...) void fatal(const char* msg, ...)
{ {
char buffer[400U]; char buffer[400U];
@ -89,11 +80,8 @@ void fatal(const char* msg, ...)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/// <summary> /* Helper to pring usage the command line arguments. (And optionally an error.) */
/// Helper to pring usage the command line arguments. (And optionally an error.)
/// </summary>
/// <param name="message">Error message.</param>
/// <param name="arg">Error message arguments.</param>
void usage(const char* message, const char* arg) void usage(const char* message, const char* arg)
{ {
::fprintf(stdout, __PROG_NAME__ " %s (built %s)\r\n", __VER__, __BUILD__); ::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); exit(EXIT_FAILURE);
} }
/// <summary> /* Helper to validate the command line arguments. */
/// Helper to validate the command line arguments.
/// </summary>
/// <param name="argc">Argument count.</param>
/// <param name="argv">Array of argument strings.</param>
/// <returns>Count of remaining unprocessed arguments.</returns>
int checkArgs(int argc, char* argv[]) int checkArgs(int argc, char* argv[])
{ {
int i, p = 0; int i, p = 0;

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file DfsiMain.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file DfsiMain.cpp
* * @ingroup dfsi
* @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
*
*/
#if !defined(__DFSI_MAIN_H__) #if !defined(__DFSI_MAIN_H__)
#define __DFSI_MAIN_H__ #define __DFSI_MAIN_H__
@ -22,20 +24,37 @@
// Externs // Externs
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** @brief */
extern int g_signal; extern int g_signal;
/** @brief */
extern std::string g_progExe; extern std::string g_progExe;
/** @brief */
extern std::string g_iniFile; extern std::string g_iniFile;
/** @brief */
extern std::string g_lockFile; extern std::string g_lockFile;
/** @brief (Global) Flag indicating foreground operation. */
extern bool g_foreground; extern bool g_foreground;
/** @brief (Global) Flag indicating the FNE should stop immediately. */
extern bool g_killed; extern bool g_killed;
/** @brief */
extern std::string g_masterAddress; extern std::string g_masterAddress;
/** @brief */
extern uint16_t g_masterPort; extern uint16_t g_masterPort;
/** @brief */
extern uint32_t g_peerId; extern uint32_t g_peerId;
extern uint8_t* g_gitHashBytes; 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, ...); extern HOST_SW_API void fatal(const char* msg, ...);
#endif // __DFSI_MAIN_H__ #endif // __DFSI_MAIN_H__

@ -1,17 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) *
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) */
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/BlockHeader.h" #include "frames/BlockHeader.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -27,9 +22,8 @@ using namespace p25::dfsi;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the BlockHeader class. */
/// Initializes a instance of the BlockHeader class.
/// </summary>
BlockHeader::BlockHeader() : BlockHeader::BlockHeader() :
m_payloadType(false), m_payloadType(false),
m_blockLength(BlockType::UNDEFINED) m_blockLength(BlockType::UNDEFINED)
@ -37,11 +31,8 @@ BlockHeader::BlockHeader() :
/* stub */ /* stub */
} }
/// <summary> /* Initializes a instance of the BlockHeader class. */
/// Initializes a instance of the BlockHeader class.
/// </summary>
/// <param name="data"></param>
/// <param name="verbose"></param>
BlockHeader::BlockHeader(uint8_t* data, bool verbose) : BlockHeader::BlockHeader(uint8_t* data, bool verbose) :
m_payloadType(false), m_payloadType(false),
m_blockLength(BlockType::UNDEFINED) m_blockLength(BlockType::UNDEFINED)
@ -49,12 +40,8 @@ BlockHeader::BlockHeader(uint8_t* data, bool verbose) :
decode(data, verbose); decode(data, verbose);
} }
/// <summary> /* Decode a block header frame. */
/// Decode a block header frame.
/// </summary>
/// <param name="data"></param>
/// <param name="verbose"></param>
/// <returns></returns>
bool BlockHeader::decode(const uint8_t* data, bool verbose) bool BlockHeader::decode(const uint8_t* data, bool verbose)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -78,11 +65,8 @@ bool BlockHeader::decode(const uint8_t* data, bool verbose)
return true; return true;
} }
/// <summary> /* Encode a block header frame. */
/// Encode a block header frame.
/// </summary>
/// <param name="data"></param>
/// <param name="verbose"></param>
void BlockHeader::encode(uint8_t* data, bool verbose) void BlockHeader::encode(uint8_t* data, bool verbose)
{ {
assert(data != nullptr); assert(data != nullptr);

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file BlockHeader.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file BlockHeader.cpp
* * @ingroup dfsi_frames
* @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
*
*/
#if !defined(__BLOCK_HEADER_H__) #if !defined(__BLOCK_HEADER_H__)
#define __BLOCK_HEADER_H__ #define __BLOCK_HEADER_H__
@ -26,47 +28,73 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // 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 { class HOST_SW_API BlockHeader {
public: public:
static const uint8_t LENGTH = 1; static const uint8_t LENGTH = 1;
static const uint8_t VERBOSE_LENGTH = 4; static const uint8_t VERBOSE_LENGTH = 4;
/// <summary>Initializes a copy instance of the BlockHeader class.</summary> /**
* @brief Initializes a copy instance of the BlockHeader class.
*/
BlockHeader(); BlockHeader();
/// <summary>Initializes a copy instance of the BlockHeader class.</summary> /**
* @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); BlockHeader(uint8_t* data, bool verbose = false);
/// <summary>Decode a block header frame.</summary> /**
* @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); bool decode(const uint8_t* data, bool verbose = false);
/// <summary>Encode a block header frame.</summary> /**
* @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); void encode(uint8_t *data, bool verbose = false);
public: public:
/// <summary>Payload type.</summary> /**
/// <remarks>This simple boolean marks this header as either IANA standard, or profile specific.</remarks> * @brief Payload type.
* This simple boolean marks this header as either IANA standard, or profile specific.
*/
__PROPERTY(bool, payloadType, PayloadType); __PROPERTY(bool, payloadType, PayloadType);
/// <summary>Block type.</summary> /**
* @brief Block type.
*/
__PROPERTY(BlockType::E, blockType, BlockType); __PROPERTY(BlockType::E, blockType, BlockType);
/// <summary>Timestamp Offset.</summary> /**
* @brief Timestamp Offset.
*/
__PROPERTY(uint16_t, timestampOffset, TimestampOffset); __PROPERTY(uint16_t, timestampOffset, TimestampOffset);
/// <summary>Block length.</summary> /**
* @brief Block length.
*/
__PROPERTY(uint16_t, blockLength, BlockLength); __PROPERTY(uint16_t, blockLength, BlockLength);
}; };
} // namespace dfsi } // namespace dfsi

@ -1,17 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) *
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) */
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/ControlOctet.h" #include "frames/ControlOctet.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -27,9 +22,8 @@ using namespace p25::dfsi;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the ControlOctet class. */
/// Initializes a instance of the ControlOctet class.
/// </summary>
ControlOctet::ControlOctet() : ControlOctet::ControlOctet() :
m_signal(false), m_signal(false),
m_compact(true), m_compact(true),
@ -38,10 +32,8 @@ ControlOctet::ControlOctet() :
/* stub */ /* stub */
} }
/// <summary> /* Initializes a instance of the ControlOctet class. */
/// Initializes a instance of the ControlOctet class.
/// </summary>
/// <param name="data"></param>
ControlOctet::ControlOctet(uint8_t* data) : ControlOctet::ControlOctet(uint8_t* data) :
m_signal(false), m_signal(false),
m_compact(true), m_compact(true),
@ -50,11 +42,8 @@ ControlOctet::ControlOctet(uint8_t* data) :
decode(data); decode(data);
} }
/// <summary> /* Decode a control octet frame. */
/// Decode a control octet frame.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
bool ControlOctet::decode(const uint8_t* data) bool ControlOctet::decode(const uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -66,10 +55,8 @@ bool ControlOctet::decode(const uint8_t* data)
return true; return true;
} }
/// <summary> /* Encode a control octet frame. */
/// Encode a control octet frame.
/// </summary>
/// <param name="data"></param>
void ControlOctet::encode(uint8_t* data) void ControlOctet::encode(uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file ControlOctet.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file ControlOctet.cpp
* * @ingroup dfsi_frames
* @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
*
*/
#if !defined(__CONTROL_OCTET_H__) #if !defined(__CONTROL_OCTET_H__)
#define __CONTROL_OCTET_H__ #define __CONTROL_OCTET_H__
@ -26,35 +28,56 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // 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 { class HOST_SW_API ControlOctet {
public: public:
static const uint8_t LENGTH = 1; static const uint8_t LENGTH = 1;
/// <summary>Initializes a copy instance of the ControlOctet class.</summary> /**
* @brief Initializes a copy instance of the ControlOctet class.
*/
ControlOctet(); ControlOctet();
/// <summary>Initializes a copy instance of the ControlOctet class.</summary> /**
* @brief Initializes a copy instance of the ControlOctet class.
* @param data Buffer to containing ControlOctet to decode.
*/
ControlOctet(uint8_t* data); ControlOctet(uint8_t* data);
/// <summary>Decode a control octet frame.</summary> /**
* @brief Decode a control octet frame.
* @param[in] data Buffer to containing ControlOctet to decode.
*/
bool decode(const uint8_t* data); bool decode(const uint8_t* data);
/// <summary>Encode a control octet frame.</summary> /**
* @brief Encode a control octet frame.
* @param[out] data Buffer to encode a ControlOctet.
*/
void encode(uint8_t* data); void encode(uint8_t* data);
public: public:
/// <summary></summary> /**
* @brief
*/
__PROPERTY(bool, signal, Signal); __PROPERTY(bool, signal, Signal);
/// <summary>Indicates a compact (1) or verbose (0) block header.</summary> /**
* @brief Indicates a compact (1) or verbose (0) block header.
*/
__PROPERTY(bool, compact, Compact); __PROPERTY(bool, compact, Compact);
/// <summary>Number of block headers following this control octet.</summary> /**
* @brief Number of block headers following this control octet.
*/
__PROPERTY(uint8_t, blockHeaderCnt, BlockHeaderCnt); __PROPERTY(uint8_t, blockHeaderCnt, BlockHeaderCnt);
}; };
} // namespace dfsi } // namespace dfsi

@ -1,17 +1,25 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @defgroup dfsi_frames DFSI Data Frames
* GPLv2 Open Source. Use is subject to license terms. * @brief Implementation for the DFSI data frames.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @ingroup dfsi
* *
* @package DVM / DFSI Peer Application * @defgroup dfsi_fsc_frames DFSI Control Frames
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * @brief Implementation for the DFSI control frames.
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) * @ingroup dfsi_frames
* *
* Copyright (C) 2024 Patrick McDonnell, W3AXL * @file FrameDefines.h
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL * @ingroup dfsi_frames
* */
*/
#if !defined(__FRAME_DEFINES_H__) #if !defined(__FRAME_DEFINES_H__)
#define __FRAME_DEFINES_H__ #define __FRAME_DEFINES_H__
@ -25,121 +33,109 @@ namespace p25
// Constants // Constants
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /**
/// Control Service Message. * @addtogroup dfsi_frames
/// </summary> * @{
*/
/** @brief FSC Control Service Message.*/
namespace FSCMessageType { namespace FSCMessageType {
// FSC Control Service Message Enumeration /** @brief FSC Control Service Message.*/
enum E : uint8_t { enum E : uint8_t {
FSC_CONNECT = 0, // Establish connection with FSS. FSC_CONNECT = 0, //! Establish connection with FSS.
FSC_HEARTBEAT = 1, // Heartbeat/Connectivity Maintenance. FSC_HEARTBEAT = 1, //! Heartbeat/Connectivity Maintenance.
FSC_ACK = 2, // Control Service Ack. 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.
}; };
} }
/// <summary> /** @brief FSC ACK/NAK Codes. */
/// ACK/NAK Codes
/// </summary>
namespace FSCAckResponseCode { namespace FSCAckResponseCode {
// FSC ACK/NAK Code Enumeration /** @brief FSC ACK/NAK Codes. */
enum E : uint8_t { enum E : uint8_t {
CONTROL_ACK = 0, // Acknowledgement. CONTROL_ACK = 0, //! Acknowledgement.
CONTROL_NAK = 1, // Unspecified Negative Acknowledgement. CONTROL_NAK = 1, //! Unspecified Negative Acknowledgement.
CONTROL_NAK_CONNECTED = 2, // Server is connected to some other host. CONTROL_NAK_CONNECTED = 2, //! Server is connected to some other host.
CONTROL_NAK_M_UNSUPP = 3, // Unsupported Manufactuerer Message. CONTROL_NAK_M_UNSUPP = 3, //! Unsupported Manufactuerer Message.
CONTROL_NAK_V_UNSUPP = 4, // Unsupported Message Version. CONTROL_NAK_V_UNSUPP = 4, //! Unsupported Message Version.
CONTROL_NAK_F_UNSUPP = 5, // Unsupported Function. CONTROL_NAK_F_UNSUPP = 5, //! Unsupported Function.
CONTROL_NAK_PARMS = 6, // Bad / Unsupported Command Parameters. CONTROL_NAK_PARMS = 6, //! Bad / Unsupported Command Parameters.
CONTROL_NAK_BUSY = 7 // FSS is currently busy with a function. CONTROL_NAK_BUSY = 7 //! FSS is currently busy with a function.
}; };
} }
/// <summary> /** @brief DFSI Block Types */
/// DFSI Block Types
/// </summary>
namespace BlockType { namespace BlockType {
// DFSI Block Types Enumeration /** @brief DFSI Block Types */
enum E : uint8_t { enum E : uint8_t {
FULL_RATE_VOICE = 0, // FULL_RATE_VOICE = 0, //! Full Rate Voice
VOICE_HEADER_P1 = 6, // VOICE_HEADER_P1 = 6, //! Voice Header 1
VOICE_HEADER_P2 = 7, // VOICE_HEADER_P2 = 7, //! Voice Header 2
START_OF_STREAM = 9, // START_OF_STREAM = 9, //! Start of Stream
END_OF_STREAM = 10, // END_OF_STREAM = 10, //! End of Stream
UNDEFINED = 127 // UNDEFINED = 127 //! Undefined
}; };
} }
/// <summary> /** @brief RT/RT Flag */
///
/// </summary>
namespace RTFlag { namespace RTFlag {
// /** @brief RT/RT Flag */
enum E : uint8_t { enum E : uint8_t {
ENABLED = 0x02U, // ENABLED = 0x02U, //! RT/RT Enabled
DISABLED = 0x04U // DISABLED = 0x04U //! RT/RT Disabled
}; };
} }
/// <summary> /** @brief Start/Stop Flag */
///
/// </summary>
namespace StartStopFlag { namespace StartStopFlag {
// /** @brief Start/Stop Flag */
enum E : uint8_t { enum E : uint8_t {
START = 0x0CU, // START = 0x0CU, //! Start
STOP = 0x25U // STOP = 0x25U //! Stop
}; };
} }
/// <summary> /** @brief V.24 Data Stream Type */
///
/// </summary>
namespace StreamTypeFlag { namespace StreamTypeFlag {
// /** @brief V.24 Data Stream Type */
enum E : uint8_t { enum E : uint8_t {
VOICE = 0x0BU // VOICE = 0x0BU //! Voice
}; };
} }
/// <summary> /** @brief RSSI Data Validity */
///
/// </summary>
namespace RssiValidityFlag { namespace RssiValidityFlag {
// /** @brief RSSI Data Validity */
enum E : uint8_t { enum E : uint8_t {
INVALID = 0x00U, // INVALID = 0x00U, //! Invalid
VALID = 0x1A // VALID = 0x1A //! Valid
}; };
} }
/// <summary> /** @brief V.24 Data Source */
///
/// </summary>
namespace SourceFlag { namespace SourceFlag {
// /** @brief V.24 Data Source */
enum E : uint8_t { enum E : uint8_t {
DIU = 0x00U, // DIU = 0x00U, //! DIU
QUANTAR = 0x02U // QUANTAR = 0x02U //! Quantar
}; };
} }
/// <summary> /** @brief */
///
/// </summary>
namespace ICWFlag { namespace ICWFlag {
// /** @brief */
enum E : uint8_t { enum E : uint8_t {
DIU = 0x00U, // DIU = 0x00U, //! DIU
QUANTAR = 0x1B // QUANTAR = 0x1B //! Quantar
}; };
} }
/** @} */
} // namespace dfsi } // namespace dfsi
} // namespace p25 } // namespace p25

@ -1,17 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Patrick McDonnell, W3AXL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) *
* */
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#if !defined(__DFSI_FRAMES_H__) #if !defined(__DFSI_FRAMES_H__)
#define __DFSI_FRAMES_H__ #define __DFSI_FRAMES_H__

@ -1,17 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) *
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) */
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/FullRateVoice.h" #include "frames/FullRateVoice.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -28,9 +23,8 @@ using namespace p25::dfsi::defines;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the FullRateVoice class. */
/// Initializes a instance of the FullRateVoice class.
/// </summary>
FullRateVoice::FullRateVoice() : FullRateVoice::FullRateVoice() :
imbeData(nullptr), imbeData(nullptr),
additionalData(nullptr), additionalData(nullptr),
@ -45,10 +39,8 @@ FullRateVoice::FullRateVoice() :
::memset(imbeData, 0x00U, IMBE_BUF_LEN); ::memset(imbeData, 0x00U, IMBE_BUF_LEN);
} }
/// <summary> /* Initializes a instance of the FullRateVoice class. */
/// Initializes a instance of the FullRateVoice class.
/// </summary>
/// <param name="data"></param>
FullRateVoice::FullRateVoice(uint8_t* data) : FullRateVoice::FullRateVoice(uint8_t* data) :
imbeData(nullptr), imbeData(nullptr),
additionalData(nullptr), additionalData(nullptr),
@ -62,9 +54,8 @@ FullRateVoice::FullRateVoice(uint8_t* data) :
decode(data); decode(data);
} }
/// <summary> /* Finalizes a instance of the FullRateVoice class. */
/// Finalizes a instance of the FullRateVoice class.
/// </summary>
FullRateVoice::~FullRateVoice() FullRateVoice::~FullRateVoice()
{ {
if (imbeData != nullptr) if (imbeData != nullptr)
@ -73,11 +64,8 @@ FullRateVoice::~FullRateVoice()
delete[] additionalData; delete[] additionalData;
} }
/// <summary> /* Decode a full rate voice frame. */
/// Decode a full rate voice frame.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
bool FullRateVoice::decode(const uint8_t* data) bool FullRateVoice::decode(const uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -117,10 +105,8 @@ bool FullRateVoice::decode(const uint8_t* data)
return true; return true;
} }
/// <summary> /* Encode a full rate voice frame. */
/// Encode a full rate voice frame.
/// </summary>
/// <param name="data"></param>
void FullRateVoice::encode(uint8_t* data) void FullRateVoice::encode(uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -150,10 +136,8 @@ void FullRateVoice::encode(uint8_t* data)
// Private Class Members // Private Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Helper indicating if the frame is voice 3 through 8. */
///
/// </summary>
/// <returns></returns>
bool FullRateVoice::isVoice3thru8() bool FullRateVoice::isVoice3thru8()
{ {
if ( (m_frameType == DFSIFrameType::LDU1_VOICE3) || (m_frameType == DFSIFrameType::LDU1_VOICE4) || (m_frameType == DFSIFrameType::LDU1_VOICE5) || if ( (m_frameType == DFSIFrameType::LDU1_VOICE3) || (m_frameType == DFSIFrameType::LDU1_VOICE4) || (m_frameType == DFSIFrameType::LDU1_VOICE5) ||
@ -164,10 +148,8 @@ bool FullRateVoice::isVoice3thru8()
} }
} }
/// <summary> /* Helper indicating if the frame is voice 12 through 17. */
///
/// </summary>
/// <returns></returns>
bool FullRateVoice::isVoice12thru17() bool FullRateVoice::isVoice12thru17()
{ {
if ( (m_frameType == DFSIFrameType::LDU2_VOICE12) || (m_frameType == DFSIFrameType::LDU2_VOICE13) || (m_frameType == DFSIFrameType::LDU2_VOICE14) || if ( (m_frameType == DFSIFrameType::LDU2_VOICE12) || (m_frameType == DFSIFrameType::LDU2_VOICE13) || (m_frameType == DFSIFrameType::LDU2_VOICE14) ||
@ -178,10 +160,8 @@ bool FullRateVoice::isVoice12thru17()
} }
} }
/// <summary> /* Helper indicating if the frame is voice 9 or 10. */
///
/// </summary>
/// <returns></returns>
bool FullRateVoice::isVoice9or10() bool FullRateVoice::isVoice9or10()
{ {
if ( (m_frameType == DFSIFrameType::LDU1_VOICE9) || (m_frameType == DFSIFrameType::LDU2_VOICE10) ) { if ( (m_frameType == DFSIFrameType::LDU1_VOICE9) || (m_frameType == DFSIFrameType::LDU2_VOICE10) ) {

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file FullRateVoice.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file FullRateVoice.cpp
* * @ingroup dfsi_frames
* @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
*
*/
#if !defined(__FULL_RATE_VOICE_H__) #if !defined(__FULL_RATE_VOICE_H__)
#define __FULL_RATE_VOICE_H__ #define __FULL_RATE_VOICE_H__
@ -27,187 +29,225 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // 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 { class HOST_SW_API FullRateVoice {
public: public:
static const uint8_t LENGTH = 18; static const uint8_t LENGTH = 18;
static const uint8_t ADDITIONAL_LENGTH = 4; static const uint8_t ADDITIONAL_LENGTH = 4;
static const uint8_t IMBE_BUF_LEN = 11; static const uint8_t IMBE_BUF_LEN = 11;
/// <summary>Initializes a copy instance of the FullRateVoice class.</summary> /**
* @brief Initializes a copy instance of the FullRateVoice class.
*/
FullRateVoice(); FullRateVoice();
/// <summary>Initializes a copy instance of the FullRateVoice class.</summary> /**
* @brief Initializes a copy instance of the FullRateVoice class.
* @param data Buffer to containing FullRateVoice to decode.
*/
FullRateVoice(uint8_t* data); FullRateVoice(uint8_t* data);
/// <summary>Finalizes a instance of the FullRateVoice class.</summary> /**
* @brief Finalizes a instance of the FullRateVoice class.
*/
~FullRateVoice(); ~FullRateVoice();
/// <summary>Decode a full rate voice frame.</summary> /**
* @brief Decode a full rate voice frame.
* @param[in] data Buffer to containing FullRateVoice to decode.
*/
bool decode(const uint8_t* data); bool decode(const uint8_t* data);
/// <summary>Encode a full rate voice frame.</summary> /**
* @brief Encode a full rate voice frame.
* @param[out] data Buffer to encode a FullRateVoice.
*/
void encode(uint8_t* data); void encode(uint8_t* data);
public: public:
uint8_t* imbeData; // ?? - this should probably be private with getters/setters uint8_t* imbeData; // ?? - this should probably be private with getters/setters
uint8_t* additionalData; // ?? - this should probably be private with getters/setters uint8_t* additionalData; // ?? - this should probably be private with getters/setters
/// <summary>Frame Type.</summary> /**
* @brief Frame Type.
*/
__PROPERTY(defines::DFSIFrameType::E, frameType, FrameType); __PROPERTY(defines::DFSIFrameType::E, frameType, FrameType);
/// <summary>Total errors detected in the frame.</summary> /**
* @brief Total errors detected in the frame.
*/
__PROPERTY(uint8_t, totalErrors, TotalErrors); __PROPERTY(uint8_t, totalErrors, TotalErrors);
/// <summary>Flag indicating the frame should be muted.</summary> /**
* @brief Flag indicating the frame should be muted.
*/
__PROPERTY(bool, muteFrame, MuteFrame); __PROPERTY(bool, muteFrame, MuteFrame);
/// <summary>Flag indicating the frame was lost.</summary> /**
* @brief Flag indicating the frame was lost.
*/
__PROPERTY(bool, lostFrame, LostFrame); __PROPERTY(bool, lostFrame, LostFrame);
/// <summary>Superframe Counter.</summary> /**
* @brief Superframe Counter.
*/
__PROPERTY(uint8_t, superframeCnt, SuperframeCnt); __PROPERTY(uint8_t, superframeCnt, SuperframeCnt);
/// <summary>Busy Status.</summary> /**
* @brief Busy Status.
*/
__PROPERTY(uint8_t, busy, Busy); __PROPERTY(uint8_t, busy, Busy);
private: private:
/// <summary></summary> /**
* @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(); bool isVoice3thru8();
/// <summary></summary> /**
* @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(); bool isVoice12thru17();
/// <summary></summary> /**
* @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(); bool isVoice9or10();
}; };
} // namespace dfsi } // namespace dfsi

@ -1,18 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Patrick McDonnell, W3AXL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) *
* */
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/MotFullRateVoice.h" #include "frames/MotFullRateVoice.h"
#include "common/p25/P25Defines.h" #include "common/p25/P25Defines.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
@ -31,9 +26,8 @@ using namespace p25::dfsi::defines;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the MotFullRateVoice class. */
/// Initializes a instance of the MotFullRateVoice class.
/// </summary>
MotFullRateVoice::MotFullRateVoice() : MotFullRateVoice::MotFullRateVoice() :
imbeData(nullptr), imbeData(nullptr),
additionalData(nullptr), additionalData(nullptr),
@ -44,10 +38,8 @@ MotFullRateVoice::MotFullRateVoice() :
::memset(imbeData, 0x00U, RAW_IMBE_LENGTH_BYTES); ::memset(imbeData, 0x00U, RAW_IMBE_LENGTH_BYTES);
} }
/// <summary> /* Initializes a instance of the MotFullRateVoice class. */
/// Initializes a instance of the MotFullRateVoice class.
/// </summary>
/// <param name="data"></param>
MotFullRateVoice::MotFullRateVoice(uint8_t* data) MotFullRateVoice::MotFullRateVoice(uint8_t* data)
{ {
// set our pointers to null since it doesn't get initialized otherwise // set our pointers to null since it doesn't get initialized otherwise
@ -57,9 +49,8 @@ MotFullRateVoice::MotFullRateVoice(uint8_t* data)
decode(data); decode(data);
} }
/// <summary> /* Finalizes a instance of the MotFullRateVoice class. */
/// Finalizes a instance of the MotFullRateVoice class.
/// </summary>
MotFullRateVoice::~MotFullRateVoice() MotFullRateVoice::~MotFullRateVoice()
{ {
if (imbeData != nullptr) if (imbeData != nullptr)
@ -68,10 +59,8 @@ MotFullRateVoice::~MotFullRateVoice()
delete[] additionalData; delete[] additionalData;
} }
/// <summary> /* */
///
/// </summary>
/// <returns></returns>
uint32_t MotFullRateVoice::size() uint32_t MotFullRateVoice::size()
{ {
uint32_t length = 0; uint32_t length = 0;
@ -91,12 +80,8 @@ uint32_t MotFullRateVoice::size()
return length; return length;
} }
/// <summary> /* Decode a full rate voice frame. */
/// Decode a full rate voice frame.
/// </summary>
/// <param name="data"></param>
/// <param name="shortened"></param>
/// <returns></returns>
bool MotFullRateVoice::decode(const uint8_t* data, bool shortened) bool MotFullRateVoice::decode(const uint8_t* data, bool shortened)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -139,11 +124,8 @@ bool MotFullRateVoice::decode(const uint8_t* data, bool shortened)
return true; return true;
} }
/// <summary> /* Encode a full rate voice frame. */
/// Encode a full rate voice frame.
/// </summary>
/// <param name="data"></param>
/// <param name="shortened"></param>
void MotFullRateVoice::encode(uint8_t* data, bool shortened) void MotFullRateVoice::encode(uint8_t* data, bool shortened)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -185,10 +167,8 @@ void MotFullRateVoice::encode(uint8_t* data, bool shortened)
// Private Class Members // Private Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Helper indicating if the frame is voice 1, 2, 10 or 11. */
///
/// </summary>
/// <returns></returns>
bool MotFullRateVoice::isVoice1or2or10or11() bool MotFullRateVoice::isVoice1or2or10or11()
{ {
if ( (m_frameType == DFSIFrameType::LDU1_VOICE1) || (m_frameType == DFSIFrameType::LDU1_VOICE2) || if ( (m_frameType == DFSIFrameType::LDU1_VOICE1) || (m_frameType == DFSIFrameType::LDU1_VOICE2) ||
@ -199,10 +179,8 @@ bool MotFullRateVoice::isVoice1or2or10or11()
} }
} }
/// <summary> /* Helper indicating if the frame is voice 2 or 11. */
///
/// </summary>
/// <returns></returns>
bool MotFullRateVoice::isVoice2or11() bool MotFullRateVoice::isVoice2or11()
{ {
if ( (m_frameType == DFSIFrameType::LDU1_VOICE2) || (m_frameType == DFSIFrameType::LDU2_VOICE11) ) { if ( (m_frameType == DFSIFrameType::LDU1_VOICE2) || (m_frameType == DFSIFrameType::LDU2_VOICE11) ) {
@ -212,10 +190,8 @@ bool MotFullRateVoice::isVoice2or11()
} }
} }
/// <summary> /* Helper indicating if the frame is voice 9 or 18. */
///
/// </summary>
/// <returns></returns>
bool MotFullRateVoice::isVoice9or18() bool MotFullRateVoice::isVoice9or18()
{ {
if ( (m_frameType == DFSIFrameType::LDU1_VOICE9) || (m_frameType == DFSIFrameType::LDU2_VOICE18) ) { if ( (m_frameType == DFSIFrameType::LDU1_VOICE9) || (m_frameType == DFSIFrameType::LDU2_VOICE18) ) {

@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file MotFullRateVoice.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file MotFullRateVoice.cpp
* * @ingroup dfsi_frames
* @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
*
*/
#if !defined(__MOT_FULL_RATE_VOICE_H__) #if !defined(__MOT_FULL_RATE_VOICE_H__)
#define __MOT_FULL_RATE_VOICE_H__ #define __MOT_FULL_RATE_VOICE_H__
@ -28,58 +30,92 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // 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 { class HOST_SW_API MotFullRateVoice {
public: public:
static const uint8_t LENGTH = 17; static const uint8_t LENGTH = 17;
static const uint8_t SHORTENED_LENGTH = 13; static const uint8_t SHORTENED_LENGTH = 13;
static const uint8_t ADDITIONAL_LENGTH = 4; static const uint8_t ADDITIONAL_LENGTH = 4;
/// <summary>Initializes a copy instance of the MotFullRateVoice class.</summary> /**
* @brief Initializes a copy instance of the MotFullRateVoice class.
*/
MotFullRateVoice(); MotFullRateVoice();
/// <summary>Initializes a copy instance of the MotFullRateVoice class.</summary> /**
* @brief Initializes a copy instance of the MotFullRateVoice class.
* @param data Buffer to containing MotFullRateVoice to decode.
*/
MotFullRateVoice(uint8_t* data); MotFullRateVoice(uint8_t* data);
/// <summary>Finalizes a instance of the MotFullRateVoice class.</summary> /**
* @brief Finalizes a instance of the MotFullRateVoice class.
*/
~MotFullRateVoice(); ~MotFullRateVoice();
/// <summary></summary> /**
* @brief
*/
uint32_t size(); uint32_t size();
/// <summary>Decode a full rate voice frame.</summary> /**
* @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); bool decode(const uint8_t* data, bool shortened = false);
/// <summary>Encode a full rate voice frame.</summary> /**
* @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); void encode(uint8_t* data, bool shortened = false);
public: public:
uint8_t* imbeData; // ?? - this should probably be private with getters/setters uint8_t* imbeData; // ?? - this should probably be private with getters/setters
uint8_t* additionalData; // ?? - this should probably be private with getters/setters uint8_t* additionalData; // ?? - this should probably be private with getters/setters
/// <summary>Frame Type.</summary> /**
* @brief Frame Type.
*/
__PROPERTY(defines::DFSIFrameType::E, frameType, FrameType); __PROPERTY(defines::DFSIFrameType::E, frameType, FrameType);
/// <summary></summary> /**
* @brief V.24 Data Source.
*/
__PROPERTY(SourceFlag::E, source, Source); __PROPERTY(SourceFlag::E, source, Source);
private: private:
/// <summary></summary> /**
* @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(); bool isVoice1or2or10or11();
/// <summary></summary> /**
* @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(); bool isVoice2or11();
/// <summary></summary> /**
* @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(); bool isVoice9or18();
}; };
} // namespace dfsi } // namespace dfsi

@ -1,18 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Patrick McDonnell, W3AXL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) *
* */
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/MotStartOfStream.h" #include "frames/MotStartOfStream.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -29,9 +24,8 @@ using namespace p25::dfsi::defines;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the MotStartOfStream class. */
/// Initializes a instance of the MotStartOfStream class.
/// </summary>
MotStartOfStream::MotStartOfStream() : MotStartOfStream::MotStartOfStream() :
m_marker(FIXED_MARKER), m_marker(FIXED_MARKER),
m_rt(RTFlag::DISABLED), m_rt(RTFlag::DISABLED),
@ -41,10 +35,8 @@ MotStartOfStream::MotStartOfStream() :
/* stub */ /* stub */
} }
/// <summary> /* Initializes a instance of the MotStartOfStream class. */
/// Initializes a instance of the MotStartOfStream class.
/// </summary>
/// <param name="data"></param>
MotStartOfStream::MotStartOfStream(uint8_t* data) : MotStartOfStream::MotStartOfStream(uint8_t* data) :
m_marker(FIXED_MARKER), m_marker(FIXED_MARKER),
m_rt(RTFlag::DISABLED), m_rt(RTFlag::DISABLED),
@ -54,11 +46,8 @@ MotStartOfStream::MotStartOfStream(uint8_t* data) :
decode(data); decode(data);
} }
/// <summary> /* Decode a start of stream frame. */
/// Decode a start of stream frame.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
bool MotStartOfStream::decode(const uint8_t* data) bool MotStartOfStream::decode(const uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -70,10 +59,8 @@ bool MotStartOfStream::decode(const uint8_t* data)
return true; return true;
} }
/// <summary> /* Encode a start of stream frame. */
/// Encode a start of stream frame.
/// </summary>
/// <param name="data"></param>
void MotStartOfStream::encode(uint8_t* data) void MotStartOfStream::encode(uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);

@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file MotStartVoiceFrame.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file MotStartVoiceFrame.cpp
* * @ingroup dfsi_frames
* @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
*
*/
#if !defined(__MOT_START_OF_STREAM_H__) #if !defined(__MOT_START_OF_STREAM_H__)
#define __MOT_START_OF_STREAM_H__ #define __MOT_START_OF_STREAM_H__
@ -27,42 +29,65 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // 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 { class HOST_SW_API MotStartOfStream {
public: public:
static const uint8_t LENGTH = 10; static const uint8_t LENGTH = 10;
static const uint8_t FIXED_MARKER = 0x02; static const uint8_t FIXED_MARKER = 0x02;
/// <summary>Initializes a copy instance of the MotStartOfStream class.</summary> /**
* @brief Initializes a copy instance of the MotStartOfStream class.
*/
MotStartOfStream(); MotStartOfStream();
/// <summary>Initializes a copy instance of the MotStartOfStream class.</summary> /**
* @brief Initializes a copy instance of the MotStartOfStream class.
* @param data Buffer to containing MotStartOfStream to decode.
*/
MotStartOfStream(uint8_t* data); MotStartOfStream(uint8_t* data);
/// <summary>Decode a start of stream frame.</summary> /**
* @brief Decode a start of stream frame.
* @param[in] data Buffer to containing MotStartOfStream to decode.
*/
bool decode(const uint8_t* data); bool decode(const uint8_t* data);
/// <summary>Encode a start of stream frame.</summary> /**
* @brief Encode a start of stream frame.
* @param[out] data Buffer to encode a MotStartOfStream.
*/
void encode(uint8_t* data); void encode(uint8_t* data);
public: public:
/// <summary></summary> /**
* @brief
*/
__PROPERTY(uint8_t, marker, Marker); __PROPERTY(uint8_t, marker, Marker);
/// <summary></summary> /**
* @brief RT/RT Flag.
*/
__PROPERTY(RTFlag::E, rt, RT); __PROPERTY(RTFlag::E, rt, RT);
/// <summary></summary> /**
* @brief Start/Stop.
*/
__PROPERTY(StartStopFlag::E, startStop, StartStop); __PROPERTY(StartStopFlag::E, startStop, StartStop);
/// <summary></summary> /**
* @brief Stream Type.
*/
__PROPERTY(StreamTypeFlag::E, streamType, StreamType); __PROPERTY(StreamTypeFlag::E, streamType, StreamType);
}; };
} // namespace dfsi } // namespace dfsi

@ -1,18 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Patrick McDonnell, W3AXL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) *
* */
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/MotStartVoiceFrame.h" #include "frames/MotStartVoiceFrame.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -29,9 +24,8 @@ using namespace p25::dfsi::defines;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the MotStartVoiceFrame class. */
/// Initializes a instance of the MotStartVoiceFrame class.
/// </summary>
MotStartVoiceFrame::MotStartVoiceFrame() : MotStartVoiceFrame::MotStartVoiceFrame() :
startOfStream(nullptr), startOfStream(nullptr),
fullRateVoice(nullptr), fullRateVoice(nullptr),
@ -45,10 +39,8 @@ MotStartVoiceFrame::MotStartVoiceFrame() :
fullRateVoice = new MotFullRateVoice(); fullRateVoice = new MotFullRateVoice();
} }
/// <summary> /* Initializes a instance of the MotStartVoiceFrame class. */
/// Initializes a instance of the MotStartVoiceFrame class.
/// </summary>
/// <param name="data"></param>
MotStartVoiceFrame::MotStartVoiceFrame(uint8_t* data) : MotStartVoiceFrame::MotStartVoiceFrame(uint8_t* data) :
startOfStream(nullptr), startOfStream(nullptr),
fullRateVoice(nullptr), fullRateVoice(nullptr),
@ -61,9 +53,8 @@ MotStartVoiceFrame::MotStartVoiceFrame(uint8_t* data) :
decode(data); decode(data);
} }
/// <summary> /* Finalizes a instance of the MotStartVoiceFrame class. */
/// Finalizes a instance of the MotStartVoiceFrame class.
/// </summary>
MotStartVoiceFrame::~MotStartVoiceFrame() MotStartVoiceFrame::~MotStartVoiceFrame()
{ {
if (startOfStream != nullptr) if (startOfStream != nullptr)
@ -72,11 +63,8 @@ MotStartVoiceFrame::~MotStartVoiceFrame()
delete fullRateVoice; delete fullRateVoice;
} }
/// <summary> /* Decode a start voice frame. */
/// Decode a start voice frame.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
bool MotStartVoiceFrame::decode(const uint8_t* data) bool MotStartVoiceFrame::decode(const uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -115,10 +103,8 @@ bool MotStartVoiceFrame::decode(const uint8_t* data)
return true; return true;
} }
/// <summary> /* Encode a start voice frame. */
/// Encode a start voice frame.
/// </summary>
/// <param name="data"></param>
void MotStartVoiceFrame::encode(uint8_t* data) void MotStartVoiceFrame::encode(uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);

@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file MotStartVoiceFrame.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file MotStartVoiceFrame.cpp
* * @ingroup dfsi_frames
* @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
*
*/
#if !defined(__MOT_START_VOICE_FRAME_H__) #if !defined(__MOT_START_VOICE_FRAME_H__)
#define __MOT_START_VOICE_FRAME_H__ #define __MOT_START_VOICE_FRAME_H__
@ -29,54 +31,81 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // 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 { class HOST_SW_API MotStartVoiceFrame {
public: public:
static const uint8_t LENGTH = 22; static const uint8_t LENGTH = 22;
/// <summary>Initializes a copy instance of the MotStartVoiceFrame class.</summary> /**
* @brief Initializes a copy instance of the MotStartVoiceFrame class.
*/
MotStartVoiceFrame(); MotStartVoiceFrame();
/// <summary>Initializes a copy instance of the MotStartVoiceFrame class.</summary> /**
* @brief Initializes a copy instance of the MotStartVoiceFrame class.
* @param data Buffer to containing MotStartVoiceFrame to decode.
*/
MotStartVoiceFrame(uint8_t* data); MotStartVoiceFrame(uint8_t* data);
/// <summary>Finalizes a instance of the MotStartVoiceFrame class.</summary> /**
* @brief Finalizes a instance of the MotStartVoiceFrame class.
*/
~MotStartVoiceFrame(); ~MotStartVoiceFrame();
/// <summary>Decode a start voice frame.</summary> /**
* @brief Decode a start voice frame.
* @param[in] data Buffer to containing MotStartVoiceFrame to decode.
*/
bool decode(const uint8_t* data); bool decode(const uint8_t* data);
/// <summary>Encode a start voice frame.</summary> /**
* @brief Encode a start voice frame.
* @param[out] data Buffer to encode a MotStartVoiceFrame.
*/
void encode(uint8_t* data); void encode(uint8_t* data);
public: public:
MotStartOfStream* startOfStream; // ?? - this should probably be private with getters/setters MotStartOfStream* startOfStream; // ?? - this should probably be private with getters/setters
MotFullRateVoice* fullRateVoice; // ?? - this should probably be private with getters/setters MotFullRateVoice* fullRateVoice; // ?? - this should probably be private with getters/setters
/// <summary></summary> /**
* @brief
*/
__PROPERTY(ICWFlag::E, icw, ICW); __PROPERTY(ICWFlag::E, icw, ICW);
/// <summary></summary> /**
* @brief RSSI Value.
*/
__PROPERTY(uint8_t, rssi, RSSI); __PROPERTY(uint8_t, rssi, RSSI);
/// <summary></summary> /**
* @brief Flag indicating whether or not the RSSI field is valid.
*/
__PROPERTY(RssiValidityFlag::E, rssiValidity, RSSIValidity); __PROPERTY(RssiValidityFlag::E, rssiValidity, RSSIValidity);
/// <summary></summary> /**
* @brief
*/
__PROPERTY(uint8_t, nRssi, NRSSI); __PROPERTY(uint8_t, nRssi, NRSSI);
/// <summary></summary> /**
* @brief
*/
__PROPERTY(uint8_t, adjMM, AdjMM); __PROPERTY(uint8_t, adjMM, AdjMM);
}; };
} // namespace dfsi } // namespace dfsi

@ -1,18 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Patrick McDonnell, W3AXL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) *
* */
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/MotVoiceHeader1.h" #include "frames/MotVoiceHeader1.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -29,9 +24,8 @@ using namespace p25::dfsi::defines;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the MotVoiceHeader1 class. */
/// Initializes a instance of the MotVoiceHeader1 class.
/// </summary>
MotVoiceHeader1::MotVoiceHeader1() : MotVoiceHeader1::MotVoiceHeader1() :
header(nullptr), header(nullptr),
startOfStream(nullptr), startOfStream(nullptr),
@ -46,10 +40,8 @@ MotVoiceHeader1::MotVoiceHeader1() :
::memset(header, 0x00U, HCW_LENGTH); ::memset(header, 0x00U, HCW_LENGTH);
} }
/// <summary> /* Initializes a instance of the MotVoiceHeader1 class. */
/// Initializes a instance of the MotVoiceHeader1 class.
/// </summary>
/// <param name="data"></param>
MotVoiceHeader1::MotVoiceHeader1(uint8_t* data) : MotVoiceHeader1::MotVoiceHeader1(uint8_t* data) :
header(nullptr), header(nullptr),
startOfStream(nullptr), startOfStream(nullptr),
@ -61,9 +53,8 @@ MotVoiceHeader1::MotVoiceHeader1(uint8_t* data) :
decode(data); decode(data);
} }
/// <summary> /* Finalizes a instance of the MotVoiceHeader1 class. */
/// Finalizes a instance of the MotVoiceHeader1 class.
/// </summary>
MotVoiceHeader1::~MotVoiceHeader1() MotVoiceHeader1::~MotVoiceHeader1()
{ {
if (startOfStream != nullptr) if (startOfStream != nullptr)
@ -72,11 +63,8 @@ MotVoiceHeader1::~MotVoiceHeader1()
delete[] header; delete[] header;
} }
/// <summary> /* Decode a voice header 1 frame. */
/// Decode a voice header 1 frame.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
bool MotVoiceHeader1::decode(const uint8_t* data) bool MotVoiceHeader1::decode(const uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -109,10 +97,8 @@ bool MotVoiceHeader1::decode(const uint8_t* data)
return true; return true;
} }
/// <summary> /* Encode a voice header 1 frame. */
/// Encode a voice header 1 frame.
/// </summary>
/// <param name="data"></param>
void MotVoiceHeader1::encode(uint8_t* data) void MotVoiceHeader1::encode(uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);

@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file MotVoiceHeader1.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file MotVoiceHeader1.cpp
* * @ingroup dfsi_frames
* @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
*
*/
#if !defined(__MOT_VOICE_HEADER_1_H__) #if !defined(__MOT_VOICE_HEADER_1_H__)
#define __MOT_VOICE_HEADER_1_H__ #define __MOT_VOICE_HEADER_1_H__
@ -28,57 +30,82 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // 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 { class HOST_SW_API MotVoiceHeader1 {
public: public:
static const uint8_t LENGTH = 30; static const uint8_t LENGTH = 30;
static const uint8_t HCW_LENGTH = 21; static const uint8_t HCW_LENGTH = 21;
/// <summary>Initializes a copy instance of the MotVoiceHeader1 class.</summary> /**
* @brief Initializes a copy instance of the MotVoiceHeader1 class.
*/
MotVoiceHeader1(); MotVoiceHeader1();
/// <summary>Initializes a copy instance of the MotVoiceHeader1 class.</summary> /**
* @brief Initializes a copy instance of the MotVoiceHeader1 class.
* @param data Buffer to containing MotVoiceHeader1 to decode.
*/
MotVoiceHeader1(uint8_t* data); MotVoiceHeader1(uint8_t* data);
/// <summary>Finalizes a instance of the MotVoiceHeader1 class.</summary> /**
* @brief Finalizes a instance of the MotVoiceHeader1 class.
*/
~MotVoiceHeader1(); ~MotVoiceHeader1();
/// <summary>Decode a voice header 1 frame.</summary> /**
* @brief Decode a voice header 1 frame.
* @param[in] data Buffer to containing MotVoiceHeader1 to decode.
*/
bool decode(const uint8_t* data); bool decode(const uint8_t* data);
/// <summary>Encode a voice header 1 frame.</summary> /**
* @brief Encode a voice header 1 frame.
* @param[out] data Buffer to encode a MotVoiceHeader1.
*/
void encode(uint8_t* data); void encode(uint8_t* data);
public: public:
uint8_t* header; // ?? - this should probably be private with getters/setters uint8_t* header; // ?? - this should probably be private with getters/setters
MotStartOfStream* startOfStream; // ?? - this should probably be private with getters/setters MotStartOfStream* startOfStream; // ?? - this should probably be private with getters/setters
/// <summary></summary> /**
* @brief
*/
__PROPERTY(ICWFlag::E, icw, ICW); __PROPERTY(ICWFlag::E, icw, ICW);
/// <summary></summary> /**
* @brief RSSI Value.
*/
__PROPERTY(uint8_t, rssi, RSSI); __PROPERTY(uint8_t, rssi, RSSI);
/// <summary></summary> /**
* @brief Flag indicating whether or not the RSSI field is valid.
*/
__PROPERTY(RssiValidityFlag::E, rssiValidity, RSSIValidity); __PROPERTY(RssiValidityFlag::E, rssiValidity, RSSIValidity);
/// <summary></summary> /**
* @brief
*/
__PROPERTY(uint8_t, nRssi, NRSSI); __PROPERTY(uint8_t, nRssi, NRSSI);
}; };
} // namespace dfsi } // namespace dfsi

@ -1,18 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Patrick McDonnell, W3AXL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) *
* */
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/MotVoiceHeader2.h" #include "frames/MotVoiceHeader2.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -29,9 +24,8 @@ using namespace p25::dfsi::defines;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the MotVoiceHeader2 class. */
/// Initializes a instance of the MotVoiceHeader2 class.
/// </summary>
MotVoiceHeader2::MotVoiceHeader2() : MotVoiceHeader2::MotVoiceHeader2() :
header(nullptr), header(nullptr),
m_source(SourceFlag::QUANTAR) m_source(SourceFlag::QUANTAR)
@ -40,10 +34,8 @@ MotVoiceHeader2::MotVoiceHeader2() :
::memset(header, 0x00U, HCW_LENGTH); ::memset(header, 0x00U, HCW_LENGTH);
} }
/// <summary> /* Initializes a instance of the MotVoiceHeader2 class. */
/// Initializes a instance of the MotVoiceHeader2 class.
/// </summary>
/// <param name="data"></param>
MotVoiceHeader2::MotVoiceHeader2(uint8_t* data) : MotVoiceHeader2::MotVoiceHeader2(uint8_t* data) :
header(nullptr), header(nullptr),
m_source(SourceFlag::QUANTAR) m_source(SourceFlag::QUANTAR)
@ -51,20 +43,16 @@ MotVoiceHeader2::MotVoiceHeader2(uint8_t* data) :
decode(data); decode(data);
} }
/// <summary> /* Finalizes a instance of the MotVoiceHeader2 class. */
/// Finalizes a instance of the MotVoiceHeader2 class.
/// </summary>
MotVoiceHeader2::~MotVoiceHeader2() MotVoiceHeader2::~MotVoiceHeader2()
{ {
if (header != nullptr) if (header != nullptr)
delete[] header; delete[] header;
} }
/// <summary> /* Decode a voice header 2 frame. */
/// Decode a voice header 2 frame.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
bool MotVoiceHeader2::decode(const uint8_t* data) bool MotVoiceHeader2::decode(const uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -82,10 +70,8 @@ bool MotVoiceHeader2::decode(const uint8_t* data)
return true; return true;
} }
/// <summary> /* Encode a voice header 2 frame. */
/// Encode a voice header 2 frame.
/// </summary>
/// <param name="data"></param>
void MotVoiceHeader2::encode(uint8_t* data) void MotVoiceHeader2::encode(uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);

@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file MotVoiceHeader2.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file MotVoiceHeader2.cpp
* * @ingroup dfsi_frames
* @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
*
*/
#if !defined(__MOT_VOICE_HEADER_2_H__) #if !defined(__MOT_VOICE_HEADER_2_H__)
#define __MOT_VOICE_HEADER_2_H__ #define __MOT_VOICE_HEADER_2_H__
@ -28,46 +30,65 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // 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 { class HOST_SW_API MotVoiceHeader2 {
public: public:
static const uint8_t LENGTH = 22; static const uint8_t LENGTH = 22;
static const uint8_t HCW_LENGTH = 20; static const uint8_t HCW_LENGTH = 20;
/// <summary>Initializes a copy instance of the MotVoiceHeader2 class.</summary> /**
* @brief Initializes a copy instance of the MotVoiceHeader2 class.
*/
MotVoiceHeader2(); MotVoiceHeader2();
/// <summary>Initializes a copy instance of the MotVoiceHeader2 class.</summary> /**
* @brief Initializes a copy instance of the MotVoiceHeader2 class.
* @param data Buffer to containing MotVoiceHeader2 to decode.
*/
MotVoiceHeader2(uint8_t* data); MotVoiceHeader2(uint8_t* data);
/// <summary>Finalizes a instance of the MotVoiceHeader2 class.</summary> /**
* @brief Finalizes a instance of the MotVoiceHeader2 class.
*/
~MotVoiceHeader2(); ~MotVoiceHeader2();
/// <summary>Decode a voice header 2 frame.</summary> /**
* @brief Decode a voice header 2 frame.
* @param[in] data Buffer to containing MotVoiceHeader2 to decode.
*/
bool decode(const uint8_t* data); bool decode(const uint8_t* data);
/// <summary>Encode a voice header 2 frame.</summary> /**
* @brief Encode a voice header 2 frame.
* @param[out] data Buffer to encode a MotVoiceHeader2.
*/
void encode(uint8_t* data); void encode(uint8_t* data);
public: public:
uint8_t* header; // ?? - this should probably be a private with getters/setters uint8_t* header; // ?? - this should probably be a private with getters/setters
/// <summary></summary> /**
* @brief V.24 Data Source.
*/
__PROPERTY(SourceFlag::E, source, Source); __PROPERTY(SourceFlag::E, source, Source);
}; };
} // namespace dfsi } // namespace dfsi

@ -1,17 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) *
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) */
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/StartOfStream.h" #include "frames/StartOfStream.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -27,9 +22,8 @@ using namespace p25::dfsi;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the StartOfStream class. */
/// Initializes a instance of the StartOfStream class.
/// </summary>
StartOfStream::StartOfStream() : StartOfStream::StartOfStream() :
m_nid(0U), m_nid(0U),
m_errorCount(0U) m_errorCount(0U)
@ -37,10 +31,8 @@ StartOfStream::StartOfStream() :
/* stub */ /* stub */
} }
/// <summary> /* Initializes a instance of the StartOfStream class. */
/// Initializes a instance of the StartOfStream class.
/// </summary>
/// <param name="data"></param>
StartOfStream::StartOfStream(uint8_t* data) : StartOfStream::StartOfStream(uint8_t* data) :
m_nid(0U), m_nid(0U),
m_errorCount(0U) m_errorCount(0U)
@ -48,11 +40,8 @@ StartOfStream::StartOfStream(uint8_t* data) :
decode(data); decode(data);
} }
/// <summary> /* Decode a start of stream frame. */
/// Decode a start of stream frame.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
bool StartOfStream::decode(const uint8_t* data) bool StartOfStream::decode(const uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -63,10 +52,8 @@ bool StartOfStream::decode(const uint8_t* data)
return true; return true;
} }
/// <summary> /* Encode a start of stream frame. */
/// Encode a start of stream frame.
/// </summary>
/// <param name="data"></param>
void StartOfStream::encode(uint8_t* data) void StartOfStream::encode(uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file StartOfStream.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file StartOfStream.cpp
* * @ingroup dfsi_frames
* @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
*
*/
#if !defined(__START_OF_STREAM_H__) #if !defined(__START_OF_STREAM_H__)
#define __START_OF_STREAM_H__ #define __START_OF_STREAM_H__
@ -26,33 +28,52 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // 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 { class HOST_SW_API StartOfStream {
public: public:
static const uint8_t LENGTH = 4; static const uint8_t LENGTH = 4;
/// <summary>Initializes a copy instance of the StartOfStream class.</summary> /**
* @brief Initializes a copy instance of the StartOfStream class.
*/
StartOfStream(); StartOfStream();
/// <summary>Initializes a copy instance of the StartOfStream class.</summary> /**
* @brief Initializes a copy instance of the StartOfStream class.
* @param data Buffer to containing StartOfStream to decode.
*/
StartOfStream(uint8_t* data); StartOfStream(uint8_t* data);
/// <summary>Decode a start of stream frame.</summary> /**
* @brief Decode a start of stream frame.
* @param[in] data Buffer to containing StartOfStream to decode.
*/
bool decode(const uint8_t* data); bool decode(const uint8_t* data);
/// <summary>Encode a start of stream frame.</summary> /**
* @brief Encode a start of stream frame.
* @param[out] data Buffer to encode a StartOfStream.
*/
void encode(uint8_t* data); void encode(uint8_t* data);
public: public:
/// <summary>Network Identifier.</summary> /**
* @brief Network Identifier.
*/
__PROPERTY(uint16_t, nid, NID); __PROPERTY(uint16_t, nid, NID);
/// <summary>Error count.</summary> /**
* @brief Error count.
*/
__PROPERTY(uint8_t, errorCount, ErrorCount); __PROPERTY(uint8_t, errorCount, ErrorCount);
}; };
} // namespace dfsi } // namespace dfsi

@ -1,17 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) *
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) */
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/fsc/FSCACK.h" #include "frames/fsc/FSCACK.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -27,9 +22,8 @@ using namespace p25::dfsi::fsc;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the FSCACK class. */
/// Initializes a instance of the FSCACK class.
/// </summary>
FSCACK::FSCACK() : FSCMessage(), FSCACK::FSCACK() : FSCMessage(),
m_ackMessageId(FSCMessageType::FSC_INVALID), m_ackMessageId(FSCMessageType::FSC_INVALID),
m_ackVersion(1U), m_ackVersion(1U),
@ -40,10 +34,8 @@ FSCACK::FSCACK() : FSCMessage(),
m_messageId = FSCMessageType::FSC_ACK; m_messageId = FSCMessageType::FSC_ACK;
} }
/// <summary> /* Initializes a instance of the FSCACK class. */
/// Initializes a instance of the FSCACK class.
/// </summary>
/// <param name="data"></param>
FSCACK::FSCACK(uint8_t* data) : FSCMessage(data), FSCACK::FSCACK(uint8_t* data) : FSCMessage(data),
m_ackMessageId(FSCMessageType::FSC_INVALID), m_ackMessageId(FSCMessageType::FSC_INVALID),
m_ackVersion(1U), m_ackVersion(1U),
@ -54,11 +46,8 @@ FSCACK::FSCACK(uint8_t* data) : FSCMessage(data),
decode(data); decode(data);
} }
/// <summary> /* Decode a FSC ACK frame. */
/// Decode a FSC ACK frame.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
bool FSCACK::decode(const uint8_t* data) bool FSCACK::decode(const uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -86,10 +75,8 @@ bool FSCACK::decode(const uint8_t* data)
return true; return true;
} }
/// <summary> /* Encode a FSC ACK frame. */
/// Encode a FSC ACK frame.
/// </summary>
/// <param name="data"></param>
void FSCACK::encode(uint8_t* data) void FSCACK::encode(uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file FSCACK.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_fsc_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file FSCACK.cpp
* * @ingroup dfsi_fsc_frames
* @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
*
*/
#if !defined(__FSC_ACK_H__) #if !defined(__FSC_ACK_H__)
#define __FSC_ACK_H__ #define __FSC_ACK_H__
@ -29,35 +31,59 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
//
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/**
* @brief Implements the FSC Acknowledgement Message.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCACK : public FSCMessage { class HOST_SW_API FSCACK : public FSCMessage {
public: public:
static const uint8_t LENGTH = 6; static const uint8_t LENGTH = 6;
/// <summary>Initializes a copy instance of the FSCACK class.</summary> /**
* @brief Initializes a copy instance of the FSCACK class.
*/
FSCACK(); FSCACK();
/// <summary>Initializes a copy instance of the FSCACK class.</summary> /**
* @brief Initializes a copy instance of the FSCACK class.
* @param data Buffer to containing FSCACK to decode.
*/
FSCACK(uint8_t* data); FSCACK(uint8_t* data);
/// <summary>Decode a FSC ACK frame.</summary> /**
* @brief Decode a FSC ACK frame.
* @param[in] data Buffer to containing FSCACK to decode.
*/
bool decode(const uint8_t* data) override; bool decode(const uint8_t* data) override;
/// <summary>Encode a FSC ACK frame.</summary> /**
* @brief Encode a FSC ACK frame.
* @param[out] data Buffer to encode a FSCACK.
*/
void encode(uint8_t* data) override; void encode(uint8_t* data) override;
public: public:
uint8_t* responseData; // ?? - this should probably be private with getters/setters uint8_t* responseData; // ?? - this should probably be private with getters/setters
/// <summary>Acknowledged Message ID.</summary> /**
* @brief Acknowledged Message ID.
*/
__PROPERTY(FSCMessageType::E, ackMessageId, AckMessageId); __PROPERTY(FSCMessageType::E, ackMessageId, AckMessageId);
/// <summary>Acknowledged Message Version.</summary> /**
* @brief Acknowledged Message Version.
*/
__READONLY_PROPERTY(uint8_t, ackVersion, AckVersion); __READONLY_PROPERTY(uint8_t, ackVersion, AckVersion);
/// <summary></summary> /**
* @brief
*/
__READONLY_PROPERTY(uint8_t, ackCorrelationTag, AckCorrelationTag); __READONLY_PROPERTY(uint8_t, ackCorrelationTag, AckCorrelationTag);
/// <summary>Response code.</summary> /**
* @brief Response code.
*/
__PROPERTY(FSCAckResponseCode::E, responseCode, ResponseCode); __PROPERTY(FSCAckResponseCode::E, responseCode, ResponseCode);
/// <summary>Response Data Length.</summary> /**
* @brief Response Data Length.
*/
__PROPERTY(uint8_t, respLength, ResponseLength); __PROPERTY(uint8_t, respLength, ResponseLength);
}; };
} // namespace fsc } // namespace fsc

@ -1,17 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) *
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) */
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/fsc/FSCConnect.h" #include "frames/fsc/FSCConnect.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -27,9 +22,8 @@ using namespace p25::dfsi::fsc;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the FSCConnect class. */
/// Initializes a instance of the FSCConnect class.
/// </summary>
FSCConnect::FSCConnect() : FSCMessage(), FSCConnect::FSCConnect() : FSCMessage(),
m_vcBasePort(0U), m_vcBasePort(0U),
m_vcSSRC(0U), m_vcSSRC(0U),
@ -39,10 +33,8 @@ FSCConnect::FSCConnect() : FSCMessage(),
m_messageId = FSCMessageType::FSC_CONNECT; m_messageId = FSCMessageType::FSC_CONNECT;
} }
/// <summary> /* Initializes a instance of the FSCConnect class. */
/// Initializes a instance of the FSCConnect class.
/// </summary>
/// <param name="data"></param>
FSCConnect::FSCConnect(uint8_t* data) : FSCMessage(data), FSCConnect::FSCConnect(uint8_t* data) : FSCMessage(data),
m_vcBasePort(0U), m_vcBasePort(0U),
m_vcSSRC(0U), m_vcSSRC(0U),
@ -52,11 +44,8 @@ FSCConnect::FSCConnect(uint8_t* data) : FSCMessage(data),
decode(data); decode(data);
} }
/// <summary> /* Decode a FSC connect frame. */
/// Decode a FSC connect frame.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
bool FSCConnect::decode(const uint8_t* data) bool FSCConnect::decode(const uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -70,10 +59,8 @@ bool FSCConnect::decode(const uint8_t* data)
return true; return true;
} }
/// <summary> /* Encode a FSC connect frame. */
/// Encode a FSC connect frame.
/// </summary>
/// <param name="data"></param>
void FSCConnect::encode(uint8_t* data) void FSCConnect::encode(uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file FSCConnect.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_fsc_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file FSCConnect.cpp
* * @ingroup dfsi_fsc_frames
* @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
*
*/
#if !defined(__FSC_CONNECT_H__) #if !defined(__FSC_CONNECT_H__)
#define __FSC_CONNECT_H__ #define __FSC_CONNECT_H__
@ -29,31 +31,53 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
//
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/**
* @brief Implements the FSC Connect Message.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCConnect : public FSCMessage { class HOST_SW_API FSCConnect : public FSCMessage {
public: public:
static const uint8_t LENGTH = 11; static const uint8_t LENGTH = 11;
/// <summary>Initializes a copy instance of the FSCConnect class.</summary> /**
* @brief Initializes a copy instance of the FSCConnect class.
*/
FSCConnect(); FSCConnect();
/// <summary>Initializes a copy instance of the FSCConnect class.</summary> /**
* @brief Initializes a copy instance of the FSCConnect class.
* @param data Buffer to containing FSCConnect to decode.
*/
FSCConnect(uint8_t* data); FSCConnect(uint8_t* data);
/// <summary>Decode a FSC connect frame.</summary> /**
* @brief Decode a FSC connect frame.
* @param[in] data Buffer to containing FSCConnect to decode.
*/
bool decode(const uint8_t* data) override; bool decode(const uint8_t* data) override;
/// <summary>Encode a FSC connect frame.</summary> /**
* @brief Encode a FSC connect frame.
* @param[out] data Buffer to encode a FSCConnect.
*/
void encode(uint8_t* data) override; void encode(uint8_t* data) override;
public: public:
/// <summary>Voice Conveyance RTP Port.</summary> /**
* @brief Voice Conveyance RTP Port.
*/
__PROPERTY(uint16_t, vcBasePort, VCBasePort); __PROPERTY(uint16_t, vcBasePort, VCBasePort);
/// <summary>SSRC Identifier for all RTP transmissions.</summary> /**
* @brief SSRC Identifier for all RTP transmissions.
*/
__PROPERTY(uint32_t, vcSSRC, VCSSRC); __PROPERTY(uint32_t, vcSSRC, VCSSRC);
/// <summary>Fixed Station Heartbeat Period.</summary> /**
* @brief Fixed Station Heartbeat Period.
*/
__PROPERTY(uint8_t, fsHeartbeatPeriod, FSHeartbeatPeriod); __PROPERTY(uint8_t, fsHeartbeatPeriod, FSHeartbeatPeriod);
/// <summary>Host Heartbeat Period.</summary> /**
* @brief Host Heartbeat Period.
*/
__PROPERTY(uint8_t, hostHeartbeatPeriod, HostHeartbeatPeriod); __PROPERTY(uint8_t, hostHeartbeatPeriod, HostHeartbeatPeriod);
}; };
} // namespace fsc } // namespace fsc

@ -1,17 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) *
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) */
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/fsc/FSCConnectResponse.h" #include "frames/fsc/FSCConnectResponse.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -27,30 +22,24 @@ using namespace p25::dfsi::fsc;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the FSCConnectResponse class. */
/// Initializes a instance of the FSCConnectResponse class.
/// </summary>
FSCConnectResponse::FSCConnectResponse() : FSCResponse(), FSCConnectResponse::FSCConnectResponse() : FSCResponse(),
m_vcBasePort(0U) m_vcBasePort(0U)
{ {
/* stub */ /* stub */
} }
/// <summary> /* Initializes a instance of the FSCConnectResponse class. */
/// Initializes a instance of the FSCConnectResponse class.
/// </summary>
/// <param name="data"></param>
FSCConnectResponse::FSCConnectResponse(uint8_t* data) : FSCResponse(data), FSCConnectResponse::FSCConnectResponse(uint8_t* data) : FSCResponse(data),
m_vcBasePort(0U) m_vcBasePort(0U)
{ {
decode(data); decode(data);
} }
/// <summary> /* Decode a FSC connect frame. */
/// Decode a FSC connect frame.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
bool FSCConnectResponse::decode(const uint8_t* data) bool FSCConnectResponse::decode(const uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -61,10 +50,8 @@ bool FSCConnectResponse::decode(const uint8_t* data)
return true; return true;
} }
/// <summary> /* Encode a FSC connect frame. */
/// Encode a FSC connect frame.
/// </summary>
/// <param name="data"></param>
void FSCConnectResponse::encode(uint8_t* data) void FSCConnectResponse::encode(uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file FSCConnectResponse.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_fsc_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file FSCConnectResponse.cpp
* * @ingroup dfsi_fsc_frames
* @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
*
*/
#if !defined(__FSC_CONNECT_RESPONSE_H__) #if !defined(__FSC_CONNECT_RESPONSE_H__)
#define __FSC_CONNECT_RESPONSE_H__ #define __FSC_CONNECT_RESPONSE_H__
@ -29,25 +31,41 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
//
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/**
* @brief Implements the FSC Connect Response Message.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCConnectResponse : public FSCResponse { class HOST_SW_API FSCConnectResponse : public FSCResponse {
public: public:
static const uint8_t LENGTH = 3; static const uint8_t LENGTH = 3;
/// <summary>Initializes a copy instance of the FSCConnectResponse class.</summary> /**
* @brief Initializes a copy instance of the FSCConnectResponse class.
*/
FSCConnectResponse(); FSCConnectResponse();
/// <summary>Initializes a copy instance of the FSCConnectResponse class.</summary> /**
* @brief Initializes a copy instance of the FSCConnectResponse class.
* @param data Buffer to containing FSCConnectResponse to decode.
*/
FSCConnectResponse(uint8_t* data); FSCConnectResponse(uint8_t* data);
/// <summary>Decode a FSC connect response frame.</summary> /**
* @brief Decode a FSC connect response frame.
* @param[in] data Buffer to containing FSCConnectResponse to decode.
*/
bool decode(const uint8_t* data) override; bool decode(const uint8_t* data) override;
/// <summary>Encode a FSC connect response frame.</summary> /**
* @brief Encode a FSC connect response frame.
* @param[out] data Buffer to encode a FSCConnectResponse.
*/
void encode(uint8_t* data) override; void encode(uint8_t* data) override;
public: public:
/// <summary>Voice Conveyance RTP Port.</summary> /**
* @brief Voice Conveyance RTP Port.
*/
__PROPERTY(uint16_t, vcBasePort, VCBasePort); __PROPERTY(uint16_t, vcBasePort, VCBasePort);
}; };
} // namespace fsc } // namespace fsc

@ -1,17 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) *
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) */
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/fsc/FSCDisconnect.h" #include "frames/fsc/FSCDisconnect.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -27,18 +22,15 @@ using namespace p25::dfsi::fsc;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the FSCDisconnect class. */
/// Initializes a instance of the FSCDisconnect class.
/// </summary>
FSCDisconnect::FSCDisconnect() : FSCMessage() FSCDisconnect::FSCDisconnect() : FSCMessage()
{ {
m_messageId = FSCMessageType::FSC_DISCONNECT; m_messageId = FSCMessageType::FSC_DISCONNECT;
} }
/// <summary> /* Initializes a instance of the FSCDisconnect class. */
/// Initializes a instance of the FSCDisconnect class.
/// </summary>
/// <param name="data"></param>
FSCDisconnect::FSCDisconnect(uint8_t* data) : FSCMessage(data) FSCDisconnect::FSCDisconnect(uint8_t* data) : FSCMessage(data)
{ {
decode(data); decode(data);

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file FSCDisconnect.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_fsc_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file FSCDisconnect.cpp
* * @ingroup dfsi_fsc_frames
* @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
*
*/
#if !defined(__FSC_DISCONNECT_H__) #if !defined(__FSC_DISCONNECT_H__)
#define __FSC_DISCONNECT_H__ #define __FSC_DISCONNECT_H__
@ -29,16 +31,24 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
//
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/**
* @brief Implements the FSC Disconnect Message.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCDisconnect : public FSCMessage { class HOST_SW_API FSCDisconnect : public FSCMessage {
public: public:
static const uint8_t LENGTH = 3; static const uint8_t LENGTH = 3;
/// <summary>Initializes a copy instance of the FSCDisconnect class.</summary> /**
* @brief Initializes a copy instance of the FSCDisconnect class.
*/
FSCDisconnect(); FSCDisconnect();
/// <summary>Initializes a copy instance of the FSCDisconnect class.</summary> /**
* @brief Initializes a copy instance of the FSCDisconnect class.
* @param data Buffer to containing FSCDisconnect to decode.
*/
FSCDisconnect(uint8_t* data); FSCDisconnect(uint8_t* data);
}; };
} // namespace fsc } // namespace fsc

@ -1,17 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) *
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) */
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/fsc/FSCHeartbeat.h" #include "frames/fsc/FSCHeartbeat.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -27,18 +22,15 @@ using namespace p25::dfsi::fsc;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the FSCHeartbeat class. */
/// Initializes a instance of the FSCHeartbeat class.
/// </summary>
FSCHeartbeat::FSCHeartbeat() : FSCMessage() FSCHeartbeat::FSCHeartbeat() : FSCMessage()
{ {
m_messageId = FSCMessageType::FSC_HEARTBEAT; m_messageId = FSCMessageType::FSC_HEARTBEAT;
} }
/// <summary> /* Initializes a instance of the FSCHeartbeat class. */
/// Initializes a instance of the FSCHeartbeat class.
/// </summary>
/// <param name="data"></param>
FSCHeartbeat::FSCHeartbeat(uint8_t* data) : FSCMessage(data) FSCHeartbeat::FSCHeartbeat(uint8_t* data) : FSCMessage(data)
{ {
decode(data); decode(data);

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file FSCHeartbeat.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_fsc_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file FSCHeartbeat.cpp
* * @ingroup dfsi_fsc_frames
* @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
*
*/
#if !defined(__FSC_HEARTBEAT_H__) #if !defined(__FSC_HEARTBEAT_H__)
#define __FSC_HEARTBEAT_H__ #define __FSC_HEARTBEAT_H__
@ -29,16 +31,24 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
//
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/**
* @brief Implements the FSC Heartbeat Message.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCHeartbeat : public FSCMessage { class HOST_SW_API FSCHeartbeat : public FSCMessage {
public: public:
static const uint8_t LENGTH = 3; static const uint8_t LENGTH = 3;
/// <summary>Initializes a copy instance of the FSCHeartbeat class.</summary> /**
* @brief Initializes a copy instance of the FSCHeartbeat class.
*/
FSCHeartbeat(); FSCHeartbeat();
/// <summary>Initializes a copy instance of the FSCHeartbeat class.</summary> /**
* @brief Initializes a copy instance of the FSCHeartbeat class.
* @param data Buffer to containing FSCHeartbeat to decode.
*/
FSCHeartbeat(uint8_t* data); FSCHeartbeat(uint8_t* data);
}; };
} // namespace fsc } // namespace fsc

@ -1,17 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) *
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) */
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/fsc/FSCMessage.h" #include "frames/fsc/FSCMessage.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -27,9 +22,8 @@ using namespace p25::dfsi::fsc;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the FSCMessage class. */
/// Initializes a instance of the FSCMessage class.
/// </summary>
FSCMessage::FSCMessage() : FSCMessage::FSCMessage() :
m_messageId(FSCMessageType::FSC_INVALID), m_messageId(FSCMessageType::FSC_INVALID),
m_version(1U), m_version(1U),
@ -38,10 +32,8 @@ FSCMessage::FSCMessage() :
/* stub */ /* stub */
} }
/// <summary> /* Initializes a instance of the FSCMessage class. */
/// Initializes a instance of the FSCMessage class.
/// </summary>
/// <param name="data"></param>
FSCMessage::FSCMessage(uint8_t* data) : FSCMessage::FSCMessage(uint8_t* data) :
m_messageId(FSCMessageType::FSC_INVALID), m_messageId(FSCMessageType::FSC_INVALID),
m_version(1U), m_version(1U),
@ -50,11 +42,8 @@ FSCMessage::FSCMessage(uint8_t* data) :
decode(data); decode(data);
} }
/// <summary> /* Decode a FSC message frame. */
/// Decode a FSC message frame.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
bool FSCMessage::decode(const uint8_t* data) bool FSCMessage::decode(const uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -68,10 +57,8 @@ bool FSCMessage::decode(const uint8_t* data)
return true; return true;
} }
/// <summary> /* Encode a FSC message frame. */
/// Encode a FSC message frame.
/// </summary>
/// <param name="data"></param>
void FSCMessage::encode(uint8_t* data) void FSCMessage::encode(uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file FSCMessage.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_fsc_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file FSCMessage.cpp
* * @ingroup dfsi_fsc_frames
* @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
*
*/
#if !defined(__FSC_MESSAGE_H__) #if !defined(__FSC_MESSAGE_H__)
#define __FSC_MESSAGE_H__ #define __FSC_MESSAGE_H__
@ -28,29 +30,49 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
//
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/**
* @brief Base class FSC messages derive from.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCMessage { class HOST_SW_API FSCMessage {
public: public:
static const uint8_t LENGTH = 3; static const uint8_t LENGTH = 3;
/// <summary>Initializes a copy instance of the FSCMessage class.</summary> /**
* @brief Initializes a copy instance of the FSCMessage class.
*/
FSCMessage(); FSCMessage();
/// <summary>Initializes a copy instance of the FSCMessage class.</summary> /**
* @brief Initializes a copy instance of the FSCMessage class.
* @param data Buffer to containing FSCMessage to decode.
*/
FSCMessage(uint8_t* data); FSCMessage(uint8_t* data);
/// <summary>Decode a FSC message frame.</summary> /**
* @brief Decode a FSC message frame.
* @param[in] data Buffer to containing FSCMessage to decode.
*/
virtual bool decode(const uint8_t* data); virtual bool decode(const uint8_t* data);
/// <summary>Encode a FSC message frame.</summary> /**
* @brief Encode a FSC message frame.
* @param[out] data Buffer to encode a FSCMessage.
*/
virtual void encode(uint8_t* data); virtual void encode(uint8_t* data);
public: public:
/// <summary>Message ID.</summary> /**
* @brief Message ID.
*/
__PROTECTED_PROPERTY(FSCMessageType::E, messageId, MessageId); __PROTECTED_PROPERTY(FSCMessageType::E, messageId, MessageId);
/// <summary>Message Version.</summary> /**
* @brief Message Version.
*/
__PROTECTED_READONLY_PROPERTY(uint8_t, version, Version); __PROTECTED_READONLY_PROPERTY(uint8_t, version, Version);
/// <summary></summary> /**
* @brief
*/
__PROTECTED_READONLY_PROPERTY(uint8_t, correlationTag, CorrelationTag); __PROTECTED_READONLY_PROPERTY(uint8_t, correlationTag, CorrelationTag);
}; };
} // namespace fsc } // namespace fsc

@ -1,17 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - DFSI Peer Application * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI Peer Application * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) *
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) */
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "frames/fsc/FSCResponse.h" #include "frames/fsc/FSCResponse.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
#include "common/Utils.h" #include "common/Utils.h"
@ -27,30 +22,24 @@ using namespace p25::dfsi::fsc;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a instance of the FSCResponse class. */
/// Initializes a instance of the FSCResponse class.
/// </summary>
FSCResponse::FSCResponse() : FSCResponse::FSCResponse() :
m_version(1U) m_version(1U)
{ {
/* stub */ /* stub */
} }
/// <summary> /* Initializes a instance of the FSCResponse class. */
/// Initializes a instance of the FSCResponse class.
/// </summary>
/// <param name="data"></param>
FSCResponse::FSCResponse(uint8_t* data) : FSCResponse::FSCResponse(uint8_t* data) :
m_version(1U) m_version(1U)
{ {
decode(data); decode(data);
} }
/// <summary> /* Decode a FSC message frame. */
/// Decode a FSC message frame.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
bool FSCResponse::decode(const uint8_t* data) bool FSCResponse::decode(const uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);
@ -60,10 +49,8 @@ bool FSCResponse::decode(const uint8_t* data)
return true; return true;
} }
/// <summary> /* Encode a FSC message frame. */
/// Encode a FSC message frame.
/// </summary>
/// <param name="data"></param>
void FSCResponse::encode(uint8_t* data) void FSCResponse::encode(uint8_t* data)
{ {
assert(data != nullptr); assert(data != nullptr);

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file FSCResponse.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_fsc_frames
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file FSCResponse.cpp
* * @ingroup dfsi_fsc_frames
* @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
*
*/
#if !defined(__FSC_RESPONSE_H__) #if !defined(__FSC_RESPONSE_H__)
#define __FSC_RESPONSE_H__ #define __FSC_RESPONSE_H__
@ -28,25 +30,41 @@ namespace p25
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
//
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/**
* @brief Base class FSC response messages derive from.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCResponse { class HOST_SW_API FSCResponse {
public: public:
static const uint8_t LENGTH = 1; static const uint8_t LENGTH = 1;
/// <summary>Initializes a copy instance of the FSCResponse class.</summary> /**
* @brief Initializes a copy instance of the FSCResponse class.
*/
FSCResponse(); FSCResponse();
/// <summary>Initializes a copy instance of the FSCResponse class.</summary> /**
* @brief Initializes a copy instance of the FSCResponse class.
* @param data Buffer to containing FSCResponse to decode.
*/
FSCResponse(uint8_t* data); FSCResponse(uint8_t* data);
/// <summary>Decode a FSC message frame.</summary> /**
* @brief Decode a FSC message frame.
* @param[in] data Buffer to containing FSCResponse to decode.
*/
virtual bool decode(const uint8_t* data); virtual bool decode(const uint8_t* data);
/// <summary>Encode a FSC message frame.</summary> /**
* @brief Encode a FSC message frame.
* @param[out] data Buffer to encode a FSCResponse.
*/
virtual void encode(uint8_t* data); virtual void encode(uint8_t* data);
public: public:
/// <summary>Response Version.</summary> /**
* @brief Response Version.
*/
__PROTECTED_READONLY_PROPERTY(uint8_t, version, Version); __PROTECTED_READONLY_PROPERTY(uint8_t, version, Version);
}; };
} // namespace fsc } // namespace fsc

@ -1,19 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - Modem Host Software * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI peer application * Copyright (C) 2024 Patrick McDonnell, W3AXL
* @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
*
*/
#include "CallData.h" #include "CallData.h"
using namespace network; using namespace network;
@ -26,9 +19,8 @@ using namespace dfsi;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a new instance of the VoiceCallData class. */
/// Initializes a new instance of the VoiceCallData class.
/// </summary>
VoiceCallData::VoiceCallData() : VoiceCallData::VoiceCallData() :
srcId(0U), srcId(0U),
dstId(0U), dstId(0U),
@ -58,9 +50,8 @@ VoiceCallData::VoiceCallData() :
::memset(netLDU2, 0x00U, 9U * 25U); ::memset(netLDU2, 0x00U, 9U * 25U);
} }
/// <summary> /* Finalizes a instance of the VoiceCallData class. */
/// Finalizes a instance of the VoiceCallData class.
/// </summary>
VoiceCallData::~VoiceCallData() VoiceCallData::~VoiceCallData()
{ {
delete[] mi; delete[] mi;
@ -70,9 +61,8 @@ VoiceCallData::~VoiceCallData()
delete[] netLDU2; delete[] netLDU2;
} }
/// <summary> /* Reset call data to defaults. */
/// Reset call data to defaults.
/// </summary>
void VoiceCallData::resetCallData() void VoiceCallData::resetCallData()
{ {
srcId = 0U; srcId = 0U;
@ -99,9 +89,8 @@ void VoiceCallData::resetCallData()
streamId = 0U; streamId = 0U;
} }
/// <summary> /* Generate a new stream ID for a call. */
/// Generate a new stream ID for a call.
/// </summary>
void VoiceCallData::newStreamId() void VoiceCallData::newStreamId()
{ {
std::uniform_int_distribution<uint32_t> dist(DVM_RAND_MIN, DVM_RAND_MAX); std::uniform_int_distribution<uint32_t> dist(DVM_RAND_MIN, DVM_RAND_MAX);

@ -1,22 +1,21 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file CallData.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_network
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file CallData.cpp
* * @ingroup dfsi_network
* @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
*
*/
#if !defined(__DFSI_CALL_DATA_H__) #if !defined(__DFSI_CALL_DATA_H__)
#define __DFSI_CALL_DATA_H__ #define __DFSI_CALL_DATA_H__
// DVM Includes
#include "Defines.h" #include "Defines.h"
#include "common/edac/RS634717.h" #include "common/edac/RS634717.h"
#include "common/network/RawFrameQueue.h" #include "common/network/RawFrameQueue.h"
@ -34,53 +33,115 @@
#include "host/modem/port/IModemPort.h" #include "host/modem/port/IModemPort.h"
#include "host/modem/port/UARTPort.h" #include "host/modem/port/UARTPort.h"
// CPP includes
#include <random> #include <random>
namespace network namespace network
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
// Represents an on-going call.
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/**
* @brief Represents an on-going call.
* @ingroup dfsi_network
*/
class HOST_SW_API VoiceCallData { class HOST_SW_API VoiceCallData {
public: public:
/// <summary>Initializes a new instance of the VoiceCallData class.</summary> /**
* @brief Initializes a new instance of the VoiceCallData class.
*/
VoiceCallData(); VoiceCallData();
/// <summary>Initializes a new instance of the VoiceCallData class.</summary> /**
* @brief Initializes a new instance of the VoiceCallData class.
*/
~VoiceCallData(); ~VoiceCallData();
/// <summary>Reset call data to defaults.</summary> /**
* @brief Reset call data to defaults.
*/
void resetCallData(); void resetCallData();
/// <summary>Generate a new stream ID for a call.</summary> /**
* @brief Generate a new stream ID for a call.
*/
void newStreamId(); void newStreamId();
// Call Data /** @name Call Data */
/**
* @brief Source Radio ID.
*/
uint32_t srcId; uint32_t srcId;
/**
* @brief Destination ID.
*/
uint32_t dstId; uint32_t dstId;
/**
* @brief Link Control Opcode.
*/
uint8_t lco; uint8_t lco;
/**
* @brief Manufacturer ID.
*/
uint8_t mfId; uint8_t mfId;
/**
* @brief Call Service Options.
*/
uint8_t serviceOptions; uint8_t serviceOptions;
/**
* @brief Low Speed Data 1.
*/
uint8_t lsd1; uint8_t lsd1;
/**
* @brief Low Speed Data 2.
*/
uint8_t lsd2; uint8_t lsd2;
/**
* @brief Encryption Message Indicator.
*/
uint8_t* mi; uint8_t* mi;
/**
* @brief Encryption Algorithm ID.
*/
uint8_t algoId; uint8_t algoId;
/**
* @brief Encryption Key ID.
*/
uint32_t kId; uint32_t kId;
/**
* @brief Voice Header 1.
*/
uint8_t* VHDR1; uint8_t* VHDR1;
/**
* @brief Voice Header 2.
*/
uint8_t* VHDR2; uint8_t* VHDR2;
/**
* @brief FNE Network LDU1 Buffer.
*/
uint8_t* netLDU1; uint8_t* netLDU1;
/**
* @brief FNE Network LDU2 Buffer.
*/
uint8_t* netLDU2; uint8_t* netLDU2;
/**
* @brief Sequence Number.
*/
uint32_t seqNo; uint32_t seqNo;
/**
* @brief
*/
uint8_t n; uint8_t n;
/**
* @brief Stream ID.
*/
uint32_t streamId; uint32_t streamId;
/** @} */
private: private:
// Used for stream ID generation // Used for stream ID generation

@ -1,17 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - Modem Host Software * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI peer application * Copyright (C) 2024 Patrick McDonnell, W3AXL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) *
* */
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "dfsi/Defines.h" #include "dfsi/Defines.h"
#include "common/network/json/json.h" #include "common/network/json/json.h"
#include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/DFSIDefines.h"
@ -27,24 +23,8 @@ using namespace network;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a new instance of the PeerNetwork class. */
/// Initializes a new instance of the PeerNetwork class.
/// </summary>
/// <param name="address">Network Hostname/IP address to connect to.</param>
/// <param name="port">Network port number.</param>
/// <param name="local"></param>
/// <param name="peerId">Unique ID on the network.</param>
/// <param name="password">Network authentication password.</param>
/// <param name="duplex">Flag indicating full-duplex operation.</param>
/// <param name="debug">Flag indicating whether network debug is enabled.</param>
/// <param name="dmr">Flag indicating whether DMR is enabled.</param>
/// <param name="p25">Flag indicating whether P25 is enabled.</param>
/// <param name="nxdn">Flag indicating whether NXDN is enabled.</param>
/// <param name="slot1">Flag indicating whether DMR slot 1 is enabled for network traffic.</param>
/// <param name="slot2">Flag indicating whether DMR slot 2 is enabled for network traffic.</param>
/// <param name="allowActivityTransfer">Flag indicating that the system activity logs will be sent to the network.</param>
/// <param name="allowDiagnosticTransfer">Flag indicating that the system diagnostic logs will be sent to the network.</param>
/// <param name="updateLookup">Flag indicating that the system will accept radio ID and talkgroup ID lookups from the network.</param>
DfsiPeerNetwork::DfsiPeerNetwork(const std::string& address, uint16_t port, uint16_t localPort, uint32_t peerId, const std::string& password, 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) : 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) 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()); assert(!password.empty());
} }
/// <summary> /* Writes P25 LDU1 frame data to the network. */
/// Writes P25 LDU1 frame data to the network.
/// </summary>
/// <param name="control"></param>
/// <param name="lsd"></param>
/// <param name="data"></param>
/// <param name="frameType"></param>
/// <returns></returns>
bool DfsiPeerNetwork::writeP25LDU1(const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data, P25DEF::FrameType::E frameType) 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) 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); return writeMaster({ NET_FUNC::PROTOCOL, NET_SUBFUNC::PROTOCOL_SUBFUNC_P25 }, message.get(), messageLength, pktSeq(resetSeq), m_p25StreamId);
} }
/// <summary> /* Writes P25 LDU2 frame data to the network. */
/// Writes P25 LDU2 frame data to the network.
/// </summary>
/// <param name="control"></param>
/// <param name="lsd"></param>
/// <param name="data"></param>
/// <returns></returns>
bool DfsiPeerNetwork::writeP25LDU2(const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data) 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) 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 // Protected Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Writes configuration to the network. */
/// Writes configuration to the network.
/// </summary>
/// <returns></returns>
bool DfsiPeerNetwork::writeConfig() bool DfsiPeerNetwork::writeConfig()
{ {
if (m_loginStreamId == 0U) { if (m_loginStreamId == 0U) {
@ -178,15 +145,8 @@ bool DfsiPeerNetwork::writeConfig()
// Private Class Members // Private Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Creates an P25 LDU1 frame message. */
/// Creates an P25 LDU1 frame message.
/// </summary>
/// <param name="length"></param>
/// <param name="control"></param>
/// <param name="lsd"></param>
/// <param name="data"></param>
/// <param name="frameType"></param>
/// <returns></returns>
UInt8Array DfsiPeerNetwork::createP25_LDU1Message_Raw(uint32_t& length, const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, 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) 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); return UInt8Array(buffer);
} }
/// <summary> /* Creates an P25 LDU2 frame message. */
/// Creates an P25 LDU2 frame message.
/// </summary>
/// <param name="length"></param>
/// <param name="control"></param>
/// <param name="lsd"></param>
/// <param name="data"></param>
/// <returns></returns>
UInt8Array DfsiPeerNetwork::createP25_LDU2Message_Raw(uint32_t& length, const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, UInt8Array DfsiPeerNetwork::createP25_LDU2Message_Raw(uint32_t& length, const p25::lc::LC& control, const p25::data::LowSpeedData& lsd,
const uint8_t* data) const uint8_t* data)
{ {

@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @file DfsiPeerNetwork.h
* GPLv2 Open Source. Use is subject to license terms. * @ingroup dfsi_network
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @file DfsiPeerNetwork.cpp
* * @ingroup dfsi_network
* @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
*
*/
#if !defined(__DFSI_PEER_NETWORK_H__) #if !defined(__DFSI_PEER_NETWORK_H__)
#define __DFSI_PEER_NETWORK_H__ #define __DFSI_PEER_NETWORK_H__
@ -25,30 +27,89 @@ namespace network
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // 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 { class HOST_SW_API DfsiPeerNetwork : public Network {
public: public:
/// <summary>Initializes a new instance of the PeerNetwork class.</summary> /**
* @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, 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); bool duplex, bool debug, bool dmr, bool p25, bool nxdn, bool slot1, bool slot2, bool allowActivityTransfer, bool allowDiagnosticTransfer, bool updateLookup, bool saveLookup);
/// <summary>Writes P25 LDU1 frame data to the network.</summary> /**
* @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, bool writeP25LDU1(const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data,
P25DEF::FrameType::E frameType) override; P25DEF::FrameType::E frameType) override;
/// <summary>Writes P25 LDU2 frame data to the network.</summary> /**
* @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; bool writeP25LDU2(const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data) override;
protected: protected:
/// <summary>Writes configuration to the network.</summary> /**
* @brief Writes configuration to the network.
* @returns bool True, if configuration was sent, otherwise false.
*/
bool writeConfig() override; bool writeConfig() override;
private: private:
/// <summary>Creates an P25 LDU1 frame message.</summary> /**
* @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, 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); const uint8_t* data, P25DEF::FrameType::E frameType);
/// <summary>Creates an P25 LDU2 frame message.</summary> /**
* @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, UInt8Array createP25_LDU2Message_Raw(uint32_t& length, const p25::lc::LC& control, const p25::data::LowSpeedData& lsd,
const uint8_t* data); const uint8_t* data);
}; };

@ -1,22 +1,15 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/** /*
* Digital Voice Modem - Modem Host Software * Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms. * GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* @package DVM / DFSI peer application * Copyright (C) 2024 Patrick McDonnell, W3AXL
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) *
* */
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "common/p25/lc/tdulc/TDULCFactory.h" #include "common/p25/lc/tdulc/TDULCFactory.h"
#include "network/SerialService.h" #include "network/SerialService.h"
#include "dfsi/ActivityLog.h" #include "dfsi/ActivityLog.h"
using namespace network; using namespace network;
@ -30,21 +23,8 @@ using namespace dfsi;
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary> /* Initializes a new instance of the SerialService class. */
/// Initializes a new instance of the SerialService class.
/// </summary>
/// <param name="portType"></param>
/// <param name="portName"></param>
/// <param name="baudrate"></param>
/// <param name="rtrt"></param>
/// <param name="diu"></param>
/// <param name="jitter"></param>
/// <param name="network"></param>
/// <param name="p25TxQueueSize"></param>
/// <param name="p25RxQueueSize"></param>
/// <param name="callTimeout"></param>
/// <param name="debug"></param>
/// <param name="trace"></param>
SerialService::SerialService(std::string& portType, const std::string& portName, uint32_t baudrate, bool rtrt, bool diu, uint16_t jitter, DfsiPeerNetwork* network, 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) : uint32_t p25TxQueueSize, uint32_t p25RxQueueSize, uint16_t callTimeout, bool debug, bool trace) :
m_portName(portName), m_portName(portName),
@ -99,9 +79,8 @@ SerialService::SerialService(std::string& portType, const std::string& portName,
m_msgBuffer = new uint8_t[BUFFER_LENGTH]; m_msgBuffer = new uint8_t[BUFFER_LENGTH];
} }
/// <summary> /* Finalizes a instance of the SerialService class. */
/// Finalizes a instance of the SerialService class.
/// </summary>
SerialService::~SerialService() SerialService::~SerialService()
{ {
if (m_port != nullptr) { if (m_port != nullptr) {
@ -118,10 +97,8 @@ SerialService::~SerialService()
delete m_rxVoiceCallData; delete m_rxVoiceCallData;
} }
/// <summary> /* Updates the timer by the passed number of milliseconds. */
/// Updates the timer by the passed number of milliseconds.
/// </summary>
/// <param name="ms"></param>
void SerialService::clock(uint32_t ms) void SerialService::clock(uint32_t ms)
{ {
// Get now // Get now
@ -229,10 +206,8 @@ void SerialService::clock(uint32_t ms)
} }
} }
/// <summary> /* Opens connection to the serial interface. */
/// Opens connection to the serial interface.
/// </summary>
/// <returns>True, if connection is established, otherwise false.</returns>
bool SerialService::open() bool SerialService::open()
{ {
LogInfoEx(LOG_SERIAL, "Opening port %s at %u baud", m_portName.c_str(), m_baudrate); LogInfoEx(LOG_SERIAL, "Opening port %s at %u baud", m_portName.c_str(), m_baudrate);
@ -249,18 +224,16 @@ bool SerialService::open()
return true; return true;
} }
/// <summary> /* Closes connection to the serial interface. */
/// Closes connection to the serial interface.
/// </summary>
void SerialService::close() void SerialService::close()
{ {
LogInfoEx(LOG_SERIAL, "Closing port"); LogInfoEx(LOG_SERIAL, "Closing port");
m_port->close(); m_port->close();
} }
/// <summary> /* Process P25 data from the peer network and send to writeP25Frame() */
/// Process P25 data from the peer network and send to writeP25Frame()
/// </summary>
void SerialService::processP25FromNet(UInt8Array p25Buffer, uint32_t length) void SerialService::processP25FromNet(UInt8Array p25Buffer, uint32_t length)
{ {
// If there's a local call in progress, ignore the frames // If there's a local call in progress, ignore the frames
@ -550,11 +523,8 @@ void SerialService::processP25FromNet(UInt8Array p25Buffer, uint32_t length)
} }
} }
/// <summary> /* Retrieve and process a P25 frame from the rx P25 queue */
/// Retrieve and process a P25 frame from the rx P25 queue
/// </summary>
/// 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 SerialService::processP25ToNet() void SerialService::processP25ToNet()
{ {
@ -1015,9 +985,8 @@ void SerialService::processP25ToNet()
// Private Class Members // Private Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary>Read a data message from the serial port</summary> /* Read a data message from the serial port */
/// This is borrowed from the Modem::getResponse() function
/// <returns>Response type</returns>
RESP_TYPE_DVM SerialService::readSerial() RESP_TYPE_DVM SerialService::readSerial()
{ {
// Flag for a 16-bit (i.e. 2-byte) length // Flag for a 16-bit (i.e. 2-byte) length
@ -1180,10 +1149,8 @@ RESP_TYPE_DVM SerialService::readSerial()
return RTM_OK; return RTM_OK;
} }
/// <summary>Called from clock thread, checks for an available P25 frame to write and sends it based on jitter timing requirements</summary> /* 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
int SerialService::writeSerial() int SerialService::writeSerial()
{ {
/** /**
@ -1255,11 +1222,8 @@ int SerialService::writeSerial()
return 0U; return 0U;
} }
/// <summary> /* Gets a frame of P25 data from the RX queue */
/// Gets a frame of P25 data from the RX queue
/// <summary>
/// <param name="*data">The data buffer to populate</param>
/// <returns>The size of the P25 data retreived, including the leading data tag
uint32_t SerialService::readP25Frame(uint8_t* data) uint32_t SerialService::readP25Frame(uint8_t* data)
{ {
@ -1301,15 +1265,8 @@ uint32_t SerialService::readP25Frame(uint8_t* data)
return 0U; return 0U;
} }
/// <summary> /* Break apart a P25 LDU and add to the TX queue, timed appropriately */
/// Break apart a P25 LDU and add to the TX queue, timed appropriately
/// </summary>
/// <param name="duid">DUID flag for the LDU</param>
/// <param name="lc">Link Control data</param>
/// <param name="ldu">LDU data</param>
///
/// 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
void SerialService::writeP25Frame(DUID::E duid, dfsi::LC& lc, uint8_t* ldu) void SerialService::writeP25Frame(DUID::E duid, dfsi::LC& lc, uint8_t* ldu)
{ {
// Sanity check // Sanity check
@ -1659,10 +1616,8 @@ void SerialService::writeP25Frame(DUID::E duid, dfsi::LC& lc, uint8_t* ldu)
} }
} }
/// <summary> /* Send a start of stream sequence (HDU, etc) to the connected serial V.24 device */
/// Send a start of stream sequence (HDU, etc) to the connected serial V24 device
/// </summary>
/// <param name="lc">Link control data object</param>
void SerialService::startOfStream(const LC& lc) void SerialService::startOfStream(const LC& lc)
{ {
// Flag that we have a network call in progress // 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); addTxToQueue(buffer2, vhdr2.LENGTH, SERIAL_TX_TYPE::NONIMBE);
} }
/// <summary> /* Send an end of stream sequence (TDU, etc) to the connected serial V.24 device */
/// Send an end of stream sequence (TDU, etc) to the connected serial V24 device
/// </summary>
/// <param name="lc">Link control data object</param>
void SerialService::endOfStream() void SerialService::endOfStream()
{ {
// Create the new end of stream (which looks like a start of stream with the stop flag) // 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; m_netCallInProgress = false;
} }
/// <summary> /* Helper to add a V24 dataframe to the P25 TX queue with the proper timestamp and formatting */
/// Helper to add a V24 dataframe to the P25 TX queue with the proper timestamp and formatting
/// </summary>
/// <param name="data">Data array to send</param>
/// <param name="len">Length of data in array</param>
/// <param name="msgType">Type of message to send (used for proper jitter clocking)</param>
void SerialService::addTxToQueue(uint8_t* data, uint16_t len, SERIAL_TX_TYPE msgType) void SerialService::addTxToQueue(uint8_t* data, uint16_t len, SERIAL_TX_TYPE msgType)
{ {
// If the port isn't connected, just return // If the port isn't connected, just return
if (m_port == nullptr) { return; } if (m_port == nullptr)
return;
// Get current time in ms // Get current time in ms
uint64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(); uint64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
@ -1865,11 +1815,8 @@ void SerialService::addTxToQueue(uint8_t* data, uint16_t len, SERIAL_TX_TYPE msg
m_lastP25Tx = msgTime; m_lastP25Tx = msgTime;
} }
/// <summary> /* Helper to insert IMBE silence frames for missing audio. */
/// Helper to insert IMBE silence frames for missing audio.
/// </summary>
/// <param name="data"></param>
/// <param name="lost"></param>
void SerialService::insertMissingAudio(uint8_t *data, uint32_t& lost) void SerialService::insertMissingAudio(uint8_t *data, uint32_t& lost)
{ {
if (data[10U] == 0x00U) { 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) void SerialService::printDebug(const uint8_t* buffer, uint16_t len)
{ {
if (m_msgDoubleLength && buffer[3U] == CMD_DEBUG_DUMP) { if (m_msgDoubleLength && buffer[3U] == CMD_DEBUG_DUMP) {

@ -1,21 +1,25 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 * @defgroup dfsi_network DFSI Networking/Serial Communications
* GPLv2 Open Source. Use is subject to license terms. * @brief Implementation for the DFSI networking and serial communications.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @ingroup dfsi
* *
* @package DVM / DFSI peer application * @file SerialService.h
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost) * @ingroup dfsi_network
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) * @file SerialService.cpp
* * @ingroup dfsi_network
* Copyright (C) 2024 Patrick McDonnell, W3AXL */
*
*/
#if !defined(__SERIAL_SERVICE_H__) #if !defined(__SERIAL_SERVICE_H__)
#define __SERIAL_SERVICE_H__ #define __SERIAL_SERVICE_H__
// DVM Includes
#include "Defines.h" #include "Defines.h"
#include "common/edac/RS634717.h" #include "common/edac/RS634717.h"
#include "common/network/RawFrameQueue.h" #include "common/network/RawFrameQueue.h"
@ -35,7 +39,6 @@
#include "host/modem/port/UARTPort.h" #include "host/modem/port/UARTPort.h"
#include "host/modem/port/ModemNullPort.h" #include "host/modem/port/ModemNullPort.h"
// System Includes
#include <string> #include <string>
#include <cstdint> #include <cstdint>
#include <map> #include <map>
@ -49,7 +52,10 @@ using namespace dfsi;
namespace network 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 { enum SERIAL_TX_TYPE {
NONIMBE, NONIMBE,
IMBE IMBE
@ -57,29 +63,65 @@ namespace network
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
// Serial V24 service
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/**
* @brief Implements the serial V.24 communications service.
* @ingroup dfsi_network
*/
class HOST_SW_API SerialService { class HOST_SW_API SerialService {
public: public:
/// <summary>Initializes an instance of the SerialService class.</summary> /**
* @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); 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);
/// <summary>Finalizes an instance of the SerialService class.</summary> /**
* @brief Finalizes an instance of the SerialService class.
*/
~SerialService(); ~SerialService();
/// <summary>Updates the serial interface by the passed number of milliseconds.</summary> /**
* @brief Updates the serial interface by the passed number of milliseconds.
* @param ms Number of milliseconds.
*/
void clock(uint32_t ms); void clock(uint32_t ms);
/// <summary>Opens connection to the serial interface.</summary> /**
* @brief Opens connection to the serial interface.
* @returns bool True, if serial interface has started, otherwise false.
*/
bool open(); bool open();
/// <summary>Closes connection to the serial interface.</summary> /**
* @brief Closes connection to the serial interface.
*/
void close(); 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); 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(); void processP25ToNet();
private: private:
@ -142,22 +184,66 @@ namespace network
VoiceCallData* m_rxVoiceCallData; VoiceCallData* m_rxVoiceCallData;
// Functions called by clock() to read/write from/to the serial port // 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(); 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(); 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); 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); 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); void startOfStream(const LC& lc);
/**
* @brief Send an end of stream sequence (TDU, etc) to the connected serial V24 device.
*/
void endOfStream(); 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); void addTxToQueue(uint8_t* data, uint16_t length, SERIAL_TX_TYPE msgType);
/// <summary>Helper to insert IMBE silence frames for missing audio.</summary> /**
* @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); void insertMissingAudio(uint8_t* data, uint32_t& lost);
/**
* @brief
* @param buffer
* @param length
*/
void printDebug(const uint8_t* buffer, uint16_t length); void printDebug(const uint8_t* buffer, uint16_t length);
}; };
} // namespace network } // namespace network

@ -361,7 +361,7 @@ namespace network
void setPresharedKey(const uint8_t* presharedKey); void setPresharedKey(const uint8_t* presharedKey);
/** /**
* @brief Process a data frames from the network. * @brief Process data frames from the network.
*/ */
void processNetwork(); void processNetwork();

Loading…
Cancel
Save

Powered by TurnKey Linux.