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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
*
*/
/**
* Digital Voice Modem - Modem Host Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI peer application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
*
*/
* @file ActivityLog.h
* @ingroup dfsi
* @file ActivityLog.cpp
* @ingroup dfsi
*/
#if !defined(__ACTIVITY_LOG_H__)
#define __ACTIVITY_LOG_H__
@ -22,11 +24,22 @@
// Global Functions
// ---------------------------------------------------------------------------
/// <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);
/// <summary>Finalizes the activity log.</summary>
/**
* @brief Finalizes the activity log.
*/
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, ...);
#endif // __ACTIVITY_LOG_H__

@ -1,16 +1,21 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
*
*/
/**
* Digital Voice Modem - Modem Host Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI peer application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
*
*/
* @defgroup dfsi DFSI V.24/UDP Software (dvmdfsi)
* @brief Digital Voice Modem - DFSI V.24/UDP Software
* @details TIA/V.24 standard interface application that connects to a V.24 interface board or UDP to allow for P25 DFSI communications with commercial P25 hardware.
* @ingroup dfsi
*
* @file Defines.h
* @ingroup dfsi
*/
#if !defined(__DEFINES_H__)
#define __DEFINES_H__
@ -21,7 +26,7 @@
// ---------------------------------------------------------------------------
#undef __PROG_NAME__
#define __PROG_NAME__ "Digital Voice Modem (DVM) DFSI Peer"
#define __PROG_NAME__ "Digital Voice Modem (DVM) DFSI V.24/UDP Peer"
#undef __EXE_NAME__
#define __EXE_NAME__ "dvmdfsi"

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
*
*/
/**
* Digital Voice Modem - Modem Host Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI peer application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
*
*/
* @file Dfsi.h
* @ingroup dfsi
* @file Dfsi.cpp
* @ingroup dfsi
*/
#if !defined(__DFSI_H__)
#define __DFSI_H__
@ -28,17 +30,28 @@
// ---------------------------------------------------------------------------
// Class Declaration
// This class implements the core service logic.
// ---------------------------------------------------------------------------
/**
* @brief This class implements the core service logic.
* @ingroup dfsi
*/
class HOST_SW_API Dfsi {
public:
/// <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);
/// <summary>Finalizes a instance of the HostTest class.</summary>
/**
* @brief Finalizes a instance of the HostTest class.
*/
~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();
private:
@ -61,11 +74,20 @@ private:
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();
/// <summary>Initializes peer network connectivity.</summary>
/**
* @brief Initializes peer network connectivity.
* @returns bool True, if network connectivity was initialized, otherwise false.
*/
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);
};

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
*
*/
/**
* Digital Voice Modem - Modem Host Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI peer application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
*
*/
* @file DfsiMain.h
* @ingroup dfsi
* @file DfsiMain.cpp
* @ingroup dfsi
*/
#if !defined(__DFSI_MAIN_H__)
#define __DFSI_MAIN_H__
@ -22,20 +24,37 @@
// Externs
// ---------------------------------------------------------------------------
/** @brief */
extern int g_signal;
/** @brief */
extern std::string g_progExe;
/** @brief */
extern std::string g_iniFile;
/** @brief */
extern std::string g_lockFile;
/** @brief (Global) Flag indicating foreground operation. */
extern bool g_foreground;
/** @brief (Global) Flag indicating the FNE should stop immediately. */
extern bool g_killed;
/** @brief */
extern std::string g_masterAddress;
/** @brief */
extern uint16_t g_masterPort;
/** @brief */
extern uint32_t g_peerId;
extern uint8_t* g_gitHashBytes;
/**
* @brief Helper to trigger a fatal error message. This will cause the program to terminate
* immediately with an error message.
*
* @param msg String format.
*
* This is a variable argument function.
*/
extern HOST_SW_API void fatal(const char* msg, ...);
#endif // __DFSI_MAIN_H__

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file BlockHeader.h
* @ingroup dfsi_frames
* @file BlockHeader.cpp
* @ingroup dfsi_frames
*/
#if !defined(__BLOCK_HEADER_H__)
#define __BLOCK_HEADER_H__
@ -26,47 +28,73 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements a DFSI block header packet.
//
// Compact Form
// Byte 0
// Bit 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+
// |E| BT |
// +-+-+-+-+-+-+-+-+
//
// Verbose Form
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// |E| BT | TSO | BL |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// ---------------------------------------------------------------------------
/**
* @brief Implements a DFSI block header packet.
* \code{.unparsed}
* Compact Form
* Byte 0
* Bit 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+
* |E| BT |
* +-+-+-+-+-+-+-+-+
*
* Verbose Form
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* |E| BT | TSO | BL |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* \endcode
* @ingroup dfsi_frames
*/
class HOST_SW_API BlockHeader {
public:
static const uint8_t LENGTH = 1;
static const uint8_t VERBOSE_LENGTH = 4;
/// <summary>Initializes a copy instance of the BlockHeader class.</summary>
/**
* @brief Initializes a copy instance of the BlockHeader class.
*/
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);
/// <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);
/// <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);
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);
/// <summary>Block type.</summary>
/**
* @brief Block type.
*/
__PROPERTY(BlockType::E, blockType, BlockType);
/// <summary>Timestamp Offset.</summary>
/**
* @brief Timestamp Offset.
*/
__PROPERTY(uint16_t, timestampOffset, TimestampOffset);
/// <summary>Block length.</summary>
/**
* @brief Block length.
*/
__PROPERTY(uint16_t, blockLength, BlockLength);
};
} // namespace dfsi

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file ControlOctet.h
* @ingroup dfsi_frames
* @file ControlOctet.cpp
* @ingroup dfsi_frames
*/
#if !defined(__CONTROL_OCTET_H__)
#define __CONTROL_OCTET_H__
@ -26,35 +28,56 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements a DFSI control octet packet.
//
// Byte 0
// Bit 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+
// |S|C| BHC |
// +-+-+-+-+-+-+-+-+
// ---------------------------------------------------------------------------
/**
* @brief Implements a DFSI control octet packet.
* \code{.unparsed}
* Byte 0
* Bit 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+
* |S|C| BHC |
* +-+-+-+-+-+-+-+-+
* \endcode
* @ingroup dfsi_frames
*/
class HOST_SW_API ControlOctet {
public:
static const uint8_t LENGTH = 1;
/// <summary>Initializes a copy instance of the ControlOctet class.</summary>
/**
* @brief Initializes a copy instance of the ControlOctet class.
*/
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);
/// <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);
/// <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);
public:
/// <summary></summary>
/**
* @brief
*/
__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);
/// <summary>Number of block headers following this control octet.</summary>
/**
* @brief Number of block headers following this control octet.
*/
__PROPERTY(uint8_t, blockHeaderCnt, BlockHeaderCnt);
};
} // namespace dfsi

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

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

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file FullRateVoice.h
* @ingroup dfsi_frames
* @file FullRateVoice.cpp
* @ingroup dfsi_frames
*/
#if !defined(__FULL_RATE_VOICE_H__)
#define __FULL_RATE_VOICE_H__
@ -27,187 +29,225 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements a P25 full rate voice packet.
//
// CAI Frames 1, 2, 10 and 11.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | FT | U0(b11-0) | U1(b11-0) |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | U2(b10-0) | U3(b11-0) | U4(b10-3) |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | Et | Er |M|L|E| E1 |SF | B |
// | | | | |4| | | |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// CAI Frames 3 - 8.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | FT | U0(b11-0) | U1(b11-0) |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | U2(b10-0) | U3(b11-0) | U4(b10-3) |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | Et | Er |M|L|E| E1 |SF | B | LC0,4,8 | LC1,5,9 | LC2, |
// | | | | |4| | | | | | 6,10 |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | | LC3,7,11 |R| Status |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// CAI Frames 12 - 17.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | FT | U0(b11-0) | U1(b11-0) |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | U2(b10-0) | U3(b11-0) | U4(b10-3) |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | Et | Er |M|L|E| E1 |SF | B | ES0,4,8 | ES1,5,9 | ES2, |
// | | | | |4| | | | | | 6,10 |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | | ES3,7,11 |R| Status |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// CAI Frames 9 and 10.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | FT | U0(b11-0) | U1(b11-0) |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | U2(b10-0) | U3(b11-0) | U4(b10-3) |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | Et | Er |M|L|E| E1 |SF | B | LSD0,2 | LSD1,3 |
// | | | | |4| | | | | |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | Rsvd |Si |Sj |
// +=+=+=+=+=+=+=+=+
//
// Because the TIA.102-BAHA spec represents the "message vectors" as
// 16-bit units (U0 - U7) this makes understanding the layout of the
// buffer ... difficult for the 8-bit aligned minded. The following is
// the layout with 8-bit aligned IMBE blocks instead of message vectors:
//
// CAI Frames 1, 2, 10 and 11.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | FT | IMBE 1 | IMBE 2 | IMBE 3 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | Et | Er |M|L|E| E1 |SF | B |
// | | | | |4| | | |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// CAI Frames 3 - 8.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | FT | IMBE 1 | IMBE 2 | IMBE 3 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | Et | Er |M|L|E| E1 |SF | B | Link Ctrl | Link Ctrl |
// | | | | |4| | | | | |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | Link Ctrl |R| Status |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// CAI Frames 12 - 17.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | FT | IMBE 1 | IMBE 2 | IMBE 3 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | Et | Er |M|L|E| E1 |SF | B | Enc Sync | Enc Sync |
// | | | | |4| | | | | |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | Enc Sync |R| Status |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// CAI Frames 9 and 10.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | FT | IMBE 1 | IMBE 2 | IMBE 3 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | Et | Er |M|L|E| E1 |SF | B | LSD0,2 | LSD1,3 |
// | | | | |4| | | | | |
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// | Rsvd |Si |Sj |
// +=+=+=+=+=+=+=+=+
// ---------------------------------------------------------------------------
/**
* @brief Implements a P25 full rate voice packet.
* \code{.unparsed}
* CAI Frames 1, 2, 10 and 11.
*
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | FT | U0(b11-0) | U1(b11-0) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | U2(b10-0) | U3(b11-0) | U4(b10-3) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | Et | Er |M|L|E| E1 |SF | B |
* | | | | |4| | | |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
*
* CAI Frames 3 - 8.
*
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | FT | U0(b11-0) | U1(b11-0) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | U2(b10-0) | U3(b11-0) | U4(b10-3) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | Et | Er |M|L|E| E1 |SF | B | LC0,4,8 | LC1,5,9 | LC2, |
* | | | | |4| | | | | | 6,10 |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | | LC3,7,11 |R| Status |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
*
* CAI Frames 12 - 17.
*
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | FT | U0(b11-0) | U1(b11-0) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | U2(b10-0) | U3(b11-0) | U4(b10-3) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | Et | Er |M|L|E| E1 |SF | B | ES0,4,8 | ES1,5,9 | ES2, |
* | | | | |4| | | | | | 6,10 |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | | ES3,7,11 |R| Status |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
*
* CAI Frames 9 and 10.
*
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | FT | U0(b11-0) | U1(b11-0) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | U2(b10-0) | U3(b11-0) | U4(b10-3) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | U4 | U5(b10-0) | U6(b10-0) | U7(b6-0) |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | Et | Er |M|L|E| E1 |SF | B | LSD0,2 | LSD1,3 |
* | | | | |4| | | | | |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | Rsvd |Si |Sj |
* +=+=+=+=+=+=+=+=+
*
* Because the TIA.102-BAHA spec represents the "message vectors" as
* 16-bit units (U0 - U7) this makes understanding the layout of the
* buffer ... difficult for the 8-bit aligned minded. The following is
* the layout with 8-bit aligned IMBE blocks instead of message vectors:
*
* CAI Frames 1, 2, 10 and 11.
*
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | FT | IMBE 1 | IMBE 2 | IMBE 3 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | Et | Er |M|L|E| E1 |SF | B |
* | | | | |4| | | |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
*
* CAI Frames 3 - 8.
*
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | FT | IMBE 1 | IMBE 2 | IMBE 3 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | Et | Er |M|L|E| E1 |SF | B | Link Ctrl | Link Ctrl |
* | | | | |4| | | | | |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | Link Ctrl |R| Status |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
*
* CAI Frames 12 - 17.
*
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | FT | IMBE 1 | IMBE 2 | IMBE 3 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | Et | Er |M|L|E| E1 |SF | B | Enc Sync | Enc Sync |
* | | | | |4| | | | | |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | Enc Sync |R| Status |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
*
* CAI Frames 9 and 10.
*
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | FT | IMBE 1 | IMBE 2 | IMBE 3 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | Et | Er |M|L|E| E1 |SF | B | LSD0,2 | LSD1,3 |
* | | | | |4| | | | | |
* +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
* | Rsvd |Si |Sj |
* +=+=+=+=+=+=+=+=+
* \endcode
* @ingroup dfsi_frames
*/
class HOST_SW_API FullRateVoice {
public:
static const uint8_t LENGTH = 18;
static const uint8_t ADDITIONAL_LENGTH = 4;
static const uint8_t IMBE_BUF_LEN = 11;
/// <summary>Initializes a copy instance of the FullRateVoice class.</summary>
/**
* @brief Initializes a copy instance of the FullRateVoice class.
*/
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);
/// <summary>Finalizes a instance of the FullRateVoice class.</summary>
/**
* @brief Finalizes a instance of the FullRateVoice class.
*/
~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);
/// <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);
public:
uint8_t* imbeData; // ?? - 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);
/// <summary>Total errors detected in the frame.</summary>
/**
* @brief Total errors detected in the frame.
*/
__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);
/// <summary>Flag indicating the frame was lost.</summary>
/**
* @brief Flag indicating the frame was lost.
*/
__PROPERTY(bool, lostFrame, LostFrame);
/// <summary>Superframe Counter.</summary>
/**
* @brief Superframe Counter.
*/
__PROPERTY(uint8_t, superframeCnt, SuperframeCnt);
/// <summary>Busy Status.</summary>
/**
* @brief Busy Status.
*/
__PROPERTY(uint8_t, busy, Busy);
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();
/// <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();
/// <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();
};
} // namespace dfsi

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

@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file MotFullRateVoice.h
* @ingroup dfsi_frames
* @file MotFullRateVoice.cpp
* @ingroup dfsi_frames
*/
#if !defined(__MOT_FULL_RATE_VOICE_H__)
#define __MOT_FULL_RATE_VOICE_H__
@ -28,58 +30,92 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements a P25 Motorola full rate voice packet.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | FT | Addtl Data | Addtl Data | Addtl Data |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Reserved | IMBE 1 | IMBE 2 | IMBE 3 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Src Flag |
// +=+=+=+=+=+=+=+=+
// ---------------------------------------------------------------------------
/**
* @brief Implements a P25 Motorola full rate voice packet.
* \code{.unparsed}
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | FT | Addtl Data | Addtl Data | Addtl Data |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Reserved | IMBE 1 | IMBE 2 | IMBE 3 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | IMBE 4 | IMBE 5 | IMBE 6 | IMBE 7 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | IMBE 8 | IMBE 9 | IMBE 10 | IMBE 11 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Src Flag |
* +=+=+=+=+=+=+=+=+
* \endcode
* @ingroup dfsi_frames
*/
class HOST_SW_API MotFullRateVoice {
public:
static const uint8_t LENGTH = 17;
static const uint8_t SHORTENED_LENGTH = 13;
static const uint8_t ADDITIONAL_LENGTH = 4;
/// <summary>Initializes a copy instance of the MotFullRateVoice class.</summary>
/**
* @brief Initializes a copy instance of the MotFullRateVoice class.
*/
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);
/// <summary>Finalizes a instance of the MotFullRateVoice class.</summary>
/**
* @brief Finalizes a instance of the MotFullRateVoice class.
*/
~MotFullRateVoice();
/// <summary></summary>
/**
* @brief
*/
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);
/// <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);
public:
uint8_t* imbeData; // ?? - 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);
/// <summary></summary>
/**
* @brief V.24 Data Source.
*/
__PROPERTY(SourceFlag::E, source, Source);
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();
/// <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();
/// <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();
};
} // namespace dfsi

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

@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file MotStartVoiceFrame.h
* @ingroup dfsi_frames
* @file MotStartVoiceFrame.cpp
* @ingroup dfsi_frames
*/
#if !defined(__MOT_START_OF_STREAM_H__)
#define __MOT_START_OF_STREAM_H__
@ -27,42 +29,65 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements a P25 Motorola start of stream packet.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Fixed Mark | RT Mode Flag | Start/Stop | Type Flag |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Reserved |
// + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | |
// +-+-+-+-+-+-+-+-+
// ---------------------------------------------------------------------------
/**
* @brief Implements a P25 Motorola start of stream packet.
* \code{.unparsed}
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Fixed Mark | RT Mode Flag | Start/Stop | Type Flag |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Reserved |
* + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* +-+-+-+-+-+-+-+-+
* \endcode
* @ingroup dfsi_frames
*/
class HOST_SW_API MotStartOfStream {
public:
static const uint8_t LENGTH = 10;
static const uint8_t FIXED_MARKER = 0x02;
/// <summary>Initializes a copy instance of the MotStartOfStream class.</summary>
/**
* @brief Initializes a copy instance of the MotStartOfStream class.
*/
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);
/// <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);
/// <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);
public:
/// <summary></summary>
/**
* @brief
*/
__PROPERTY(uint8_t, marker, Marker);
/// <summary></summary>
/**
* @brief RT/RT Flag.
*/
__PROPERTY(RTFlag::E, rt, RT);
/// <summary></summary>
/**
* @brief Start/Stop.
*/
__PROPERTY(StartStopFlag::E, startStop, StartStop);
/// <summary></summary>
/**
* @brief Stream Type.
*/
__PROPERTY(StreamTypeFlag::E, streamType, StreamType);
};
} // namespace dfsi

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

