C++ class representing the state of a MIP command.
More...
#include <mip_cmdqueue.hpp>
|
| PendingCmd () |
| Create a null pending command in the CmdResult::NONE state. More...
|
|
| PendingCmd (uint8_t descriptorSet, uint8_t fieldDescriptor, Timeout additionalTime=0) |
| Create a pending command for the given descriptor pair. More...
|
|
| 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. More...
|
|
template<class Cmd > |
| PendingCmd (const Cmd &cmd, Timeout additionalTime=0) |
| Create a pending command given the actual command struct. More...
|
|
template<class Cmd > |
| PendingCmd (const Cmd &cmd, uint8_t *responseBuffer, uint8_t responseBufferSize, Timeout additionalTime=0) |
| Create a pending command given the actual command struct and a response buffer. More...
|
|
| PendingCmd (const PendingCmd &)=delete |
| Disable copying and moving. Once queued, a pending command must remain in the same memory location. More...
|
|
PendingCmd & | operator= (const PendingCmd &)=delete |
|
| ~PendingCmd () |
| Sanity check that the PendingCmd is not deallocated while still in the queue. More...
|
|
CmdResult | status () const |
| Gets the status of the pending command. More...
|
|
uint8_t | responseDescriptor () const |
| Returns the response descriptor. More...
|
|
const uint8_t * | response () const |
| Returns the response payload pointer. More...
|
|
uint8_t | responseLength () const |
| Returns the length of the response data. More...
|
|
C++ class representing the state of a MIP command.
◆ PendingCmd() [1/6]
mip::PendingCmd::PendingCmd |
( |
| ) |
|
|
inline |
Create a null pending command in the CmdResult::NONE state.
◆ PendingCmd() [2/6]
mip::PendingCmd::PendingCmd |
( |
uint8_t |
descriptorSet, |
|
|
uint8_t |
fieldDescriptor, |
|
|
Timeout |
additionalTime = 0 |
|
) |
| |
|
inline |
Create a pending command for the given descriptor pair.
- Parameters
-
descriptorSet | MIP descriptor set for the command. |
fieldDescriptor | MIP field descriptor for the command. |
additionalTime | Optional additional time to allow for the device to process the command. Default 0. |
◆ PendingCmd() [3/6]
mip::PendingCmd::PendingCmd |
( |
uint8_t |
descriptorSet, |
|
|
uint8_t |
fieldDescriptor, |
|
|
uint8_t |
responseDescriptor, |
|
|
uint8_t * |
responseBuffer, |
|
|
uint8_t |
responseBufferSize, |
|
|
Timeout |
additionalTime |
|
) |
| |
|
inline |
Create a pending command with expected response.
- Parameters
-
descriptorSet | MIP descriptor set for the command. |
fieldDescriptor | MIP field descriptor for the command. |
responseDescriptor | MIP field descriptor for the response. |
responseBuffer | A buffer used for the command response data. Must be big enough for the expected response. You can reuse the buffer used to send the command. |
responseBufferSize | Length of responseBuffer in bytes. |
additionalTime | Optional additional time to allow for the device to process the command. Default 0. |
◆ PendingCmd() [4/6]
template<class Cmd >
mip::PendingCmd::PendingCmd |
( |
const Cmd & |
cmd, |
|
|
Timeout |
additionalTime = 0 |
|
) |
| |
|
inline |
Create a pending command given the actual command struct.
- Parameters
-
cmd | The C++ command struct (this must be the C++ version of the struct, the C struct will not work). It need not be fully populated; this parameter is unused except for its type information. |
additionalTime | Optional additional time to allow for the device to process the command. Default 0. |
◆ PendingCmd() [5/6]
template<class Cmd >
mip::PendingCmd::PendingCmd |
( |
const Cmd & |
cmd, |
|
|
uint8_t * |
responseBuffer, |
|
|
uint8_t |
responseBufferSize, |
|
|
Timeout |
additionalTime = 0 |
|
) |
| |
|
inline |
Create a pending command given the actual command struct and a response buffer.
- Parameters
-
cmd | The C++ command struct (this must be the C++ version of the struct, the C struct will not work). It need not be fully populated; this parameter is unused except for its type information. |
responseBuffer | A buffer used for the command response data. Must be big enough for the expected response. You can reuse the buffer used to send the command. |
responseBufferSize | Length of responseBuffer in bytes. |
additionalTime | Optional additional time to allow for the device to process the command. Default 0. |
◆ PendingCmd() [6/6]
mip::PendingCmd::PendingCmd |
( |
const PendingCmd & |
| ) |
|
|
delete |
Disable copying and moving. Once queued, a pending command must remain in the same memory location.
◆ ~PendingCmd()
mip::PendingCmd::~PendingCmd |
( |
| ) |
|
|
inline |
Sanity check that the PendingCmd is not deallocated while still in the queue.
◆ operator=()
◆ response()
const uint8_t* mip::PendingCmd::response |
( |
| ) |
const |
|
inline |
Returns the response payload pointer.
This function may only be called after the command finishes with an ACK.
◆ responseDescriptor()
uint8_t mip::PendingCmd::responseDescriptor |
( |
| ) |
const |
|
inline |
Returns the response descriptor.
◆ responseLength()
uint8_t mip::PendingCmd::responseLength |
( |
| ) |
const |
|
inline |
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.
◆ status()
Gets the status of the pending command.
The documentation for this struct was generated from the following file: