diff --git a/src/common/p25/lc/tsbk/mbt/MBT_ISP_TELE_INT_DIAL_REQ.cpp b/src/common/p25/lc/tsbk/mbt/MBT_ISP_TELE_INT_DIAL_REQ.cpp index f87ef53e..6f2c51aa 100644 --- a/src/common/p25/lc/tsbk/mbt/MBT_ISP_TELE_INT_DIAL_REQ.cpp +++ b/src/common/p25/lc/tsbk/mbt/MBT_ISP_TELE_INT_DIAL_REQ.cpp @@ -21,6 +21,12 @@ using namespace p25::lc::tsbk; #include #include +// --------------------------------------------------------------------------- +// Public Class Members +// --------------------------------------------------------------------------- + +/* Initializes a new instance of the MBT_ISP_TELE_INT_DIAL_REQ class. */ + MBT_ISP_TELE_INT_DIAL_REQ::MBT_ISP_TELE_INT_DIAL_REQ() : AMBT(), m_digitCount(0U), m_duplex(false), @@ -30,18 +36,22 @@ MBT_ISP_TELE_INT_DIAL_REQ::MBT_ISP_TELE_INT_DIAL_REQ() : AMBT(), ::memset(m_digits, 0x0FU, MAX_DIGITS); } +/* Decode a standard multi-block trunking signalling block. */ + bool MBT_ISP_TELE_INT_DIAL_REQ::decodeMBT(const data::DataHeader& dataHeader, const data::DataBlock* blocks) { assert(blocks != nullptr); - if (dataHeader.getFormat() != PDUFormatType::UNCONFIRMED || - dataHeader.getSAP() != PDUSAP::TRUNK_CTRL || dataHeader.getOutbound()) { + if (dataHeader.getFormat() != PDUFormatType::UNCONFIRMED || dataHeader.getSAP() != PDUSAP::TRUNK_CTRL || dataHeader.getOutbound()) { LogError(LOG_P25, "MBT_ISP_TELE_INT_DIAL_REQ::decodeMBT(), invalid PDU header"); return false; } - DECLARE_UINT8_ARRAY(pduUserData, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()); - if (!AMBT::decode(dataHeader, blocks, pduUserData)) + DECLARE_UINT8_ARRAY(pduUserData, + P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()); + + bool ret = AMBT::decode(dataHeader, blocks, pduUserData); + if (!ret) return false; if (m_lco != TSBKO::IOSP_TELE_INT_DIAL) { @@ -69,13 +79,14 @@ bool MBT_ISP_TELE_INT_DIAL_REQ::decodeMBT(const data::DataHeader& dataHeader, co ::memset(m_digits, 0x0FU, MAX_DIGITS); for (uint8_t i = 0U; i < m_digitCount; i++) { const uint32_t octet = 3U + (i / 2U); - m_digits[i] = ((i & 1U) == 0U) ? - ((pduUserData[octet] >> 4) & 0x0FU) : (pduUserData[octet] & 0x0FU); + m_digits[i] = ((i & 1U) == 0U) ? ((pduUserData[octet] >> 4) & 0x0FU) : (pduUserData[octet] & 0x0FU); } return true; } +/* Encode a standard multi-block trunking signalling block. */ + void MBT_ISP_TELE_INT_DIAL_REQ::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData) { assert(pduUserData != nullptr); @@ -123,11 +134,15 @@ void MBT_ISP_TELE_INT_DIAL_REQ::encodeMBT(data::DataHeader& dataHeader, uint8_t* edac::CRC::addCRC32(pduUserData, length); } +/* Returns a string that represents the current MBT. */ + std::string MBT_ISP_TELE_INT_DIAL_REQ::toString(bool isp) { return std::string("TSBKO, ISP_TELE_INT_DIAL_REQ (Telephone Interconnect Request - Explicit Dialing)"); } +/* Copies the encoded four-bit dial digit values to the supplied buffer. */ + uint8_t MBT_ISP_TELE_INT_DIAL_REQ::getDialDigits(uint8_t* digits) const { assert(digits != nullptr); @@ -136,6 +151,8 @@ uint8_t MBT_ISP_TELE_INT_DIAL_REQ::getDialDigits(uint8_t* digits) const return m_digitCount; } +/* Sets encoded four-bit dial digit values. */ + bool MBT_ISP_TELE_INT_DIAL_REQ::setDialDigits(const uint8_t* digits, uint8_t count) { assert(digits != nullptr); diff --git a/src/common/p25/lc/tsbk/mbt/MBT_ISP_TELE_INT_DIAL_REQ.h b/src/common/p25/lc/tsbk/mbt/MBT_ISP_TELE_INT_DIAL_REQ.h index 24ff1215..5d9e6b37 100644 --- a/src/common/p25/lc/tsbk/mbt/MBT_ISP_TELE_INT_DIAL_REQ.h +++ b/src/common/p25/lc/tsbk/mbt/MBT_ISP_TELE_INT_DIAL_REQ.h @@ -7,6 +7,12 @@ * Copyright (C) 2026 Bryan Biedenkapp, N2PLL * */ +/** + * @file MBT_ISP_TELE_INT_DIAL_REQ.h + * @ingroup p25_ambt + * @file MBT_ISP_TELE_INT_DIAL_REQ.cpp + * @ingroup p25_ambt + */ #if !defined(__P25_LC_TSBK__MBT_ISP_TELE_INT_DIAL_REQ_H__) #define __P25_LC_TSBK__MBT_ISP_TELE_INT_DIAL_REQ_H__ @@ -19,6 +25,10 @@ namespace p25 { namespace tsbk { + // --------------------------------------------------------------------------- + // Class Declaration + // --------------------------------------------------------------------------- + /** * @brief Implements TELE INT DIAL REQ - Telephone Interconnect Request, * Explicit Dialing (standard unconfirmed MBT format). @@ -26,21 +36,57 @@ namespace p25 */ class DVM_COMMON_API MBT_ISP_TELE_INT_DIAL_REQ : public AMBT { public: + /** + * @brief Initializes a new instance of the MBT_ISP_TELE_INT_DIAL_REQ class. + */ MBT_ISP_TELE_INT_DIAL_REQ(); + /** + * @brief Decode a standard multi-block trunking signalling block. + * @param[in] dataHeader P25 PDU data header + * @param[in] blocks P25 PDU data blocks + * @returns bool True, if MBT decoded, otherwise false. + */ bool decodeMBT(const data::DataHeader& dataHeader, const data::DataBlock* blocks) override; + /** + * @brief Encode a standard multi-block trunking signalling block. + * @param[out] dataHeader P25 PDU data header + * @param[out] pduUserData P25 PDU user data + */ void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData) override; + /** + * @brief Returns a string that represents the current MBT. + * @returns std::string String representation of the MBT. + */ std::string toString(bool isp = false) override; - /** @brief Copies the encoded four-bit dial digit values to the supplied buffer. */ + /** + * @brief Copies the encoded four-bit dial digit values to the supplied buffer. + * @param[out] digits Buffer containing dial digit values. + * @returns uint8_t Number of dial digit values copied. + */ uint8_t getDialDigits(uint8_t* digits) const; - /** @brief Sets encoded four-bit dial digit values. */ + /** + * @brief Sets encoded four-bit dial digit values. + * @param[in] digits Buffer containing dial digit values. + * @param count Number of dial digit values. + * @returns bool True, if the digit values were set, otherwise false. + */ bool setDialDigits(const uint8_t* digits, uint8_t count); public: + /** + * @brief Number of dial digit values. + */ DECLARE_PROTECTED_RO_PROPERTY(uint8_t, digitCount, DigitCount); + /** + * @brief Flag indicating full-duplex service. + */ DECLARE_PROPERTY(bool, duplex, Duplex); + /** + * @brief Flag indicating packet-mode service. + */ DECLARE_PROPERTY(bool, packetMode, PacketMode); private: