MeshNet  1.0.0
Public Member Functions | Data Fields
MeshPacketHeader Struct Reference

This structure contains informations about mesh packet, that are stored in it's header. More...

#include <meshPacket.h>

Collaboration diagram for MeshPacketHeader:
Collaboration graph
[legend]

Public Member Functions

 MeshPacketHeader ()=default
 
uint16_t GetUniquePacketID () const
 Gets unique packed identifier which is composed from ID and source address. More...
 
bool HasError () const
 Checks if packet header is not valid. More...
 
void Clear ()
 Clears all data in packet header. More...
 
void operator= (const MeshFrameHeader &val)
 
uint16_t GetRawLength (bool includeCarriageCount) const
 Gets size of raw packet header including BSSID(4 bytes), which is not stored in packet. More...
 
bool FromMeshFrame (const MeshFrame &frame)
 Converts MeshFrame to current structure. More...
 
bool FromMeshFrame (MeshFrameHeader frameHeader, const uint8_t *data, uint16_t dataSize)
 Converts MeshFrame (which consists from MeshFrameHeader and it's data) to current structure. More...
 
MeshFrameHeader ToMeshFrameHeader (MeshMAC BSSID)
 Converts packet header to frame packet header. More...
 

Data Fields

MeshFrameControl FrameControl
 Contains flags, that controls frame. More...
 
uint8_t ID = 0
 Unique packet ID. More...
 
uint8_t Source = INVALID_MESH_ADDRESS
 Address of message source node. More...
 
uint8_t Destination = INVALID_MESH_ADDRESS
 Address of destination source node. More...
 
uint8_t From = INVALID_MESH_ADDRESS
 Address of neighbor node, which last time relayied current packet. More...
 
uint8_t To = INVALID_MESH_ADDRESS
 Address of neighbor node, which has to receive current packet and other neighbor nodes has to ignore it. More...
 
uint8_t Hops = 0
 Count of hops, that message done during transmission. Source MNode has 0 hops, next one 1 hop, etc. More...
 

Detailed Description

This structure contains informations about mesh packet, that are stored in it's header.

See also
MeshPacketHeader
meshPacket.h

Constructor & Destructor Documentation

◆ MeshPacketHeader()

MeshPacketHeader::MeshPacketHeader ( )
default

Member Function Documentation

◆ Clear()

void MeshPacketHeader::Clear ( )

Clears all data in packet header.

◆ FromMeshFrame() [1/2]

bool MeshPacketHeader::FromMeshFrame ( const MeshFrame frame)

Converts MeshFrame to current structure.

Parameters
frameMesh frame to convert.
Returns
Returns true when some packet fields are missing in data.

◆ FromMeshFrame() [2/2]

bool MeshPacketHeader::FromMeshFrame ( MeshFrameHeader  frameHeader,
const uint8_t *  data,
uint16_t  dataSize 
)

Converts MeshFrame (which consists from MeshFrameHeader and it's data) to current structure.

Parameters
frameHeaderMesh frame header.
[in]dataData contained in frame.
[in]dataSizeSize of data contained in frame in bytes.
Returns
Returns true when some packet fields are missing in data.

◆ GetRawLength()

uint16_t MeshPacketHeader::GetRawLength ( bool  includeCarriageCount) const
inline

Gets size of raw packet header including BSSID(4 bytes), which is not stored in packet.

Parameters
includeCarriageCountSet to true, if packet will include CarriageCount or not.
Returns
Returns size of raw packet header in bytes.

◆ GetUniquePacketID()

uint16_t MeshPacketHeader::GetUniquePacketID ( ) const
inline

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

◆ HasError()

bool MeshPacketHeader::HasError ( ) const
inline

Checks if packet header is not valid.

◆ operator=()

void MeshPacketHeader::operator= ( const MeshFrameHeader val)
inline

◆ ToMeshFrameHeader()

MeshFrameHeader MeshPacketHeader::ToMeshFrameHeader ( MeshMAC  BSSID)

Converts packet header to frame packet header.

Parameters
BSSIDBSSID, that will be inserted to frame header, because packet does not contains it.
Returns
Converted MeshFrameHeader.
Note
Returned MeshFrameHeader does not contains correct CarriageCount and Carriage settings from FrameControl.

Field Documentation

◆ Destination

uint8_t MeshPacketHeader::Destination = INVALID_MESH_ADDRESS

Address of destination source node.

◆ FrameControl

MeshFrameControl MeshPacketHeader::FrameControl

Contains flags, that controls frame.

See also
MeshFrameControl

◆ From

uint8_t MeshPacketHeader::From = INVALID_MESH_ADDRESS

Address of neighbor node, which last time relayied current packet.

◆ Hops

uint8_t MeshPacketHeader::Hops = 0

Count of hops, that message done during transmission. Source MNode has 0 hops, next one 1 hop, etc.

◆ ID

uint8_t MeshPacketHeader::ID = 0

Unique packet ID.

Note
ID has to be generated by source node.

◆ Source

uint8_t MeshPacketHeader::Source = INVALID_MESH_ADDRESS

Address of message source node.

◆ To

uint8_t MeshPacketHeader::To = INVALID_MESH_ADDRESS

Address of neighbor node, which has to receive current packet and other neighbor nodes has to ignore it.


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