Functions
Accessors - Functions for accessing information about an existing MIP packet.

Use these functions to get information about a MIP packet after it has been parsed. More...

Collaboration diagram for Accessors - Functions for accessing information about an existing MIP packet.:

Functions

uint8_t * mip_packet_buffer (mip_packet *packet)
 Returns a writable pointer to the data buffer. More...
 
packet_length mip_packet_buffer_size (const mip_packet *packet)
 Returns the size of the buffer backing the MIP packet. More...
 
uint16_t mip_packet_checksum_value (const mip_packet *packet)
 Returns the value of the checksum as written in the packet. More...
 
uint16_t mip_packet_compute_checksum (const mip_packet *packet)
 Computes the checksum of the MIP packet. More...
 
uint8_t mip_packet_descriptor_set (const mip_packet *packet)
 Returns the MIP descriptor set for this packet. More...
 
void mip_packet_from_buffer (mip_packet *packet, uint8_t *buffer, size_t length)
 Initializes a MIP packet from an existing buffer. More...
 
bool mip_packet_is_data (const mip_packet *packet)
 Returns true if the packet is from a data descriptor set. More...
 
bool mip_packet_is_empty (const mip_packet *packet)
 Returns true if the mip packet contains no payload. More...
 
bool mip_packet_is_sane (const mip_packet *packet)
 Returns true if the packet buffer is not NULL and is at least the minimum size (MIP_PACKET_LENGTH_MIN). More...
 
bool mip_packet_is_valid (const mip_packet *packet)
 Returns true if the packet is valid. More...
 
const uint8_t * mip_packet_payload (const mip_packet *packet)
 Returns a pointer to the packet's payload (the first field). More...
 
uint8_t mip_packet_payload_length (const mip_packet *packet)
 Returns the length of the payload (MIP fields). More...
 
const uint8_t * mip_packet_pointer (const mip_packet *packet)
 Returns a pointer to the data buffer containing the packet. More...
 
remaining_count mip_packet_remaining_space (const mip_packet *packet)
 Returns the remaining space available for more payload data. More...
 
packet_length mip_packet_total_length (const mip_packet *packet)
 Returns the total length of the packet, in bytes. More...
 

Detailed Description

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.

Function Documentation

◆ mip_packet_buffer()

uint8_t* mip_packet_buffer ( mip_packet packet)

Returns a writable pointer to the data buffer.

Definition at line 113 of file mip_packet.c.

◆ mip_packet_buffer_size()

packet_length mip_packet_buffer_size ( const mip_packet packet)

Returns the size of the buffer backing the MIP packet.

Note
This is the BUFFER SIZE and not the packet length.

Definition at line 224 of file mip_packet.c.

◆ mip_packet_checksum_value()

uint16_t mip_packet_checksum_value ( const mip_packet 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().

Definition at line 140 of file mip_packet.c.

◆ mip_packet_compute_checksum()

uint16_t mip_packet_compute_checksum ( const mip_packet packet)

Computes the checksum of the MIP packet.

Returns
The computed checksum value.

Definition at line 152 of file mip_packet.c.

◆ mip_packet_descriptor_set()

uint8_t mip_packet_descriptor_set ( const mip_packet packet)

Returns the MIP descriptor set for this packet.

Definition at line 87 of file mip_packet.c.

◆ mip_packet_from_buffer()

void mip_packet_from_buffer ( mip_packet packet,
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.

Parameters
packet
bufferThe data buffer containing the bytes for a MIP packet. Must be at least MIP_PACKET_LENGTH_MIN bytes in size.
lengthThe length of the data pointed to by buffer.
Note
The data does not need to be a valid MIP packet, for instance to use the mip_packet_is_sane() or mip_packet_is_valid() functions. However, if it is NOT a valid MIP packet, the result of calling any accessor function is unpredictable. In particular, if length is less than MIP_PACKET_LENGTH_MIN bytes, calling the accessor functions is undefined behavior.

Definition at line 36 of file mip_packet.c.

◆ mip_packet_is_data()

bool mip_packet_is_data ( const mip_packet packet)

Returns true if the packet is from a data descriptor set.

See also
is_data_descriptor_set
Returns
true if the packet contains data.
false if it contains commands or replies.

Definition at line 247 of file mip_packet.c.

◆ mip_packet_is_empty()

bool mip_packet_is_empty ( const mip_packet packet)

Returns true if the mip packet contains no payload.

Parameters
packet
Returns
true if the packet has a payload length of 0.

Definition at line 210 of file mip_packet.c.

◆ mip_packet_is_sane()

bool mip_packet_is_sane ( const mip_packet 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.

Definition at line 179 of file mip_packet.c.

◆ mip_packet_is_valid()

bool mip_packet_is_valid ( const mip_packet packet)

Returns true if the packet is valid.

A packet is valid if:

Definition at line 192 of file mip_packet.c.

◆ mip_packet_payload()

const uint8_t* mip_packet_payload ( const mip_packet packet)

Returns a pointer to the packet's payload (the first field).

Definition at line 129 of file mip_packet.c.

◆ mip_packet_payload_length()

uint8_t mip_packet_payload_length ( const mip_packet packet)

Returns the length of the payload (MIP fields).

Definition at line 95 of file mip_packet.c.

◆ mip_packet_pointer()

const uint8_t* mip_packet_pointer ( const mip_packet packet)

Returns a pointer to the data buffer containing the packet.

Definition at line 121 of file mip_packet.c.

◆ mip_packet_remaining_space()

remaining_count mip_packet_remaining_space ( const mip_packet packet)

Returns the remaining space available for more payload data.

This is equal to the buffer size less the total packet length.

Definition at line 234 of file mip_packet.c.

◆ mip_packet_total_length()

packet_length mip_packet_total_length ( const mip_packet packet)

Returns the total length of the packet, in bytes.

Returns
The length of the packet. Always at least MIP_PACKET_LENGTH_MIN.

Definition at line 105 of file mip_packet.c.



microstrain_inertial_driver
Author(s): Brian Bingham, Parker Hannifin Corp
autogenerated on Wed Mar 22 2023 02:35:07