MeshNet  1.0.0
Data Structures | Enumerations
meshPacketBuilder.h File Reference

This file contains class which can concatinate packet splitted to frames back to packet. More...

#include "meshPacket.h"
Include dependency graph for meshPacketBuilder.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  MeshPacketBuilder
 This class can build packet from multiple frames. It is usually used to concatinate data from packet, that was splitted into multiple frames in carriage, because of packet size. This class also checks if frame needs to be built (if is not carriage frame, so packet is not splitted) and converts this frame to packet. More...
 
struct  MeshACKSetup
 Structure, which has data, that are needed for ACK packet creation. More...
 

Enumerations

enum  MeshPacketBuilderStatus : int8_t {
  MPB_None = 0, MPB_FullPacketOK = 1, MPB_PartPacketOK = 2, MPB_Ignored = 3,
  MPB_SameFrameReceived = -1, MPB_InvalidFrameError = -2, MPB_FrameSizeExceededError = -3, MPB_FrameOrderError = -4,
  MPB_FrameHeaderMissingError = -5, MPB_InvalidPacketError = -6, MPB_PayloadSizeExceededError = -7, MPB_AllocationError = -8,
  MPB_PacketIntegrityError = -9
}
 Mesh packet builder status. More...
 

Detailed Description

This file contains class which can concatinate packet splitted to frames back to packet.

Credits

Author
Matej Fito�
Date
Jan 4, 2022
See also
MeshPacketBuilder
MeshACKSetup

Enumeration Type Documentation

◆ MeshPacketBuilderStatus

Mesh packet builder status.

See also
MeshPacketBuilder
meshPacketBuilder.h
Enumerator
MPB_None 

No action was done yet.

MPB_FullPacketOK 

Full packet was built and is ready to use.

MPB_PartPacketOK 

Part of packet (frame from carriage) was appended.

MPB_Ignored 

Packet frame was ignored.

MPB_SameFrameReceived 

WARNING: Same frame from carriage was received multiple times. This may happened, when ACK was not received correctly and transmitting node has resent same frame. This error has to be solved by sending ACK.

MPB_InvalidFrameError 

ERROR: Invalid frame appended and will be ignored. This may happened, when frame was corrupted.

MPB_FrameSizeExceededError 

ERROR: Frame size exceeded and will be ignored. This may happened, when frame is larger then maximum frame size set using SetMaxFrameSize() method or when frame from carriage is larger than carriage header frame. This may be solved by sending some error response, where will be specified max frame size.

Note
When using NRF24L01+ this should never happend when MaxFrameSize was not changed from default value 32 bytes, because frame larger than 32 bytes will not be received by NRF24L01+ hardware.
MPB_FrameOrderError 

ERROR: Appended frame from carriage, that was not expected yet. Frame will be ignored. This may happened, when some frame from carriage, that was expected was skipped and next frame from that carriage was appended. This can be repaired by sending some error response, which says to transmitter to resend frame, that was expected.

MPB_FrameHeaderMissingError 

ERROR: Appended frame from carriage, but frame header is missing. Frame will be ignored. This may happened, when header frame from carriage was not received, but next frame from that carriage was received or when packet was ignored, but transmitter keeps sending frames of ignored packet. It is not recommended to solving this error, because by sending some error response to transmitter, because usually the ignored messages does not belongs to current received.

Warning
Do not repair by sending some error response to transmitter.
MPB_InvalidPacketError 

ERROR: Invalid packet appended and packet will be ignored. This may happened, when system packet was received, but system packet type field is missing. Or when ACK was received and was splitted to multiple frames, which is foridden.

MPB_PayloadSizeExceededError 

FATAL ERROR: Payload size exceeded and whole packet will be discarded. This may happened, when corrupted header frame was received. This error protects MCU memory from large memory space allocation. Maximum payload size is set in macro: MESH_PACKET_PAYLOAD_SIZE_LIMIT.

MPB_AllocationError 

FATAL ERROR: Cannot allocate space for pacet payload, whole packet will be discarded. This may happened, when heap memory is full. It is recommended to send smaller packets.

MPB_PacketIntegrityError 

ERROR: Packet integrity check failed. Some frame from carriage was corupted.

Todo:
Not implemented yet, need to be done.