MIP_SDK
latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
|
Classes | |
struct | mip::C::mip_cmd_queue |
Holds a list of pending commands. More... | |
Typedefs | |
typedef struct mip::C::mip_cmd_queue | mip::C::mip_cmd_queue |
Holds a list of pending commands. More... | |
Functions | |
void | mip::C::mip_cmd_queue_init (mip_cmd_queue *queue, mip_timeout base_reply_timeout) |
Initializes a command queue. More... | |
void | mip::C::mip_cmd_queue_enqueue (mip_cmd_queue *queue, mip_pending_cmd *cmd) |
Queue a command to wait for replies. More... | |
void | mip::C::mip_cmd_queue_dequeue (mip_cmd_queue *queue, mip_pending_cmd *cmd) |
Removes a pending command from the queue. More... | |
void | mip::C::mip_cmd_queue_clear (mip_cmd_queue *queue) |
Clears the command queue. More... | |
void | mip::C::mip_cmd_queue_update (mip_cmd_queue *queue, mip_timestamp now) |
Call periodically to make sure commands time out if no packets are received. More... | |
void | mip::C::mip_cmd_queue_set_base_reply_timeout (mip_cmd_queue *queue, mip_timeout timeout) |
Sets the base reply timeout for all commands. More... | |
mip_timeout | mip::C::mip_cmd_queue_base_reply_timeout (const mip_cmd_queue *queue) |
Gets the base reply timeout for all commands. More... | |
void | mip::C::mip_cmd_queue_process_packet (mip_cmd_queue *queue, const mip_packet_view *packet, mip_timestamp timestamp) |
Process an incoming packet and check for replies to pending commands. More... | |
typedef struct mip::C::mip_cmd_queue mip::C::mip_cmd_queue |
Holds a list of pending commands.
Currently only one command may be pending at a time.
mip_timeout mip::C::mip_cmd_queue_base_reply_timeout | ( | const mip_cmd_queue * | queue | ) |
Gets the base reply timeout for all commands.
void mip::C::mip_cmd_queue_clear | ( | mip_cmd_queue * | queue | ) |
Clears the command queue.
This must be called from the same thread context as the update function.
queue |
void mip::C::mip_cmd_queue_dequeue | ( | mip_cmd_queue * | queue, |
mip_pending_cmd * | cmd | ||
) |
Removes a pending command from the queue.
void mip::C::mip_cmd_queue_enqueue | ( | mip_cmd_queue * | queue, |
mip_pending_cmd * | cmd | ||
) |
Queue a command to wait for replies.
queue | |
cmd | Listens for replies to this command. |
void mip::C::mip_cmd_queue_init | ( | mip_cmd_queue * | queue, |
mip_timeout | base_reply_timeout | ||
) |
Initializes a command queue.
queue | |
base_reply_timeout | The minimum timeout given to all MIP commands. Additional time may be given to specific commands which take longer. This is intended to be used to accommodate long communication latencies, such as when using a TCP connection. |
void mip::C::mip_cmd_queue_process_packet | ( | mip_cmd_queue * | queue, |
const mip_packet_view * | packet, | ||
mip_timestamp | timestamp | ||
) |
Process an incoming packet and check for replies to pending commands.
Call this from the Mip_parser callback, passing the arguments directly.
queue | |
packet | The received MIP packet. Assumed to be valid. |
timestamp | The time the packet was received |
void mip::C::mip_cmd_queue_set_base_reply_timeout | ( | mip_cmd_queue * | queue, |
mip_timeout | timeout | ||
) |
Sets the base reply timeout for all commands.
The base reply timeout is the minimum time to wait for a reply. Takes effect for any commands queued after this function call.
queue | |
timeout |
void mip::C::mip_cmd_queue_update | ( | mip_cmd_queue * | queue, |
mip_timestamp | now | ||
) |
Call periodically to make sure commands time out if no packets are received.
Call this during the device update if no calls to mip_cmd_queue_process_packet are made (e.g. because no packets were received). It is safe to call this in either case.
queue | |
now |