/** * Digital Voice Modem - Host Software * GPLv2 Open Source. Use is subject to license terms. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * @package DVM / Host Software * */ /* * Copyright (C) 2018 by Bryan Biedenkapp N2PLL * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #if !defined(__P25_DATA__DATA_HEADER_H__) #define __P25_DATA__DATA_HEADER_H__ #include "Defines.h" #include "p25/edac/Trellis.h" #include namespace p25 { namespace data { // --------------------------------------------------------------------------- // Class Declaration // Represents the data header for PDU P25 packets. // --------------------------------------------------------------------------- class HOST_SW_API DataHeader { public: /// Initializes a new instance of the DataHeader class. DataHeader(); /// Finalizes a instance of the DataHeader class. ~DataHeader(); /// Decodes P25 PDU data header. bool decode(const uint8_t* data); /// Encodes P25 PDU data header. void encode(uint8_t* data); /// Helper to reset data values to defaults. void reset(); /// Gets the total number of data octets. uint32_t getDataOctets() const; /** Common Data */ /// Sets the total number of blocks to follow this header. void setBlocksToFollow(uint8_t blocksToFollow); /// Gets the total number of blocks to follow this header. uint8_t getBlocksToFollow() const; /// Sets the count of block padding. void setPadCount(uint8_t padCount); /// Gets the count of block padding. uint8_t getPadCount() const; public: /// Flag indicating if acknowledgement is needed. __PROPERTY(bool, ackNeeded, AckNeeded); /// Flag indicating if this is an outbound data packet. __PROPERTY(bool, outbound, Outbound); /// Data packet format. __PROPERTY(uint8_t, fmt, Format); /// Service access point. __PROPERTY(uint8_t, sap, SAP); /// Manufacturer ID. __PROPERTY(uint8_t, mfId, MFId); /// Logical link ID. __PROPERTY(uint32_t, llId, LLId); /// Flag indicating whether or not this data packet is a full message. __PROPERTY(bool, fullMessage, FullMessage); /// __PROPERTY(bool, sync, Sync); /// __PROPERTY(uint8_t, n, N); /// Data packet sequence number. __PROPERTY(uint8_t, seqNo, SeqNo); /// Offset of the header. __PROPERTY(uint8_t, headerOffset, HeaderOffset); /// Alternate Trunking Block Opcode __PROPERTY(uint8_t, ambtOpcode, AMBTOpcode); private: edac::Trellis m_trellis; uint8_t m_blocksToFollow; uint8_t m_padCount; uint32_t m_dataOctets; }; } // namespace data } // namespace p25 #endif // __P25_DATA__DATA_HEADER_H__