diff --git a/src/common/p25/dfsi/frames/Frames.h b/src/common/p25/dfsi/frames/Frames.h index 694eeeb5..7779b8d1 100644 --- a/src/common/p25/dfsi/frames/Frames.h +++ b/src/common/p25/dfsi/frames/Frames.h @@ -35,5 +35,6 @@ #include "common/p25/dfsi/frames/fsc/FSCReportSelModes.h" #include "common/p25/dfsi/frames/fsc/FSCDisconnect.h" #include "common/p25/dfsi/frames/fsc/FSCHeartbeat.h" +#include "common/p25/dfsi/frames/fsc/FSCSelChannel.h" #endif // __DFSI_FRAMES_H__ \ No newline at end of file diff --git a/src/common/p25/dfsi/frames/fsc/FSCConnect.h b/src/common/p25/dfsi/frames/fsc/FSCConnect.h index 9dc3d60e..f199ba05 100644 --- a/src/common/p25/dfsi/frames/fsc/FSCConnect.h +++ b/src/common/p25/dfsi/frames/fsc/FSCConnect.h @@ -58,7 +58,7 @@ namespace p25 * @param[out] data Buffer to encode a FSCConnect. */ void encode(uint8_t* data) override; - + public: /** * @brief Voice Conveyance RTP Port. diff --git a/src/common/p25/dfsi/frames/fsc/FSCMessage.cpp b/src/common/p25/dfsi/frames/fsc/FSCMessage.cpp index 978363d1..cc640c2f 100644 --- a/src/common/p25/dfsi/frames/fsc/FSCMessage.cpp +++ b/src/common/p25/dfsi/frames/fsc/FSCMessage.cpp @@ -86,14 +86,13 @@ std::unique_ptr FSCMessage::createMessage(const uint8_t* data) case FSCMessageType::FSC_REPORT_SEL_MODES: message = new FSCReportSelModes(); break; + case FSCMessageType::FSC_SEL_CHAN: + message = new FSCSelChannel(); + break; case FSCMessageType::FSC_DISCONNECT: message = new FSCDisconnect(); break; - case FSCMessageType::FSC_SEL_CHAN: - message = new FSCMessage(); - break; - default: LogError(LOG_P25, "FSCMessage::createMessage(), unknown message value, messageId = $%02X", messageId); break; diff --git a/src/common/p25/dfsi/frames/fsc/FSCSelChannel.cpp b/src/common/p25/dfsi/frames/fsc/FSCSelChannel.cpp new file mode 100644 index 00000000..6b97b856 --- /dev/null +++ b/src/common/p25/dfsi/frames/fsc/FSCSelChannel.cpp @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - Common Library + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2025 Bryan Biedenkapp, N2PLL + * + */ +#include "common/p25/dfsi/frames/fsc/FSCSelChannel.h" +#include "common/p25/dfsi/DFSIDefines.h" +#include "common/Utils.h" +#include "common/Log.h" + +#include +#include + +using namespace p25::dfsi; +using namespace p25::dfsi::frames; +using namespace p25::dfsi::frames::fsc; + +// --------------------------------------------------------------------------- +// Public Class Members +// --------------------------------------------------------------------------- + +/* Initializes a instance of the FSCSelChannel class. */ + +FSCSelChannel::FSCSelChannel() : FSCMessage(), + m_rxChan(1U), + m_txChan(1U) +{ + m_messageId = FSCMessageType::FSC_SEL_CHAN; +} + +/* Decode a FSC select channel frame. */ + +bool FSCSelChannel::decode(const uint8_t* data) +{ + assert(data != nullptr); + FSCMessage::decode(data); + + m_rxChan = data[3U]; // Receive Channel + m_txChan = data[4U]; // Transmit Channel + + return true; +} + +/* Encode a FSC select channel frame. */ + +void FSCSelChannel::encode(uint8_t* data) +{ + assert(data != nullptr); + FSCMessage::encode(data); + + data[3U] = m_rxChan; // Receive Channel + data[4U] = m_txChan; // Transmit Channel +} diff --git a/src/common/p25/dfsi/frames/fsc/FSCSelChannel.h b/src/common/p25/dfsi/frames/fsc/FSCSelChannel.h new file mode 100644 index 00000000..31727576 --- /dev/null +++ b/src/common/p25/dfsi/frames/fsc/FSCSelChannel.h @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Digital Voice Modem - Common Library + * GPLv2 Open Source. Use is subject to license terms. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright (C) 2025 Bryan Biedenkapp, N2PLL + * + */ +/** + * @file FSCReportSelModes.h + * @ingroup dfsi_fsc_frames + * @file FSCReportSelModes.cpp + * @ingroup dfsi_fsc_frames + */ +#if !defined(__FSC_SEL_CHANNEL_H__) +#define __FSC_SEL_CHANNEL_H__ + +#include "Defines.h" +#include "common/Defines.h" +#include "common/Log.h" +#include "common/Utils.h" +#include "common/p25/dfsi/frames/FrameDefines.h" +#include "common/p25/dfsi/frames/fsc/FSCMessage.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + namespace fsc + { + // --------------------------------------------------------------------------- + // Class Declaration + // --------------------------------------------------------------------------- + + /** + * @brief Implements the FSC Select Channel Message. + * @ingroup dfsi_fsc_frames + */ + class HOST_SW_API FSCSelChannel : public FSCMessage { + public: + static const uint8_t LENGTH = 3U; + + /** + * @brief Initializes a copy instance of the FSCSelChannel class. + */ + FSCSelChannel(); + + /** + * @brief Decode a FSC select channel frame. + * @param[in] data Buffer to containing FSCSelChannel to decode. + */ + bool decode(const uint8_t* data) override; + /** + * @brief Encode a FSC select channel frame. + * @param[out] data Buffer to encode a FSCSelChannel. + */ + void encode(uint8_t* data) override; + + public: + /** + * @brief Receive Channel Number. + */ + __PROPERTY(uint8_t, rxChan, RxChan); + /** + * @brief Transmit Channel Number. + */ + __PROPERTY(uint8_t, txChan, TxChan); + }; + } // namespace fsc + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __FSC_SEL_CHANNEL_H__ \ No newline at end of file