MeshNet  1.0.0
Public Member Functions | Static Public Member Functions | Data Fields
MeshFrameHeader Struct Reference

#include <meshFrame.h>

Collaboration diagram for MeshFrameHeader:
Collaboration graph
[legend]

Public Member Functions

 MeshFrameHeader ()=default
 
 MeshFrameHeader (const uint8_t *data, uint8_t dataSize)
 Fills frame header fields only from raw data, frame data are ignored. More...
 
uint16_t GetUniquePacketID () const
 Gets unique packed identifier which is composed from ID and source address. More...
 
bool HasError () const
 Checks if frame is not valid. More...
 
void Clear ()
 Clears all data in frame header. More...
 
bool IsSamePacket (const MeshFrameHeader &frameHeader) const
 Checks if two frames are from same packet. More...
 
bool IsSamePacket (const MeshFrame &frame) const
 Checks if two frames are from same packet. More...
 
uint8_t GetRawLength () const
 Gets size of raw data length of header only. More...
 
bool FromRaw (const uint8_t *data, uint8_t dataSize)
 Fills frame header fields only from raw data, frame data are ignored. More...
 
bool ToRaw (uint8_t *data, uint8_t &dataSize) const
 Converts frame header to raw data. More...
 

Static Public Member Functions

static uint8_t GetRawLength (bool includeCarriageCount)
 Gets size of raw data length of header only. More...
 

Data Fields

MeshFrameControl FrameControl
 Contains flags, that controls frame. More...
 
MeshMAC BSSID
 Mesh network identifier. More...
 
uint8_t ID = 0
 Unique packet ID. More...
 
uint8_t Source = INVALID_MESH_ADDRESS
 Address of message source node. More...
 
uint8_t CarriageCount = 0
 Count of remaining frames in carriage. More...
 

Constructor & Destructor Documentation

◆ MeshFrameHeader() [1/2]

MeshFrameHeader::MeshFrameHeader ( )
default

◆ MeshFrameHeader() [2/2]

MeshFrameHeader::MeshFrameHeader ( const uint8_t *  data,
uint8_t  dataSize 
)

Fills frame header fields only from raw data, frame data are ignored.

Parameters
[in]dataReceived raw data.
[in]dataSizeLength of received raw data in bytes.

Member Function Documentation

◆ Clear()

void MeshFrameHeader::Clear ( )

Clears all data in frame header.

◆ FromRaw()

bool MeshFrameHeader::FromRaw ( const uint8_t *  data,
uint8_t  dataSize 
)

Fills frame header fields only from raw data, frame data are ignored.

Parameters
[in]dataReceived raw data.
[in]dataSizeLength of received raw data in bytes.
Returns
Returns true when no error happened.

◆ GetRawLength() [1/2]

uint8_t MeshFrameHeader::GetRawLength ( ) const
inline

Gets size of raw data length of header only.

Returns
Returns size of raw data length in bytes.

◆ GetRawLength() [2/2]

static uint8_t MeshFrameHeader::GetRawLength ( bool  includeCarriageCount)
inlinestatic

Gets size of raw data length of header only.

Parameters
includeCarriageCountSet to true to get length including carriage count byte
Returns
Returns size of raw data length in bytes.

◆ GetUniquePacketID()

uint16_t MeshFrameHeader::GetUniquePacketID ( ) const
inline

Gets unique packed identifier which is composed from ID and source address.

◆ HasError()

bool MeshFrameHeader::HasError ( ) const
inline

Checks if frame is not valid.

◆ IsSamePacket() [1/2]

bool MeshFrameHeader::IsSamePacket ( const MeshFrame frame) const
inline

Checks if two frames are from same packet.

Parameters
frameAnother frame.
Returns
Returns true when both frames are from same packet.

◆ IsSamePacket() [2/2]

bool MeshFrameHeader::IsSamePacket ( const MeshFrameHeader frameHeader) const
inline

Checks if two frames are from same packet.

Parameters
frameHeaderAnother frame header.
Returns
Returns true when both frames are from same packet.

◆ ToRaw()

bool MeshFrameHeader::ToRaw ( uint8_t *  data,
uint8_t &  dataSize 
) const

Converts frame header to raw data.

Parameters
[out]dataOutput raw data buffer.
[in,out]dataSizeInput is reserved size of data buffer and output is contains raw data size.
Returns
Returns true when structure was converted to raw data or false when data buffer has not enough space.

Field Documentation

◆ BSSID

MeshMAC MeshFrameHeader::BSSID

Mesh network identifier.

◆ CarriageCount

uint8_t MeshFrameHeader::CarriageCount = 0

Count of remaining frames in carriage.

◆ FrameControl

MeshFrameControl MeshFrameHeader::FrameControl

Contains flags, that controls frame.

See also
MeshFrameControl

◆ ID

uint8_t MeshFrameHeader::ID = 0

Unique packet ID.

Note
ID has to be generated by source node.

◆ Source

uint8_t MeshFrameHeader::Source = INVALID_MESH_ADDRESS

Address of message source node.


The documentation for this struct was generated from the following files: