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

Static class, that groups static methods to decode ERR_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 Source 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 Source 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 ERR_ACK_ErrorCode GetErrorCode (const MeshPacket &packet)
 Gets error code, that describes error. More...
 
static void SetErrorCode (MeshPacket &packet, ERR_ACK_ErrorCode ErrorCode)
 Sets error code, that describes error. More...
 
static uint8_t GetRepairValue (const MeshPacket &packet)
 Gets value, that can be used for solving the error. Some error codes does not contains this value. More...
 
static void SetRepairValue (MeshPacket &packet, uint8_t RepairValue)
 Sets value, that can be used for solving the error. Some error codes does not contains this value. 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, ERR_ACK_ErrorCode ErrorCode, uint8_t RepairValue=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, uint8_t ExpectedSize, ERR_ACK_ErrorCode ErrorCode, uint8_t RepairValue=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, ERR_ACK_ErrorCode ErrorCode, uint8_t RepairValue=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, ERR_ACK_ErrorCode ErrorCode, uint8_t RepairValue=0)
 Constructs packet of current type. More...
 

Static Public Attributes

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

Private Member Functions

 ERR_ACKPD ()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ ERR_ACKPD()

ERR_ACKPD::ERR_ACKPD ( )
inlineprivate

Member Function Documentation

◆ Construct() [1/4]

static bool ERR_ACKPD::Construct ( MeshPacket packet,
uint8_t  sourceAddr,
uint8_t  destAddr,
uint8_t  ACK_ID,
uint8_t  ACK_Source,
ERR_ACK_ErrorCode  ErrorCode,
uint8_t  RepairValue = 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.
ErrorCodeError code, that describes error.
RepairValueValue that can be used for solving the error. Its value depends on error code.
Returns
Returns true when packet was constructed successfully.

◆ Construct() [2/4]

static bool ERR_ACKPD::Construct ( MeshPacket packet,
uint8_t  sourceAddr,
uint8_t  destAddr,
uint8_t  ACK_ID,
uint8_t  ACK_Source,
MeshMAC  foreignBSSID,
ERR_ACK_ErrorCode  ErrorCode,
uint8_t  RepairValue = 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.
ErrorCodeError code, that describes error.
RepairValueValue that can be used for solving the error. Its value depends on error code.
Returns
Returns true when packet was constructed successfully.

◆ Construct() [3/4]

static bool ERR_ACKPD::Construct ( MeshPacket packet,
uint8_t  sourceAddr,
uint8_t  destAddr,
uint8_t  ACK_ID,
uint8_t  ACK_Source,
MeshMAC  foreignBSSID,
uint8_t  ExpectedSize,
ERR_ACK_ErrorCode  ErrorCode,
uint8_t  RepairValue = 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.
foreignBSSIDBSSID of foreign network, which has to receive this frame.
ErrorCodeError code, that describes error.
RepairValueValue that can be used for solving the error. Its value depends on error code.
Returns
Returns true when packet was constructed successfully.

◆ Construct() [4/4]

static bool ERR_ACKPD::Construct ( MeshPacket packet,
uint8_t  sourceAddr,
uint8_t  destAddr,
uint8_t  ACK_ID,
uint8_t  ACK_Source,
uint8_t  ExpectedSize,
ERR_ACK_ErrorCode  ErrorCode,
uint8_t  RepairValue = 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.
ErrorCodeError code, that describes error.
RepairValueValue that can be used for solving the error. Its value depends on error code.
Returns
Returns true when packet was constructed successfully.

◆ GetACK_ID()

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

Gets ID of packet (which with Source 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 ERR_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.

◆ GetErrorCode()

static ERR_ACK_ErrorCode ERR_ACKPD::GetErrorCode ( const MeshPacket packet)
inlinestatic

Gets error code, that describes error.

Parameters
[in]packetSystem packet to decode.
Returns
Error code.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.
See also
ERR_ACK_ErrorCode

◆ GetExpectedFrameSize() [1/2]

static uint8_t ERR_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 ERR_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 ERR_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 ERR_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.

◆ GetRepairValue()

static uint8_t ERR_ACKPD::GetRepairValue ( const MeshPacket packet)
inlinestatic

Gets value, that can be used for solving the error. Some error codes does not contains this value.

Parameters
[in]packetSystem packet to decode.
Returns
Value that can be used for solving the error. Its value depends on error code.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

◆ IsForeignNet() [1/2]

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

Checks if frame is for foreign network.

◆ IsForeignNet() [2/2]

static bool ERR_ACKPD::IsForeignNet ( uint8_t  frameDataSize)
inlinestatic

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

◆ IsSameType()

static bool ERR_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 ERR_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 ERR_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 ERR_ACKPD::SetACK_ID ( MeshPacket packet,
uint8_t  ACK_ID 
)
inlinestatic

Sets ID of packet (which with Source 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 ERR_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.

◆ SetErrorCode()

static void ERR_ACKPD::SetErrorCode ( MeshPacket packet,
ERR_ACK_ErrorCode  ErrorCode 
)
inlinestatic

Sets error code, that describes error.

Parameters
[in]packetSystem packet to decode.
ErrorCodeError code.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.
See also
ERR_ACK_ErrorCode

◆ SetExpectedFrameSize()

static void ERR_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 ERR_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.

◆ SetRepairValue()

static void ERR_ACKPD::SetRepairValue ( MeshPacket packet,
uint8_t  RepairValue 
)
inlinestatic

Sets value, that can be used for solving the error. Some error codes does not contains this value.

Parameters
[in]packetSystem packet to decode.
RepairValueValue that can be used for solving the error. Its value depends on error code.
Warning
Always check, if packet is valid using IsValid() method, else exception can be thrown.

Field Documentation

◆ Type

const static SystemPacketType ERR_ACKPD::Type = SPT_ERR_ACK
static

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


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