|
20 | 20 |
|
21 | 21 | #include <stdint.h>
|
22 | 22 |
|
23 |
| - |
24 | 23 | /**
|
25 | 24 | * @defgroup unify_definitions Unify definitions
|
26 | 25 | * @ingroup unify_components
|
27 | 26 | * @brief Type definitions and macros for Unify components and applications.
|
28 | 27 | */
|
29 | 28 |
|
30 |
| - |
31 | 29 | /**
|
32 | 30 | * @defgroup unify_sl_status_codes Status Codes
|
33 | 31 | * @ingroup unify_definitions
|
|
46 | 44 | *************************** GENERIC ERRORS ********************************
|
47 | 45 | ******************************************************************************/
|
48 | 46 |
|
49 |
| -#define SL_STATUS_OK ((sl_status_t)0x0000) ///< No error. |
50 |
| -#define SL_STATUS_FAIL ((sl_status_t)0x0001) ///< Generic error. |
| 47 | +#define SL_STATUS_OK ((sl_status_t)0x0000) ///< No error. |
| 48 | +#define SL_STATUS_FAIL ((sl_status_t)0x0001) ///< Generic error. |
51 | 49 |
|
52 | 50 | // State Errors
|
53 |
| -#define SL_STATUS_INVALID_STATE ((sl_status_t)0x0002) ///< Generic invalid state error. |
54 |
| -#define SL_STATUS_NOT_READY ((sl_status_t)0x0003) ///< Module is not ready for requested operation. |
55 |
| -#define SL_STATUS_BUSY ((sl_status_t)0x0004) ///< Module is busy and cannot carry out requested operation. |
56 |
| -#define SL_STATUS_IN_PROGRESS ((sl_status_t)0x0005) ///< Operation is in progress and not yet complete (pass or fail). |
57 |
| -#define SL_STATUS_ABORT ((sl_status_t)0x0006) ///< Operation aborted. |
58 |
| -#define SL_STATUS_TIMEOUT ((sl_status_t)0x0007) ///< Operation timed out. |
59 |
| -#define SL_STATUS_PERMISSION ((sl_status_t)0x0008) ///< Operation not allowed per permissions. |
60 |
| -#define SL_STATUS_WOULD_BLOCK ((sl_status_t)0x0009) ///< Non-blocking operation would block. |
61 |
| -#define SL_STATUS_IDLE ((sl_status_t)0x000A) ///< Operation/module is Idle, cannot carry requested operation. |
62 |
| -#define SL_STATUS_IS_WAITING ((sl_status_t)0x000B) ///< Operation cannot be done while construct is waiting. |
63 |
| -#define SL_STATUS_NONE_WAITING ((sl_status_t)0x000C) ///< No task/construct waiting/pending for that action/event. |
64 |
| -#define SL_STATUS_SUSPENDED ((sl_status_t)0x000D) ///< Operation cannot be done while construct is suspended. |
65 |
| -#define SL_STATUS_NOT_AVAILABLE ((sl_status_t)0x000E) ///< Feature not available due to software configuration. |
66 |
| -#define SL_STATUS_NOT_SUPPORTED ((sl_status_t)0x000F) ///< Feature not supported. |
67 |
| -#define SL_STATUS_INITIALIZATION ((sl_status_t)0x0010) ///< Initialization failed. |
68 |
| -#define SL_STATUS_NOT_INITIALIZED ((sl_status_t)0x0011) ///< Module has not been initialized. |
69 |
| -#define SL_STATUS_ALREADY_INITIALIZED ((sl_status_t)0x0012) ///< Module has already been initialized. |
70 |
| -#define SL_STATUS_DELETED ((sl_status_t)0x0013) ///< Object/construct has been deleted. |
71 |
| -#define SL_STATUS_ISR ((sl_status_t)0x0014) ///< Illegal call from ISR. |
72 |
| -#define SL_STATUS_NETWORK_UP ((sl_status_t)0x0015) ///< Illegal call because network is up. |
73 |
| -#define SL_STATUS_NETWORK_DOWN ((sl_status_t)0x0016) ///< Illegal call because network is down. |
74 |
| -#define SL_STATUS_NOT_JOINED ((sl_status_t)0x0017) ///< Failure due to not being joined in a network. |
75 |
| -#define SL_STATUS_NO_BEACONS ((sl_status_t)0x0018) ///< Invalid operation as there are no beacons. |
| 51 | +#define SL_STATUS_INVALID_STATE \ |
| 52 | + ((sl_status_t)0x0002) ///< Generic invalid state error. |
| 53 | +#define SL_STATUS_NOT_READY \ |
| 54 | + ((sl_status_t)0x0003) ///< Module is not ready for requested operation. |
| 55 | +#define SL_STATUS_BUSY \ |
| 56 | + ((sl_status_t)0x0004) ///< Module is busy and cannot carry out requested operation. |
| 57 | +#define SL_STATUS_IN_PROGRESS \ |
| 58 | + ((sl_status_t)0x0005) ///< Operation is in progress and not yet complete (pass or fail). |
| 59 | +#define SL_STATUS_ABORT ((sl_status_t)0x0006) ///< Operation aborted. |
| 60 | +#define SL_STATUS_TIMEOUT ((sl_status_t)0x0007) ///< Operation timed out. |
| 61 | +#define SL_STATUS_PERMISSION \ |
| 62 | + ((sl_status_t)0x0008) ///< Operation not allowed per permissions. |
| 63 | +#define SL_STATUS_WOULD_BLOCK \ |
| 64 | + ((sl_status_t)0x0009) ///< Non-blocking operation would block. |
| 65 | +#define SL_STATUS_IDLE \ |
| 66 | + ((sl_status_t)0x000A) ///< Operation/module is Idle, cannot carry requested operation. |
| 67 | +#define SL_STATUS_IS_WAITING \ |
| 68 | + ((sl_status_t)0x000B) ///< Operation cannot be done while construct is waiting. |
| 69 | +#define SL_STATUS_NONE_WAITING \ |
| 70 | + ((sl_status_t)0x000C) ///< No task/construct waiting/pending for that action/event. |
| 71 | +#define SL_STATUS_SUSPENDED \ |
| 72 | + ((sl_status_t)0x000D) ///< Operation cannot be done while construct is suspended. |
| 73 | +#define SL_STATUS_NOT_AVAILABLE \ |
| 74 | + ((sl_status_t)0x000E) ///< Feature not available due to software configuration. |
| 75 | +#define SL_STATUS_NOT_SUPPORTED \ |
| 76 | + ((sl_status_t)0x000F) ///< Feature not supported. |
| 77 | +#define SL_STATUS_INITIALIZATION \ |
| 78 | + ((sl_status_t)0x0010) ///< Initialization failed. |
| 79 | +#define SL_STATUS_NOT_INITIALIZED \ |
| 80 | + ((sl_status_t)0x0011) ///< Module has not been initialized. |
| 81 | +#define SL_STATUS_ALREADY_INITIALIZED \ |
| 82 | + ((sl_status_t)0x0012) ///< Module has already been initialized. |
| 83 | +#define SL_STATUS_DELETED \ |
| 84 | + ((sl_status_t)0x0013) ///< Object/construct has been deleted. |
| 85 | +#define SL_STATUS_ISR ((sl_status_t)0x0014) ///< Illegal call from ISR. |
| 86 | +#define SL_STATUS_NETWORK_UP \ |
| 87 | + ((sl_status_t)0x0015) ///< Illegal call because network is up. |
| 88 | +#define SL_STATUS_NETWORK_DOWN \ |
| 89 | + ((sl_status_t)0x0016) ///< Illegal call because network is down. |
| 90 | +#define SL_STATUS_NOT_JOINED \ |
| 91 | + ((sl_status_t)0x0017) ///< Failure due to not being joined in a network. |
| 92 | +#define SL_STATUS_NO_BEACONS \ |
| 93 | + ((sl_status_t)0x0018) ///< Invalid operation as there are no beacons. |
76 | 94 |
|
77 | 95 | // Allocation/ownership Errors
|
78 |
| -#define SL_STATUS_ALLOCATION_FAILED ((sl_status_t)0x0019) ///< Generic allocation error. |
79 |
| -#define SL_STATUS_NO_MORE_RESOURCE ((sl_status_t)0x001A) ///< No more resource available to perform the operation. |
80 |
| -#define SL_STATUS_EMPTY ((sl_status_t)0x001B) ///< Item/list/queue is empty. |
81 |
| -#define SL_STATUS_FULL ((sl_status_t)0x001C) ///< Item/list/queue is full. |
82 |
| -#define SL_STATUS_WOULD_OVERFLOW ((sl_status_t)0x001D) ///< Item would overflow. |
83 |
| -#define SL_STATUS_HAS_OVERFLOWED ((sl_status_t)0x001E) ///< Item/list/queue has been overflowed. |
84 |
| -#define SL_STATUS_OWNERSHIP ((sl_status_t)0x001F) ///< Generic ownership error. |
85 |
| -#define SL_STATUS_IS_OWNER ((sl_status_t)0x0020) ///< Already/still owning resource. |
| 96 | +#define SL_STATUS_ALLOCATION_FAILED \ |
| 97 | + ((sl_status_t)0x0019) ///< Generic allocation error. |
| 98 | +#define SL_STATUS_NO_MORE_RESOURCE \ |
| 99 | + ((sl_status_t)0x001A) ///< No more resource available to perform the operation. |
| 100 | +#define SL_STATUS_EMPTY ((sl_status_t)0x001B) ///< Item/list/queue is empty. |
| 101 | +#define SL_STATUS_FULL ((sl_status_t)0x001C) ///< Item/list/queue is full. |
| 102 | +#define SL_STATUS_WOULD_OVERFLOW \ |
| 103 | + ((sl_status_t)0x001D) ///< Item would overflow. |
| 104 | +#define SL_STATUS_HAS_OVERFLOWED \ |
| 105 | + ((sl_status_t)0x001E) ///< Item/list/queue has been overflowed. |
| 106 | +#define SL_STATUS_OWNERSHIP ((sl_status_t)0x001F) ///< Generic ownership error. |
| 107 | +#define SL_STATUS_IS_OWNER \ |
| 108 | + ((sl_status_t)0x0020) ///< Already/still owning resource. |
86 | 109 |
|
87 | 110 | // Invalid Parameters Errors
|
88 |
| -#define SL_STATUS_INVALID_PARAMETER ((sl_status_t)0x0021) ///< Generic invalid argument or consequence of invalid argument. |
89 |
| -#define SL_STATUS_NULL_POINTER ((sl_status_t)0x0022) ///< Invalid null pointer received as argument. |
90 |
| -#define SL_STATUS_INVALID_CONFIGURATION ((sl_status_t)0x0023) ///< Invalid configuration provided. |
91 |
| -#define SL_STATUS_INVALID_MODE ((sl_status_t)0x0024) ///< Invalid mode. |
92 |
| -#define SL_STATUS_INVALID_HANDLE ((sl_status_t)0x0025) ///< Invalid handle. |
93 |
| -#define SL_STATUS_INVALID_TYPE ((sl_status_t)0x0026) ///< Invalid type for operation. |
94 |
| -#define SL_STATUS_INVALID_INDEX ((sl_status_t)0x0027) ///< Invalid index. |
95 |
| -#define SL_STATUS_INVALID_RANGE ((sl_status_t)0x0028) ///< Invalid range. |
96 |
| -#define SL_STATUS_INVALID_KEY ((sl_status_t)0x0029) ///< Invalid key. |
97 |
| -#define SL_STATUS_INVALID_CREDENTIALS ((sl_status_t)0x002A) ///< Invalid credentials. |
98 |
| -#define SL_STATUS_INVALID_COUNT ((sl_status_t)0x002B) ///< Invalid count. |
99 |
| -#define SL_STATUS_INVALID_SIGNATURE ((sl_status_t)0x002C) ///< Invalid signature / verification failed. |
100 |
| -#define SL_STATUS_NOT_FOUND ((sl_status_t)0x002D) ///< Item could not be found. |
101 |
| -#define SL_STATUS_ALREADY_EXISTS ((sl_status_t)0x002E) ///< Item already exists. |
| 111 | +#define SL_STATUS_INVALID_PARAMETER \ |
| 112 | + ((sl_status_t)0x0021) ///< Generic invalid argument or consequence of invalid argument. |
| 113 | +#define SL_STATUS_NULL_POINTER \ |
| 114 | + ((sl_status_t)0x0022) ///< Invalid null pointer received as argument. |
| 115 | +#define SL_STATUS_INVALID_CONFIGURATION \ |
| 116 | + ((sl_status_t)0x0023) ///< Invalid configuration provided. |
| 117 | +#define SL_STATUS_INVALID_MODE ((sl_status_t)0x0024) ///< Invalid mode. |
| 118 | +#define SL_STATUS_INVALID_HANDLE ((sl_status_t)0x0025) ///< Invalid handle. |
| 119 | +#define SL_STATUS_INVALID_TYPE \ |
| 120 | + ((sl_status_t)0x0026) ///< Invalid type for operation. |
| 121 | +#define SL_STATUS_INVALID_INDEX ((sl_status_t)0x0027) ///< Invalid index. |
| 122 | +#define SL_STATUS_INVALID_RANGE ((sl_status_t)0x0028) ///< Invalid range. |
| 123 | +#define SL_STATUS_INVALID_KEY ((sl_status_t)0x0029) ///< Invalid key. |
| 124 | +#define SL_STATUS_INVALID_CREDENTIALS \ |
| 125 | + ((sl_status_t)0x002A) ///< Invalid credentials. |
| 126 | +#define SL_STATUS_INVALID_COUNT ((sl_status_t)0x002B) ///< Invalid count. |
| 127 | +#define SL_STATUS_INVALID_SIGNATURE \ |
| 128 | + ((sl_status_t)0x002C) ///< Invalid signature / verification failed. |
| 129 | +#define SL_STATUS_NOT_FOUND ((sl_status_t)0x002D) ///< Item could not be found. |
| 130 | +#define SL_STATUS_ALREADY_EXISTS \ |
| 131 | + ((sl_status_t)0x002E) ///< Item already exists. |
102 | 132 |
|
103 | 133 | // IO/Communication Errors
|
104 |
| -#define SL_STATUS_IO ((sl_status_t)0x002F) ///< Generic I/O failure. |
105 |
| -#define SL_STATUS_IO_TIMEOUT ((sl_status_t)0x0030) ///< I/O failure due to timeout. |
106 |
| -#define SL_STATUS_TRANSMIT ((sl_status_t)0x0031) ///< Generic transmission error. |
107 |
| -#define SL_STATUS_TRANSMIT_UNDERFLOW ((sl_status_t)0x0032) ///< Transmit underflowed. |
108 |
| -#define SL_STATUS_TRANSMIT_INCOMPLETE ((sl_status_t)0x0033) ///< Transmit is incomplete. |
109 |
| -#define SL_STATUS_TRANSMIT_BUSY ((sl_status_t)0x0034) ///< Transmit is busy. |
110 |
| -#define SL_STATUS_RECEIVE ((sl_status_t)0x0035) ///< Generic reception error. |
111 |
| -#define SL_STATUS_OBJECT_READ ((sl_status_t)0x0036) ///< Failed to read on/via given object. |
112 |
| -#define SL_STATUS_OBJECT_WRITE ((sl_status_t)0x0037) ///< Failed to write on/via given object. |
113 |
| -#define SL_STATUS_MESSAGE_TOO_LONG ((sl_status_t)0x0038) ///< Message is too long. |
| 134 | +#define SL_STATUS_IO ((sl_status_t)0x002F) ///< Generic I/O failure. |
| 135 | +#define SL_STATUS_IO_TIMEOUT \ |
| 136 | + ((sl_status_t)0x0030) ///< I/O failure due to timeout. |
| 137 | +#define SL_STATUS_TRANSMIT \ |
| 138 | + ((sl_status_t)0x0031) ///< Generic transmission error. |
| 139 | +#define SL_STATUS_TRANSMIT_UNDERFLOW \ |
| 140 | + ((sl_status_t)0x0032) ///< Transmit underflowed. |
| 141 | +#define SL_STATUS_TRANSMIT_INCOMPLETE \ |
| 142 | + ((sl_status_t)0x0033) ///< Transmit is incomplete. |
| 143 | +#define SL_STATUS_TRANSMIT_BUSY ((sl_status_t)0x0034) ///< Transmit is busy. |
| 144 | +#define SL_STATUS_RECEIVE ((sl_status_t)0x0035) ///< Generic reception error. |
| 145 | +#define SL_STATUS_OBJECT_READ \ |
| 146 | + ((sl_status_t)0x0036) ///< Failed to read on/via given object. |
| 147 | +#define SL_STATUS_OBJECT_WRITE \ |
| 148 | + ((sl_status_t)0x0037) ///< Failed to write on/via given object. |
| 149 | +#define SL_STATUS_MESSAGE_TOO_LONG \ |
| 150 | + ((sl_status_t)0x0038) ///< Message is too long. |
114 | 151 |
|
115 | 152 | // ANSI C/POSIX codes
|
116 |
| -#define SL_STATUS_ERRNO ((sl_status_t)0x0101) ///< System error: errno is set and strerror can be used to fetch the error-message. |
| 153 | +#define SL_STATUS_ERRNO \ |
| 154 | + ((sl_status_t)0x0101) ///< System error: errno is set and strerror can be used to fetch the error-message. |
117 | 155 |
|
118 | 156 | // Net-MQTT status codes
|
119 |
| -#define SL_STATUS_NET_MQTT_NO_CONN ((sl_status_t)0x0841) ///< Not connected to a broker. |
120 |
| -#define SL_STATUS_NET_MQTT_LOST_CONN ((sl_status_t)0x0842) ///< Connection to broker lost. |
121 |
| -#define SL_STATUS_NET_MQTT_PROTOCOL ((sl_status_t)0x0843) ///< Protocol error. |
122 |
| -#define SL_STATUS_NET_MQTT_TLS_HANDSHAKE ((sl_status_t)0x0844) ///< TLS negotiation failed. |
123 |
| -#define SL_STATUS_NET_MQTT_PAYLOAD_SIZE ((sl_status_t)0x0845) ///< Payload size is too large. |
124 |
| -#define SL_STATUS_NET_MQTT_NOT_SUPPORTED ((sl_status_t)0x0846) ///< MQTTv5 properties are set but client is not using MQTTv5. |
125 |
| -#define SL_STATUS_NET_MQTT_AUTH ((sl_status_t)0x0847) ///< Authentication failed. |
126 |
| -#define SL_STATUS_NET_MQTT_ACL_DENIED ((sl_status_t)0x0848) ///< Access control list deny. |
127 |
| -#define SL_STATUS_NET_MQTT_MALFORMED_UTF8 ((sl_status_t)0x0849) ///< Malformed UTF-8 string in the specified MQTT-topic. |
128 |
| -#define SL_STATUS_NET_MQTT_DUPLICATE_PROPERTY ((sl_status_t)0x084A) ///< An MQTTv5 property is duplicated where it is forbidden. |
129 |
| -#define SL_STATUS_NET_MQTT_QOS_NOT_SUPPORTED ((sl_status_t)0x084B) ///< The requested QoS level is not supported by the broker. |
130 |
| -#define SL_STATUS_NET_MQTT_OVERSIZE_PACKET ((sl_status_t)0x084C) ///< Resulting packet will become larger than the broker supports. |
| 157 | +#define SL_STATUS_NET_MQTT_NO_CONN \ |
| 158 | + ((sl_status_t)0x0841) ///< Not connected to a broker. |
| 159 | +#define SL_STATUS_NET_MQTT_LOST_CONN \ |
| 160 | + ((sl_status_t)0x0842) ///< Connection to broker lost. |
| 161 | +#define SL_STATUS_NET_MQTT_PROTOCOL ((sl_status_t)0x0843) ///< Protocol error. |
| 162 | +#define SL_STATUS_NET_MQTT_TLS_HANDSHAKE \ |
| 163 | + ((sl_status_t)0x0844) ///< TLS negotiation failed. |
| 164 | +#define SL_STATUS_NET_MQTT_PAYLOAD_SIZE \ |
| 165 | + ((sl_status_t)0x0845) ///< Payload size is too large. |
| 166 | +#define SL_STATUS_NET_MQTT_NOT_SUPPORTED \ |
| 167 | + ((sl_status_t)0x0846) ///< MQTTv5 properties are set but client is not using MQTTv5. |
| 168 | +#define SL_STATUS_NET_MQTT_AUTH \ |
| 169 | + ((sl_status_t)0x0847) ///< Authentication failed. |
| 170 | +#define SL_STATUS_NET_MQTT_ACL_DENIED \ |
| 171 | + ((sl_status_t)0x0848) ///< Access control list deny. |
| 172 | +#define SL_STATUS_NET_MQTT_MALFORMED_UTF8 \ |
| 173 | + ((sl_status_t)0x0849) ///< Malformed UTF-8 string in the specified MQTT-topic. |
| 174 | +#define SL_STATUS_NET_MQTT_DUPLICATE_PROPERTY \ |
| 175 | + ((sl_status_t)0x084A) ///< An MQTTv5 property is duplicated where it is forbidden. |
| 176 | +#define SL_STATUS_NET_MQTT_QOS_NOT_SUPPORTED \ |
| 177 | + ((sl_status_t)0x084B) ///< The requested QoS level is not supported by the broker. |
| 178 | +#define SL_STATUS_NET_MQTT_OVERSIZE_PACKET \ |
| 179 | + ((sl_status_t)0x084C) ///< Resulting packet will become larger than the broker supports. |
131 | 180 |
|
132 | 181 | // Other codes
|
133 |
| -#define SL_STATUS_PRINT_INFO_MESSAGE ((sl_status_t)0x0900) ///< Only information message should be printed, without starting an application |
| 182 | +#define SL_STATUS_PRINT_INFO_MESSAGE \ |
| 183 | + ((sl_status_t)0x0900) ///< Only information message should be printed, without starting an application |
134 | 184 |
|
135 | 185 | /*
|
136 | 186 | ******************************** DATA TYPES *******************************
|
|
0 commit comments