MIP logging in C++.
More...
MIP logging in C++.
◆ formatField()
Format a MIP field to a human-readable string.
The string will identify the field descriptor and payload bytes.
- Parameters
-
| buffer | Buffer 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_size | Number of characters the buffer can hold, including the NULL terminator. Must be 0 if buffer is NULL. |
[in,out] | index | Position 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. |
| field | Field 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()
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
-
| buffer | Buffer 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] | index | Position 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. |
| packet | Packet 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()
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
-
| buffer | Buffer 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] | index | Position 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. |
| packet | Packet 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()
◆ logPacket()
◆ logPacketVerbose()