Go to the documentation of this file.
96 #ifndef _WIN32 // Avoid name conflict with windows.h
102 constexpr CmdResult() : value(C::
MIP_ACK_OK) {}
104 ~CmdResult() =
default;
106 CmdResult& operator=(
const CmdResult& other) =
default;
109 static constexpr CmdResult userResult(uint8_t n) {
return CmdResult(
static_cast<C::mip_cmd_result>(STATUS_USER - int8_t(n))); }
110 static constexpr CmdResult fromAckNack(uint8_t code) {
return CmdResult(
static_cast<C::mip_cmd_result>(code)); }
112 operator const void*()
const {
return isAck() ? this :
nullptr; }
113 bool operator!()
const {
return !isAck(); }
115 constexpr
bool operator==(CmdResult other)
const {
return value == other.value; }
116 constexpr
bool operator!=(CmdResult other)
const {
return value != other.value; }
135 #endif // __cplusplus
@ MIP_STATUS_PENDING
Command has been queued but the I/O update hasn't run yet.
const char * mip_cmd_result_to_string(enum mip_cmd_result result)
Converts the command result to a string for debugging.
bool mip_cmd_result_is_reply(enum mip_cmd_result result)
Determines if the result is a reply from the device (i.e.
@ MIP_NACK_COMMAND_FAILED
The device could not complete the command.
bool mip_cmd_result_is_ack(enum mip_cmd_result result)
Determines if the result is an ack (successful response from the device)
@ MIP_STATUS_ERROR
Command could not be executed (error sending/receiving)
mip_cmd_result
Represents the status of a MIP command.
@ MIP_NACK_COMMAND_UNKNOWN
Command not supported.
@ MIP_NACK_COMMAND_TIMEOUT
Internal device timeout. Use MIP_STATUS_TIMEDOUT for command timeouts.
@ MIP_ACK_OK
Command completed successfully.
bool mip_cmd_result_is_finished(enum mip_cmd_result result)
Determines if the command has completed, timed out, been cancelled, or otherwise is no longer waiting...
@ MIP_NACK_INVALID_CHECKSUM
Reserved.
@ MIP_STATUS_WAITING
Waiting for command reply (timeout timer has started).
bool mip_cmd_result_is_status(enum mip_cmd_result result)
Determines if the result code was generated by this lib (i.e.
bool operator==(const GTEST_10_TUPLE_(T)&t, const GTEST_10_TUPLE_(U)&u)
@ MIP_STATUS_NONE
Command has been initialized but not queued yet.
bool operator!=(const GTEST_10_TUPLE_(T)&t, const GTEST_10_TUPLE_(U)&u)
@ MIP_STATUS_USER_START
Values defined by user code must be less than or equal to this value.
@ MIP_STATUS_CANCELLED
Command was canceled in software.
@ MIP_NACK_INVALID_PARAM
A parameter was not a supported value.
bool mip_cmd_result_is_user(enum mip_cmd_result result)
Determines if the result code was generated by user software.
@ MIP_STATUS_TIMEDOUT
Reply was not received before timeout expired.