MIP_SDK  v3.0.0
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.hpp>

Inheritance diagram for mip::CmdResult:
mip::TypedResult< MipCmd >

Public Member Functions

constexpr CmdResult ()
 
constexpr CmdResult (C::mip_cmd_result result)
 
 ~CmdResult ()=default
 
CmdResultoperator= (const CmdResult &other)=default
 
CmdResultoperator= (C::mip_cmd_result other)
 
 operator const void * () const
 
bool operator! () const
 
constexpr bool operator== (CmdResult other) const
 
constexpr bool operator!= (CmdResult other) const
 
constexpr bool operator== (C::mip_cmd_result other) const
 
constexpr 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 constexpr CmdResult userResult (uint8_t n)
 
static constexpr 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_USER = C::MIP_STATUS_USER_START
 Values defined by user code must be less than or equal to this value. More...
 
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 enum, but with some convenient member functions and some operator overloads.

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

fprintf(stderr, "Couldn't ping the device!\n");

Constructor & Destructor Documentation

◆ CmdResult() [1/2]

constexpr mip::CmdResult::CmdResult ( )
inlineconstexpr

◆ CmdResult() [2/2]

constexpr mip::CmdResult::CmdResult ( C::mip_cmd_result  result)
inlineconstexpr

◆ ~CmdResult()

mip::CmdResult::~CmdResult ( )
default

Member Function Documentation

◆ fromAckNack()

static constexpr CmdResult mip::CmdResult::fromAckNack ( uint8_t  code)
inlinestaticconstexpr

◆ 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]

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

◆ operator!=() [2/2]

constexpr bool mip::CmdResult::operator!= ( CmdResult  other) const
inlineconstexpr

◆ 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]

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

◆ operator==() [2/2]

constexpr bool mip::CmdResult::operator== ( CmdResult  other) const
inlineconstexpr

◆ userResult()

static constexpr CmdResult mip::CmdResult::userResult ( uint8_t  n)
inlinestaticconstexpr

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_USER

constexpr C::mip_cmd_result mip::CmdResult::STATUS_USER = C::MIP_STATUS_USER_START
staticconstexpr

Values defined by user code must be less than or equal to this value.

◆ 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:
mip::commands_base::ping
TypedResult< Ping > ping(C::mip_interface &device)
Definition: commands_base.cpp:73