|
MIP_SDK
v3.0.0
MicroStrain Communications Library for embedded systems
|
Functions for accessing information about an existing MIP packet. More...
Functions | |
| void | mip::C::mip_packet_from_buffer (mip_packet_view *packet, const uint8_t *buffer, size_t length) |
| Initializes a MIP packet from an existing buffer. More... | |
| uint8_t | mip::C::mip_packet_descriptor_set (const mip_packet_view *packet) |
| Returns the MIP descriptor set for this packet. More... | |
| uint_least16_t | mip::C::mip_packet_total_length (const mip_packet_view *packet) |
| Returns the total length of the packet, in bytes. More... | |
| uint8_t | mip::C::mip_packet_payload_length (const mip_packet_view *packet) |
| Returns the length of the payload (MIP fields). More... | |
| uint8_t * | mip::C::mip_packet_buffer (mip_packet_view *packet) |
| Returns a writable pointer to the data buffer. More... | |
| const uint8_t * | mip::C::mip_packet_pointer (const mip_packet_view *packet) |
| Returns a pointer to the data buffer containing the packet. More... | |
| const uint8_t * | mip::C::mip_packet_payload (const mip_packet_view *packet) |
| Returns a pointer to the packet's payload (the first field). More... | |
| uint16_t | mip::C::mip_packet_checksum_value (const mip_packet_view *packet) |
| Returns the value of the checksum as written in the packet. More... | |
| uint16_t | mip::C::mip_packet_compute_checksum (const mip_packet_view *packet) |
| Computes the checksum of the MIP packet. More... | |
| bool | mip::C::mip_packet_is_sane (const mip_packet_view *packet) |
| Returns true if the packet buffer is not NULL and is at least the minimum size (MIP_PACKET_LENGTH_MIN). More... | |
| bool | mip::C::mip_packet_is_valid (const mip_packet_view *packet) |
| Returns true if the packet is valid. More... | |
| bool | mip::C::mip_packet_is_empty (const mip_packet_view *packet) |
| Returns true if the mip packet contains no payload. More... | |
| uint_least16_t | mip::C::mip_packet_buffer_size (const mip_packet_view *packet) |
| Returns the size of the buffer backing the MIP packet. More... | |
| int | mip::C::mip_packet_remaining_space (const mip_packet_view *packet) |
| Returns the remaining space available for more payload data. More... | |
| bool | mip::C::mip_packet_is_data (const mip_packet_view *packet) |
| Returns true if the packet is from a data descriptor set. More... | |
Functions for accessing information about an existing MIP packet.
Use these functions to get information about a MIP packet after it has been parsed. Generally, first the descriptor set would be inspected followed by iterating the fields using the MipFieldIteration functions.
With the exception of mip_packet_checksum_value() (and any function which calls it, e.g. mip_packet_is_valid()), these functions may also be used on packets which are under construction via the PacketBuilding functions.
| uint8_t * mip::C::mip_packet_buffer | ( | mip_packet_view * | packet | ) |
Returns a writable pointer to the data buffer.
| uint_least16_t mip::C::mip_packet_buffer_size | ( | const mip_packet_view * | packet | ) |
Returns the size of the buffer backing the MIP packet.
| uint16_t mip::C::mip_packet_checksum_value | ( | const mip_packet_view * | packet | ) |
Returns the value of the checksum as written in the packet.
This function does not compute the checksum. To do so, use mip_packet_compute_checksum().
| uint16_t mip::C::mip_packet_compute_checksum | ( | const mip_packet_view * | packet | ) |
Computes the checksum of the MIP packet.
| uint8_t mip::C::mip_packet_descriptor_set | ( | const mip_packet_view * | packet | ) |
Returns the MIP descriptor set for this packet.
| void mip::C::mip_packet_from_buffer | ( | mip_packet_view * | packet, |
| const uint8_t * | buffer, | ||
| size_t | length | ||
| ) |
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. |
| bool mip::C::mip_packet_is_data | ( | const mip_packet_view * | packet | ) |
Returns true if the packet is from a data descriptor set.
| bool mip::C::mip_packet_is_empty | ( | const mip_packet_view * | packet | ) |
Returns true if the mip packet contains no payload.
| packet |
| bool mip::C::mip_packet_is_sane | ( | const mip_packet_view * | packet | ) |
Returns true if the packet buffer is not NULL and is at least the minimum size (MIP_PACKET_LENGTH_MIN).
If the packet is not 'sane', then none of the mip_packet_* functions may be used to access it (to do so is undefined behavior). This should never occur in normal circumstances.
| bool mip::C::mip_packet_is_valid | ( | const mip_packet_view * | packet | ) |
Returns true if the packet is valid.
A packet is valid if:
| const uint8_t * mip::C::mip_packet_payload | ( | const mip_packet_view * | packet | ) |
Returns a pointer to the packet's payload (the first field).
| uint8_t mip::C::mip_packet_payload_length | ( | const mip_packet_view * | packet | ) |
Returns the length of the payload (MIP fields).
| const uint8_t * mip::C::mip_packet_pointer | ( | const mip_packet_view * | packet | ) |
Returns a pointer to the data buffer containing the packet.
| int mip::C::mip_packet_remaining_space | ( | const mip_packet_view * | packet | ) |
Returns the remaining space available for more payload data.
This is equal to the buffer size less the total packet length.
| uint_least16_t mip::C::mip_packet_total_length | ( | const mip_packet_view * | packet | ) |
Returns the total length of the packet, in bytes.
1.8.17