19 #ifndef INCLUDE_ARTIK_ERROR_H_ 20 #define INCLUDE_ARTIK_ERROR_H_ 30 #define MAX_ERRR_MSG_LEN 64 31 #define INVALID_MODULE (void *)(-1) 45 #define E_BAD_ARGS (-1) 55 #define E_NOT_INITIALIZED (-3) 65 #define E_NOT_SUPPORTED (-5) 70 #define E_OVERFLOW (-6) 76 #define E_ACCESS_DENIED (-7) 82 #define E_INTERRUPTED (-8) 87 #define E_TRY_AGAIN (-9) 92 #define E_TIMEOUT (-10) 97 #define E_INVALID_VALUE (-11) 102 #define E_WEBSOCKET_QUEUE (-12) 107 #define E_NOT_CONNECTED (-13) 112 #define E_HTTP_ERROR (-1000) 117 #define E_BT_ERROR (-2000) 122 #define E_ZIGBEE_ERROR (-3000) 126 #define E_ZIGBEE_INVALID_DAEMON (-3001) 130 #define E_ZIGBEE_NO_DAEMON (-3002) 134 #define E_ZIGBEE_NO_MESSAGE (-3003) 138 #define E_ZIGBEE_NO_DEVICE (-3004) 142 #define E_ZIGBEE_ERR_SOCK (-3005) 146 #define E_ZIGBEE_MSG_SEND_ERROR (-3006) 151 #define E_ZIGBEE_NETWORK_EXIST (-3007) 156 #define E_WEBSOCKET_ERROR (-4000) 161 #define E_WIFI_ERROR (-5000) 162 #define E_WIFI_ERROR_AUTHENTICATION (-5001) 163 #define E_WIFI_ERROR_ASSOCIATION (-5002) 164 #define E_WIFI_ERROR_BAD_PARAMS (-5003) 169 #define E_LWM2M_ERROR (-6000) 174 #define E_MQTT_ERROR (-18) 179 #define E_NETWORK_ERROR (-7000) 184 #define E_SECURITY_ERROR (-7000) 185 #define E_SECURITY_INVALID_X509 (-7001) 186 #define E_SECURITY_INVALID_PKCS7 (-7002) 187 #define E_SECURITY_CA_VERIF_FAILED (-7003) 188 #define E_SECURITY_DIGEST_MISMATCH (-7004) 189 #define E_SECURITY_SIGNATURE_MISMATCH (-7005) 190 #define E_SECURITY_SIGNING_TIME_ROLLBACK (-7006) 195 #define E_IN_PROGRESS (-16) 205 char msg[MAX_ERRR_MSG_LEN];
224 {E_WIFI_ERROR_AUTHENTICATION,
"Wi-Fi Authentication failed"},
225 {E_WIFI_ERROR_ASSOCIATION,
"Wi-Fi Association failed"},
226 {E_WIFI_ERROR_BAD_PARAMS,
"Wrong Wi-Fi parameters"},
239 {E_SECURITY_INVALID_X509,
"X509 data is not valid"},
240 {E_SECURITY_INVALID_PKCS7,
"PKCS7 data is not valid"},
241 {E_SECURITY_CA_VERIF_FAILED,
"Certificate verification against CA failed"},
242 {E_SECURITY_DIGEST_MISMATCH,
"Computed digest mismatch"},
243 {E_SECURITY_SIGNATURE_MISMATCH,
"Signature mismatch"},
244 {E_SECURITY_SIGNING_TIME_ROLLBACK,
"Signing time rollback error"}
247 static const char *error_msg_null =
"null";
249 static inline const char *error_msg(
artik_error err)
254 msgs = error_msg_strings;
256 for (i = 0; i < size; i++) {
257 if (msgs[i].err == err)
258 return (
char *)msgs[i].msg;
261 return error_msg_null;
#define E_ZIGBEE_ERR_SOCK
Zigbee Socket error.
#define E_NO_MEM
A memory allocation could not be performed.
#define E_HTTP_ERROR
An error happened on a HTTP request.
#define E_INVALID_VALUE
An invalid value was returned.
#define E_BT_ERROR
An error occurred with the Bluetooth adapter.
#define E_ZIGBEE_NO_DAEMON
Zigbee daemon wasn't started.
#define E_NOT_SUPPORTED
The called function is not supported by the device.
#define S_OK
No error occurred while processing the function.
#define E_ZIGBEE_ERROR
An error occurred with the ZigBee service.
#define E_LWM2M_ERROR
An error occurred with the LWM2M service.
#define E_BUSY
The device is currently in use by another caller.
#define E_OVERFLOW
An overflow occurred while receiving data.
#define E_ACCESS_DENIED
The function could not access one resource due to missing permissions.
#define E_INTERRUPTED
The blocking function was interrupted by an error or a manual operation.
#define E_ZIGBEE_MSG_SEND_ERROR
Zigbee Message send error.
#define E_NOT_INITIALIZED
The called module has not been initialized yet.
int artik_error
Error type.
#define E_ZIGBEE_NETWORK_EXIST
Current network already exists. It is used for network_join_manually and network_form_manually.
#define E_ZIGBEE_NO_MESSAGE
Fail to read message from Zigbee socket.
#define E_BAD_ARGS
Wrong arguments passed to the function.
#define E_MQTT_ERROR
An error occurred with the MQTT.
#define E_NETWORK_ERROR
An error happened on Network service.
#define E_TIMEOUT
The function exited because it reached its timeout period.
#define E_WIFI_ERROR
An error occurred with the Wi-Fi service.
#define E_ZIGBEE_INVALID_DAEMON
The version of Zigbee daemon is wrong.
#define E_TRY_AGAIN
Requested data is not yet available, try again.
Error message definition.
#define E_SECURITY_ERROR
Errors specific to the security module.
#define E_WEBSOCKET_ERROR
An error occurred in a websocket process.