MIP_SDK  v3.0.0
MicroStrain Communications Library for embedded systems
Public Member Functions | List of all members
mip::PendingCmd Struct Reference

C++ class representing the state of a MIP command. More...

#include <mip_cmdqueue.hpp>

Inheritance diagram for mip::PendingCmd:
mip::C::mip_pending_cmd

Public Member Functions

 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...
 
PendingCmdoperator= (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...
 

Additional Inherited Members

- Public Attributes inherited from mip::C::mip_pending_cmd
union {
}; 
 

Detailed Description

C++ class representing the state of a MIP command.

Constructor & Destructor Documentation

◆ 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
descriptorSetMIP descriptor set for the command.
fieldDescriptorMIP field descriptor for the command.
additionalTimeOptional 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
descriptorSetMIP descriptor set for the command.
fieldDescriptorMIP field descriptor for the command.
responseDescriptorMIP field descriptor for the response.
responseBufferA 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.
responseBufferSizeLength of responseBuffer in bytes.
additionalTimeOptional 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
cmdThe 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.
additionalTimeOptional 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
cmdThe 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.
responseBufferA 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.
responseBufferSizeLength of responseBuffer in bytes.
additionalTimeOptional 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.

Member Function Documentation

◆ operator=()

PendingCmd& mip::PendingCmd::operator= ( const PendingCmd )
delete

◆ 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()

CmdResult mip::PendingCmd::status ( ) const
inline

Gets the status of the pending command.


The documentation for this struct was generated from the following file: