InertialPacketCollector
InertialPacketCollector

Class that sets/matches expected responses, and stores all the Inertial packets

Functions
InertialPacketCollector
InertialPacketCollector()

The default constructor for the InertialPacketCollector

InertialPacketCollector
~InertialPacketCollector()

The destructor for the InertialPacketCollector

Types
circular_data_buffer

Typedef for a circular buffer of a InertialDataPacket

Constants
MAX_DATA_BUFFER_SIZE = 1024 * 100

The maximum number of data packets that can be stored in the circular buffer

Variables
m_dataPackets
circular_data_buffer m_dataPackets

A circular buffer that holds InertialDataPackets

m_packetMutex
std::mutex m_packetMutex

A mutex used for thread safety when accessing/modifying the m_dataPackets buffer

m_emptyBufferCondition
std::condition_variable m_emptyBufferCondition

Allows the write to buffer thread to tell the reading thread when data is available

Functions
addDataPacket
void addDataPacket(
const InertialPacket &packet
)

Adds a data packet to the data packets circular buffer

Parameters
packet

The InertialPacket to be added to the buffer

getDataPackets
void getDataPackets(
std::vector<InertialDataPacket&packets,
uint32 timeout0,
uint32 maxPackets0
)

Gets up to the requested amount of data packets that have been collected.

Parameters
packets
std::vector<InertialDataPacket>&

A vector of InertialDataPacket to hold the result.

maxPackets
uint32

The maximum number of packets to return. If this is 0 (default), all sweeps will be returned.

totalPackets
uint32 totalPackets()

Gets the total number of data packets that are currently in the buffer.

Returns

The total number of data packets that are currently in the buffer.