MeshNet  1.0.0
Static Public Member Functions | Static Public Attributes | Private Member Functions
PathDiscPD Class Reference

Static class, that groups static methods to decode path discovery packet. More...

#include <meshPacketDecoders.h>

Static Public Member Functions

static bool IsSameType (const MeshPacket &packet)
 Checks if system packet type match decoder type, but does not check its validity. More...
 
static bool IsValid (const MeshPacket &packet)
 Checks if packet is valid. More...
 
static bool IsValid (const MeshPacketHeader &packetHeader, const uint8_t *frameData, uint8_t frameDataSize)
 Checks if packet is valid. Designed for packet header checking in MeshPacketBuilder. More...
 
static MeshMAC GetMAC (const MeshPacket &packet)
 Gets MAC address of node, which evoked packet discovery. More...
 
static void SetMAC (MeshPacket &packet, MeshMAC MAC)
 Sets MAC address of node, which evoked packet discovery. More...
 
static bool Construct (MeshPacket &packet, uint8_t sourceAddr, uint8_t destAddr, MeshMAC MAC)
 Constructs packet of current type. More...
 

Static Public Attributes

const static SystemPacketType Type = SPT_PathDiscovery
 Type of system packet, that can be decoded with current decoder. More...
 

Private Member Functions

 PathDiscPD ()
 

Detailed Description

Static class, that groups static methods to decode path discovery packet.

Constructor & Destructor Documentation

◆ PathDiscPD()

PathDiscPD::PathDiscPD ( )
inlineprivate

Member Function Documentation

◆ Construct()

static bool PathDiscPD::Construct ( MeshPacket packet,
uint8_t  sourceAddr,
uint8_t  destAddr,
MeshMAC  MAC 
)
inlinestatic

Constructs packet of current type.

Parameters
[in]packetSystem packet to construct.
sourceAddrSource node address.
destAddrDestination node address.
MACMAC address of node, which evoked packet discovery.
Returns
Returns true when packet was constructed successfully.

◆ GetMAC()

static MeshMAC PathDiscPD::GetMAC ( const MeshPacket packet)
inlinestatic

Gets MAC address of node, which evoked packet discovery.

Parameters
[in]packetSystem packet to decode.
Returns
MAC address of node, which evoked packet discovery.
Warning
Always check, if packet is valid using IsValid() method returns true, else exception can be thrown.

◆ IsSameType()

static bool PathDiscPD::IsSameType ( const MeshPacket packet)
inlinestatic

Checks if system packet type match decoder type, but does not check its validity.

Parameters
[in]packetSystem packet to decode.
Returns
True when this decoder should be used to decode current system packet.

◆ IsValid() [1/2]

static bool PathDiscPD::IsValid ( const MeshPacket packet)
inlinestatic

Checks if packet is valid.

Parameters
[in]packetSystem packet to decode.
Returns
True when packet is valid and can be decoded.
Warning
Invalid packet should not be decoded, because it can cause exception.

◆ IsValid() [2/2]

static bool PathDiscPD::IsValid ( const MeshPacketHeader packetHeader,
const uint8_t *  frameData,
uint8_t  frameDataSize 
)
inlinestatic

Checks if packet is valid. Designed for packet header checking in MeshPacketBuilder.

Parameters
[in]packetHeaderReceived packet header.
[in]frameDataPointer to data contained in first frame (excluding fields reserved for packet header).
[in]frameDataSizeSize of frame data in bytes.
Returns
True when packet is valid and can be decoded.
Warning
Invalid packet should not be decoded, because it can cause exception.

◆ SetMAC()

static void PathDiscPD::SetMAC ( MeshPacket packet,
MeshMAC  MAC 
)
inlinestatic

Sets MAC address of node, which evoked packet discovery.

Parameters
[in]packetSystem packet to decode.
MACMAC address of node, which evoked packet discovery.
Warning
Always check, if packet is valid using IsValid() method returns true, else exception can be thrown.

Field Documentation

◆ Type

const static SystemPacketType PathDiscPD::Type = SPT_PathDiscovery
static

Type of system packet, that can be decoded with current decoder.


The documentation for this class was generated from the following file: