diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 758ef778..7ae97836 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -21,6 +21,8 @@ file(GLOB common_SRC "src/common/p25/acl/*.cpp" "src/common/p25/data/*.cpp" "src/common/p25/dfsi/*.cpp" + "src/common/p25/dfsi/frames/*.cpp" + "src/common/p25/dfsi/frames/fsc/*.cpp" "src/common/p25/lc/*.cpp" "src/common/p25/lc/tdulc/*.cpp" "src/common/p25/lc/tsbk/*.cpp" @@ -63,6 +65,8 @@ file(GLOB common_INCLUDE "src/common/p25/acl/*.h" "src/common/p25/data/*.h" "src/common/p25/dfsi/*.h" + "src/common/p25/dfsi/frames/*.h" + "src/common/p25/dfsi/frames/fsc/*.h" "src/common/p25/lc/*.h" "src/common/p25/lc/tdulc/*.h" "src/common/p25/lc/tsbk/*.h" diff --git a/src/dfsi/frames/BlockHeader.cpp b/src/common/p25/dfsi/frames/BlockHeader.cpp similarity index 95% rename from src/dfsi/frames/BlockHeader.cpp rename to src/common/p25/dfsi/frames/BlockHeader.cpp index eaf5d52a..01e56f29 100644 --- a/src/dfsi/frames/BlockHeader.cpp +++ b/src/common/p25/dfsi/frames/BlockHeader.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/BlockHeader.h" +#include "common/p25/dfsi/frames/BlockHeader.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -17,6 +17,7 @@ using namespace p25; using namespace p25::dfsi; +using namespace p25::dfsi::frames; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/BlockHeader.h b/src/common/p25/dfsi/frames/BlockHeader.h new file mode 100644 index 00000000..b56c54e3 --- /dev/null +++ b/src/common/p25/dfsi/frames/BlockHeader.h @@ -0,0 +1,106 @@ +// 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) 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__ + +#include "Defines.h" +#include "common/Defines.h" +#include "common/Log.h" +#include "common/Utils.h" +#include "common/p25/dfsi/frames/FrameDefines.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + // --------------------------------------------------------------------------- + // Class Declaration + // --------------------------------------------------------------------------- + + /** + * @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; + + /** + * @brief Initializes a copy instance of the BlockHeader class. + */ + BlockHeader(); + /** + * @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); + + /** + * @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); + /** + * @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: + /** + * @brief Payload type. + * This simple boolean marks this header as either IANA standard, or profile specific. + */ + __PROPERTY(bool, payloadType, PayloadType); + /** + * @brief Block type. + */ + __PROPERTY(BlockType::E, blockType, BlockType); + /** + * @brief Timestamp Offset. + */ + __PROPERTY(uint16_t, timestampOffset, TimestampOffset); + /** + * @brief Block length. + */ + __PROPERTY(uint16_t, blockLength, BlockLength); + }; + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __BLOCK_HEADER_H__ \ No newline at end of file diff --git a/src/dfsi/frames/ControlOctet.cpp b/src/common/p25/dfsi/frames/ControlOctet.cpp similarity index 92% rename from src/dfsi/frames/ControlOctet.cpp rename to src/common/p25/dfsi/frames/ControlOctet.cpp index 264561b6..0308b526 100644 --- a/src/dfsi/frames/ControlOctet.cpp +++ b/src/common/p25/dfsi/frames/ControlOctet.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/ControlOctet.h" +#include "common/p25/dfsi/frames/ControlOctet.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -17,6 +17,7 @@ using namespace p25; using namespace p25::dfsi; +using namespace p25::dfsi::frames; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/ControlOctet.h b/src/common/p25/dfsi/frames/ControlOctet.h new file mode 100644 index 00000000..308ec2e4 --- /dev/null +++ b/src/common/p25/dfsi/frames/ControlOctet.h @@ -0,0 +1,89 @@ +// 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) 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__ + +#include "Defines.h" +#include "common/Defines.h" +#include "common/Log.h" +#include "common/Utils.h" +#include "common/p25/dfsi/frames/FrameDefines.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + // --------------------------------------------------------------------------- + // Class Declaration + // --------------------------------------------------------------------------- + + /** + * @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; + + /** + * @brief Initializes a copy instance of the ControlOctet class. + */ + ControlOctet(); + /** + * @brief Initializes a copy instance of the ControlOctet class. + * @param data Buffer to containing ControlOctet to decode. + */ + ControlOctet(uint8_t* data); + + /** + * @brief Decode a control octet frame. + * @param[in] data Buffer to containing ControlOctet to decode. + */ + bool decode(const uint8_t* data); + /** + * @brief Encode a control octet frame. + * @param[out] data Buffer to encode a ControlOctet. + */ + void encode(uint8_t* data); + + public: + /** + * @brief + */ + __PROPERTY(bool, signal, Signal); + /** + * @brief Indicates a compact (1) or verbose (0) block header. + */ + __PROPERTY(bool, compact, Compact); + /** + * @brief Number of block headers following this control octet. + */ + __PROPERTY(uint8_t, blockHeaderCnt, BlockHeaderCnt); + }; + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __CONTROL_OCTET_H__ \ No newline at end of file diff --git a/src/common/p25/dfsi/frames/FrameDefines.h b/src/common/p25/dfsi/frames/FrameDefines.h new file mode 100644 index 00000000..b78991b8 --- /dev/null +++ b/src/common/p25/dfsi/frames/FrameDefines.h @@ -0,0 +1,145 @@ +// 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) 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__ + +#include "common/Defines.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + // --------------------------------------------------------------------------- + // Constants + // --------------------------------------------------------------------------- + + /** + * @addtogroup dfsi_frames + * @{ + */ + + /** @brief FSC Control Service Message.*/ + namespace FSCMessageType { + /** @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_DISCONNECT = 9, //! Detach Control Service. + + FSC_INVALID = 127, //! Invalid Control Message. + }; + } + + /** @brief FSC ACK/NAK Codes. */ + namespace FSCAckResponseCode { + /** @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. + }; + } + + /** @brief DFSI Block Types */ + namespace BlockType { + /** @brief DFSI Block Types */ + enum E : uint8_t { + FULL_RATE_VOICE = 0, //! Full Rate Voice + + VOICE_HEADER_P1 = 6, //! Voice Header 1 + VOICE_HEADER_P2 = 7, //! Voice Header 2 + + START_OF_STREAM = 9, //! Start of Stream + END_OF_STREAM = 10, //! End of Stream + + UNDEFINED = 127 //! Undefined + }; + } + + /** @brief RT/RT Flag */ + namespace RTFlag { + /** @brief RT/RT Flag */ + enum E : uint8_t { + ENABLED = 0x02U, //! RT/RT Enabled + DISABLED = 0x04U //! RT/RT Disabled + }; + } + + /** @brief Start/Stop Flag */ + namespace StartStopFlag { + /** @brief Start/Stop Flag */ + enum E : uint8_t { + START = 0x0CU, //! Start + STOP = 0x25U //! Stop + }; + } + + /** @brief V.24 Data Stream Type */ + namespace StreamTypeFlag { + /** @brief V.24 Data Stream Type */ + enum E : uint8_t { + VOICE = 0x0BU //! Voice + }; + } + + /** @brief RSSI Data Validity */ + namespace RssiValidityFlag { + /** @brief RSSI Data Validity */ + enum E : uint8_t { + INVALID = 0x00U, //! Invalid + VALID = 0x1A //! Valid + }; + } + + /** @brief V.24 Data Source */ + namespace SourceFlag { + /** @brief V.24 Data Source */ + enum E : uint8_t { + DIU = 0x00U, //! DIU + QUANTAR = 0x02U //! Quantar + }; + } + + /** @brief */ + namespace ICWFlag { + /** @brief */ + enum E : uint8_t { + DIU = 0x00U, //! DIU + QUANTAR = 0x1B //! Quantar + }; + } + /** @} */ + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __FRAME_DEFINES_H__ diff --git a/src/common/p25/dfsi/frames/Frames.h b/src/common/p25/dfsi/frames/Frames.h new file mode 100644 index 00000000..803c981e --- /dev/null +++ b/src/common/p25/dfsi/frames/Frames.h @@ -0,0 +1,38 @@ +// 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) 2024 Patrick McDonnell, W3AXL + * Copyright (C) 2024 Bryan Biedenkapp, N2PLL + * + */ +#if !defined(__DFSI_FRAMES_H__) +#define __DFSI_FRAMES_H__ + +#include "Defines.h" + +// TIA +#include "common/p25/dfsi/frames/StartOfStream.h" +#include "common/p25/dfsi/frames/ControlOctet.h" +#include "common/p25/dfsi/frames/BlockHeader.h" +#include "common/p25/dfsi/frames/FullRateVoice.h" + +// "The" Manufacturer +#include "common/p25/dfsi/frames/MotFullRateVoice.h" +#include "common/p25/dfsi/frames/MotStartOfStream.h" +#include "common/p25/dfsi/frames/MotStartVoiceFrame.h" +#include "common/p25/dfsi/frames/MotVoiceHeader1.h" +#include "common/p25/dfsi/frames/MotVoiceHeader2.h" + +// FSC +#include "common/p25/dfsi/frames/fsc/FSCMessage.h" +#include "common/p25/dfsi/frames/fsc/FSCResponse.h" +#include "common/p25/dfsi/frames/fsc/FSCACK.h" +#include "common/p25/dfsi/frames/fsc/FSCConnect.h" +#include "common/p25/dfsi/frames/fsc/FSCConnectResponse.h" +#include "common/p25/dfsi/frames/fsc/FSCDisconnect.h" +#include "common/p25/dfsi/frames/fsc/FSCHeartbeat.h" + +#endif // __DFSI_FRAMES_H__ \ No newline at end of file diff --git a/src/dfsi/frames/FullRateVoice.cpp b/src/common/p25/dfsi/frames/FullRateVoice.cpp similarity index 97% rename from src/dfsi/frames/FullRateVoice.cpp rename to src/common/p25/dfsi/frames/FullRateVoice.cpp index 9008a799..f8b1ed56 100644 --- a/src/dfsi/frames/FullRateVoice.cpp +++ b/src/common/p25/dfsi/frames/FullRateVoice.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/FullRateVoice.h" +#include "common/p25/dfsi/frames/FullRateVoice.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -18,6 +18,7 @@ using namespace p25; using namespace p25::dfsi; using namespace p25::dfsi::defines; +using namespace p25::dfsi::frames; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/FullRateVoice.h b/src/common/p25/dfsi/frames/FullRateVoice.h new file mode 100644 index 00000000..a3696bb0 --- /dev/null +++ b/src/common/p25/dfsi/frames/FullRateVoice.h @@ -0,0 +1,259 @@ +// 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) 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__ + +#include "Defines.h" +#include "common/Defines.h" +#include "common/p25/dfsi/DFSIDefines.h" +#include "common/Log.h" +#include "common/Utils.h" +#include "common/p25/dfsi/frames/FrameDefines.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + // --------------------------------------------------------------------------- + // Class Declaration + // --------------------------------------------------------------------------- + + /** + * @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; + + /** + * @brief Initializes a copy instance of the FullRateVoice class. + */ + FullRateVoice(); + /** + * @brief Initializes a copy instance of the FullRateVoice class. + * @param data Buffer to containing FullRateVoice to decode. + */ + FullRateVoice(uint8_t* data); + /** + * @brief Finalizes a instance of the FullRateVoice class. + */ + ~FullRateVoice(); + + /** + * @brief Decode a full rate voice frame. + * @param[in] data Buffer to containing FullRateVoice to decode. + */ + bool decode(const uint8_t* data); + /** + * @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 + + /** + * @brief Frame Type. + */ + __PROPERTY(defines::DFSIFrameType::E, frameType, FrameType); + /** + * @brief Total errors detected in the frame. + */ + __PROPERTY(uint8_t, totalErrors, TotalErrors); + /** + * @brief Flag indicating the frame should be muted. + */ + __PROPERTY(bool, muteFrame, MuteFrame); + /** + * @brief Flag indicating the frame was lost. + */ + __PROPERTY(bool, lostFrame, LostFrame); + /** + * @brief Superframe Counter. + */ + __PROPERTY(uint8_t, superframeCnt, SuperframeCnt); + /** + * @brief Busy Status. + */ + __PROPERTY(uint8_t, busy, Busy); + + private: + /** + * @brief Helper indicating if the frame is voice 3 through 8. + * @returns bool True, if frame is voice 3 through 8, otherwise false. + */ + bool isVoice3thru8(); + /** + * @brief Helper indicating if the frame is voice 12 through 17. + * @returns bool True, if frame is voice 12 through 17, otherwise false. + */ + bool isVoice12thru17(); + /** + * @brief Helper indicating if the frame is voice 9 or 10. + * @returns bool True, if frame is voice 9, or 10, otherwise false. + */ + bool isVoice9or10(); + }; + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __FULL_RATE_VOICE_H__ \ No newline at end of file diff --git a/src/dfsi/frames/MotFullRateVoice.cpp b/src/common/p25/dfsi/frames/MotFullRateVoice.cpp similarity index 97% rename from src/dfsi/frames/MotFullRateVoice.cpp rename to src/common/p25/dfsi/frames/MotFullRateVoice.cpp index 403bebed..542ff327 100644 --- a/src/dfsi/frames/MotFullRateVoice.cpp +++ b/src/common/p25/dfsi/frames/MotFullRateVoice.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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. * @@ -8,7 +8,7 @@ * Copyright (C) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/MotFullRateVoice.h" +#include "common/p25/dfsi/frames/MotFullRateVoice.h" #include "common/p25/P25Defines.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" @@ -21,6 +21,7 @@ using namespace p25; using namespace p25::defines; using namespace p25::dfsi; using namespace p25::dfsi::defines; +using namespace p25::dfsi::frames; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/MotFullRateVoice.h b/src/common/p25/dfsi/frames/MotFullRateVoice.h new file mode 100644 index 00000000..1def57cf --- /dev/null +++ b/src/common/p25/dfsi/frames/MotFullRateVoice.h @@ -0,0 +1,127 @@ +// 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) 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__ + +#include "Defines.h" +#include "common/Defines.h" +#include "common/p25/dfsi/DFSIDefines.h" +#include "common/Log.h" +#include "common/Utils.h" +#include "common/p25/dfsi/frames/FrameDefines.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + // --------------------------------------------------------------------------- + // Class Declaration + // --------------------------------------------------------------------------- + + /** + * @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 = 14; + static const uint8_t ADDITIONAL_LENGTH = 4; + + /** + * @brief Initializes a copy instance of the MotFullRateVoice class. + */ + MotFullRateVoice(); + /** + * @brief Initializes a copy instance of the MotFullRateVoice class. + * @param data Buffer to containing MotFullRateVoice to decode. + */ + MotFullRateVoice(uint8_t* data); + /** + * @brief Finalizes a instance of the MotFullRateVoice class. + */ + ~MotFullRateVoice(); + + /** + * @brief + */ + uint32_t size(); + /** + * @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); + /** + * @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 + + /** + * @brief Frame Type. + */ + __PROPERTY(defines::DFSIFrameType::E, frameType, FrameType); + /** + * @brief V.24 Data Source. + */ + __PROPERTY(SourceFlag::E, source, Source); + + private: + /** + * @brief Helper indicating if the frame is voice 1, 2, 10 or 11. + * @returns bool True, if frame is voice 1, 2, 10, or 11, otherwise false. + */ + bool isVoice1or2or10or11(); + /** + * @brief Helper indicating if the frame is voice 2 or 11. + * @returns bool True, if frame is voice 2, or 11, otherwise false. + */ + bool isVoice2or11(); + /** + * @brief Helper indicating if the frame is voice 9 or 18. + * @returns bool True, if frame is voice 9, or 18, otherwise false. + */ + bool isVoice9or18(); + }; + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __MOT_FULL_RATE_VOICE_H__ \ No newline at end of file diff --git a/src/dfsi/frames/MotStartOfStream.cpp b/src/common/p25/dfsi/frames/MotStartOfStream.cpp similarity index 93% rename from src/dfsi/frames/MotStartOfStream.cpp rename to src/common/p25/dfsi/frames/MotStartOfStream.cpp index aa3516ff..0ce7e6cd 100644 --- a/src/dfsi/frames/MotStartOfStream.cpp +++ b/src/common/p25/dfsi/frames/MotStartOfStream.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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. * @@ -8,7 +8,7 @@ * Copyright (C) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/MotStartOfStream.h" +#include "common/p25/dfsi/frames/MotStartOfStream.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -19,6 +19,7 @@ using namespace p25; using namespace p25::dfsi; using namespace p25::dfsi::defines; +using namespace p25::dfsi::frames; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/MotStartOfStream.h b/src/common/p25/dfsi/frames/MotStartOfStream.h new file mode 100644 index 00000000..73e898d2 --- /dev/null +++ b/src/common/p25/dfsi/frames/MotStartOfStream.h @@ -0,0 +1,99 @@ +// 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) 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__ + +#include "Defines.h" +#include "common/Defines.h" +#include "common/Log.h" +#include "common/Utils.h" +#include "common/p25/dfsi/frames/FrameDefines.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + // --------------------------------------------------------------------------- + // Class Declaration + // --------------------------------------------------------------------------- + + /** + * @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; + + /** + * @brief Initializes a copy instance of the MotStartOfStream class. + */ + MotStartOfStream(); + /** + * @brief Initializes a copy instance of the MotStartOfStream class. + * @param data Buffer to containing MotStartOfStream to decode. + */ + MotStartOfStream(uint8_t* data); + + /** + * @brief Decode a start of stream frame. + * @param[in] data Buffer to containing MotStartOfStream to decode. + */ + bool decode(const uint8_t* data); + /** + * @brief Encode a start of stream frame. + * @param[out] data Buffer to encode a MotStartOfStream. + */ + void encode(uint8_t* data); + + public: + /** + * @brief + */ + __PROPERTY(uint8_t, marker, Marker); + /** + * @brief RT/RT Flag. + */ + __PROPERTY(RTFlag::E, rt, RT); + /** + * @brief Start/Stop. + */ + __PROPERTY(StartStopFlag::E, startStop, StartStop); + /** + * @brief Stream Type. + */ + __PROPERTY(StreamTypeFlag::E, streamType, StreamType); + }; + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __MOT_START_OF_STREAM_H__ \ No newline at end of file diff --git a/src/dfsi/frames/MotStartVoiceFrame.cpp b/src/common/p25/dfsi/frames/MotStartVoiceFrame.cpp similarity index 96% rename from src/dfsi/frames/MotStartVoiceFrame.cpp rename to src/common/p25/dfsi/frames/MotStartVoiceFrame.cpp index 4519e189..91070f4f 100644 --- a/src/dfsi/frames/MotStartVoiceFrame.cpp +++ b/src/common/p25/dfsi/frames/MotStartVoiceFrame.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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. * @@ -8,7 +8,7 @@ * Copyright (C) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/MotStartVoiceFrame.h" +#include "common/p25/dfsi/frames/MotStartVoiceFrame.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -19,6 +19,7 @@ using namespace p25; using namespace p25::dfsi; using namespace p25::dfsi::defines; +using namespace p25::dfsi::frames; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/MotStartVoiceFrame.h b/src/common/p25/dfsi/frames/MotStartVoiceFrame.h new file mode 100644 index 00000000..0c7d3713 --- /dev/null +++ b/src/common/p25/dfsi/frames/MotStartVoiceFrame.h @@ -0,0 +1,117 @@ +// 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) 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__ + +#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/MotStartOfStream.h" +#include "common/p25/dfsi/frames/MotFullRateVoice.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + // --------------------------------------------------------------------------- + // Class Declaration + // --------------------------------------------------------------------------- + + /** + * @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; + + /** + * @brief Initializes a copy instance of the MotStartVoiceFrame class. + */ + MotStartVoiceFrame(); + /** + * @brief Initializes a copy instance of the MotStartVoiceFrame class. + * @param data Buffer to containing MotStartVoiceFrame to decode. + */ + MotStartVoiceFrame(uint8_t* data); + /** + * @brief Finalizes a instance of the MotStartVoiceFrame class. + */ + ~MotStartVoiceFrame(); + + /** + * @brief Decode a start voice frame. + * @param[in] data Buffer to containing MotStartVoiceFrame to decode. + */ + bool decode(const uint8_t* data); + /** + * @brief Encode a start voice frame. + * @param[out] data Buffer to encode a MotStartVoiceFrame. + */ + void encode(uint8_t* data); + + public: + MotStartOfStream* startOfStream; // ?? - this should probably be private with getters/setters + MotFullRateVoice* fullRateVoice; // ?? - this should probably be private with getters/setters + + /** + * @brief + */ + __PROPERTY(ICWFlag::E, icw, ICW); + /** + * @brief RSSI Value. + */ + __PROPERTY(uint8_t, rssi, RSSI); + /** + * @brief Flag indicating whether or not the RSSI field is valid. + */ + __PROPERTY(RssiValidityFlag::E, rssiValidity, RSSIValidity); + /** + * @brief + */ + __PROPERTY(uint8_t, nRssi, NRSSI); + /** + * @brief + */ + __PROPERTY(uint8_t, adjMM, AdjMM); + }; + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __MOT_START_VOICE_FRAME_H__ \ No newline at end of file diff --git a/src/dfsi/frames/MotVoiceHeader1.cpp b/src/common/p25/dfsi/frames/MotVoiceHeader1.cpp similarity index 96% rename from src/dfsi/frames/MotVoiceHeader1.cpp rename to src/common/p25/dfsi/frames/MotVoiceHeader1.cpp index 3490d82b..908cd831 100644 --- a/src/dfsi/frames/MotVoiceHeader1.cpp +++ b/src/common/p25/dfsi/frames/MotVoiceHeader1.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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. * @@ -8,7 +8,7 @@ * Copyright (C) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/MotVoiceHeader1.h" +#include "common/p25/dfsi/frames/MotVoiceHeader1.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -19,6 +19,7 @@ using namespace p25; using namespace p25::dfsi; using namespace p25::dfsi::defines; +using namespace p25::dfsi::frames; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/MotVoiceHeader1.h b/src/common/p25/dfsi/frames/MotVoiceHeader1.h new file mode 100644 index 00000000..37cdc3cd --- /dev/null +++ b/src/common/p25/dfsi/frames/MotVoiceHeader1.h @@ -0,0 +1,117 @@ +// 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) 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__ + +#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/MotStartOfStream.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + // --------------------------------------------------------------------------- + // Class Declaration + // --------------------------------------------------------------------------- + + /** + * @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; + + /** + * @brief Initializes a copy instance of the MotVoiceHeader1 class. + */ + MotVoiceHeader1(); + /** + * @brief Initializes a copy instance of the MotVoiceHeader1 class. + * @param data Buffer to containing MotVoiceHeader1 to decode. + */ + MotVoiceHeader1(uint8_t* data); + /** + * @brief Finalizes a instance of the MotVoiceHeader1 class. + */ + ~MotVoiceHeader1(); + + /** + * @brief Decode a voice header 1 frame. + * @param[in] data Buffer to containing MotVoiceHeader1 to decode. + */ + bool decode(const uint8_t* data); + /** + * @brief Encode a voice header 1 frame. + * @param[out] data Buffer to encode a MotVoiceHeader1. + */ + void encode(uint8_t* data); + + public: + uint8_t* header; // ?? - this should probably be private with getters/setters + MotStartOfStream* startOfStream; // ?? - this should probably be private with getters/setters + + /** + * @brief + */ + __PROPERTY(ICWFlag::E, icw, ICW); + /** + * @brief RSSI Value. + */ + __PROPERTY(uint8_t, rssi, RSSI); + /** + * @brief Flag indicating whether or not the RSSI field is valid. + */ + __PROPERTY(RssiValidityFlag::E, rssiValidity, RSSIValidity); + /** + * @brief + */ + __PROPERTY(uint8_t, nRssi, NRSSI); + }; + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __MOT_VOICE_HEADER_1_H__ \ No newline at end of file diff --git a/src/dfsi/frames/MotVoiceHeader2.cpp b/src/common/p25/dfsi/frames/MotVoiceHeader2.cpp similarity index 93% rename from src/dfsi/frames/MotVoiceHeader2.cpp rename to src/common/p25/dfsi/frames/MotVoiceHeader2.cpp index e44f0457..0bfd227b 100644 --- a/src/dfsi/frames/MotVoiceHeader2.cpp +++ b/src/common/p25/dfsi/frames/MotVoiceHeader2.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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. * @@ -8,7 +8,7 @@ * Copyright (C) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/MotVoiceHeader2.h" +#include "common/p25/dfsi/frames/MotVoiceHeader2.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -19,6 +19,7 @@ using namespace p25; using namespace p25::dfsi; using namespace p25::dfsi::defines; +using namespace p25::dfsi::frames; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/MotVoiceHeader2.h b/src/common/p25/dfsi/frames/MotVoiceHeader2.h new file mode 100644 index 00000000..1fa6615a --- /dev/null +++ b/src/common/p25/dfsi/frames/MotVoiceHeader2.h @@ -0,0 +1,100 @@ +// 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) 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__ + +#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/MotStartOfStream.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + // --------------------------------------------------------------------------- + // Class Declaration + // --------------------------------------------------------------------------- + + /** + * @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; + + /** + * @brief Initializes a copy instance of the MotVoiceHeader2 class. + */ + MotVoiceHeader2(); + /** + * @brief Initializes a copy instance of the MotVoiceHeader2 class. + * @param data Buffer to containing MotVoiceHeader2 to decode. + */ + MotVoiceHeader2(uint8_t* data); + /** + * @brief Finalizes a instance of the MotVoiceHeader2 class. + */ + ~MotVoiceHeader2(); + + /** + * @brief Decode a voice header 2 frame. + * @param[in] data Buffer to containing MotVoiceHeader2 to decode. + */ + bool decode(const uint8_t* data); + /** + * @brief Encode a voice header 2 frame. + * @param[out] data Buffer to encode a MotVoiceHeader2. + */ + void encode(uint8_t* data); + + public: + uint8_t* header; // ?? - this should probably be a private with getters/setters + + /** + * @brief V.24 Data Source. + */ + __PROPERTY(SourceFlag::E, source, Source); + }; + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __MOT_VOICE_HEADER_2_H__ \ No newline at end of file diff --git a/src/dfsi/frames/StartOfStream.cpp b/src/common/p25/dfsi/frames/StartOfStream.cpp similarity index 92% rename from src/dfsi/frames/StartOfStream.cpp rename to src/common/p25/dfsi/frames/StartOfStream.cpp index 5eac7015..45bf61e8 100644 --- a/src/dfsi/frames/StartOfStream.cpp +++ b/src/common/p25/dfsi/frames/StartOfStream.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/StartOfStream.h" +#include "common/p25/dfsi/frames/StartOfStream.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -17,6 +17,7 @@ using namespace p25; using namespace p25::dfsi; +using namespace p25::dfsi::frames; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/StartOfStream.h b/src/common/p25/dfsi/frames/StartOfStream.h new file mode 100644 index 00000000..11c6fbac --- /dev/null +++ b/src/common/p25/dfsi/frames/StartOfStream.h @@ -0,0 +1,85 @@ +// 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) 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__ + +#include "Defines.h" +#include "common/Defines.h" +#include "common/Log.h" +#include "common/Utils.h" +#include "common/p25/dfsi/frames/FrameDefines.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + // --------------------------------------------------------------------------- + // Class Declaration + // --------------------------------------------------------------------------- + + /** + * @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; + + /** + * @brief Initializes a copy instance of the StartOfStream class. + */ + StartOfStream(); + /** + * @brief Initializes a copy instance of the StartOfStream class. + * @param data Buffer to containing StartOfStream to decode. + */ + StartOfStream(uint8_t* data); + + /** + * @brief Decode a start of stream frame. + * @param[in] data Buffer to containing StartOfStream to decode. + */ + bool decode(const uint8_t* data); + /** + * @brief Encode a start of stream frame. + * @param[out] data Buffer to encode a StartOfStream. + */ + void encode(uint8_t* data); + + public: + /** + * @brief Network Identifier. + */ + __PROPERTY(uint16_t, nid, NID); + /** + * @brief Error count. + */ + __PROPERTY(uint8_t, errorCount, ErrorCount); + }; + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __START_OF_STREAM_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCACK.cpp b/src/common/p25/dfsi/frames/fsc/FSCACK.cpp similarity index 94% rename from src/dfsi/frames/fsc/FSCACK.cpp rename to src/common/p25/dfsi/frames/fsc/FSCACK.cpp index a3502f6d..f99d32f9 100644 --- a/src/dfsi/frames/fsc/FSCACK.cpp +++ b/src/common/p25/dfsi/frames/fsc/FSCACK.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/fsc/FSCACK.h" +#include "common/p25/dfsi/frames/fsc/FSCACK.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -16,7 +16,8 @@ #include using namespace p25::dfsi; -using namespace p25::dfsi::fsc; +using namespace p25::dfsi::frames; +using namespace p25::dfsi::frames::fsc; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/fsc/FSCACK.h b/src/common/p25/dfsi/frames/fsc/FSCACK.h new file mode 100644 index 00000000..ef59d939 --- /dev/null +++ b/src/common/p25/dfsi/frames/fsc/FSCACK.h @@ -0,0 +1,96 @@ +// 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) 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__ + +#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 Acknowledgement Message. + * @ingroup dfsi_fsc_frames + */ + class HOST_SW_API FSCACK : public FSCMessage { + public: + static const uint8_t LENGTH = 6; + + /** + * @brief Initializes a copy instance of the FSCACK class. + */ + FSCACK(); + /** + * @brief Initializes a copy instance of the FSCACK class. + * @param data Buffer to containing FSCACK to decode. + */ + FSCACK(uint8_t* data); + + /** + * @brief Decode a FSC ACK frame. + * @param[in] data Buffer to containing FSCACK to decode. + */ + bool decode(const uint8_t* data) override; + /** + * @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 + + /** + * @brief Acknowledged Message ID. + */ + __PROPERTY(FSCMessageType::E, ackMessageId, AckMessageId); + /** + * @brief Acknowledged Message Version. + */ + __READONLY_PROPERTY(uint8_t, ackVersion, AckVersion); + /** + * @brief + */ + __READONLY_PROPERTY(uint8_t, ackCorrelationTag, AckCorrelationTag); + /** + * @brief Response code. + */ + __PROPERTY(FSCAckResponseCode::E, responseCode, ResponseCode); + /** + * @brief Response Data Length. + */ + __PROPERTY(uint8_t, respLength, ResponseLength); + }; + } // namespace fsc + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __FSC_ACK_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCConnect.cpp b/src/common/p25/dfsi/frames/fsc/FSCConnect.cpp similarity index 92% rename from src/dfsi/frames/fsc/FSCConnect.cpp rename to src/common/p25/dfsi/frames/fsc/FSCConnect.cpp index b58dbf80..14265b39 100644 --- a/src/dfsi/frames/fsc/FSCConnect.cpp +++ b/src/common/p25/dfsi/frames/fsc/FSCConnect.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/fsc/FSCConnect.h" +#include "common/p25/dfsi/frames/fsc/FSCConnect.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -16,7 +16,8 @@ #include using namespace p25::dfsi; -using namespace p25::dfsi::fsc; +using namespace p25::dfsi::frames; +using namespace p25::dfsi::frames::fsc; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/fsc/FSCConnect.h b/src/common/p25/dfsi/frames/fsc/FSCConnect.h new file mode 100644 index 00000000..0c0a0ab4 --- /dev/null +++ b/src/common/p25/dfsi/frames/fsc/FSCConnect.h @@ -0,0 +1,90 @@ +// 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) 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__ + +#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 Connect Message. + * @ingroup dfsi_fsc_frames + */ + class HOST_SW_API FSCConnect : public FSCMessage { + public: + static const uint8_t LENGTH = 11; + + /** + * @brief Initializes a copy instance of the FSCConnect class. + */ + FSCConnect(); + /** + * @brief Initializes a copy instance of the FSCConnect class. + * @param data Buffer to containing FSCConnect to decode. + */ + FSCConnect(uint8_t* data); + + /** + * @brief Decode a FSC connect frame. + * @param[in] data Buffer to containing FSCConnect to decode. + */ + bool decode(const uint8_t* data) override; + /** + * @brief Encode a FSC connect frame. + * @param[out] data Buffer to encode a FSCConnect. + */ + void encode(uint8_t* data) override; + + public: + /** + * @brief Voice Conveyance RTP Port. + */ + __PROPERTY(uint16_t, vcBasePort, VCBasePort); + /** + * @brief SSRC Identifier for all RTP transmissions. + */ + __PROPERTY(uint32_t, vcSSRC, VCSSRC); + /** + * @brief Fixed Station Heartbeat Period. + */ + __PROPERTY(uint8_t, fsHeartbeatPeriod, FSHeartbeatPeriod); + /** + * @brief Host Heartbeat Period. + */ + __PROPERTY(uint8_t, hostHeartbeatPeriod, HostHeartbeatPeriod); + }; + } // namespace fsc + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __FSC_CONNECT_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCConnectResponse.cpp b/src/common/p25/dfsi/frames/fsc/FSCConnectResponse.cpp similarity index 89% rename from src/dfsi/frames/fsc/FSCConnectResponse.cpp rename to src/common/p25/dfsi/frames/fsc/FSCConnectResponse.cpp index 812e2b7f..cc412df4 100644 --- a/src/dfsi/frames/fsc/FSCConnectResponse.cpp +++ b/src/common/p25/dfsi/frames/fsc/FSCConnectResponse.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/fsc/FSCConnectResponse.h" +#include "common/p25/dfsi/frames/fsc/FSCConnectResponse.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -16,7 +16,8 @@ #include using namespace p25::dfsi; -using namespace p25::dfsi::fsc; +using namespace p25::dfsi::frames; +using namespace p25::dfsi::frames::fsc; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/fsc/FSCConnectResponse.h b/src/common/p25/dfsi/frames/fsc/FSCConnectResponse.h new file mode 100644 index 00000000..2243d004 --- /dev/null +++ b/src/common/p25/dfsi/frames/fsc/FSCConnectResponse.h @@ -0,0 +1,78 @@ +// 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) 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__ + +#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/FSCResponse.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + namespace fsc + { + // --------------------------------------------------------------------------- + // 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; + + /** + * @brief Initializes a copy instance of the FSCConnectResponse class. + */ + FSCConnectResponse(); + /** + * @brief Initializes a copy instance of the FSCConnectResponse class. + * @param data Buffer to containing FSCConnectResponse to decode. + */ + FSCConnectResponse(uint8_t* data); + + /** + * @brief Decode a FSC connect response frame. + * @param[in] data Buffer to containing FSCConnectResponse to decode. + */ + bool decode(const uint8_t* data) override; + /** + * @brief Encode a FSC connect response frame. + * @param[out] data Buffer to encode a FSCConnectResponse. + */ + void encode(uint8_t* data) override; + + public: + /** + * @brief Voice Conveyance RTP Port. + */ + __PROPERTY(uint16_t, vcBasePort, VCBasePort); + }; + } // namespace fsc + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __FSC_CONNECT_RESPONSE_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCDisconnect.cpp b/src/common/p25/dfsi/frames/fsc/FSCDisconnect.cpp similarity index 83% rename from src/dfsi/frames/fsc/FSCDisconnect.cpp rename to src/common/p25/dfsi/frames/fsc/FSCDisconnect.cpp index 862a59e5..a59f28d0 100644 --- a/src/dfsi/frames/fsc/FSCDisconnect.cpp +++ b/src/common/p25/dfsi/frames/fsc/FSCDisconnect.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/fsc/FSCDisconnect.h" +#include "common/p25/dfsi/frames/fsc/FSCDisconnect.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -16,7 +16,8 @@ #include using namespace p25::dfsi; -using namespace p25::dfsi::fsc; +using namespace p25::dfsi::frames; +using namespace p25::dfsi::frames::fsc; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/fsc/FSCDisconnect.h b/src/common/p25/dfsi/frames/fsc/FSCDisconnect.h new file mode 100644 index 00000000..a39739f4 --- /dev/null +++ b/src/common/p25/dfsi/frames/fsc/FSCDisconnect.h @@ -0,0 +1,61 @@ +// 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) 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__ + +#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 Disconnect Message. + * @ingroup dfsi_fsc_frames + */ + class HOST_SW_API FSCDisconnect : public FSCMessage { + public: + static const uint8_t LENGTH = 3; + + /** + * @brief Initializes a copy instance of the FSCDisconnect class. + */ + FSCDisconnect(); + /** + * @brief Initializes a copy instance of the FSCDisconnect class. + * @param data Buffer to containing FSCDisconnect to decode. + */ + FSCDisconnect(uint8_t* data); + }; + } // namespace fsc + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __FSC_DISCONNECT_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCHeartbeat.cpp b/src/common/p25/dfsi/frames/fsc/FSCHeartbeat.cpp similarity index 83% rename from src/dfsi/frames/fsc/FSCHeartbeat.cpp rename to src/common/p25/dfsi/frames/fsc/FSCHeartbeat.cpp index a2c67dd4..d8ae59b5 100644 --- a/src/dfsi/frames/fsc/FSCHeartbeat.cpp +++ b/src/common/p25/dfsi/frames/fsc/FSCHeartbeat.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/fsc/FSCHeartbeat.h" +#include "common/p25/dfsi/frames/fsc/FSCHeartbeat.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -16,7 +16,8 @@ #include using namespace p25::dfsi; -using namespace p25::dfsi::fsc; +using namespace p25::dfsi::frames; +using namespace p25::dfsi::frames::fsc; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/fsc/FSCHeartbeat.h b/src/common/p25/dfsi/frames/fsc/FSCHeartbeat.h new file mode 100644 index 00000000..eca02888 --- /dev/null +++ b/src/common/p25/dfsi/frames/fsc/FSCHeartbeat.h @@ -0,0 +1,61 @@ +// 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) 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__ + +#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 Heartbeat Message. + * @ingroup dfsi_fsc_frames + */ + class HOST_SW_API FSCHeartbeat : public FSCMessage { + public: + static const uint8_t LENGTH = 3; + + /** + * @brief Initializes a copy instance of the FSCHeartbeat class. + */ + FSCHeartbeat(); + /** + * @brief Initializes a copy instance of the FSCHeartbeat class. + * @param data Buffer to containing FSCHeartbeat to decode. + */ + FSCHeartbeat(uint8_t* data); + }; + } // namespace fsc + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __FSC_HEARTBEAT_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCMessage.cpp b/src/common/p25/dfsi/frames/fsc/FSCMessage.cpp similarity index 91% rename from src/dfsi/frames/fsc/FSCMessage.cpp rename to src/common/p25/dfsi/frames/fsc/FSCMessage.cpp index f884eb59..7689b314 100644 --- a/src/dfsi/frames/fsc/FSCMessage.cpp +++ b/src/common/p25/dfsi/frames/fsc/FSCMessage.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/fsc/FSCMessage.h" +#include "common/p25/dfsi/frames/fsc/FSCMessage.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -16,7 +16,8 @@ #include using namespace p25::dfsi; -using namespace p25::dfsi::fsc; +using namespace p25::dfsi::frames; +using namespace p25::dfsi::frames::fsc; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/fsc/FSCMessage.h b/src/common/p25/dfsi/frames/fsc/FSCMessage.h new file mode 100644 index 00000000..55be0087 --- /dev/null +++ b/src/common/p25/dfsi/frames/fsc/FSCMessage.h @@ -0,0 +1,85 @@ +// 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) 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__ + +#include "Defines.h" +#include "common/Defines.h" +#include "common/Log.h" +#include "common/Utils.h" +#include "common/p25/dfsi/frames/FrameDefines.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + namespace fsc + { + // --------------------------------------------------------------------------- + // 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; + + /** + * @brief Initializes a copy instance of the FSCMessage class. + */ + FSCMessage(); + /** + * @brief Initializes a copy instance of the FSCMessage class. + * @param data Buffer to containing FSCMessage to decode. + */ + FSCMessage(uint8_t* data); + + /** + * @brief Decode a FSC message frame. + * @param[in] data Buffer to containing FSCMessage to decode. + */ + virtual bool decode(const uint8_t* data); + /** + * @brief Encode a FSC message frame. + * @param[out] data Buffer to encode a FSCMessage. + */ + virtual void encode(uint8_t* data); + + public: + /** + * @brief Message ID. + */ + __PROTECTED_PROPERTY(FSCMessageType::E, messageId, MessageId); + /** + * @brief Message Version. + */ + __PROTECTED_READONLY_PROPERTY(uint8_t, version, Version); + /** + * @brief + */ + __PROTECTED_READONLY_PROPERTY(uint8_t, correlationTag, CorrelationTag); + }; + } // namespace fsc + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __FSC_MESSAGE_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCResponse.cpp b/src/common/p25/dfsi/frames/fsc/FSCResponse.cpp similarity index 88% rename from src/dfsi/frames/fsc/FSCResponse.cpp rename to src/common/p25/dfsi/frames/fsc/FSCResponse.cpp index d2145ed6..1a12ab12 100644 --- a/src/dfsi/frames/fsc/FSCResponse.cpp +++ b/src/common/p25/dfsi/frames/fsc/FSCResponse.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Digital Voice Modem - DFSI V.24/UDP Software + * 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) 2024 Bryan Biedenkapp, N2PLL * */ -#include "frames/fsc/FSCResponse.h" +#include "common/p25/dfsi/frames/fsc/FSCResponse.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/Utils.h" #include "common/Log.h" @@ -16,7 +16,8 @@ #include using namespace p25::dfsi; -using namespace p25::dfsi::fsc; +using namespace p25::dfsi::frames; +using namespace p25::dfsi::frames::fsc; // --------------------------------------------------------------------------- // Public Class Members diff --git a/src/common/p25/dfsi/frames/fsc/FSCResponse.h b/src/common/p25/dfsi/frames/fsc/FSCResponse.h new file mode 100644 index 00000000..517b39ed --- /dev/null +++ b/src/common/p25/dfsi/frames/fsc/FSCResponse.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) 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__ + +#include "Defines.h" +#include "common/Defines.h" +#include "common/Log.h" +#include "common/Utils.h" +#include "common/p25/dfsi/frames/FrameDefines.h" + +namespace p25 +{ + namespace dfsi + { + namespace frames + { + namespace fsc + { + // --------------------------------------------------------------------------- + // 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; + + /** + * @brief Initializes a copy instance of the FSCResponse class. + */ + FSCResponse(); + /** + * @brief Initializes a copy instance of the FSCResponse class. + * @param data Buffer to containing FSCResponse to decode. + */ + FSCResponse(uint8_t* data); + + /** + * @brief Decode a FSC message frame. + * @param[in] data Buffer to containing FSCResponse to decode. + */ + virtual bool decode(const uint8_t* data); + /** + * @brief Encode a FSC message frame. + * @param[out] data Buffer to encode a FSCResponse. + */ + virtual void encode(uint8_t* data); + + public: + /** + * @brief Response Version. + */ + __PROTECTED_READONLY_PROPERTY(uint8_t, version, Version); + }; + } // namespace fsc + } // namespace frames + } // namespace dfsi +} // namespace p25 + +#endif // __FSC_RESPONSE_H__ \ No newline at end of file diff --git a/src/dfsi/CMakeLists.txt b/src/dfsi/CMakeLists.txt index 3331cbe4..8330ff76 100644 --- a/src/dfsi/CMakeLists.txt +++ b/src/dfsi/CMakeLists.txt @@ -17,12 +17,6 @@ file(GLOB dvmdfsi_SRC "src/dfsi/network/*.h" "src/dfsi/network/*.cpp" - # DFSI Data Frames - "src/dfsi/frames/*.h" - "src/dfsi/frames/*.cpp" - "src/dfsi/frames/fsc/*.h" - "src/dfsi/frames/fsc/*.cpp" - # Core "src/dfsi/*.h" "src/dfsi/*.cpp" diff --git a/src/dfsi/frames/BlockHeader.h b/src/dfsi/frames/BlockHeader.h deleted file mode 100644 index 47274fb4..00000000 --- a/src/dfsi/frames/BlockHeader.h +++ /dev/null @@ -1,103 +0,0 @@ -// 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 - * - */ -/** - * @file BlockHeader.h - * @ingroup dfsi_frames - * @file BlockHeader.cpp - * @ingroup dfsi_frames - */ -#if !defined(__BLOCK_HEADER_H__) -#define __BLOCK_HEADER_H__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" - -namespace p25 -{ - namespace dfsi - { - // --------------------------------------------------------------------------- - // Class Declaration - // --------------------------------------------------------------------------- - - /** - * @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; - - /** - * @brief Initializes a copy instance of the BlockHeader class. - */ - BlockHeader(); - /** - * @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); - - /** - * @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); - /** - * @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: - /** - * @brief Payload type. - * This simple boolean marks this header as either IANA standard, or profile specific. - */ - __PROPERTY(bool, payloadType, PayloadType); - /** - * @brief Block type. - */ - __PROPERTY(BlockType::E, blockType, BlockType); - /** - * @brief Timestamp Offset. - */ - __PROPERTY(uint16_t, timestampOffset, TimestampOffset); - /** - * @brief Block length. - */ - __PROPERTY(uint16_t, blockLength, BlockLength); - }; - } // namespace dfsi -} // namespace p25 - -#endif // __BLOCK_HEADER_H__ \ No newline at end of file diff --git a/src/dfsi/frames/ControlOctet.h b/src/dfsi/frames/ControlOctet.h deleted file mode 100644 index d6396513..00000000 --- a/src/dfsi/frames/ControlOctet.h +++ /dev/null @@ -1,86 +0,0 @@ -// 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 - * - */ -/** - * @file ControlOctet.h - * @ingroup dfsi_frames - * @file ControlOctet.cpp - * @ingroup dfsi_frames - */ -#if !defined(__CONTROL_OCTET_H__) -#define __CONTROL_OCTET_H__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" - -namespace p25 -{ - namespace dfsi - { - // --------------------------------------------------------------------------- - // Class Declaration - // --------------------------------------------------------------------------- - - /** - * @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; - - /** - * @brief Initializes a copy instance of the ControlOctet class. - */ - ControlOctet(); - /** - * @brief Initializes a copy instance of the ControlOctet class. - * @param data Buffer to containing ControlOctet to decode. - */ - ControlOctet(uint8_t* data); - - /** - * @brief Decode a control octet frame. - * @param[in] data Buffer to containing ControlOctet to decode. - */ - bool decode(const uint8_t* data); - /** - * @brief Encode a control octet frame. - * @param[out] data Buffer to encode a ControlOctet. - */ - void encode(uint8_t* data); - - public: - /** - * @brief - */ - __PROPERTY(bool, signal, Signal); - /** - * @brief Indicates a compact (1) or verbose (0) block header. - */ - __PROPERTY(bool, compact, Compact); - /** - * @brief Number of block headers following this control octet. - */ - __PROPERTY(uint8_t, blockHeaderCnt, BlockHeaderCnt); - }; - } // namespace dfsi -} // namespace p25 - -#endif // __CONTROL_OCTET_H__ \ No newline at end of file diff --git a/src/dfsi/frames/FrameDefines.h b/src/dfsi/frames/FrameDefines.h deleted file mode 100644 index 9ca2ad6c..00000000 --- a/src/dfsi/frames/FrameDefines.h +++ /dev/null @@ -1,142 +0,0 @@ -// 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 - * - */ -/** - * @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__ - -#include "common/Defines.h" - -namespace p25 -{ - namespace dfsi - { - // --------------------------------------------------------------------------- - // Constants - // --------------------------------------------------------------------------- - - /** - * @addtogroup dfsi_frames - * @{ - */ - - /** @brief FSC Control Service Message.*/ - namespace FSCMessageType { - /** @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_DISCONNECT = 9, //! Detach Control Service. - - FSC_INVALID = 127, //! Invalid Control Message. - }; - } - - /** @brief FSC ACK/NAK Codes. */ - namespace FSCAckResponseCode { - /** @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. - }; - } - - /** @brief DFSI Block Types */ - namespace BlockType { - /** @brief DFSI Block Types */ - enum E : uint8_t { - FULL_RATE_VOICE = 0, //! Full Rate Voice - - VOICE_HEADER_P1 = 6, //! Voice Header 1 - VOICE_HEADER_P2 = 7, //! Voice Header 2 - - START_OF_STREAM = 9, //! Start of Stream - END_OF_STREAM = 10, //! End of Stream - - UNDEFINED = 127 //! Undefined - }; - } - - /** @brief RT/RT Flag */ - namespace RTFlag { - /** @brief RT/RT Flag */ - enum E : uint8_t { - ENABLED = 0x02U, //! RT/RT Enabled - DISABLED = 0x04U //! RT/RT Disabled - }; - } - - /** @brief Start/Stop Flag */ - namespace StartStopFlag { - /** @brief Start/Stop Flag */ - enum E : uint8_t { - START = 0x0CU, //! Start - STOP = 0x25U //! Stop - }; - } - - /** @brief V.24 Data Stream Type */ - namespace StreamTypeFlag { - /** @brief V.24 Data Stream Type */ - enum E : uint8_t { - VOICE = 0x0BU //! Voice - }; - } - - /** @brief RSSI Data Validity */ - namespace RssiValidityFlag { - /** @brief RSSI Data Validity */ - enum E : uint8_t { - INVALID = 0x00U, //! Invalid - VALID = 0x1A //! Valid - }; - } - - /** @brief V.24 Data Source */ - namespace SourceFlag { - /** @brief V.24 Data Source */ - enum E : uint8_t { - DIU = 0x00U, //! DIU - QUANTAR = 0x02U //! Quantar - }; - } - - /** @brief */ - namespace ICWFlag { - /** @brief */ - enum E : uint8_t { - DIU = 0x00U, //! DIU - QUANTAR = 0x1B //! Quantar - }; - } - /** @} */ - } // namespace dfsi -} // namespace p25 - -#endif // __FRAME_DEFINES_H__ diff --git a/src/dfsi/frames/Frames.h b/src/dfsi/frames/Frames.h deleted file mode 100644 index 45ebd1c3..00000000 --- a/src/dfsi/frames/Frames.h +++ /dev/null @@ -1,38 +0,0 @@ -// 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 - * - */ -#if !defined(__DFSI_FRAMES_H__) -#define __DFSI_FRAMES_H__ - -#include "Defines.h" - -// TIA -#include "frames/StartOfStream.h" -#include "frames/ControlOctet.h" -#include "frames/BlockHeader.h" -#include "frames/FullRateVoice.h" - -// "The" Manufacturer -#include "frames/MotFullRateVoice.h" -#include "frames/MotStartOfStream.h" -#include "frames/MotStartVoiceFrame.h" -#include "frames/MotVoiceHeader1.h" -#include "frames/MotVoiceHeader2.h" - -// FSC -#include "frames/fsc/FSCMessage.h" -#include "frames/fsc/FSCResponse.h" -#include "frames/fsc/FSCACK.h" -#include "frames/fsc/FSCConnect.h" -#include "frames/fsc/FSCConnectResponse.h" -#include "frames/fsc/FSCDisconnect.h" -#include "frames/fsc/FSCHeartbeat.h" - -#endif // __DFSI_FRAMES_H__ \ No newline at end of file diff --git a/src/dfsi/frames/FullRateVoice.h b/src/dfsi/frames/FullRateVoice.h deleted file mode 100644 index a9d2e945..00000000 --- a/src/dfsi/frames/FullRateVoice.h +++ /dev/null @@ -1,256 +0,0 @@ -// 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 - * - */ -/** - * @file FullRateVoice.h - * @ingroup dfsi_frames - * @file FullRateVoice.cpp - * @ingroup dfsi_frames - */ -#if !defined(__FULL_RATE_VOICE_H__) -#define __FULL_RATE_VOICE_H__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/p25/dfsi/DFSIDefines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" - -namespace p25 -{ - namespace dfsi - { - // --------------------------------------------------------------------------- - // Class Declaration - // --------------------------------------------------------------------------- - - /** - * @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; - - /** - * @brief Initializes a copy instance of the FullRateVoice class. - */ - FullRateVoice(); - /** - * @brief Initializes a copy instance of the FullRateVoice class. - * @param data Buffer to containing FullRateVoice to decode. - */ - FullRateVoice(uint8_t* data); - /** - * @brief Finalizes a instance of the FullRateVoice class. - */ - ~FullRateVoice(); - - /** - * @brief Decode a full rate voice frame. - * @param[in] data Buffer to containing FullRateVoice to decode. - */ - bool decode(const uint8_t* data); - /** - * @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 - - /** - * @brief Frame Type. - */ - __PROPERTY(defines::DFSIFrameType::E, frameType, FrameType); - /** - * @brief Total errors detected in the frame. - */ - __PROPERTY(uint8_t, totalErrors, TotalErrors); - /** - * @brief Flag indicating the frame should be muted. - */ - __PROPERTY(bool, muteFrame, MuteFrame); - /** - * @brief Flag indicating the frame was lost. - */ - __PROPERTY(bool, lostFrame, LostFrame); - /** - * @brief Superframe Counter. - */ - __PROPERTY(uint8_t, superframeCnt, SuperframeCnt); - /** - * @brief Busy Status. - */ - __PROPERTY(uint8_t, busy, Busy); - - private: - /** - * @brief Helper indicating if the frame is voice 3 through 8. - * @returns bool True, if frame is voice 3 through 8, otherwise false. - */ - bool isVoice3thru8(); - /** - * @brief Helper indicating if the frame is voice 12 through 17. - * @returns bool True, if frame is voice 12 through 17, otherwise false. - */ - bool isVoice12thru17(); - /** - * @brief Helper indicating if the frame is voice 9 or 10. - * @returns bool True, if frame is voice 9, or 10, otherwise false. - */ - bool isVoice9or10(); - }; - } // namespace dfsi -} // namespace p25 - -#endif // __FULL_RATE_VOICE_H__ \ No newline at end of file diff --git a/src/dfsi/frames/MotFullRateVoice.h b/src/dfsi/frames/MotFullRateVoice.h deleted file mode 100644 index dd4c00f8..00000000 --- a/src/dfsi/frames/MotFullRateVoice.h +++ /dev/null @@ -1,124 +0,0 @@ -// 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 - * - */ -/** - * @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__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/p25/dfsi/DFSIDefines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" - -namespace p25 -{ - namespace dfsi - { - // --------------------------------------------------------------------------- - // Class Declaration - // --------------------------------------------------------------------------- - - /** - * @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 = 14; - static const uint8_t ADDITIONAL_LENGTH = 4; - - /** - * @brief Initializes a copy instance of the MotFullRateVoice class. - */ - MotFullRateVoice(); - /** - * @brief Initializes a copy instance of the MotFullRateVoice class. - * @param data Buffer to containing MotFullRateVoice to decode. - */ - MotFullRateVoice(uint8_t* data); - /** - * @brief Finalizes a instance of the MotFullRateVoice class. - */ - ~MotFullRateVoice(); - - /** - * @brief - */ - uint32_t size(); - /** - * @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); - /** - * @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 - - /** - * @brief Frame Type. - */ - __PROPERTY(defines::DFSIFrameType::E, frameType, FrameType); - /** - * @brief V.24 Data Source. - */ - __PROPERTY(SourceFlag::E, source, Source); - - private: - /** - * @brief Helper indicating if the frame is voice 1, 2, 10 or 11. - * @returns bool True, if frame is voice 1, 2, 10, or 11, otherwise false. - */ - bool isVoice1or2or10or11(); - /** - * @brief Helper indicating if the frame is voice 2 or 11. - * @returns bool True, if frame is voice 2, or 11, otherwise false. - */ - bool isVoice2or11(); - /** - * @brief Helper indicating if the frame is voice 9 or 18. - * @returns bool True, if frame is voice 9, or 18, otherwise false. - */ - bool isVoice9or18(); - }; - } // namespace dfsi -} // namespace p25 - -#endif // __MOT_FULL_RATE_VOICE_H__ \ No newline at end of file diff --git a/src/dfsi/frames/MotStartOfStream.h b/src/dfsi/frames/MotStartOfStream.h deleted file mode 100644 index 0f3ee54b..00000000 --- a/src/dfsi/frames/MotStartOfStream.h +++ /dev/null @@ -1,96 +0,0 @@ -// 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 - * - */ -/** - * @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__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" - -namespace p25 -{ - namespace dfsi - { - // --------------------------------------------------------------------------- - // Class Declaration - // --------------------------------------------------------------------------- - - /** - * @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; - - /** - * @brief Initializes a copy instance of the MotStartOfStream class. - */ - MotStartOfStream(); - /** - * @brief Initializes a copy instance of the MotStartOfStream class. - * @param data Buffer to containing MotStartOfStream to decode. - */ - MotStartOfStream(uint8_t* data); - - /** - * @brief Decode a start of stream frame. - * @param[in] data Buffer to containing MotStartOfStream to decode. - */ - bool decode(const uint8_t* data); - /** - * @brief Encode a start of stream frame. - * @param[out] data Buffer to encode a MotStartOfStream. - */ - void encode(uint8_t* data); - - public: - /** - * @brief - */ - __PROPERTY(uint8_t, marker, Marker); - /** - * @brief RT/RT Flag. - */ - __PROPERTY(RTFlag::E, rt, RT); - /** - * @brief Start/Stop. - */ - __PROPERTY(StartStopFlag::E, startStop, StartStop); - /** - * @brief Stream Type. - */ - __PROPERTY(StreamTypeFlag::E, streamType, StreamType); - }; - } // namespace dfsi -} // namespace p25 - -#endif // __MOT_START_OF_STREAM_H__ \ No newline at end of file diff --git a/src/dfsi/frames/MotStartVoiceFrame.h b/src/dfsi/frames/MotStartVoiceFrame.h deleted file mode 100644 index 200af8be..00000000 --- a/src/dfsi/frames/MotStartVoiceFrame.h +++ /dev/null @@ -1,114 +0,0 @@ -// 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 - * - */ -/** - * @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__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" -#include "frames/MotStartOfStream.h" -#include "frames/MotFullRateVoice.h" - -namespace p25 -{ - namespace dfsi - { - // --------------------------------------------------------------------------- - // Class Declaration - // --------------------------------------------------------------------------- - - /** - * @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; - - /** - * @brief Initializes a copy instance of the MotStartVoiceFrame class. - */ - MotStartVoiceFrame(); - /** - * @brief Initializes a copy instance of the MotStartVoiceFrame class. - * @param data Buffer to containing MotStartVoiceFrame to decode. - */ - MotStartVoiceFrame(uint8_t* data); - /** - * @brief Finalizes a instance of the MotStartVoiceFrame class. - */ - ~MotStartVoiceFrame(); - - /** - * @brief Decode a start voice frame. - * @param[in] data Buffer to containing MotStartVoiceFrame to decode. - */ - bool decode(const uint8_t* data); - /** - * @brief Encode a start voice frame. - * @param[out] data Buffer to encode a MotStartVoiceFrame. - */ - void encode(uint8_t* data); - - public: - MotStartOfStream* startOfStream; // ?? - this should probably be private with getters/setters - MotFullRateVoice* fullRateVoice; // ?? - this should probably be private with getters/setters - - /** - * @brief - */ - __PROPERTY(ICWFlag::E, icw, ICW); - /** - * @brief RSSI Value. - */ - __PROPERTY(uint8_t, rssi, RSSI); - /** - * @brief Flag indicating whether or not the RSSI field is valid. - */ - __PROPERTY(RssiValidityFlag::E, rssiValidity, RSSIValidity); - /** - * @brief - */ - __PROPERTY(uint8_t, nRssi, NRSSI); - /** - * @brief - */ - __PROPERTY(uint8_t, adjMM, AdjMM); - }; - } // namespace dfsi -} // namespace p25 - -#endif // __MOT_START_VOICE_FRAME_H__ \ No newline at end of file diff --git a/src/dfsi/frames/MotVoiceHeader1.h b/src/dfsi/frames/MotVoiceHeader1.h deleted file mode 100644 index 93b6079f..00000000 --- a/src/dfsi/frames/MotVoiceHeader1.h +++ /dev/null @@ -1,114 +0,0 @@ -// 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 - * - */ -/** - * @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__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" -#include "frames/MotStartOfStream.h" - -namespace p25 -{ - namespace dfsi - { - // --------------------------------------------------------------------------- - // Class Declaration - // --------------------------------------------------------------------------- - - /** - * @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; - - /** - * @brief Initializes a copy instance of the MotVoiceHeader1 class. - */ - MotVoiceHeader1(); - /** - * @brief Initializes a copy instance of the MotVoiceHeader1 class. - * @param data Buffer to containing MotVoiceHeader1 to decode. - */ - MotVoiceHeader1(uint8_t* data); - /** - * @brief Finalizes a instance of the MotVoiceHeader1 class. - */ - ~MotVoiceHeader1(); - - /** - * @brief Decode a voice header 1 frame. - * @param[in] data Buffer to containing MotVoiceHeader1 to decode. - */ - bool decode(const uint8_t* data); - /** - * @brief Encode a voice header 1 frame. - * @param[out] data Buffer to encode a MotVoiceHeader1. - */ - void encode(uint8_t* data); - - public: - uint8_t* header; // ?? - this should probably be private with getters/setters - MotStartOfStream* startOfStream; // ?? - this should probably be private with getters/setters - - /** - * @brief - */ - __PROPERTY(ICWFlag::E, icw, ICW); - /** - * @brief RSSI Value. - */ - __PROPERTY(uint8_t, rssi, RSSI); - /** - * @brief Flag indicating whether or not the RSSI field is valid. - */ - __PROPERTY(RssiValidityFlag::E, rssiValidity, RSSIValidity); - /** - * @brief - */ - __PROPERTY(uint8_t, nRssi, NRSSI); - }; - } // namespace dfsi -} // namespace p25 - -#endif // __MOT_VOICE_HEADER_1_H__ \ No newline at end of file diff --git a/src/dfsi/frames/MotVoiceHeader2.h b/src/dfsi/frames/MotVoiceHeader2.h deleted file mode 100644 index d26c626b..00000000 --- a/src/dfsi/frames/MotVoiceHeader2.h +++ /dev/null @@ -1,97 +0,0 @@ -// 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 - * - */ -/** - * @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__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" -#include "frames/MotStartOfStream.h" - -namespace p25 -{ - namespace dfsi - { - // --------------------------------------------------------------------------- - // Class Declaration - // --------------------------------------------------------------------------- - - /** - * @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; - - /** - * @brief Initializes a copy instance of the MotVoiceHeader2 class. - */ - MotVoiceHeader2(); - /** - * @brief Initializes a copy instance of the MotVoiceHeader2 class. - * @param data Buffer to containing MotVoiceHeader2 to decode. - */ - MotVoiceHeader2(uint8_t* data); - /** - * @brief Finalizes a instance of the MotVoiceHeader2 class. - */ - ~MotVoiceHeader2(); - - /** - * @brief Decode a voice header 2 frame. - * @param[in] data Buffer to containing MotVoiceHeader2 to decode. - */ - bool decode(const uint8_t* data); - /** - * @brief Encode a voice header 2 frame. - * @param[out] data Buffer to encode a MotVoiceHeader2. - */ - void encode(uint8_t* data); - - public: - uint8_t* header; // ?? - this should probably be a private with getters/setters - - /** - * @brief V.24 Data Source. - */ - __PROPERTY(SourceFlag::E, source, Source); - }; - } // namespace dfsi -} // namespace p25 - -#endif // __MOT_VOICE_HEADER_2_H__ \ No newline at end of file diff --git a/src/dfsi/frames/StartOfStream.h b/src/dfsi/frames/StartOfStream.h deleted file mode 100644 index 1004b04a..00000000 --- a/src/dfsi/frames/StartOfStream.h +++ /dev/null @@ -1,82 +0,0 @@ -// 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 - * - */ -/** - * @file StartOfStream.h - * @ingroup dfsi_frames - * @file StartOfStream.cpp - * @ingroup dfsi_frames - */ -#if !defined(__START_OF_STREAM_H__) -#define __START_OF_STREAM_H__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" - -namespace p25 -{ - namespace dfsi - { - // --------------------------------------------------------------------------- - // Class Declaration - // --------------------------------------------------------------------------- - - /** - * @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; - - /** - * @brief Initializes a copy instance of the StartOfStream class. - */ - StartOfStream(); - /** - * @brief Initializes a copy instance of the StartOfStream class. - * @param data Buffer to containing StartOfStream to decode. - */ - StartOfStream(uint8_t* data); - - /** - * @brief Decode a start of stream frame. - * @param[in] data Buffer to containing StartOfStream to decode. - */ - bool decode(const uint8_t* data); - /** - * @brief Encode a start of stream frame. - * @param[out] data Buffer to encode a StartOfStream. - */ - void encode(uint8_t* data); - - public: - /** - * @brief Network Identifier. - */ - __PROPERTY(uint16_t, nid, NID); - /** - * @brief Error count. - */ - __PROPERTY(uint8_t, errorCount, ErrorCount); - }; - } // namespace dfsi -} // namespace p25 - -#endif // __START_OF_STREAM_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCACK.h b/src/dfsi/frames/fsc/FSCACK.h deleted file mode 100644 index 1ba7081f..00000000 --- a/src/dfsi/frames/fsc/FSCACK.h +++ /dev/null @@ -1,93 +0,0 @@ -// 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 - * - */ -/** - * @file FSCACK.h - * @ingroup dfsi_fsc_frames - * @file FSCACK.cpp - * @ingroup dfsi_fsc_frames - */ -#if !defined(__FSC_ACK_H__) -#define __FSC_ACK_H__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" -#include "frames/fsc/FSCMessage.h" - -namespace p25 -{ - namespace dfsi - { - namespace fsc - { - // --------------------------------------------------------------------------- - // 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; - - /** - * @brief Initializes a copy instance of the FSCACK class. - */ - FSCACK(); - /** - * @brief Initializes a copy instance of the FSCACK class. - * @param data Buffer to containing FSCACK to decode. - */ - FSCACK(uint8_t* data); - - /** - * @brief Decode a FSC ACK frame. - * @param[in] data Buffer to containing FSCACK to decode. - */ - bool decode(const uint8_t* data) override; - /** - * @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 - - /** - * @brief Acknowledged Message ID. - */ - __PROPERTY(FSCMessageType::E, ackMessageId, AckMessageId); - /** - * @brief Acknowledged Message Version. - */ - __READONLY_PROPERTY(uint8_t, ackVersion, AckVersion); - /** - * @brief - */ - __READONLY_PROPERTY(uint8_t, ackCorrelationTag, AckCorrelationTag); - /** - * @brief Response code. - */ - __PROPERTY(FSCAckResponseCode::E, responseCode, ResponseCode); - /** - * @brief Response Data Length. - */ - __PROPERTY(uint8_t, respLength, ResponseLength); - }; - } // namespace fsc - } // namespace dfsi -} // namespace p25 - -#endif // __FSC_ACK_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCConnect.h b/src/dfsi/frames/fsc/FSCConnect.h deleted file mode 100644 index 8ef34f59..00000000 --- a/src/dfsi/frames/fsc/FSCConnect.h +++ /dev/null @@ -1,87 +0,0 @@ -// 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 - * - */ -/** - * @file FSCConnect.h - * @ingroup dfsi_fsc_frames - * @file FSCConnect.cpp - * @ingroup dfsi_fsc_frames - */ -#if !defined(__FSC_CONNECT_H__) -#define __FSC_CONNECT_H__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" -#include "frames/fsc/FSCMessage.h" - -namespace p25 -{ - namespace dfsi - { - namespace fsc - { - // --------------------------------------------------------------------------- - // 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; - - /** - * @brief Initializes a copy instance of the FSCConnect class. - */ - FSCConnect(); - /** - * @brief Initializes a copy instance of the FSCConnect class. - * @param data Buffer to containing FSCConnect to decode. - */ - FSCConnect(uint8_t* data); - - /** - * @brief Decode a FSC connect frame. - * @param[in] data Buffer to containing FSCConnect to decode. - */ - bool decode(const uint8_t* data) override; - /** - * @brief Encode a FSC connect frame. - * @param[out] data Buffer to encode a FSCConnect. - */ - void encode(uint8_t* data) override; - - public: - /** - * @brief Voice Conveyance RTP Port. - */ - __PROPERTY(uint16_t, vcBasePort, VCBasePort); - /** - * @brief SSRC Identifier for all RTP transmissions. - */ - __PROPERTY(uint32_t, vcSSRC, VCSSRC); - /** - * @brief Fixed Station Heartbeat Period. - */ - __PROPERTY(uint8_t, fsHeartbeatPeriod, FSHeartbeatPeriod); - /** - * @brief Host Heartbeat Period. - */ - __PROPERTY(uint8_t, hostHeartbeatPeriod, HostHeartbeatPeriod); - }; - } // namespace fsc - } // namespace dfsi -} // namespace p25 - -#endif // __FSC_CONNECT_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCConnectResponse.h b/src/dfsi/frames/fsc/FSCConnectResponse.h deleted file mode 100644 index 6645a5f6..00000000 --- a/src/dfsi/frames/fsc/FSCConnectResponse.h +++ /dev/null @@ -1,75 +0,0 @@ -// 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 - * - */ -/** - * @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__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" -#include "frames/fsc/FSCResponse.h" - -namespace p25 -{ - namespace dfsi - { - namespace fsc - { - // --------------------------------------------------------------------------- - // 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; - - /** - * @brief Initializes a copy instance of the FSCConnectResponse class. - */ - FSCConnectResponse(); - /** - * @brief Initializes a copy instance of the FSCConnectResponse class. - * @param data Buffer to containing FSCConnectResponse to decode. - */ - FSCConnectResponse(uint8_t* data); - - /** - * @brief Decode a FSC connect response frame. - * @param[in] data Buffer to containing FSCConnectResponse to decode. - */ - bool decode(const uint8_t* data) override; - /** - * @brief Encode a FSC connect response frame. - * @param[out] data Buffer to encode a FSCConnectResponse. - */ - void encode(uint8_t* data) override; - - public: - /** - * @brief Voice Conveyance RTP Port. - */ - __PROPERTY(uint16_t, vcBasePort, VCBasePort); - }; - } // namespace fsc - } // namespace dfsi -} // namespace p25 - -#endif // __FSC_CONNECT_RESPONSE_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCDisconnect.h b/src/dfsi/frames/fsc/FSCDisconnect.h deleted file mode 100644 index 51f12309..00000000 --- a/src/dfsi/frames/fsc/FSCDisconnect.h +++ /dev/null @@ -1,58 +0,0 @@ -// 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 - * - */ -/** - * @file FSCDisconnect.h - * @ingroup dfsi_fsc_frames - * @file FSCDisconnect.cpp - * @ingroup dfsi_fsc_frames - */ -#if !defined(__FSC_DISCONNECT_H__) -#define __FSC_DISCONNECT_H__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" -#include "frames/fsc/FSCMessage.h" - -namespace p25 -{ - namespace dfsi - { - namespace fsc - { - // --------------------------------------------------------------------------- - // 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; - - /** - * @brief Initializes a copy instance of the FSCDisconnect class. - */ - FSCDisconnect(); - /** - * @brief Initializes a copy instance of the FSCDisconnect class. - * @param data Buffer to containing FSCDisconnect to decode. - */ - FSCDisconnect(uint8_t* data); - }; - } // namespace fsc - } // namespace dfsi -} // namespace p25 - -#endif // __FSC_DISCONNECT_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCHeartbeat.h b/src/dfsi/frames/fsc/FSCHeartbeat.h deleted file mode 100644 index d3f1e91b..00000000 --- a/src/dfsi/frames/fsc/FSCHeartbeat.h +++ /dev/null @@ -1,58 +0,0 @@ -// 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 - * - */ -/** - * @file FSCHeartbeat.h - * @ingroup dfsi_fsc_frames - * @file FSCHeartbeat.cpp - * @ingroup dfsi_fsc_frames - */ -#if !defined(__FSC_HEARTBEAT_H__) -#define __FSC_HEARTBEAT_H__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" -#include "frames/fsc/FSCMessage.h" - -namespace p25 -{ - namespace dfsi - { - namespace fsc - { - // --------------------------------------------------------------------------- - // 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; - - /** - * @brief Initializes a copy instance of the FSCHeartbeat class. - */ - FSCHeartbeat(); - /** - * @brief Initializes a copy instance of the FSCHeartbeat class. - * @param data Buffer to containing FSCHeartbeat to decode. - */ - FSCHeartbeat(uint8_t* data); - }; - } // namespace fsc - } // namespace dfsi -} // namespace p25 - -#endif // __FSC_HEARTBEAT_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCMessage.h b/src/dfsi/frames/fsc/FSCMessage.h deleted file mode 100644 index 8f0e4db0..00000000 --- a/src/dfsi/frames/fsc/FSCMessage.h +++ /dev/null @@ -1,82 +0,0 @@ -// 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 - * - */ -/** - * @file FSCMessage.h - * @ingroup dfsi_fsc_frames - * @file FSCMessage.cpp - * @ingroup dfsi_fsc_frames - */ -#if !defined(__FSC_MESSAGE_H__) -#define __FSC_MESSAGE_H__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" - -namespace p25 -{ - namespace dfsi - { - namespace fsc - { - // --------------------------------------------------------------------------- - // 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; - - /** - * @brief Initializes a copy instance of the FSCMessage class. - */ - FSCMessage(); - /** - * @brief Initializes a copy instance of the FSCMessage class. - * @param data Buffer to containing FSCMessage to decode. - */ - FSCMessage(uint8_t* data); - - /** - * @brief Decode a FSC message frame. - * @param[in] data Buffer to containing FSCMessage to decode. - */ - virtual bool decode(const uint8_t* data); - /** - * @brief Encode a FSC message frame. - * @param[out] data Buffer to encode a FSCMessage. - */ - virtual void encode(uint8_t* data); - - public: - /** - * @brief Message ID. - */ - __PROTECTED_PROPERTY(FSCMessageType::E, messageId, MessageId); - /** - * @brief Message Version. - */ - __PROTECTED_READONLY_PROPERTY(uint8_t, version, Version); - /** - * @brief - */ - __PROTECTED_READONLY_PROPERTY(uint8_t, correlationTag, CorrelationTag); - }; - } // namespace fsc - } // namespace dfsi -} // namespace p25 - -#endif // __FSC_MESSAGE_H__ \ No newline at end of file diff --git a/src/dfsi/frames/fsc/FSCResponse.h b/src/dfsi/frames/fsc/FSCResponse.h deleted file mode 100644 index a5bb191b..00000000 --- a/src/dfsi/frames/fsc/FSCResponse.h +++ /dev/null @@ -1,74 +0,0 @@ -// 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 - * - */ -/** - * @file FSCResponse.h - * @ingroup dfsi_fsc_frames - * @file FSCResponse.cpp - * @ingroup dfsi_fsc_frames - */ -#if !defined(__FSC_RESPONSE_H__) -#define __FSC_RESPONSE_H__ - -#include "Defines.h" -#include "common/Defines.h" -#include "common/Log.h" -#include "common/Utils.h" -#include "frames/FrameDefines.h" - -namespace p25 -{ - namespace dfsi - { - namespace fsc - { - // --------------------------------------------------------------------------- - // 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; - - /** - * @brief Initializes a copy instance of the FSCResponse class. - */ - FSCResponse(); - /** - * @brief Initializes a copy instance of the FSCResponse class. - * @param data Buffer to containing FSCResponse to decode. - */ - FSCResponse(uint8_t* data); - - /** - * @brief Decode a FSC message frame. - * @param[in] data Buffer to containing FSCResponse to decode. - */ - virtual bool decode(const uint8_t* data); - /** - * @brief Encode a FSC message frame. - * @param[out] data Buffer to encode a FSCResponse. - */ - virtual void encode(uint8_t* data); - - public: - /** - * @brief Response Version. - */ - __PROTECTED_READONLY_PROPERTY(uint8_t, version, Version); - }; - } // namespace fsc - } // namespace dfsi -} // namespace p25 - -#endif // __FSC_RESPONSE_H__ \ No newline at end of file diff --git a/src/dfsi/network/CallData.cpp b/src/dfsi/network/CallData.cpp index 4f853c0e..bf4111d6 100644 --- a/src/dfsi/network/CallData.cpp +++ b/src/dfsi/network/CallData.cpp @@ -13,6 +13,7 @@ using namespace network; using namespace modem; using namespace p25; using namespace p25::defines; +using namespace p25::dfsi::frames; using namespace dfsi; // --------------------------------------------------------------------------- diff --git a/src/dfsi/network/CallData.h b/src/dfsi/network/CallData.h index 4fa2917f..443ad858 100644 --- a/src/dfsi/network/CallData.h +++ b/src/dfsi/network/CallData.h @@ -23,12 +23,12 @@ #include "common/p25/P25Defines.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/LC.h" +#include "common/p25/dfsi/frames/Frames.h" #include "common/Log.h" #include "common/Utils.h" #include "common/yaml/Yaml.h" #include "common/RingBuffer.h" #include "network/DfsiPeerNetwork.h" -#include "frames/Frames.h" #include "host/modem/Modem.h" #include "host/modem/port/IModemPort.h" #include "host/modem/port/UARTPort.h" diff --git a/src/dfsi/network/SerialService.cpp b/src/dfsi/network/SerialService.cpp index 60e45dac..cc1bba28 100644 --- a/src/dfsi/network/SerialService.cpp +++ b/src/dfsi/network/SerialService.cpp @@ -17,6 +17,7 @@ using namespace modem; using namespace p25; using namespace p25::defines; using namespace p25::dfsi::defines; +using namespace p25::dfsi::frames; using namespace dfsi; // --------------------------------------------------------------------------- diff --git a/src/dfsi/network/SerialService.h b/src/dfsi/network/SerialService.h index f5163d3e..b81e842f 100644 --- a/src/dfsi/network/SerialService.h +++ b/src/dfsi/network/SerialService.h @@ -27,13 +27,13 @@ #include "common/p25/P25Defines.h" #include "common/p25/dfsi/DFSIDefines.h" #include "common/p25/dfsi/LC.h" +#include "common/p25/dfsi/frames/Frames.h" #include "common/Log.h" #include "common/Utils.h" #include "common/yaml/Yaml.h" #include "common/RingBuffer.h" #include "network/DfsiPeerNetwork.h" #include "network/CallData.h" -#include "frames/Frames.h" #include "host/modem/Modem.h" #include "host/modem/port/IModemPort.h" #include "host/modem/port/UARTPort.h" diff --git a/src/host/modem/Modem.cpp b/src/host/modem/Modem.cpp index 0c445e7f..03fba0e7 100644 --- a/src/host/modem/Modem.cpp +++ b/src/host/modem/Modem.cpp @@ -1742,7 +1742,7 @@ uint8_t Modem::getVersion() const } // --------------------------------------------------------------------------- -// Private Class Members +// Protected Class Members // --------------------------------------------------------------------------- /* Internal helper to warm reset the connection to the modem. */ diff --git a/src/host/modem/Modem.h b/src/host/modem/Modem.h index a5091191..a87d0eb2 100644 --- a/src/host/modem/Modem.h +++ b/src/host/modem/Modem.h @@ -312,7 +312,7 @@ namespace modem /** * @brief Finalizes a instance of the Modem class. */ - ~Modem(); + virtual ~Modem(); /** * @brief Sets the RF DC offset parameters. @@ -419,18 +419,18 @@ namespace modem * @brief Opens connection to the air interface modem. * @returns bool True, if connection to modem is made, otherwise false. */ - bool open(); + virtual bool open(); /** * @brief Updates the modem by the passed number of milliseconds. * @param ms Number of milliseconds. */ - void clock(uint32_t ms); + virtual void clock(uint32_t ms); /** * @brief Closes connection to the air interface modem. */ - void close(); + virtual void close(); /** * @brief Get the frame data length for the next frame in the DMR Slot 1 ring buffer. @@ -661,7 +661,7 @@ namespace modem */ uint8_t getVersion() const; - private: + protected: friend class ::Host; friend class ::HostCal; friend class ::RESTAPI; @@ -871,11 +871,11 @@ namespace modem /** * @brief Flag indicating if modem trace is enabled. */ - __READONLY_PROPERTY(bool, trace, Trace); + __PROTECTED_READONLY_PROPERTY(bool, trace, Trace); /** * @brief Flag indicating if modem debugging is enabled. */ - __READONLY_PROPERTY(bool, debug, Debug); + __PROTECTED_READONLY_PROPERTY(bool, debug, Debug); }; } // namespace modem