@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file MotStartVoiceFrame.h
* @ingroup dfsi_frames
* @file MotStartVoiceFrame.cpp
* @ingroup dfsi_frames
*/
#if !defined(__MOT_START_VOICE_FRAME_H__)
#define __MOT_START_VOICE_FRAME_H__
@ -29,54 +31,81 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements a P25 Motorola voice frame 1/10 start.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Encoded Motorola Start of Stream |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | ICW Flag ? | RSSI | RSSI Valid | RSSI |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Adj MM ? | Full Rate Voice Frame |
// +-+-+-+-+-+-+-+-+ +
// | |
// + +
// | |
// + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | |
// +=+=+=+=+=+=+=+=+
// ---------------------------------------------------------------------------
/**
* @brief Implements a P25 Motorola voice frame 1/10 start.
* \code{.unparsed}
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Encoded Motorola Start of Stream |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | ICW Flag ? | RSSI | RSSI Valid | RSSI |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Adj MM ? | Full Rate Voice Frame |
* +-+-+-+-+-+-+-+-+ +
* | |
* + +
* | |
* + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* +=+=+=+=+=+=+=+=+
* \endcode
* @ingroup dfsi_frames
*/
class HOST_SW_API MotStartVoiceFrame {
public:
static const uint8_t LENGTH = 22;
/// <summary>Initializes a copy instance of the MotStartVoiceFrame class.</summary>
/**
* @brief Initializes a copy instance of the MotStartVoiceFrame class.
*/
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);
/// <summary>Finalizes a instance of the MotStartVoiceFrame class.</summary>
/**
* @brief Finalizes a instance of the MotStartVoiceFrame class.
*/
~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);
/// <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);
public:
MotStartOfStream* startOfStream; // ?? - 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);
/// <summary></summary>
/**
* @brief RSSI Value.
*/
__PROPERTY(uint8_t, rssi, RSSI);
/// <summary></summary>
/**
* @brief Flag indicating whether or not the RSSI field is valid.
*/
__PROPERTY(RssiValidityFlag::E, rssiValidity, RSSIValidity);
/// <summary></summary>
/**
* @brief
*/
__PROPERTY(uint8_t, nRssi, NRSSI);
/// <summary></summary>
/**
* @brief
*/
__PROPERTY(uint8_t, adjMM, AdjMM);
};
} // namespace dfsi

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

@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file MotVoiceHeader1.h
* @ingroup dfsi_frames
* @file MotVoiceHeader1.cpp
* @ingroup dfsi_frames
*/
#if !defined(__MOT_VOICE_HEADER_1_H__)
#define __MOT_VOICE_HEADER_1_H__
@ -28,57 +30,82 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements a P25 Motorola voice header frame 1.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Encoded Motorola Start of Stream |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | ICW Flag ? | RSSI | RSSI Valid | RSSI |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Header Control Word |
// + +
// | |
// + +
// | |
// + +
// | |
// + +
// | |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Src Flag |
// +-+-+-+-+-+-+-+-+
// ---------------------------------------------------------------------------
/**
* @brief Implements a P25 Motorola voice header frame 1.
* \code{.unparsed}
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Encoded Motorola Start of Stream |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | ICW Flag ? | RSSI | RSSI Valid | RSSI |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Header Control Word |
* + +
* | |
* + +
* | |
* + +
* | |
* + +
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Src Flag |
* +-+-+-+-+-+-+-+-+
* \endcode
* @ingroup dfsi_frames
*/
class HOST_SW_API MotVoiceHeader1 {
public:
static const uint8_t LENGTH = 30;
static const uint8_t HCW_LENGTH = 21;
/// <summary>Initializes a copy instance of the MotVoiceHeader1 class.</summary>
/**
* @brief Initializes a copy instance of the MotVoiceHeader1 class.
*/
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);
/// <summary>Finalizes a instance of the MotVoiceHeader1 class.</summary>
/**
* @brief Finalizes a instance of the MotVoiceHeader1 class.
*/
~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);
/// <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);
public:
uint8_t* header; // ?? - 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);
/// <summary></summary>
/**
* @brief RSSI Value.
*/
__PROPERTY(uint8_t, rssi, RSSI);
/// <summary></summary>
/**
* @brief Flag indicating whether or not the RSSI field is valid.
*/
__PROPERTY(RssiValidityFlag::E, rssiValidity, RSSIValidity);
/// <summary></summary>
/**
* @brief
*/
__PROPERTY(uint8_t, nRssi, NRSSI);
};
} // namespace dfsi

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

