Filter results by

Older Versions

Older API versions are available as a download. To view, extract the file and open the index.html file in a web browser.

artik_error.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2017 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  */
18 
19 #ifndef INCLUDE_ARTIK_ERROR_H_
20 #define INCLUDE_ARTIK_ERROR_H_
21 
30 #define MAX_ERRR_MSG_LEN 64
31 #define INVALID_MODULE (void *)(-1)
32 
35 typedef int artik_error;
36 
40 #define S_OK (0)
41 
45 #define E_BAD_ARGS (-1)
46 
50 #define E_BUSY (-2)
51 
55 #define E_NOT_INITIALIZED (-3)
56 
60 #define E_NO_MEM (-4)
61 
65 #define E_NOT_SUPPORTED (-5)
66 
70 #define E_OVERFLOW (-6)
71 
76 #define E_ACCESS_DENIED (-7)
77 
82 #define E_INTERRUPTED (-8)
83 
87 #define E_TRY_AGAIN (-9)
88 
92 #define E_TIMEOUT (-10)
93 
97 #define E_INVALID_VALUE (-11)
98 
102 #define E_WEBSOCKET_QUEUE (-12)
103 
107 #define E_NOT_CONNECTED (-13)
108 
112 #define E_HTTP_ERROR (-1000)
113 
117 #define E_BT_ERROR (-2000)
118 
122 #define E_ZIGBEE_ERROR (-3000)
123 
126 #define E_ZIGBEE_INVALID_DAEMON (-3001)
127 
130 #define E_ZIGBEE_NO_DAEMON (-3002)
131 
134 #define E_ZIGBEE_NO_MESSAGE (-3003)
135 
138 #define E_ZIGBEE_NO_DEVICE (-3004)
139 
142 #define E_ZIGBEE_ERR_SOCK (-3005)
143 
146 #define E_ZIGBEE_MSG_SEND_ERROR (-3006)
147 
151 #define E_ZIGBEE_NETWORK_EXIST (-3007)
152 
156 #define E_WEBSOCKET_ERROR (-4000)
157 
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)
165 
169 #define E_LWM2M_ERROR (-6000)
170 
174 #define E_MQTT_ERROR (-18)
175 
179 #define E_NETWORK_ERROR (-7000)
180 
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)
191 
195 #define E_IN_PROGRESS (-16)
196 
203 typedef struct {
204  int err;
205  char msg[MAX_ERRR_MSG_LEN];
207 
208 static const artik_error_msg_string error_msg_strings[] = {
209  {S_OK, "OK"},
210  {E_BAD_ARGS, "Bad arguments"},
211  {E_BUSY, "Busy"},
212  {E_NOT_INITIALIZED, "Not initialized"},
213  {E_NO_MEM, "No memory"},
214  {E_NOT_SUPPORTED, "Not supported"},
215  {E_OVERFLOW, "Overflow"},
216  {E_ACCESS_DENIED, "Access denied"},
217  {E_INTERRUPTED, "Interrupted"},
218  {E_HTTP_ERROR, "HTTP error"},
219  {E_TRY_AGAIN, "Try again"},
220  {E_TIMEOUT, "Timeout"},
221  {E_WEBSOCKET_ERROR, "Websocket error"},
222  {E_BT_ERROR, "Bluetooth adapter error"},
223  {E_WIFI_ERROR, "Wi-Fi error"},
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"},
227  {E_ZIGBEE_ERROR, "ZigBee error"},
228  {E_ZIGBEE_INVALID_DAEMON, "Invalid zigbee daemon"},
229  {E_ZIGBEE_NO_DAEMON, "No zigbee daemon"},
230  {E_ZIGBEE_NO_MESSAGE, "No zigbee message"},
231  {E_ZIGBEE_ERR_SOCK, "Socket error"},
232  {E_ZIGBEE_MSG_SEND_ERROR, "Send message error"},
233  {E_ZIGBEE_NETWORK_EXIST, "Network has existed"},
234  {E_INVALID_VALUE, "Invalid value"},
235  {E_LWM2M_ERROR, "LWM2M error"},
236  {E_MQTT_ERROR, "MQTT error"},
237  {E_NETWORK_ERROR, "Network error"},
238  {E_SECURITY_ERROR, "Security error"},
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"}
245 };
246 
247 static const char *error_msg_null = "null";
248 
249 static inline const char *error_msg(artik_error err)
250 {
251  const artik_error_msg_string *msgs;
252  int i, size;
253 
254  msgs = error_msg_strings;
255  size = sizeof(error_msg_strings) / sizeof(artik_error_msg_string);
256  for (i = 0; i < size; i++) {
257  if (msgs[i].err == err)
258  return (char *)msgs[i].msg;
259  }
260 
261  return error_msg_null;
262 }
263 
264 #endif /* INCLUDE_ARTIK_ERROR_H_ */
#define E_ZIGBEE_ERR_SOCK
Zigbee Socket error.
Definition: artik_error.h:142
#define E_NO_MEM
A memory allocation could not be performed.
Definition: artik_error.h:60
#define E_HTTP_ERROR
An error happened on a HTTP request.
Definition: artik_error.h:112
#define E_INVALID_VALUE
An invalid value was returned.
Definition: artik_error.h:97
#define E_BT_ERROR
An error occurred with the Bluetooth adapter.
Definition: artik_error.h:117
#define E_ZIGBEE_NO_DAEMON
Zigbee daemon wasn&#39;t started.
Definition: artik_error.h:130
#define E_NOT_SUPPORTED
The called function is not supported by the device.
Definition: artik_error.h:65
#define S_OK
No error occurred while processing the function.
Definition: artik_error.h:40
#define E_ZIGBEE_ERROR
An error occurred with the ZigBee service.
Definition: artik_error.h:122
#define E_LWM2M_ERROR
An error occurred with the LWM2M service.
Definition: artik_error.h:169
#define E_BUSY
The device is currently in use by another caller.
Definition: artik_error.h:50
#define E_OVERFLOW
An overflow occurred while receiving data.
Definition: artik_error.h:70
#define E_ACCESS_DENIED
The function could not access one resource due to missing permissions.
Definition: artik_error.h:76
#define E_INTERRUPTED
The blocking function was interrupted by an error or a manual operation.
Definition: artik_error.h:82
#define E_ZIGBEE_MSG_SEND_ERROR
Zigbee Message send error.
Definition: artik_error.h:146
#define E_NOT_INITIALIZED
The called module has not been initialized yet.
Definition: artik_error.h:55
int artik_error
Error type.
Definition: artik_error.h:35
#define E_ZIGBEE_NETWORK_EXIST
Current network already exists. It is used for network_join_manually and network_form_manually.
Definition: artik_error.h:151
#define E_ZIGBEE_NO_MESSAGE
Fail to read message from Zigbee socket.
Definition: artik_error.h:134
#define E_BAD_ARGS
Wrong arguments passed to the function.
Definition: artik_error.h:45
#define E_MQTT_ERROR
An error occurred with the MQTT.
Definition: artik_error.h:174
#define E_NETWORK_ERROR
An error happened on Network service.
Definition: artik_error.h:179
#define E_TIMEOUT
The function exited because it reached its timeout period.
Definition: artik_error.h:92
#define E_WIFI_ERROR
An error occurred with the Wi-Fi service.
Definition: artik_error.h:161
#define E_ZIGBEE_INVALID_DAEMON
The version of Zigbee daemon is wrong.
Definition: artik_error.h:126
#define E_TRY_AGAIN
Requested data is not yet available, try again.
Definition: artik_error.h:87
Error message definition.
Definition: artik_error.h:203
#define E_SECURITY_ERROR
Errors specific to the security module.
Definition: artik_error.h:184
#define E_WEBSOCKET_ERROR
An error occurred in a websocket process.
Definition: artik_error.h:156
Last updated on: