MIP_SDK
latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
|
Go to the documentation of this file.
23 ~CmdQueue() { assert(_first_pending_cmd==
nullptr); }
40 static_assert(
sizeof(CmdQueue) ==
sizeof(
C::mip_cmd_queue),
"CmdQueue must not have additional data members.");
69 PendingCmd(uint8_t descriptorSet, uint8_t fieldDescriptor, uint8_t
responseDescriptor, uint8_t* responseBuffer, uint8_t responseBufferSize,
Timeout additionalTime) {
C::mip_pending_cmd_init_full(
this, descriptorSet, fieldDescriptor,
responseDescriptor, responseBuffer, responseBufferSize, additionalTime); }
87 PendingCmd(
const Cmd&, uint8_t* responseBuffer, uint8_t responseBufferSize,
Timeout additionalTime=0) :
PendingCmd(Cmd::
DESCRIPTOR_SET, Cmd::FIELD_DESCRIPTOR, Cmd::Response::FIELD_DESCRIPTOR, responseBuffer, responseBufferSize, additionalTime) {}
uint8_t responseDescriptor() const
Returns the response descriptor.
Definition: mip_cmdqueue.hpp:103
const uint8_t * mip_pending_cmd_response(const mip_pending_cmd *cmd)
Returns the response payload pointer.
Definition: mip_cmdqueue.c:128
Timeout baseReplyTimeout() const
Definition: mip_cmdqueue.hpp:36
struct mip::C::mip_cmd_queue mip_cmd_queue
Holds a list of pending commands.
A collection of C++ classes and functions covering the full mip api.
Definition: commands_3dm.c:11
void clear()
Definition: mip_cmdqueue.hpp:31
PendingCmd(uint8_t descriptorSet, uint8_t fieldDescriptor, Timeout additionalTime=0)
Create a pending command for the given descriptor pair.
Definition: mip_cmdqueue.hpp:58
void enqueue(C::mip_pending_cmd &cmd)
Definition: mip_cmdqueue.hpp:28
void 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.
Definition: mip_cmdqueue.c:381
PendingCmd(const Cmd &cmd, Timeout additionalTime=0)
Create a pending command given the actual command struct.
Definition: mip_cmdqueue.hpp:77
void mip_cmd_queue_clear(mip_cmd_queue *queue)
Clears the command queue.
Definition: mip_cmdqueue.c:423
~CmdQueue()
Definition: mip_cmdqueue.hpp:23
void dequeue(C::mip_pending_cmd &cmd)
Definition: mip_cmdqueue.hpp:29
PendingCmd(const Cmd &, uint8_t *responseBuffer, uint8_t responseBufferSize, Timeout additionalTime=0)
Create a pending command given the actual command struct and a response buffer.
Definition: mip_cmdqueue.hpp:87
mip_timeout mip_cmd_queue_base_reply_timeout(const mip_cmd_queue *queue)
Gets the base reply timeout for all commands.
Definition: mip_cmdqueue.c:493
void setBaseReplyTimeout(Timeout timeout)
Definition: mip_cmdqueue.hpp:35
Holds a list of pending commands.
Definition: mip_cmdqueue.h:88
Structure representing a MIP Packet.
Definition: mip_packet.h:50
void mip_cmd_queue_enqueue(mip_cmd_queue *queue, mip_pending_cmd *cmd)
Queue a command to wait for replies.
Definition: mip_cmdqueue.c:227
bool isFinished() const
Definition: mip_result.hpp:70
void update(Timestamp now)
Definition: mip_cmdqueue.hpp:33
C++ class representing the state of a MIP command.
Definition: mip_cmdqueue.hpp:46
~PendingCmd()
Sanity check that the PendingCmd is not deallocated while still in the queue.
Definition: mip_cmdqueue.hpp:96
@ DESCRIPTOR_SET
Definition: commands_3dm.hpp:31
CmdResult status() const
Gets the status of the pending command.
Definition: mip_cmdqueue.hpp:100
Represents the status of a MIP command.
Definition: mip_result.hpp:24
void mip_cmd_queue_dequeue(mip_cmd_queue *queue, mip_pending_cmd *cmd)
Removes a pending command from the queue.
Definition: mip_cmdqueue.c:250
uint8_t responseLength() const
Returns the length of the response data.
Definition: mip_cmdqueue.hpp:109
uint8_t mip_pending_cmd_response_length(const mip_pending_cmd *cmd)
Returns the length of the response data.
Definition: mip_cmdqueue.c:142
enum mip_cmd_result mip_pending_cmd_status(const mip_pending_cmd *cmd)
Returns the status of the pending command.
Definition: mip_cmdqueue.c:110
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, mip_timeout additional_time)
Initialize a pending mip commmand with all parameters.
Definition: mip_cmdqueue.c:90
PendingCmd(uint8_t descriptorSet, uint8_t fieldDescriptor, uint8_t responseDescriptor, uint8_t *responseBuffer, uint8_t responseBufferSize, Timeout additionalTime)
Create a pending command with expected response.
Definition: mip_cmdqueue.hpp:69
void mip_cmd_queue_set_base_reply_timeout(mip_cmd_queue *queue, mip_timeout timeout)
Sets the base reply timeout for all commands.
Definition: mip_cmdqueue.c:483
PendingCmd & operator=(const PendingCmd &)=delete
microstrain::EmbeddedTimestamp Timestamp
Definition: mip_types.h:50
Represents a command awaiting a reply from the device.
Definition: mip_cmdqueue.h:37
void mip_cmd_queue_update(mip_cmd_queue *queue, mip_timestamp now)
Call periodically to make sure commands time out if no packets are received.
Definition: mip_cmdqueue.c:446
uint8_t mip_pending_cmd_response_descriptor(const mip_pending_cmd *cmd)
Returns the response descriptor.
Definition: mip_cmdqueue.c:118
CmdQueue & operator=(const CmdQueue &)=delete
PendingCmd()
Create a null pending command in the CmdResult::NONE state.
Definition: mip_cmdqueue.hpp:50
void mip_cmd_queue_init(mip_cmd_queue *queue, mip_timeout base_reply_timeout)
Initializes a command queue.
Definition: mip_cmdqueue.c:206
microstrain::EmbeddedTimeout Timeout
Definition: mip_types.h:51
static constexpr C::mip_cmd_result STATUS_NONE
Command has been initialized but not queued yet.
Definition: mip_result.hpp:32
void processPacket(const C::mip_packet_view &packet, Timestamp timestamp)
Definition: mip_cmdqueue.hpp:38
void 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.
Definition: mip_cmdqueue.c:48
const uint8_t * response() const
Returns the response payload pointer.
Definition: mip_cmdqueue.hpp:106
CmdQueue(Timeout baseReplyTimeout=1000)
Definition: mip_cmdqueue.hpp:22
C++ wrapper around a command queue.
Definition: mip_cmdqueue.hpp:20