You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dvmhost/p25/data/DataBlock.h

99 lines
3.5 KiB

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

Powered by TurnKey Linux.