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

Static class, that groups static methods to decode relayied network connection response 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 uint16_t GetFlags (const MeshPacket &packet)
 Gets network connect flags. More...
 
static void SetFlags (MeshPacket &packet, uint16_t flags)
 Sets network connect flags. More...
 
static MeshMAC GetRequesterMAC (const MeshPacket &packet)
 Gets MAC address of node, which requests network connection. More...
 
static void SetRequesterMAC (MeshPacket &packet, MeshMAC requesterMAC)
 SetsMAC address of node, which requests network connection. More...
 
static uint8_t GetAssignedAddr (const MeshPacket &packet)
 Gets address assigned to node which requested connection. More...
 
static void SetAssignedAddr (MeshPacket &packet, uint8_t address)
 Sets address assigned to node which requested connection. More...
 
static bool IsRefusedConnection (MeshPacket &packet)
 Checks if connection is refused. More...
 
static NetConRespRefuseReason GetRefuseReason (MeshPacket &packet)
 Gets refuse reason when connection was refused. More...
 
static void SetRefuseReason (MeshPacket &packet, NetConRespRefuseReason reason)
 Sets refuse reason when connection was refused. More...
 
static uint16_t GetReservedTime (const MeshPacket &packet)
 Gets reserved time in DHCP table in minutes. More...
 
static void SetReservedTime (MeshPacket &packet, uint16_t time)
 Sets reserved time in DHCP table in minutes. More...
 
static bool Construct (MeshPacket &packet, uint8_t sourceAddr, uint8_t destAddr, uint16_t flags, MeshMAC requesterMAC, uint8_t address, uint16_t time)
 Constructs packet of current type. More...
 
static bool ConstructRefused (MeshPacket &packet, uint8_t sourceAddr, uint8_t destAddr, uint16_t flags, MeshMAC requesterMAC, NetConRespRefuseReason reason)
 Constructs refused connection response packet of current type. More...
 

Static Public Attributes

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

Private Member Functions

 RelNetConRespPD ()
 

Detailed Description

Static class, that groups static methods to decode relayied network connection response packet.

Constructor & Destructor Documentation

◆ RelNetConRespPD()

RelNetConRespPD::RelNetConRespPD ( )
inlineprivate

Member Function Documentation

◆ Construct()

static bool RelNetConRespPD::Construct ( MeshPacket packet,
uint8_t  sourceAddr,
uint8_t  destAddr,
uint16_t  flags,
MeshMAC  requesterMAC,
uint8_t  address,
uint16_t  time 
)
inlinestatic

Constructs packet of current type.

Parameters
[in]packetSystem packet to construct.
sourceAddrSource node address.
destAddrDestination node address.
flagsNetwork scan flags.
requesterMACMAC address of node, which requests network connection.
addressAddress assigned to node which requested connection.
timeReserved time in DHCP table in minutes.
Returns
Returns true when packet was constructed successfully.

◆ ConstructRefused()

static bool RelNetConRespPD::ConstructRefused ( MeshPacket packet,
uint8_t  sourceAddr,
uint8_t  destAddr,
uint16_t  flags,
MeshMAC  requesterMAC,
NetConRespRefuseReason  reason 
)
inlinestatic

Constructs refused connection response packet of current type.

Parameters
[in]packetSystem packet to construct.
sourceAddrSource node address.
destAddrDestination node address.
flagsNetwork scan flags.
requesterMACMAC address of node, which requests network connection.
reasonRefuse reason.
Returns
Returns true when packet was constructed successfully.

◆ GetAssignedAddr()

static uint8_t RelNetConRespPD::GetAssignedAddr ( const MeshPacket packet)
inlinestatic

Gets address assigned to node which requested connection.

Parameters
[in]packetSystem packet to decode.
Returns
Address assigned to node which requested connection.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

◆ GetFlags()

static uint16_t RelNetConRespPD::GetFlags ( const MeshPacket packet)
inlinestatic

Gets network connect flags.

Parameters
[in]packetSystem packet to decode.
Returns
Network connect flags.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

◆ GetRefuseReason()

static NetConRespRefuseReason RelNetConRespPD::GetRefuseReason ( MeshPacket packet)
inlinestatic

Gets refuse reason when connection was refused.

Parameters
[in]packetSystem packet to decode.

◆ GetRequesterMAC()

static MeshMAC RelNetConRespPD::GetRequesterMAC ( const MeshPacket packet)
inlinestatic

Gets MAC address of node, which requests network connection.

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

◆ GetReservedTime()

static uint16_t RelNetConRespPD::GetReservedTime ( const MeshPacket packet)
inlinestatic

Gets reserved time in DHCP table in minutes.

Parameters
[in]packetSystem packet to decode.
Returns
Reserved time in DHCP table in minutes.
Warning
Always check, if packet is valid using IsValid() method check if IsRefusedConnection() returns false, else exception can be thrown.

◆ IsRefusedConnection()

static bool RelNetConRespPD::IsRefusedConnection ( MeshPacket packet)
inlinestatic

Checks if connection is refused.

◆ IsSameType()

static bool RelNetConRespPD::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 RelNetConRespPD::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 RelNetConRespPD::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.

◆ SetAssignedAddr()

static void RelNetConRespPD::SetAssignedAddr ( MeshPacket packet,
uint8_t  address 
)
inlinestatic

Sets address assigned to node which requested connection.

Parameters
[in]packetSystem packet to decode.
addressAddress assigned to node which requested connection.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

◆ SetFlags()

static void RelNetConRespPD::SetFlags ( MeshPacket packet,
uint16_t  flags 
)
inlinestatic

Sets network connect flags.

Parameters
[in]packetSystem packet to decode.
flagsNetwork connect flags.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

◆ SetRefuseReason()

static void RelNetConRespPD::SetRefuseReason ( MeshPacket packet,
NetConRespRefuseReason  reason 
)
inlinestatic

Sets refuse reason when connection was refused.

Parameters
[in]packetSystem packet to decode.
reasonRefuse reason to set.
Note
This method can be called only if packet is set as refused.

◆ SetRequesterMAC()

static void RelNetConRespPD::SetRequesterMAC ( MeshPacket packet,
MeshMAC  requesterMAC 
)
inlinestatic

SetsMAC address of node, which requests network connection.

Parameters
[in]packetSystem packet to decode.
requesterMACMAC address of node, which requests network connection.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

◆ SetReservedTime()

static void RelNetConRespPD::SetReservedTime ( MeshPacket packet,
uint16_t  time 
)
inlinestatic

Sets reserved time in DHCP table in minutes.

Parameters
[in]packetSystem packet to decode.
timeReserved time in DHCP table in minutes.
Warning
Always check, if packet is valid using IsValid() method check if IsRefusedConnection() returns false, else exception can be thrown.

Field Documentation

◆ Type

const static SystemPacketType RelNetConRespPD::Type = SPT_Connect
static

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


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