/** * 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 * */ // // Based on code from the MMDVMHost project. (https://github.com/g4klx/MMDVMHost) // Licensed under the GPLv2 License (https://opensource.org/licenses/GPL-2.0) // /* * Copyright (C) 2018-2019 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 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 uses 1/2 rate Trellis. __PROPERTY(bool, halfRateTrellis, HalfRateTrellis); /// Sets the data block serial number. __PROPERTY(uint8_t, serialNo, SerialNo); private: edac::Trellis m_trellis; uint8_t m_fmt; uint8_t* m_data; }; } // namespace data } // namespace p25 #endif // __P25_DATA__DATA_BLOCK_H__