MIP_SDK  latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
mip_result.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stdbool.h>
4 #include <stdint.h>
5 
6 #ifdef __cplusplus
7 namespace mip {
8 namespace C {
9 extern "C" {
10 #endif // __cplusplus
11 
12 
16 
27 typedef enum mip_cmd_result
28 {
30 
31  // Status codes < 0
38 
39  // Device replies >= 0
40  MIP_ACK_OK = 0x00,
47 
48 const char *mip_cmd_result_to_string(enum mip_cmd_result result);
49 
51 
52 bool mip_cmd_result_is_reply(enum mip_cmd_result result);
54 bool mip_cmd_result_is_user(enum mip_cmd_result result);
55 
56 bool mip_cmd_result_is_ack(enum mip_cmd_result result);
57 
60 
61 #ifdef __cplusplus
62 } // extern "C"
63 } // namespace C
64 } // namespace mip
65 #endif // __cplusplus
mip::C::mip_cmd_result_is_reply
bool mip_cmd_result_is_reply(enum mip_cmd_result result)
Determines if the result is a reply from the device (i.e. mip_ack).
Definition: mip_result.c:55
mip::C::MIP_STATUS_WAITING
@ MIP_STATUS_WAITING
Waiting for command reply (timeout timer has started).
Definition: mip_result.h:35
mip
A collection of C++ classes and functions covering the full mip api.
Definition: commands_3dm.c:11
mip::C::mip_cmd_result_is_finished
bool mip_cmd_result_is_finished(enum mip_cmd_result status)
Determines if the command has completed, timed out, been cancelled, or otherwise is no longer waiting...
Definition: mip_result.c:47
mip::C::mip_cmd_result
mip_cmd_result
Represents the status of a MIP command.
Definition: mip_result.h:27
mip::C::mip_cmd_result_to_string
const char * mip_cmd_result_to_string(enum mip_cmd_result result)
Converts the command result to a string for debugging.
Definition: mip_result.c:17
mip::C::MIP_NACK_COMMAND_UNKNOWN
@ MIP_NACK_COMMAND_UNKNOWN
Command not supported.
Definition: mip_result.h:41
mip::C::MIP_STATUS_PENDING
@ MIP_STATUS_PENDING
Command has been queued but the I/O update hasn't run yet.
Definition: mip_result.h:36
mip::C::MIP_NACK_COMMAND_TIMEOUT
@ MIP_NACK_COMMAND_TIMEOUT
Internal device timeout. Use MIP_STATUS_TIMEDOUT for command timeouts.
Definition: mip_result.h:45
mip::C::MIP_NACK_COMMAND_FAILED
@ MIP_NACK_COMMAND_FAILED
The device could not complete the command.
Definition: mip_result.h:44
mip::C::MIP_STATUS_TIMEDOUT
@ MIP_STATUS_TIMEDOUT
Reply was not received before timeout expired.
Definition: mip_result.h:34
mip::C::MIP_STATUS_CANCELLED
@ MIP_STATUS_CANCELLED
Command was canceled in software.
Definition: mip_result.h:33
mip::C::MIP_STATUS_ERROR
@ MIP_STATUS_ERROR
Command could not be executed (error sending/receiving)
Definition: mip_result.h:32
mip::C::mip_cmd_result_is_ack
bool mip_cmd_result_is_ack(enum mip_cmd_result result)
Determines if the result is an ack (successful response from the device)
Definition: mip_result.c:79
mip::C::mip_cmd_result_is_user
bool mip_cmd_result_is_user(enum mip_cmd_result result)
Determines if the result code was generated by user software.
Definition: mip_result.c:71
mip::C::MIP_NACK_INVALID_PARAM
@ MIP_NACK_INVALID_PARAM
A parameter was not a supported value.
Definition: mip_result.h:43
mip::C::mip_cmd_result_is_status
bool mip_cmd_result_is_status(enum mip_cmd_result result)
Determines if the result code was generated by this lib (i.e. mip_cmd_status).
Definition: mip_result.c:63
mip::C::MIP_ACK_OK
@ MIP_ACK_OK
Command completed successfully.
Definition: mip_result.h:40
mip::C::MIP_NACK_INVALID_CHECKSUM
@ MIP_NACK_INVALID_CHECKSUM
Reserved.
Definition: mip_result.h:42
mip::C::MIP_STATUS_USER_START
@ MIP_STATUS_USER_START
Values defined by user code must be less than or equal to this value.
Definition: mip_result.h:29
mip::C::MIP_STATUS_NONE
@ MIP_STATUS_NONE
Command has been initialized but not queued yet.
Definition: mip_result.h:37