MIP_SDK  v3.0.0
MicroStrain Communications Library for embedded systems
Classes | Typedefs | Functions
Pending Mip Commands

Classes

struct  mip::C::mip_pending_cmd
 Represents a command awaiting a reply from the device. More...
 

Typedefs

typedef struct mip::C::mip_pending_cmd mip::C::mip_pending_cmd
 Represents a command awaiting a reply from the device. More...
 

Functions

void mip::C::mip_pending_cmd_init (mip_pending_cmd *cmd, uint8_t descriptor_set, uint8_t field_descriptor)
 Initialize a pending command with no reponse data or additional time. More...
 
void mip::C::mip_pending_cmd_init_with_timeout (mip_pending_cmd *cmd, uint8_t descriptor_set, uint8_t field_descriptor, mip_timeout additional_time)
 Initialize a pending mip commmand with extra timeout time. More...
 
void mip::C::mip_pending_cmd_init_with_response (mip_pending_cmd *cmd, uint8_t descriptor_set, uint8_t field_descriptor, uint8_t response_descriptor, uint8_t *response_buffer, uint8_t response_buffer_size)
 Initialize a pending mip commmand with expected response data. More...
 
void mip::C::mip_pending_cmd_init_full (mip_pending_cmd *cmd, uint8_t descriptor_set, uint8_t field_descriptor, uint8_t response_descriptor, uint8_t *response_buffer, uint8_t response_buffer_size, mip_timeout additional_time)
 Initialize a pending mip commmand with all parameters. More...
 
enum mip_cmd_result mip::C::mip_pending_cmd_status (const mip_pending_cmd *cmd)
 Returns the status of the pending command. More...
 
uint8_t mip::C::mip_pending_cmd_response_descriptor (const mip_pending_cmd *cmd)
 Returns the response descriptor. More...
 
const uint8_t * mip::C::mip_pending_cmd_response (const mip_pending_cmd *cmd)
 Returns the response payload pointer. More...
 
uint8_t mip::C::mip_pending_cmd_response_length (const mip_pending_cmd *cmd)
 Returns the length of the response data. More...
 
int mip::C::mip_pending_cmd_remaining_time (const mip_pending_cmd *cmd, mip_timestamp now)
 Determines how much time is remaining before the command times out. More...
 
bool mip::C::mip_pending_cmd_check_timeout (const mip_pending_cmd *cmd, mip_timestamp now)
 Checks if the command should time out. More...
 

Detailed Description

Typedef Documentation

◆ mip_pending_cmd

Represents a command awaiting a reply from the device.

Note
This should be considered an "opaque" structure; its members should be considered an internal implementation detail. Avoid accessing them directly as they are subject to change in future versions of this software.

Function Documentation

◆ mip_pending_cmd_check_timeout()

bool mip::C::mip_pending_cmd_check_timeout ( const mip_pending_cmd cmd,
mip_timestamp  now 
)

Checks if the command should time out.

Parameters
cmd
nowCurrent time
Returns
true if the command should time out. Only possible for MIP_STATUS_WAITING.
false if the command should not time out.

◆ mip_pending_cmd_init()

void mip::C::mip_pending_cmd_init ( mip_pending_cmd cmd,
uint8_t  descriptor_set,
uint8_t  field_descriptor 
)

Initialize a pending command with no reponse data or additional time.

Parameters
cmd
descriptor_setCommand descriptor set.
field_descriptorCommand field descriptor.

◆ mip_pending_cmd_init_full()

void mip::C::mip_pending_cmd_init_full ( mip_pending_cmd cmd,
uint8_t  descriptor_set,
uint8_t  field_descriptor,
uint8_t  response_descriptor,
uint8_t *  response_buffer,
uint8_t  response_buffer_size,
mip_timeout  additional_time 
)

Initialize a pending mip commmand with all parameters.

Parameters
cmd
descriptor_setCommand descriptor set.
field_descriptorCommand field descriptor.
response_descriptorOptional response data descriptor. Use 0x00 if no data is expected.
response_bufferOptional buffer to hold response data, if any. If NULL, response_buffer_size must be 0.
response_buffer_sizeSize of the response buffer. The response will be limited to this size.
additional_timeAdditional time on top of the base reply timeout for this specific command.

◆ mip_pending_cmd_init_with_response()

void mip::C::mip_pending_cmd_init_with_response ( mip_pending_cmd cmd,
uint8_t  descriptor_set,
uint8_t  field_descriptor,
uint8_t  response_descriptor,
uint8_t *  response_buffer,
uint8_t  response_buffer_size 
)

Initialize a pending mip commmand with expected response data.

Parameters
cmd
descriptor_setCommand descriptor set.
field_descriptorCommand field descriptor.
response_descriptorOptional response data descriptor. Use 0x00 if no data is expected.
response_bufferOptional buffer to hold response data, if any. If NULL, response_buffer_size must be 0.
response_buffer_sizeSize of the response buffer. The response will be limited to this size.

◆ mip_pending_cmd_init_with_timeout()

void mip::C::mip_pending_cmd_init_with_timeout ( mip_pending_cmd cmd,
uint8_t  descriptor_set,
uint8_t  field_descriptor,
mip_timeout  additional_time 
)

Initialize a pending mip commmand with extra timeout time.

Parameters
cmd
descriptor_setCommand descriptor set.
field_descriptorCommand field descriptor.
additional_timeAdditional time on top of the base reply timeout for this specific command.

◆ mip_pending_cmd_remaining_time()

int mip::C::mip_pending_cmd_remaining_time ( const mip_pending_cmd cmd,
mip_timestamp  now 
)

Determines how much time is remaining before the command times out.

For most cases you should instead call mip_pending_cmd_check_timeout() to know if the command has timed out or not.

Parameters
cmdThe command to check. Must be in MIP_STATUS_WAITING state.
nowThe current timestamp.
Warning
The command must be in the MIP_STATUS_WAITING state, otherwise the result is unspecified.
Returns
The time remaining before the command times out. The value will be negative if the timeout time has passed.

◆ mip_pending_cmd_response()

const uint8_t * mip::C::mip_pending_cmd_response ( const mip_pending_cmd cmd)

Returns the response payload pointer.

This function may only be called after the command finishes with an ACK.

◆ mip_pending_cmd_response_descriptor()

uint8_t mip::C::mip_pending_cmd_response_descriptor ( const mip_pending_cmd cmd)

Returns the response descriptor.

◆ mip_pending_cmd_response_length()

uint8_t mip::C::mip_pending_cmd_response_length ( const mip_pending_cmd cmd)

Returns the length of the response data.

This function may only be called after the command finishes. If the command completed with a NACK, or if it timed out, the response length will be zero.

◆ mip_pending_cmd_status()

enum mip_cmd_result mip::C::mip_pending_cmd_status ( const mip_pending_cmd cmd)

Returns the status of the pending command.

See also
mip_cmd_status