@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file MotVoiceHeader2.h
* @ingroup dfsi_frames
* @file MotVoiceHeader2.cpp
* @ingroup dfsi_frames
*/
#if !defined(__MOT_VOICE_HEADER_2_H__)
#define __MOT_VOICE_HEADER_2_H__
@ -28,46 +30,65 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements a P25 Motorola voice header frame 2.
//
// Byte 0 1 2 3
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Header Control Word |
// + +
// | |
// + +
// | |
// + +
// | |
// + +
// | |
// + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | | Reserved |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// ---------------------------------------------------------------------------
/**
* @brief Implements a P25 Motorola voice header frame 2.
* \code{.unparsed}
* Byte 0 1 2 3
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Header Control Word |
* + +
* | |
* + +
* | |
* + +
* | |
* + +
* | |
* + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | | Reserved |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* \endcode
* @ingroup dfsi_frames
*/
class HOST_SW_API MotVoiceHeader2 {
public:
static const uint8_t LENGTH = 22;
static const uint8_t HCW_LENGTH = 20;
/// <summary>Initializes a copy instance of the MotVoiceHeader2 class.</summary>
/**
* @brief Initializes a copy instance of the MotVoiceHeader2 class.
*/
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);
/// <summary>Finalizes a instance of the MotVoiceHeader2 class.</summary>
/**
* @brief Finalizes a instance of the MotVoiceHeader2 class.
*/
~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);
/// <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);
public:
uint8_t* header; // ?? - this should probably be a private with getters/setters
/// <summary></summary>
/**
* @brief V.24 Data Source.
*/
__PROPERTY(SourceFlag::E, source, Source);
};
} // namespace dfsi

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file StartOfStream.h
* @ingroup dfsi_frames
* @file StartOfStream.cpp
* @ingroup dfsi_frames
*/
#if !defined(__START_OF_STREAM_H__)
#define __START_OF_STREAM_H__
@ -26,33 +28,52 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements a P25 DFSI start of stream packet.
//
// Byte 0 1 2
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | NID | Rsvd | Err C |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// ---------------------------------------------------------------------------
/**
* @brief Implements a P25 DFSI start of stream packet.
* \code{.unparsed}
* Byte 0 1 2
* Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | NID | Rsvd | Err C |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* \endcode
* @ingroup dfsi_frames
*/
class HOST_SW_API StartOfStream {
public:
static const uint8_t LENGTH = 4;
/// <summary>Initializes a copy instance of the StartOfStream class.</summary>
/**
* @brief Initializes a copy instance of the StartOfStream class.
*/
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);
/// <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);
/// <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);
public:
/// <summary>Network Identifier.</summary>
/**
* @brief Network Identifier.
*/
__PROPERTY(uint16_t, nid, NID);
/// <summary>Error count.</summary>
/**
* @brief Error count.
*/
__PROPERTY(uint8_t, errorCount, ErrorCount);
};
} // namespace dfsi

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file FSCACK.h
* @ingroup dfsi_fsc_frames
* @file FSCACK.cpp
* @ingroup dfsi_fsc_frames
*/
#if !defined(__FSC_ACK_H__)
#define __FSC_ACK_H__
@ -29,35 +31,59 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
//
// ---------------------------------------------------------------------------
/**
* @brief Implements the FSC Acknowledgement Message.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCACK : public FSCMessage {
public:
static const uint8_t LENGTH = 6;
/// <summary>Initializes a copy instance of the FSCACK class.</summary>
/**
* @brief Initializes a copy instance of the FSCACK class.
*/
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);
/// <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;
/// <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;
public:
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);
/// <summary>Acknowledged Message Version.</summary>
/**
* @brief Acknowledged Message Version.
*/
__READONLY_PROPERTY(uint8_t, ackVersion, AckVersion);
/// <summary></summary>
/**
* @brief
*/
__READONLY_PROPERTY(uint8_t, ackCorrelationTag, AckCorrelationTag);
/// <summary>Response code.</summary>
/**
* @brief Response code.
*/
__PROPERTY(FSCAckResponseCode::E, responseCode, ResponseCode);
/// <summary>Response Data Length.</summary>
/**
* @brief Response Data Length.
*/
__PROPERTY(uint8_t, respLength, ResponseLength);
};
} // namespace fsc

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file FSCConnect.h
* @ingroup dfsi_fsc_frames
* @file FSCConnect.cpp
* @ingroup dfsi_fsc_frames
*/
#if !defined(__FSC_CONNECT_H__)
#define __FSC_CONNECT_H__
@ -29,31 +31,53 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
//
// ---------------------------------------------------------------------------
/**
* @brief Implements the FSC Connect Message.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCConnect : public FSCMessage {
public:
static const uint8_t LENGTH = 11;
/// <summary>Initializes a copy instance of the FSCConnect class.</summary>
/**
* @brief Initializes a copy instance of the FSCConnect class.
*/
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);
/// <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;
/// <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;
public:
/// <summary>Voice Conveyance RTP Port.</summary>
/**
* @brief Voice Conveyance RTP Port.
*/
__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);
/// <summary>Fixed Station Heartbeat Period.</summary>
/**
* @brief Fixed Station Heartbeat Period.
*/
__PROPERTY(uint8_t, fsHeartbeatPeriod, FSHeartbeatPeriod);
/// <summary>Host Heartbeat Period.</summary>
/**
* @brief Host Heartbeat Period.
*/
__PROPERTY(uint8_t, hostHeartbeatPeriod, HostHeartbeatPeriod);
};
} // namespace fsc

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file FSCConnectResponse.h
* @ingroup dfsi_fsc_frames
* @file FSCConnectResponse.cpp
* @ingroup dfsi_fsc_frames
*/
#if !defined(__FSC_CONNECT_RESPONSE_H__)
#define __FSC_CONNECT_RESPONSE_H__
@ -29,25 +31,41 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
//
// ---------------------------------------------------------------------------
/**
* @brief Implements the FSC Connect Response Message.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCConnectResponse : public FSCResponse {
public:
static const uint8_t LENGTH = 3;
/// <summary>Initializes a copy instance of the FSCConnectResponse class.</summary>
/**
* @brief Initializes a copy instance of the FSCConnectResponse class.
*/
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);
/// <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;
/// <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;
public:
/// <summary>Voice Conveyance RTP Port.</summary>
/**
* @brief Voice Conveyance RTP Port.
*/
__PROPERTY(uint16_t, vcBasePort, VCBasePort);
};
} // namespace fsc

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file FSCDisconnect.h
* @ingroup dfsi_fsc_frames
* @file FSCDisconnect.cpp
* @ingroup dfsi_fsc_frames
*/
#if !defined(__FSC_DISCONNECT_H__)
#define __FSC_DISCONNECT_H__
@ -29,16 +31,24 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
//
// ---------------------------------------------------------------------------
/**
* @brief Implements the FSC Disconnect Message.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCDisconnect : public FSCMessage {
public:
static const uint8_t LENGTH = 3;
/// <summary>Initializes a copy instance of the FSCDisconnect class.</summary>
/**
* @brief Initializes a copy instance of the FSCDisconnect class.
*/
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);
};
} // namespace fsc

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file FSCHeartbeat.h
* @ingroup dfsi_fsc_frames
* @file FSCHeartbeat.cpp
* @ingroup dfsi_fsc_frames
*/
#if !defined(__FSC_HEARTBEAT_H__)
#define __FSC_HEARTBEAT_H__
@ -29,16 +31,24 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
//
// ---------------------------------------------------------------------------
/**
* @brief Implements the FSC Heartbeat Message.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCHeartbeat : public FSCMessage {
public:
static const uint8_t LENGTH = 3;
/// <summary>Initializes a copy instance of the FSCHeartbeat class.</summary>
/**
* @brief Initializes a copy instance of the FSCHeartbeat class.
*/
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);
};
} // namespace fsc

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file FSCMessage.h
* @ingroup dfsi_fsc_frames
* @file FSCMessage.cpp
* @ingroup dfsi_fsc_frames
*/
#if !defined(__FSC_MESSAGE_H__)
#define __FSC_MESSAGE_H__
@ -28,29 +30,49 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
//
// ---------------------------------------------------------------------------
/**
* @brief Base class FSC messages derive from.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCMessage {
public:
static const uint8_t LENGTH = 3;
/// <summary>Initializes a copy instance of the FSCMessage class.</summary>
/**
* @brief Initializes a copy instance of the FSCMessage class.
*/
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);
/// <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);
/// <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);
public:
/// <summary>Message ID.</summary>
/**
* @brief Message ID.
*/
__PROTECTED_PROPERTY(FSCMessageType::E, messageId, MessageId);
/// <summary>Message Version.</summary>
/**
* @brief Message Version.
*/
__PROTECTED_READONLY_PROPERTY(uint8_t, version, Version);
/// <summary></summary>
/**
* @brief
*/
__PROTECTED_READONLY_PROPERTY(uint8_t, correlationTag, CorrelationTag);
};
} // namespace fsc

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

@ -1,16 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - DFSI Peer Application
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI Peer Application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file FSCResponse.h
* @ingroup dfsi_fsc_frames
* @file FSCResponse.cpp
* @ingroup dfsi_fsc_frames
*/
#if !defined(__FSC_RESPONSE_H__)
#define __FSC_RESPONSE_H__
@ -28,25 +30,41 @@ namespace p25
{
// ---------------------------------------------------------------------------
// Class Declaration
//
// ---------------------------------------------------------------------------
/**
* @brief Base class FSC response messages derive from.
* @ingroup dfsi_fsc_frames
*/
class HOST_SW_API FSCResponse {
public:
static const uint8_t LENGTH = 1;
/// <summary>Initializes a copy instance of the FSCResponse class.</summary>
/**
* @brief Initializes a copy instance of the FSCResponse class.
*/
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);
/// <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);
/// <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);
public:
/// <summary>Response Version.</summary>
/**
* @brief Response Version.
*/
__PROTECTED_READONLY_PROPERTY(uint8_t, version, Version);
};
} // namespace fsc

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

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

@ -1,17 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only
/**
* Digital Voice Modem - Modem Host Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI peer application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
#include "dfsi/Defines.h"
#include "common/network/json/json.h"
#include "common/p25/dfsi/DFSIDefines.h"
@ -27,24 +23,8 @@ using namespace network;
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// 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>
/* Initializes a new instance of the PeerNetwork class. */
DfsiPeerNetwork::DfsiPeerNetwork(const std::string& address, uint16_t port, uint16_t localPort, uint32_t peerId, const std::string& password,
bool duplex, bool debug, bool dmr, bool p25, bool nxdn, bool slot1, bool slot2, bool allowActivityTransfer, bool allowDiagnosticTransfer, bool updateLookup, bool saveLookup) :
Network(address, port, localPort, peerId, password, duplex, debug, dmr, p25, nxdn, slot1, slot2, allowActivityTransfer, allowDiagnosticTransfer, updateLookup, saveLookup)
@ -54,14 +34,8 @@ DfsiPeerNetwork::DfsiPeerNetwork(const std::string& address, uint16_t port, uint
assert(!password.empty());
}
/// <summary>
/// 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>
/* Writes P25 LDU1 frame data to the network. */
bool DfsiPeerNetwork::writeP25LDU1(const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data, P25DEF::FrameType::E frameType)
{
if (m_status != NET_STAT_RUNNING && m_status != NET_STAT_MST_RUNNING)
@ -82,13 +56,8 @@ bool DfsiPeerNetwork::writeP25LDU1(const p25::lc::LC& control, const p25::data::
return writeMaster({ NET_FUNC::PROTOCOL, NET_SUBFUNC::PROTOCOL_SUBFUNC_P25 }, message.get(), messageLength, pktSeq(resetSeq), m_p25StreamId);
}
/// <summary>
/// Writes P25 LDU2 frame data to the network.
/// </summary>
/// <param name="control"></param>
/// <param name="lsd"></param>
/// <param name="data"></param>
/// <returns></returns>
/* Writes P25 LDU2 frame data to the network. */
bool DfsiPeerNetwork::writeP25LDU2(const p25::lc::LC& control, const p25::data::LowSpeedData& lsd, const uint8_t* data)
{
if (m_status != NET_STAT_RUNNING && m_status != NET_STAT_MST_RUNNING)
@ -113,10 +82,8 @@ bool DfsiPeerNetwork::writeP25LDU2(const p25::lc::LC& control, const p25::data::
// Protected Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Writes configuration to the network.
/// </summary>
/// <returns></returns>
/* Writes configuration to the network. */
bool DfsiPeerNetwork::writeConfig()
{
if (m_loginStreamId == 0U) {
@ -178,15 +145,8 @@ bool DfsiPeerNetwork::writeConfig()
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// 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>
/* Creates an P25 LDU1 frame message. */
UInt8Array DfsiPeerNetwork::createP25_LDU1Message_Raw(uint32_t& length, const p25::lc::LC& control, const p25::data::LowSpeedData& lsd,
const uint8_t* data, P25DEF::FrameType::E frameType)
{
@ -260,14 +220,8 @@ UInt8Array DfsiPeerNetwork::createP25_LDU1Message_Raw(uint32_t& length, const p2
return UInt8Array(buffer);
}
/// <summary>
/// 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>
/* Creates an P25 LDU2 frame message. */
UInt8Array DfsiPeerNetwork::createP25_LDU2Message_Raw(uint32_t& length, const p25::lc::LC& control, const p25::data::LowSpeedData& lsd,
const uint8_t* data)
{

@ -1,17 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
/**
* Digital Voice Modem - Modem Host Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI peer application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
*
*/
* @file DfsiPeerNetwork.h
* @ingroup dfsi_network
* @file DfsiPeerNetwork.cpp
* @ingroup dfsi_network
*/
#if !defined(__DFSI_PEER_NETWORK_H__)
#define __DFSI_PEER_NETWORK_H__
@ -25,30 +27,89 @@ namespace network
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements the core peer networking logic.
// ---------------------------------------------------------------------------
/**
* @brief Implements the core peer networking logic.
* @ingroup dfsi_network
*/
class HOST_SW_API DfsiPeerNetwork : public Network {
public:
/// <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,
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,
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;
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;
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,
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,
const uint8_t* data);
};

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

@ -1,21 +1,25 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - DFSI V.24/UDP Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
*
*/
/**
* Digital Voice Modem - Modem Host Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / DFSI peer application
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
*
* Copyright (C) 2024 Patrick McDonnell, W3AXL
*
*/
* @defgroup dfsi_network DFSI Networking/Serial Communications
* @brief Implementation for the DFSI networking and serial communications.
* @ingroup dfsi
*
* @file SerialService.h
* @ingroup dfsi_network
* @file SerialService.cpp
* @ingroup dfsi_network
*/
#if !defined(__SERIAL_SERVICE_H__)
#define __SERIAL_SERVICE_H__
// DVM Includes
#include "Defines.h"
#include "common/edac/RS634717.h"
#include "common/network/RawFrameQueue.h"
@ -35,7 +39,6 @@
#include "host/modem/port/UARTPort.h"
#include "host/modem/port/ModemNullPort.h"
// System Includes
#include <string>
#include <cstdint>
#include <map>
@ -49,7 +52,10 @@ using namespace dfsi;
namespace network
{
// DFSI serial tx flags used to determine proper jitter handling of data in ringbuffer
/**
* @brief DFSI serial tx flags used to determine proper jitter handling of data in ringbuffer.
* @ingroup dfsi_network
*/
enum SERIAL_TX_TYPE {
NONIMBE,
IMBE
@ -57,29 +63,65 @@ namespace network
// ---------------------------------------------------------------------------
// Class Declaration
// Serial V24 service
// ---------------------------------------------------------------------------
/**
* @brief Implements the serial V.24 communications service.
* @ingroup dfsi_network
*/
class HOST_SW_API SerialService {
public:
/// <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);
/// <summary>Finalizes an instance of the SerialService class.</summary>
/**
* @brief Finalizes an instance of the SerialService class.
*/
~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);
/// <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();
/// <summary>Closes connection to the serial interface.</summary>
/**
* @brief Closes connection to the serial interface.
*/
void close();
// Handle P25 data from network to V24
/**
* @brief Process data frames from the network.
* @param p25Buffer Buffer containing the network frame.
* @param length Length of the buffer.
*/
void processP25FromNet(UInt8Array p25Buffer, uint32_t length);
// Handle P25 data from V24 to network
/**
* @brief Process data frames from the V.24 serial interface.
*
* This function pieces together LDU1/LDU2 messages from individual DFSI frames received over the serial port. It's
* called multiple times before an LDU is sent, and each time adds more data pieces to the LDUs.
*/
void processP25ToNet();
private:
@ -142,22 +184,66 @@ namespace network
VoiceCallData* m_rxVoiceCallData;
// Functions called by clock() to read/write from/to the serial port
/**
* @brief Read a data message from the serial interface.
* @return RESP_TYPE_DVM
*/
RESP_TYPE_DVM readSerial();
/**
* @brief Helper to write data from the P25 Tx queue to the serial interface.
*
* Very similar to the readP25Frame function.
*
* Note: the length encoded at the start does not include the length, tag, or timestamp bytes.
*
* @return int Actual number of bytes written to the serial interface.
*/
int writeSerial();
/**
* @brief Gets a frame of P25 data from the RX queue.
* @param data Buffer containing P25 data.
* @return uint32_t Size of the P25 data buffer, including leading data tag.
*/
uint32_t readP25Frame(uint8_t* data);
/**
* @brief Process a P25 LDU and add to the TX queue, timed appropriately.
* @param duid DUID.
* @param lc Instance of the dfsi::LC class.
* @param ldu Buffer containing LDU data.
*/
void writeP25Frame(P25DEF::DUID::E duid, dfsi::LC& lc, uint8_t* ldu);
// Helpers for TX stream data
/**
* @brief Send a start of stream sequence (HDU, etc) to the connected serial V24 device.
* @param lc Instance of the p25::LC class.
*/
void startOfStream(const LC& lc);
/**
* @brief Send an end of stream sequence (TDU, etc) to the connected serial V24 device.
*/
void endOfStream();
// Helper for timing TX data appropriately based on frame type
/**
* @brief Helper to add a V.24 dataframe to the P25 Tx queue with the proper timestamp and formatting.
* @param data Buffer containing V.24 data frame to send.
* @param len Length of buffer.
* @param msgType Type of message to send (used for proper jitter clocking).
*/
void addTxToQueue(uint8_t* data, uint16_t length, SERIAL_TX_TYPE msgType);
/// <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);
/**
* @brief
* @param buffer
* @param length
*/
void printDebug(const uint8_t* buffer, uint16_t length);
};
} // namespace network

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

Loading…
Cancel
Save

Powered by TurnKey Linux.