3es
0.7
|
This class accepts responsibility for collating incoming byte streams. More...
#include <3espacketbuffer.h>
Public Member Functions | |
PacketBuffer () | |
Constructors 2Kb buffer. | |
~PacketBuffer () | |
Destructor. | |
int | addBytes (const uint8_t *bytes, size_t byteCount) |
Adds bytes to the buffer. More... | |
PacketHeader * | extractPacket () |
Extract the first valid packet in the buffer. More... | |
void | releasePacket (PacketHeader *packet) |
Releases the memory for the given packet. More... | |
This class accepts responsibility for collating incoming byte streams.
Data is buffered until full packets have arrived, which must be extracted using extractPacket()
.
int tes::PacketBuffer::addBytes | ( | const uint8_t * | bytes, |
size_t | byteCount | ||
) |
Adds bytes
to the buffer.
Data are rejected if the marker is not present or, if present, data before the marker are rejected.
PacketHeader* tes::PacketBuffer::extractPacket | ( | ) |
Extract the first valid packet in the buffer.
Additional packets may be available.
releasePacket()
. void tes::PacketBuffer::releasePacket | ( | PacketHeader * | packet | ) |
Releases the memory for the given packet.
packet | The packet to release. |