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/DataHeader.h

108 lines
4.2 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
*
*/
/*
* 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 <string>
namespace p25
{
namespace data
{
// ---------------------------------------------------------------------------
// Class Declaration
// Represents the data header for PDU P25 packets.
// ---------------------------------------------------------------------------
class HOST_SW_API DataHeader {
public:
/// <summary>Initializes a new instance of the DataHeader class.</summary>
DataHeader();
/// <summary>Finalizes a instance of the DataHeader class.</summary>
~DataHeader();
/// <summary>Decodes P25 PDU data header.</summary>
bool decode(const uint8_t* data);
/// <summary>Encodes P25 PDU data header.</summary>
void encode(uint8_t* data);
/// <summary>Helper to reset data values to defaults.</summary>
void reset();
/// <summary>Gets the total number of data octets.</summary>
uint32_t getDataOctets() const;
/** Common Data */
/// <summary>Sets the total number of blocks to follow this header.</summary>
void setBlocksToFollow(uint8_t blocksToFollow);
/// <summary>Gets the total number of blocks to follow this header.</summary>
uint8_t getBlocksToFollow() const;
/// <summary>Sets the count of block padding.</summary>
void setPadCount(uint8_t padCount);
/// <summary>Gets the count of block padding.</summary>
uint8_t getPadCount() const;
public:
/// <summary>Flag indicating if acknowledgement is needed.</summary>
__PROPERTY(bool, ackNeeded, AckNeeded);
/// <summary>Flag indicating if this is an outbound data packet.</summary>
__PROPERTY(bool, outbound, Outbound);
/// <summary>Data packet format.</summary>
__PROPERTY(uint8_t, fmt, Format);
/// <summary>Service access point.</summary>
__PROPERTY(uint8_t, sap, SAP);
/// <summary>Manufacturer ID.</summary>
__PROPERTY(uint8_t, mfId, MFId);
/// <summary>Logical link ID.</summary>
__PROPERTY(uint32_t, llId, LLId);
/// <summary>Flag indicating whether or not this data packet is a full message.</summary>
__PROPERTY(bool, fullMessage, FullMessage);
/// <summary></summary>
__PROPERTY(bool, sync, Sync);
/// <summary></summary>
__PROPERTY(uint8_t, n, N);
/// <summary>Data packet sequence number.</summary>
__PROPERTY(uint8_t, seqNo, SeqNo);
/// <summary>Offset of the header.</summary>
__PROPERTY(uint8_t, headerOffset, HeaderOffset);
/// <summary>Alternate Trunking Block Opcode</summary>
__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__

Powered by TurnKey Linux.