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

Static class, that groups static methods to decode ACK 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 uint8_t GetACK_ID (const MeshPacket &packet)
 Gets ID of packet (which with Souce creates unique packet identifier), that is being acknowledged. More...
 
static void SetACK_ID (MeshPacket &packet, uint8_t ACK_ID)
 Sets ID of packet (which with Souce creates unique packet identifier), that is being acknowledged. More...
 
static uint8_t GetACK_Source (const MeshPacket &packet)
 Gets Source of packet (which with ID creates unique packet identifier), that is being acknowledged. More...
 
static void SetACK_Source (MeshPacket &packet, uint8_t ACK_Source)
 Sets Source of packet (which with ID creates unique packet identifier), that is being acknowledged. More...
 
static uint8_t GetExpectedFrameSize (const uint8_t *frameData)
 Gets size of frame, which is expected to be received after this acknowledgement. Designed for packet header checking in MeshPacketBuilder. This has to be used, when packet is splitted to multiple frames and each frame has to be acknowledged. It can help prevent to hidden terminal problem. All transmitters which receive this ACK frame has to calculate time, they has to wait until transmission. More...
 
static uint8_t GetExpectedFrameSize (const MeshPacket &packet)
 Gets size of frame, which is expected to be received after this acknowledgement. This has to be used, when packet is splitted to multiple frames and each frame has to be acknowledged. It can help prevent to hidden terminal problem. All transmitters which receive this ACK frame has to calculate time, they has to wait until transmission. More...
 
static void SetExpectedFrameSize (MeshPacket &packet, uint8_t ExpectedSize)
 Sets size of frame, which is expected to be received after this acknowledgement. This has to be used, when packet is splitted to multiple frames and each frame has to be acknowledged. It can help prevent to hidden terminal problem. All transmitters which receive this ACK frame has to calculate time, they has to wait until transmission. More...
 
static bool IsForeignNet (const MeshPacket &packet)
 Checks if frame is for foreign network. More...
 
static bool IsForeignNet (uint8_t frameDataSize)
 Checks if frame is for foreign network. Designed for packet header checking in MeshPacketBuilder. More...
 
static MeshMAC GetForeignNetBSSID (const MeshPacket &packet)
 Gets BSSID of foreign network, which has to receive this frame. More...
 
static MeshMAC GetForeignNetBSSID (const uint8_t *frameData)
 Gets BSSID of foreign network, which has to receive this frame. Designed for packet header checking in MeshPacketBuilder. More...
 
static void SetForeignNetBSSID (MeshPacket &packet, MeshMAC foreignBSSID)
 Sets BSSID of foreign network, which has to receive this frame. More...
 
static bool Construct (MeshPacket &packet, uint8_t sourceAddr, uint8_t destAddr, uint8_t ACK_ID, uint8_t ACK_Source, uint8_t ExpectedSize=0)
 Constructs packet of current type. More...
 
static bool Construct (MeshPacket &packet, uint8_t sourceAddr, uint8_t destAddr, uint8_t ACK_ID, uint8_t ACK_Source, MeshMAC foreignBSSID, uint8_t ExpectedSize=0)
 Constructs packet of current type. More...
 

Static Public Attributes

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

Private Member Functions

 ACKPD ()
 

Detailed Description

Static class, that groups static methods to decode ACK packet.

Constructor & Destructor Documentation

◆ ACKPD()

ACKPD::ACKPD ( )
inlineprivate

Member Function Documentation

◆ Construct() [1/2]

static bool ACKPD::Construct ( MeshPacket packet,
uint8_t  sourceAddr,
uint8_t  destAddr,
uint8_t  ACK_ID,
uint8_t  ACK_Source,
MeshMAC  foreignBSSID,
uint8_t  ExpectedSize = 0 
)
inlinestatic

Constructs packet of current type.

Parameters
[in]packetSystem packet to construct.
sourceAddrSource node address.
destAddrDestination node address.
ACK_IDID of acknowledged packet.
ACK_SourceSource address of acknowledged packet.
foreignBSSIDBSSID of foreign network, which has to receive this frame.
ExpectedSizeExpected size of next carriage frame to be received. If there is no next frame, set to 0.
Returns
Returns true when packet was constructed successfully.

◆ Construct() [2/2]

static bool ACKPD::Construct ( MeshPacket packet,
uint8_t  sourceAddr,
uint8_t  destAddr,
uint8_t  ACK_ID,
uint8_t  ACK_Source,
uint8_t  ExpectedSize = 0 
)
inlinestatic

Constructs packet of current type.

Parameters
[in]packetSystem packet to construct.
sourceAddrSource node address.
destAddrDestination node address.
ACK_IDID of acknowledged packet.
ACK_SourceSource address of acknowledged packet.
ExpectedSizeExpected size of next carriage frame to be received. If there is no next frame, set to 0.
Returns
Returns true when packet was constructed successfully.

◆ GetACK_ID()

static uint8_t ACKPD::GetACK_ID ( const MeshPacket packet)
inlinestatic

Gets ID of packet (which with Souce creates unique packet identifier), that is being acknowledged.

Parameters
[in]packetSystem packet to decode.
Returns
ID of acknowledged pacekt.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

◆ GetACK_Source()

static uint8_t ACKPD::GetACK_Source ( const MeshPacket packet)
inlinestatic

Gets Source of packet (which with ID creates unique packet identifier), that is being acknowledged.

Parameters
[in]packetSystem packet to decode.
Returns
Source address of acknowledged pacekt.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

◆ GetExpectedFrameSize() [1/2]

static uint8_t ACKPD::GetExpectedFrameSize ( const MeshPacket packet)
inlinestatic

Gets size of frame, which is expected to be received after this acknowledgement. This has to be used, when packet is splitted to multiple frames and each frame has to be acknowledged. It can help prevent to hidden terminal problem. All transmitters which receive this ACK frame has to calculate time, they has to wait until transmission.

Parameters
[in]packetSystem packet to decode.
Returns
Expected size of next carriage frame to be received. If there is no next frame, 0 is set.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

◆ GetExpectedFrameSize() [2/2]

static uint8_t ACKPD::GetExpectedFrameSize ( const uint8_t *  frameData)
inlinestatic

Gets size of frame, which is expected to be received after this acknowledgement. Designed for packet header checking in MeshPacketBuilder. This has to be used, when packet is splitted to multiple frames and each frame has to be acknowledged. It can help prevent to hidden terminal problem. All transmitters which receive this ACK frame has to calculate time, they has to wait until transmission.

Parameters
[in]frameDataPointer to data contained in first frame (excluding fields reserved for packet header).
Returns
Expected size of next carriage frame to be received. If there is no next frame, 0 is set.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

◆ GetForeignNetBSSID() [1/2]

static MeshMAC ACKPD::GetForeignNetBSSID ( const MeshPacket packet)
inlinestatic

Gets BSSID of foreign network, which has to receive this frame.

Parameters
[in]packetSystem packet to decode.
Returns
BSSID of foreign network, which has to receive this frame.
Warning
Always check, if packet is valid using IsValid() method and if IsForeignNet() returns true, else exception can be thrown.

◆ GetForeignNetBSSID() [2/2]

static MeshMAC ACKPD::GetForeignNetBSSID ( const uint8_t *  frameData)
inlinestatic

Gets BSSID of foreign network, which has to receive this frame. Designed for packet header checking in MeshPacketBuilder.

Parameters
[in]frameDataPointer to data contained in first frame (excluding fields reserved for packet header).
Returns
BSSID of foreign network, which has to receive this frame.
Warning
Always check, if packet is valid using IsValid() method and if IsForeignNet() returns true, else exception can be thrown.

◆ IsForeignNet() [1/2]

static bool ACKPD::IsForeignNet ( const MeshPacket packet)
inlinestatic

Checks if frame is for foreign network.

◆ IsForeignNet() [2/2]

static bool ACKPD::IsForeignNet ( uint8_t  frameDataSize)
inlinestatic

Checks if frame is for foreign network. Designed for packet header checking in MeshPacketBuilder.

◆ IsSameType()

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

◆ SetACK_ID()

static void ACKPD::SetACK_ID ( MeshPacket packet,
uint8_t  ACK_ID 
)
inlinestatic

Sets ID of packet (which with Souce creates unique packet identifier), that is being acknowledged.

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

◆ SetACK_Source()

static void ACKPD::SetACK_Source ( MeshPacket packet,
uint8_t  ACK_Source 
)
inlinestatic

Sets Source of packet (which with ID creates unique packet identifier), that is being acknowledged.

Parameters
[in]packetSystem packet to decode.
ACK_SourceSource address of acknowledged packet.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

◆ SetExpectedFrameSize()

static void ACKPD::SetExpectedFrameSize ( MeshPacket packet,
uint8_t  ExpectedSize 
)
inlinestatic

Sets size of frame, which is expected to be received after this acknowledgement. This has to be used, when packet is splitted to multiple frames and each frame has to be acknowledged. It can help prevent to hidden terminal problem. All transmitters which receive this ACK frame has to calculate time, they has to wait until transmission.

Parameters
[in]packetSystem packet to decode.
ExpectedSizeExpected size of next carriage frame to be received. If there is no next frame, set to 0.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

◆ SetForeignNetBSSID()

static void ACKPD::SetForeignNetBSSID ( MeshPacket packet,
MeshMAC  foreignBSSID 
)
inlinestatic

Sets BSSID of foreign network, which has to receive this frame.

Parameters
[in]packetSystem packet to decode.
foreignBSSIDBSSID of foreign network, which has to receive this frame.
Warning
Always check, if packet is valid using IsValid() method and if IsForeignNet() returns true, else exception can be thrown.

Field Documentation

◆ Type

const static SystemPacketType ACKPD::Type = SPT_ACK
static

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


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