HiveMindBridge
Public Member Functions | Private Attributes | List of all members
BytesAccumulator Class Reference

#include <BytesAccumulator.h>

Collaboration diagram for BytesAccumulator:
Collaboration graph

Public Member Functions

bool appendBytes (uint8_t *bytes, uint16_t length, uint32_t packetNumber)
 
std::vector< uint8_t > * getBytes ()
 
uint32_t getLastPacketNumber () const
 

Private Attributes

std::vector< uint8_t > m_bytes
 
uint32_t m_lastPacketNumber = -1
 

Detailed Description

An accumulator of bytes to be used for the reception of an arbitrary bytes payload.

Member Function Documentation

◆ appendBytes()

bool BytesAccumulator::appendBytes ( uint8_t *  bytes,
uint16_t  length,
uint32_t  packetNumber 
)

Append some bytes to reconstruct the payload from many packets

Parameters
bytesThe bytes from a packet
lengthThe length of the packet's payload
packetNumberThe number of the packet number
Returns
false if the packet number does not follow strictly the last packet to have been appended. Returns true if the operation succeded.

◆ getBytes()

std::vector< uint8_t > * BytesAccumulator::getBytes ( )

Returns the assembled bytes

◆ getLastPacketNumber()

uint32_t BytesAccumulator::getLastPacketNumber ( ) const

Returns the number of the last packet that was appended to the accumulator.

Member Data Documentation

◆ m_bytes

std::vector<uint8_t> BytesAccumulator::m_bytes
private

◆ m_lastPacketNumber

uint32_t BytesAccumulator::m_lastPacketNumber = -1
private

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