/** * 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-2021 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_BLOCK_H__) #define __P25_DATA__DATA_BLOCK_H__ #include "Defines.h" #include "p25/data/DataHeader.h" #include "p25/edac/Trellis.h" #include namespace p25 { namespace data { // --------------------------------------------------------------------------- // Class Declaration // Represents a data block for PDU P25 packets. // --------------------------------------------------------------------------- class HOST_SW_API DataBlock { public: /// Initializes a new instance of the DataBlock class. DataBlock(); /// Finalizes a instance of the DataBlock class. ~DataBlock(); /// Decodes P25 PDU data block. bool decode(const uint8_t* data, const DataHeader header); /// Encodes a P25 PDU data block. void encode(uint8_t* data); /// Sets the data format. void setFormat(const uint8_t fmt); /// Sets the data format from the data header. void setFormat(const DataHeader header); /// Gets the data format. uint8_t getFormat() const; /// Sets the raw data stored in the data block. void setData(const uint8_t* buffer); /// Gets the raw data stored in the data block. uint32_t getData(uint8_t* buffer) const; public: /// Flag indicating whether or not the data block is confirmed. __PROPERTY(bool, confirmed, Confirmed); /// Sets the data block serial number. __PROPERTY(uint8_t, serialNo, SerialNo); /// Flag indicating this is the last block in a sequence of block. __PROPERTY(bool, lastBlock, LastBlock); /// Logical link ID. __PROPERTY(uint32_t, llId, LLId); /// Service access point. __PROPERTY(uint8_t, sap, SAP); private: edac::Trellis m_trellis; uint8_t m_fmt; uint8_t m_headerSap; uint8_t* m_data; /// uint16_t crc9(); }; } // namespace data } // namespace p25 #endif // __P25_DATA__DATA_BLOCK_H__