MIP SDK  0.0.1
MicroStrain Communications Library for embedded systems
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
mip::CmdResult Struct Reference

Represents the status of a MIP command. More...

#include <mip_result.h>

Public Member Functions

 CmdResult ()
 
 CmdResult (C::mip_cmd_result result)
 
CmdResultoperator= (const CmdResult &other)=default
 
CmdResultoperator= (C::mip_cmd_result other)
 
 operator const void * () const
 
bool operator! () const
 
bool operator== (CmdResult other) const
 
bool operator!= (CmdResult other) const
 
bool operator== (C::mip_cmd_result other) const
 
bool operator!= (C::mip_cmd_result other) const
 
const char * name () const
 
bool isReplyCode () const
 
bool isStatusCode () const
 
bool isFinished () const
 
bool isAck () const
 

Static Public Member Functions

static CmdResult fromAckNack (uint8_t code)
 

Public Attributes

C::mip_cmd_result value = C::MIP_STATUS_NONE
 

Static Public Attributes

static constexpr C::mip_cmd_result STATUS_ERROR = C::MIP_STATUS_ERROR
 Command could not be executed (error sending/receiving) More...
 
static constexpr C::mip_cmd_result STATUS_CANCELLED = C::MIP_STATUS_CANCELLED
 Command was canceled in software. More...
 
static constexpr C::mip_cmd_result STATUS_TIMEDOUT = C::MIP_STATUS_TIMEDOUT
 Reply was not received before timeout expired. More...
 
static constexpr C::mip_cmd_result STATUS_WAITING = C::MIP_STATUS_WAITING
 Waiting for command reply (timeout timer has started). More...
 
static constexpr C::mip_cmd_result STATUS_QUEUED = C::MIP_STATUS_PENDING
 Command has been queued but the I/O update hasn't run yet. More...
 
static constexpr C::mip_cmd_result STATUS_NONE = C::MIP_STATUS_NONE
 Command has been initialized but not queued yet. More...
 
static constexpr C::mip_cmd_result ACK_OK = C::MIP_ACK_OK
 Command completed successfully. More...
 
static constexpr C::mip_cmd_result NACK_COMMAND_UNKNOWN = C::MIP_NACK_COMMAND_UNKNOWN
 Command not supported. More...
 
static constexpr C::mip_cmd_result NACK_INVALID_CHECKSUM = C::MIP_NACK_INVALID_CHECKSUM
 Reserved. More...
 
static constexpr C::mip_cmd_result NACK_INVALID_PARAM = C::MIP_NACK_INVALID_PARAM
 A parameter was not a supported value. More...
 
static constexpr C::mip_cmd_result NACK_COMMAND_FAILED = C::MIP_NACK_COMMAND_FAILED
 The device could not complete the command. More...
 
static constexpr C::mip_cmd_result NACK_COMMAND_TIMEOUT = C::MIP_NACK_COMMAND_TIMEOUT
 Internal device timeout. Use MIP_STATUS_TIMEDOUT for command timeouts. More...
 
static constexpr C::mip_cmd_result STATUS_PENDING = STATUS_QUEUED
 

Detailed Description

Represents the status of a MIP command.

This is the same as the mip_cmd_result C enum, but with member functions and some operator overloads.

CmdResult is convertible to bool, allowing code like the following:

Constructor & Destructor Documentation

◆ CmdResult() [1/2]

mip::CmdResult::CmdResult ( )
inline

◆ CmdResult() [2/2]

mip::CmdResult::CmdResult ( C::mip_cmd_result  result)
inline

Member Function Documentation

◆ fromAckNack()

static CmdResult mip::CmdResult::fromAckNack ( uint8_t  code)
inlinestatic

◆ isAck()

bool mip::CmdResult::isAck ( ) const
inline

◆ isFinished()

bool mip::CmdResult::isFinished ( ) const
inline

◆ isReplyCode()

bool mip::CmdResult::isReplyCode ( ) const
inline

◆ isStatusCode()

bool mip::CmdResult::isStatusCode ( ) const
inline

