MIP_SDK  v3.0.0-502-gc890c1c
MicroStrain Communications Library for embedded systems
Functions
MIP Logging [CPP]

MIP logging in C++. More...

Functions

bool mip::formatPacketBytes (microstrain::Span< char > buffer, size_t *index, const PacketView &packet)
 Format MIP packet bytes to a string. More...
 
bool mip::formatPacket (microstrain::Span< char > buffer, size_t *index, const PacketView &packet)
 Format a MIP packet to a human-readable string. More...
 
bool mip::formatField (microstrain::Span< char > buffer, size_t *index, const FieldView &field)
 Format a MIP field to a human-readable string. More...
 
void mip::logPacket (const PacketView &packet, microstrain_log_level level)
 
void mip::logField (const FieldView &field, microstrain_log_level level)
 
void mip::logPacketVerbose (const PacketView &packet, microstrain_log_level level)
 

Detailed Description

MIP logging in C++.

Function Documentation

◆ formatField()

bool mip::formatField ( microstrain::Span< char >  buffer,
size_t *  index,
const FieldView field 
)
inline

Format a MIP field to a human-readable string.

The string will identify the field descriptor and payload bytes.

Parameters
bufferBuffer of characters. The size should be the number of characters, including the NULL terminator, that will fit in the buffer. If the pointer is NULL and size is 0, this function will just compute the required buffer size and not write any characters.
buffer_sizeNumber of characters the buffer can hold, including the NULL terminator. Must be 0 if buffer is NULL.
[in,out]indexPosition in buffer where string data will be written. It will be updated with the new index and will point to the new NULL terminator position. If insufficient space is available in buffer, index will still be updated even if it exceeds buffer_size.
fieldField to be printed. There are no restrictions on the field view other than it being initialized; even a view where mip_field_is_valid returns false is allowed.
Returns
True if successful.
False in case of insufficient buffer space.

◆ formatPacket()

bool mip::formatPacket ( microstrain::Span< char >  buffer,
size_t *  index,
const PacketView packet 
)
inline

Format a MIP packet to a human-readable string.

The string will identify the packet descriptor set and the field descriptor and payload for each field in the packet.

Parameters
bufferBuffer of characters. The size should be the number of characters, including the NULL terminator, that will fit in the buffer. If the pointer is NULL and size is 0, this function will just compute the required buffer size and not write any characters.
[in,out]indexPosition in buffer where string data will be written. It will be updated with the new index and will point to the new NULL terminator position. If insufficient space is available in buffer, index will still be updated even if it exceeds buffer_size.
packetPacket to be printed. There are no restrictions on the packet view other than it being initialized; even a view where mip_packet_is_sane returns false is allowed.
Returns
True if successful.
False in case of insufficient buffer space.

◆ formatPacketBytes()

bool mip::formatPacketBytes ( microstrain::Span< char >  buffer,
size_t *  index,
const PacketView packet 
)
inline

Format MIP packet bytes to a string.

The bytes will be grouped by header, field, and checksum. For example, a reset comm speed command would print like this: 75650104 04090501 f2bb

Parameters
bufferBuffer of characters. The size should be the number of characters, including the NULL terminator, that will fit in the buffer. If the pointer is NULL and size is 0, this function will just compute the required buffer size and not write any characters.
[in,out]indexPosition in buffer where string data will be written. It will be updated with the new index and will point to the new NULL terminator position. If insufficient space is available in buffer, index will still be updated even if it exceeds buffer_size.
packetPacket to be printed. There are no restrictions on the packet view other than it being initialized; even a view where mip_packet_is_sane returns false is allowed.
Returns
True if successful.
False in case of insufficient buffer space.

◆ logField()

void mip::logField ( const FieldView field,
microstrain_log_level  level 
)
inline

◆ logPacket()

void mip::logPacket ( const PacketView packet,
microstrain_log_level  level 
)
inline

◆ logPacketVerbose()

void mip::logPacketVerbose ( const PacketView packet,
microstrain_log_level  level 
)
inline