MIP SDK
0.0.1
MicroStrain Communications Library for embedded systems
|
C++ class representing a MIP Packet. More...
#include <mip.hpp>
Public Member Functions | |
Packet (uint8_t *buffer, size_t bufferSize, uint8_t descriptorSet) | |
Packet (uint8_t *buffer, size_t length) | |
Initializes a MIP packet from an existing buffer. More... | |
Packet (const C::mip_packet *other) | |
Constructs a C++ Packet class from the base C object. More... | |
Packet (const C::mip_packet &other) | |
Constructs a C++ Packet class from the base C object. More... | |
uint8_t | descriptorSet () const |
PacketLength | totalLength () const |
uint8_t | payloadLength () const |
bool | isData () const |
bool | isCommand () const |
const uint8_t * | pointer () const |
const uint8_t * | payload () const |
uint16_t | checksumValue () const |
uint16_t | computeChecksum () const |
bool | isSane () const |
bool | isValid () const |
bool | isEmpty () const |
PacketLength | bufferSize () const |
RemainingCount | remainingSpace () const |
bool | addField (uint8_t fieldDescriptor, const uint8_t *payload, size_t payloadLength) |
RemainingCount | allocField (uint8_t fieldDescriptor, uint8_t payloadLength, uint8_t **payloadPtr_out) |
RemainingCount | reallocLastField (uint8_t *payloadPtr, uint8_t newPayloadLength) |
RemainingCount | cancelLastField (uint8_t *payloadPtr) |
void | finalize () |
void | reset (uint8_t descSet) |
void | reset () |
Resets the packet using the same descriptor set. More... | |
Field | firstField () const |
Returns the first field in the packet. More... | |
FieldIterator | begin () const |
FieldIterator | end () const |
template<class Field > | |
bool | addField (const Field &field, uint8_t fieldDescriptor=Field::FIELD_DESCRIPTOR) |
Static Public Member Functions | |
template<class Field > | |
static Packet | createFromField (uint8_t *buffer, size_t bufferSize, const Field &field, uint8_t fieldDescriptor=Field::FIELD_DESCRIPTOR) |
C++ class representing a MIP Packet.
Fields may be iterated over using the C-style method or with a range-based for loop:
|
inline |
|
inline |
Initializes a MIP packet from an existing buffer.
Use this when receiving or parsing MIP packets.
The data in the buffer should be a valid or suspected MIP packet.
packet | |
buffer | The data buffer containing the bytes for a MIP packet. Must be at least MIP_PACKET_LENGTH_MIN bytes in size. |
length | The length of the data pointed to by buffer. |
|
inline |
Constructs a C++ Packet class from the base C object.
|
inline |
Constructs a C++ Packet class from the base C object.
|
inline |
|
inline |
|
inline |
|
inline |
Returns a forward iterator to the first field in the packet.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inline |
|
inline |
Returns a sentry object representing the end of fields in the packet.
|
inline |
|
inline |
Returns the first field in the packet.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Resets the packet using the same descriptor set.
|
inline |
|
inline |