InertialParser
InertialParser

Parsers all inertial data and stores it in a corresponding container

Functions
InertialParser
InertialParser(
InertialPacketCollector *packetCollector,
std::weak_ptr<ResponseCollectorresponseCollector
)

Constructor for InertialParser

Parameters
packetCollector

the InertialPacketCollector to be associated with this parser

Variables
m_packetCollector
InertialPacketCollector* m_packetCollector

The InertialPacketCollector associated with this parser and it's parent device

m_responseCollector
std::weak_ptr<ResponseCollector> m_responseCollector

The ResponseCollector associated with this parser and it's parent device

Functions
processPacket
void processPacket(
InertialPacket &packet
)

Takes an InertialPacket, adds it to the data container if it is a data packet, or adds it to the appropriate handler depending on the packet type

Parameters
packet

A verified, valid InertialPacket

findMatchingResponse
void findMatchingResponse(
InertialPacket &packet
)

Takes an InertialPacket and checks if the packet collector has any responses it is waiting on.  If it does, and the packet matches the expected response, the packet is "given" to the packet collector.

Parameters
packet

An InertialPacket to match against expected responses

parseFields
InertialDataFields parseFields(
InertialPacket &packet
)

Parses the InertialDataFields out of the InertialPacket and returns them in a container.

Parameters
packet

The InertialPacket to parse the fields from

Returns

A vector of InertialDataFields parsed from the packet

parseAsPacket
InertialParseResult parseAsPacket(
DataBuffer &data,
InertialPacket &packet
)

Takes a DataBuffer that has had its read position moved to the start of a packet and verifies that the bytes form a valid Inertial (MIP) packet

Parameters
data

A DataBuffer with its read position at the start of a packet (0x7565)

packet

An InertialPacket to hold all the packet information if the packet is verified from the DataBuffer

Returns

An InertialParseResult describing if the packet was verified, or why it failed verification

findPacketInBytes
bool findPacketInBytes(
DataBuffer &data
)

Checks for packets after the current bytes buffer's read position (starting at the next byte, not the current one).  If a packet is found, the packet is processed and the byte buffer's read position is moved.  If a packet is not found, nothing changes in the byte buffer

Parameters
data

The bytes to look through for a packet

Returns

true if a MIP Inertial packet is found, false otherwise

parse
void parse(
DataBuffer &data
)

Takes a DataBuffer and finds the next MIP Inertial Packet, or the next command response that is expected by the base station.

If an ASPP packet is found, the packet will be stored in the WirelessPacketCollector If a command response is found and is expected, it will be handled and passed to the base station directly.

Parameters
data

A DataBuffer containing bytes that should be parsed for MicroStrain packets