![]() |
Classes | |
struct | mip_pending_cmd |
Represents a command awaiting a reply from the device. More... | |
Typedefs | |
typedef struct mip_pending_cmd | mip_pending_cmd |
Represents a command awaiting a reply from the device. More... | |
Functions | |
bool | mip_pending_cmd_check_timeout (const mip_pending_cmd *cmd, timestamp_type now) |
Checks if the command should time out. More... | |
void | 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_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_size, timeout_type additional_time) |
Initialize a pending mip commmand with all parameters. More... | |
void | 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_pending_cmd_init_with_timeout (mip_pending_cmd *cmd, uint8_t descriptor_set, uint8_t field_descriptor, timeout_type additional_time) |
Initialize a pending mip commmand with extra timeout time. More... | |
int | mip_pending_cmd_remaining_time (const mip_pending_cmd *cmd, timestamp_type now) |
Determines how much time is remaining before the command times out. More... | |
const uint8_t * | mip_pending_cmd_response (const mip_pending_cmd *cmd) |
Returns the response payload pointer. More... | |
uint8_t | mip_pending_cmd_response_length (const mip_pending_cmd *cmd) |
Returns the length of the response data. More... | |
enum mip_cmd_result | mip_pending_cmd_status (const mip_pending_cmd *cmd) |
Returns the status of the pending command. More... | |
typedef struct mip_pending_cmd mip_pending_cmd |
Represents a command awaiting a reply from the device.
bool mip_pending_cmd_check_timeout | ( | const mip_pending_cmd * | cmd, |
timestamp_type | now | ||
) |
Checks if the command should time out.
cmd | |
now | Current time |
Definition at line 170 of file mip_cmdqueue.c.
void 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.
cmd | |
descriptor_set | Command descriptor set. |
field_descriptor | Command field descriptor. |
Definition at line 26 of file mip_cmdqueue.c.
void 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, | ||
timeout_type | additional_time | ||
) |
Initialize a pending mip commmand with all parameters.
cmd | |
descriptor_set | Command descriptor set. |
field_descriptor | Command field descriptor. |
response_descriptor | Optional response data descriptor. Use 0x00 if no data is expected. |
response_buffer | Optional buffer to hold response data, if any. If NULL, response_buffer_size must be 0. |
response_buffer_size | Size of the response buffer. The response will be limited to this size. |
additional_time | Additional time on top of the base reply timeout for this specific command. |
Definition at line 86 of file mip_cmdqueue.c.
void 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.
cmd | |
descriptor_set | Command descriptor set. |
field_descriptor | Command field descriptor. |
response_descriptor | Optional response data descriptor. Use 0x00 if no data is expected. |
response_buffer | Optional buffer to hold response data, if any. If NULL, response_buffer_size must be 0. |
response_buffer_size | Optional buffer to hold response data, if any. If NULL, response_buffer_size must be 0. |
response_buffer_size | Size of the response buffer. The response will be limited to this size. |
Definition at line 64 of file mip_cmdqueue.c.
void mip_pending_cmd_init_with_timeout | ( | mip_pending_cmd * | cmd, |
uint8_t | descriptor_set, | ||
uint8_t | field_descriptor, | ||
timeout_type | additional_time | ||
) |
Initialize a pending mip commmand with extra timeout time.
cmd | |
descriptor_set | Command descriptor set. |
field_descriptor | Command field descriptor. |
additional_time | Additional time on top of the base reply timeout for this specific command. |
Definition at line 42 of file mip_cmdqueue.c.
int mip_pending_cmd_remaining_time | ( | const mip_pending_cmd * | cmd, |
timestamp_type | 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.
cmd | The command to check. Must be in MIP_STATUS_WAITING state. |
now | The current timestamp. |
Definition at line 152 of file mip_cmdqueue.c.
const uint8_t* 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.
Definition at line 116 of file mip_cmdqueue.c.
uint8_t 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.
Definition at line 130 of file mip_cmdqueue.c.
enum mip_cmd_result mip_pending_cmd_status | ( | const mip_pending_cmd * | cmd | ) |
Returns the status of the pending command.
Definition at line 106 of file mip_cmdqueue.c.