◆ name()

const char* mip::CmdResult::name ( ) const
inline

◆ operator const void *()

mip::CmdResult::operator const void * ( ) const
inline

◆ operator!()

bool mip::CmdResult::operator! ( ) const
inline

◆ operator!=() [1/2]

bool mip::CmdResult::operator!= ( C::mip_cmd_result  other) const
inline

◆ operator!=() [2/2]

bool mip::CmdResult::operator!= ( CmdResult  other) const
inline

◆ operator=() [1/2]

CmdResult& mip::CmdResult::operator= ( C::mip_cmd_result  other)
inline

◆ operator=() [2/2]

CmdResult& mip::CmdResult::operator= ( const CmdResult other)
default

◆ operator==() [1/2]

bool mip::CmdResult::operator== ( C::mip_cmd_result  other) const
inline

◆ operator==() [2/2]

bool mip::CmdResult::operator== ( CmdResult  other) const
inline

Member Data Documentation

◆ ACK_OK

constexpr C::mip_cmd_result mip::CmdResult::ACK_OK = C::MIP_ACK_OK
staticconstexpr

Command completed successfully.

◆ NACK_COMMAND_FAILED

constexpr C::mip_cmd_result mip::CmdResult::NACK_COMMAND_FAILED = C::MIP_NACK_COMMAND_FAILED
staticconstexpr

The device could not complete the command.

◆ NACK_COMMAND_TIMEOUT

constexpr C::mip_cmd_result mip::CmdResult::NACK_COMMAND_TIMEOUT = C::MIP_NACK_COMMAND_TIMEOUT
staticconstexpr

Internal device timeout. Use MIP_STATUS_TIMEDOUT for command timeouts.

◆ NACK_COMMAND_UNKNOWN

constexpr C::mip_cmd_result mip::CmdResult::NACK_COMMAND_UNKNOWN = C::MIP_NACK_COMMAND_UNKNOWN
staticconstexpr

Command not supported.

◆ NACK_INVALID_CHECKSUM

constexpr C::mip_cmd_result mip::CmdResult::NACK_INVALID_CHECKSUM = C::MIP_NACK_INVALID_CHECKSUM
staticconstexpr

Reserved.

◆ NACK_INVALID_PARAM

constexpr C::mip_cmd_result mip::CmdResult::NACK_INVALID_PARAM = C::MIP_NACK_INVALID_PARAM
staticconstexpr

A parameter was not a supported value.

◆ STATUS_CANCELLED

constexpr C::mip_cmd_result mip::CmdResult::STATUS_CANCELLED = C::MIP_STATUS_CANCELLED
staticconstexpr

Command was canceled in software.

◆ STATUS_ERROR

constexpr C::mip_cmd_result mip::CmdResult::STATUS_ERROR = C::MIP_STATUS_ERROR
staticconstexpr

Command could not be executed (error sending/receiving)

◆ STATUS_NONE

constexpr C::mip_cmd_result mip::CmdResult::STATUS_NONE = C::MIP_STATUS_NONE
staticconstexpr

Command has been initialized but not queued yet.

◆ STATUS_PENDING

constexpr C::mip_cmd_result mip::CmdResult::STATUS_PENDING = STATUS_QUEUED
staticconstexpr

◆ STATUS_QUEUED

constexpr C::mip_cmd_result mip::CmdResult::STATUS_QUEUED = C::MIP_STATUS_PENDING
staticconstexpr

Command has been queued but the I/O update hasn't run yet.

◆ STATUS_TIMEDOUT

constexpr C::mip_cmd_result mip::CmdResult::STATUS_TIMEDOUT = C::MIP_STATUS_TIMEDOUT
staticconstexpr

Reply was not received before timeout expired.

◆ STATUS_WAITING

constexpr C::mip_cmd_result mip::CmdResult::STATUS_WAITING = C::MIP_STATUS_WAITING
staticconstexpr

Waiting for command reply (timeout timer has started).

◆ value

C::mip_cmd_result mip::CmdResult::value = C::MIP_STATUS_NONE

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