Knox Tizen Wearable SDK
tizen_error.h
1 /*
2  * Copyright ⓒ Samsung Electronics, Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef LIBMDM_DOC_TIZEN_ERROR_H
19 #define LIBMDM_DOC_TIZEN_ERROR_H
20 
21 #include <errno.h>
22 
32 #define TIZEN_ERROR_MAX_PLATFORM_ERROR 0
33 #define TIZEN_ERROR_MIN_PLATFORM_ERROR (-1073741824LL) /* = -2147483648 / 2 */
34 
35 /* Use this constant macro as the value of the first module specific error */
36 #define TIZEN_ERROR_MIN_MODULE_ERROR (-2147483648LL)
37 
38 /* Module errors cannot be greater than the following constant */
39 #define TIZEN_ERROR_MAX_MODULE_ERROR (TIZEN_ERROR_MIN_PLATFORM_ERROR - 1)
40 
41 /* Check if error or not */
42 #define TIZEN_ERROR_IS_OK(x) (0 <= (x))
43 
44 /* Check if error or not */
45 #define TIZEN_ERROR_IS_ERROR(x) (!TIZEN_ERROR_IS_OK(x))
46 
47 /* Check if slp error or not */
48 #define TIZEN_ERROR_IS_PLATFORM_ERROR(x) (TIZEN_ERROR_MIN_PLATFORM_ERROR <= (x) && (x) < 0)
49 
50 /* Application Error Class */
51 #define TIZEN_ERROR_APPLICATION_CLASS -0x00000200
52 /* Base Error Class */
53 #define TIZEN_ERROR_BASE_CLASS -0x00000400
54 /* Content Error Class */
55 #define TIZEN_ERROR_CONTENT_CLASS -0x00000800
56 /* Location Error Class */
57 #define TIZEN_ERROR_LOCATION_CLASS -0x00001000
58 /* Multimedia Error Class */
59 #define TIZEN_ERROR_MULTIMEDIA_CLASS -0x00002000
60 /* Messaging Error Class */
61 #define TIZEN_ERROR_MESSAGING_CLASS -0x00004000
62 /* Network Error Class */
63 #define TIZEN_ERROR_NETWORK_CLASS -0x00008000
64 /* Social Error Class */
65 #define TIZEN_ERROR_SOCIAL_CLASS -0x00010000
66 /* System Error Class */
67 #define TIZEN_ERROR_SYSTEM_CLASS -0x00020000
68 /* Telephony Error Class */
69 #define TIZEN_ERROR_TELEPHONY_CLASS -0x00040000
70 /* UI Error class */
71 #define TIZEN_ERROR_UI_CLASS -0x00080000
72 /* UIX Error class */
73 #define TIZEN_ERROR_UIX_CLASS -0x00100000
74 /* AD Error class */
75 #define TIZEN_ERROR_AD_CLASS -0x00200000
76 /* Web Error class */
77 #define TIZEN_ERROR_WEB_CLASS -0x00400000
78 /* DRM Error class */
79 #define TIZEN_ERROR_DRM_CLASS -0x00800000
80 /* Account Error class */
81 #define TIZEN_ERROR_ACCOUNT_CLASS -0x01000000
82 
83 /* Tizen Account Error */
84 #define TIZEN_ERROR_ACCOUNT -0x01000000
85 /* Tizen Application Error */
86 #define TIZEN_ERROR_APPLICATION -0x01100000
87 /* Tizen Application Manager Error */
88 #define TIZEN_ERROR_APPLICATION_MANAGER -0x01110000
89 /* Tizen Badge Error */
90 #define TIZEN_ERROR_BADGE -0x01120000
91 /* Tizen Message Port Error */
92 #define TIZEN_ERROR_MESSAGE_PORT -0x01130000
93 /* Tizen Notification Error */
94 #define TIZEN_ERROR_NOTIFICATION -0x01140000
95 /* Tizen Package Manager Error */
96 #define TIZEN_ERROR_PACKAGE_MANAGER -0x01150000
97 /* Tizen Shortcut Error */
98 #define TIZEN_ERROR_SHORTCUT -0x01160000
99 /* Tizen UI Gadget Error */
100 #define TIZEN_ERROR_UI_GADGET -0x01170000
101 /* Tizen Bundle Error */
102 #define TIZEN_ERROR_BUNDLE -0x01180000
103 /* Tizen Data Control Error */
104 #define TIZEN_ERROR_DATA_CONTROL -0x01190000
105 /* Tizen Service Application Error */
106 #define TIZEN_ERROR_SERVICE_APPLICATION -0x01200000
107 /* Tizen Utility ICU Error */
108 #define TIZEN_ERROR_UTILITY_ICU -0x01500000
109 /* Tizen Mime Type Error */
110 #define TIZEN_ERROR_MIME_TYPE -0x01600000
111 /* Tizen Media Content Error */
112 #define TIZEN_ERROR_MEDIA_CONTENT -0x01610000
113 /* Tizen Email Service Error */
114 #define TIZEN_ERROR_EMAIL_SERVICE -0x01700000
115 /* Tizen Messaging Service Error */
116 #define TIZEN_ERROR_MESSAGING_SERVICE -0x01710000
117 /* Tizen Push Error */
118 #define TIZEN_ERROR_PUSH -0x01720000
119 /* Tizen Audio IO Error */
120 #define TIZEN_ERROR_AUDIO_IO -0x01900000
121 /* Tizen Camera Error */
122 #define TIZEN_ERROR_CAMERA -0x01910000
123 /* Tizen Image Util Error */
124 #define TIZEN_ERROR_IMAGE_UTIL -0x01920000
125 /* Tizen Metadata Extractor Error */
126 #define TIZEN_ERROR_METADATA_EXTRACTOR -0x01930000
127 /* Tizen Player Error */
128 #define TIZEN_ERROR_PLAYER -0x01940000
129 /* Tizen Recorder Error */
130 #define TIZEN_ERROR_RECORDER -0x01950000
131 /* Tizen Sound Manager Error */
132 #define TIZEN_ERROR_SOUND_MANAGER -0x01960000
133 /* Tizen Tone Player Error */
134 #define TIZEN_ERROR_TONE_PLAYER -0x01970000
135 /* Tizen Video Util Error */
136 #define TIZEN_ERROR_VIDEO_UTIL -0x01980000
137 /* Tizen Wav Player Error */
138 #define TIZEN_ERROR_WAV_PLAYER -0x01990000
139 /* Tizen Radio Error */
140 #define TIZEN_ERROR_RADIO -0x019A0000
141 /* Tizen MEDIA CODEC Error */
142 #define TIZEN_ERROR_MEDIACODEC -0x019B0000
143 /* Tizen Bluetooth Error */
144 #define TIZEN_ERROR_BLUETOOTH -0x01C00000
145 /* Tizen Connection Error */
146 #define TIZEN_ERROR_CONNECTION -0x01C10000
147 /* Tizen NFC Error */
148 #define TIZEN_ERROR_NFC -0x01C20000
149 /* Tizen Serial Error */
150 #define TIZEN_ERROR_SERIAL -0x01C30000
151 /* Tizen Tethering Error */
152 #define TIZEN_ERROR_TETHERING -0x01C40000
153 /* Tizen Wifi Error */
154 #define TIZEN_ERROR_WIFI -0x01C50000
155 /* Tizen Wifi Direct Error */
156 #define TIZEN_ERROR_WIFI_DIRECT -0x01C60000
157 /* Tizen Privacy Manager Error */
158 #define TIZEN_ERROR_PRIVACY_MANAGER -0x01E00000
159 /* Tizen Key Manager Error */
160 #define TIZEN_ERROR_KEY_MANAGER -0x01E10000
161 /* Tizen PRIVILEGE INFO Error */
162 #define TIZEN_ERROR_PRIVILEGE_INFORMATION -0x01E20000
163 /* Tizen Calendar Error */
164 #define TIZEN_ERROR_CALENDAR -0x02000000
165 /* Tizen Contacts Error */
166 #define TIZEN_ERROR_CONTACTS -0x02010000
167 /* Tizen Storage Error */
168 #define TIZEN_ERROR_STORAGE -0x02200000
169 /* Tizen Vconf Error */
170 #define TIZEN_ERROR_VCONF -0x02210000
171 /* Tizen Device Error */
172 #define TIZEN_ERROR_DEVICE -0x02400000
173 /* Tizen Dlog Error */
174 #define TIZEN_ERROR_DLOG -0x02410000
175 /* Tizen Media Key Error */
176 #define TIZEN_ERROR_MEDIA_KEY -0x02420000
177 /* Tizen Runetime Info Error */
178 #define TIZEN_ERROR_RUNTIME_INFORMATION -0x02430000
179 /* Tizen Sensor Error */
180 #define TIZEN_ERROR_SENSOR -0x02440000
181 /* Tizen System Info Error */
182 #define TIZEN_ERROR_SYSTEM_INFORMATION -0x02450000
183 /* Tizen System Setting Error */
184 #define TIZEN_ERROR_SYSTEM_SETTING -0x02460000
185 /* Tizen System Resource Error */
186 #define TIZEN_ERROR_SYSTEM_RESOURCE -0x02470000
187 /* Tizen Context Error */
188 #define TIZEN_ERROR_CONTEXT -0x02480000
189 /* Tizen Telephony Error */
190 #define TIZEN_ERROR_TELEPHONY -0x02600000
191 /* Tizen EFL Util Error */
192 #define TIZEN_ERROR_EFL_UTIL -0x02800000
193 /* Tizen UtilX Error */
194 #define TIZEN_ERROR_UTILX -0x02810000
195 /* Tizen Native Buffer Error */
196 #define TIZEN_ERROR_NATIVE_BUFFER -0x02820000
197 /* Tizen Buffer Manager Error */
198 #define TIZEN_ERROR_TBM -0x02830000
199 /* Tizen Download Error */
200 #define TIZEN_ERROR_DOWNLOAD -0x02A00000
201 /* Tizen WebView Error */
202 #define TIZEN_ERROR_WEBVIEW -0x02A10000
203 /* Tizen Location Manager */
204 #define TIZEN_ERROR_LOCATION_MANAGER -0x02C00000
205 /* Tizen STT Error */
206 #define TIZEN_ERROR_STT -0x02F00000
207 /* Tizen TTS Error */
208 #define TIZEN_ERROR_TTS -0x02F10000
209 
215 typedef enum {
216  TIZEN_ERROR_NONE = 0,
217  TIZEN_ERROR_NOT_PERMITTED = -EPERM,
218  TIZEN_ERROR_NO_SUCH_FILE = -ENOENT,
219  TIZEN_ERROR_NO_SUCH_PROCESS = -ESRCH,
220  TIZEN_ERROR_INTERRUPTED_SYS_CALL = -EINTR,
221  TIZEN_ERROR_IO_ERROR = -EIO,
222  TIZEN_ERROR_NO_SUCH_DEVICE = -ENXIO,
223  TIZEN_ERROR_ARGUMENT_LIST_TOO_LONG = -E2BIG,
224  TIZEN_ERROR_EXEC_FORMAT_ERROR = -ENOEXEC,
225  TIZEN_ERROR_BAD_FILE_NUMBER = -EBADF,
227  TIZEN_ERROR_TRY_AGAIN = -EAGAIN,
228  TIZEN_ERROR_OUT_OF_MEMORY = -ENOMEM,
229  TIZEN_ERROR_PERMISSION_DENIED = -EACCES,
230  TIZEN_ERROR_BAD_ADDRESS = -EFAULT,
231  TIZEN_ERROR_BLOCK_DEVICE_REQUIRED = -ENOTBLK,
232  TIZEN_ERROR_RESOURCE_BUSY = -EBUSY,
233  TIZEN_ERROR_FILE_EXISTS = -EEXIST,
234  TIZEN_ERROR_CROSS_DEVICE_LINK = -EXDEV,
235  TIZEN_ERROR_NOT_A_DIRECTORY = -ENOTDIR,
237  TIZEN_ERROR_IS_A_DIRECTORY = -EISDIR,
238  TIZEN_ERROR_INVALID_PARAMETER = -EINVAL,
239  TIZEN_ERROR_FILE_TABLE_OVERFLOW = -ENFILE,
240  TIZEN_ERROR_TOO_MANY_OPEN_FILES = -EMFILE,
241  TIZEN_ERROR_TOO_NOT_A_TERMINAL = -ENOTTY,
242  TIZEN_ERROR_TOO_TEXT_FILE_BUSY = -ETXTBSY,
243  TIZEN_ERROR_FILE_TOO_LARGE = -EFBIG,
244  TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE = -ENOSPC,
245  TIZEN_ERROR_ILLEGAL_SEEK = -ESPIPE,
246  TIZEN_ERROR_READ_ONLY_FILESYSTEM = -EROFS,
247  TIZEN_ERROR_NO_DATA = -ENODATA,
249  TIZEN_ERROR_TOO_MANY_LINKS = -EMLINK,
250  TIZEN_ERROR_BROKEN_PIPE = -EPIPE,
251  TIZEN_ERROR_ARGUMENT_OUT_OF_DOMAIN = -EDOM,
252  TIZEN_ERROR_RESULT_OUT_OF_RANGE = -ERANGE,
253  TIZEN_ERROR_WOULD_CAUSE_DEADLOCK = -EDEADLK,
254  TIZEN_ERROR_FILE_NAME_TOO_LONG = -ENAMETOOLONG,
255  TIZEN_ERROR_FILE_NO_LOCKS_AVAILABLE = -ENOLCK,
256  TIZEN_ERROR_INVALID_OPERATION = -ENOSYS,
257  TIZEN_ERROR_DIR_NOT_EMPTY = -ENOTEMPTY,
258  TIZEN_ERROR_TOO_MANY_SYMBOLIC_LINKS = -ELOOP,
259  TIZEN_ERROR_WOULD_BLOCK = TIZEN_ERROR_TRY_AGAIN,
260  TIZEN_ERROR_CORRUPTED_SHARED_LIB = -ELIBBAD,
261  TIZEN_ERROR_LIB_SECTION_CORRUPTED = -ELIBSCN,
262  TIZEN_ERROR_LINK_TOO_MANY_SHARED_LIB = -ELIBMAX,
263  TIZEN_ERROR_SHARED_LIB_EXEC = -ELIBEXEC,
264  TIZEN_ERROR_ILLEGAL_BYTE_SEQ = -EILSEQ,
265  TIZEN_ERROR_SYSTEM_CALL_RESTART = -ERESTART,
266  TIZEN_ERROR_STREAMS_PIPE = -ESTRPIPE,
267  TIZEN_ERROR_TOO_MANY_USERS = -EUSERS,
268  TIZEN_ERROR_NON_SOCKET = -ENOTSOCK,
269  TIZEN_ERROR_NO_DEST_ADDRESS = -EDESTADDRREQ,
270  TIZEN_ERROR_MSG_TOO_LONG = -EMSGSIZE,
271  TIZEN_ERROR_PROTOCOL_WRONG_TYPE = -EPROTOTYPE,
272  TIZEN_ERROR_PROTOCOL_NOT_AVALIABLE = -ENOPROTOOPT,
273  TIZEN_ERROR_PROTOCOL_NOT_SUPPORTED = -EPROTONOSUPPORT,
274  TIZEN_ERROR_SOCKET_TYPE_NOT_SUPPORTED = -ESOCKTNOSUPPORT,
275  TIZEN_ERROR_ENDPOINT_OPERATIN_NOT_SUPPORTED = -EOPNOTSUPP,
276  TIZEN_ERROR_PROTOCOL_FAMILY_NOT_SUPPORTED = -EPFNOSUPPORT,
277  TIZEN_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED = -EAFNOSUPPORT,
278  TIZEN_ERROR_ADDRES_IN_USE = -EADDRINUSE,
279  TIZEN_ERROR_CANNOT_ASSIGN_ADDRESS = -EADDRNOTAVAIL,
280  TIZEN_ERROR_NETWORK_DOWN = -ENETDOWN,
281  TIZEN_ERROR_NETWORK_UNREACHABLE = -ENETUNREACH,
282  TIZEN_ERROR_NETWORK_RESET = -ENETRESET,
283  TIZEN_ERROR_CONNECTION_ABORTED = -ECONNABORTED,
284  TIZEN_ERROR_CONNECTION_RESET_BY_PEER = -ECONNRESET,
285  TIZEN_ERROR_BUFFER_SPACE = -ENOBUFS,
286  TIZEN_ERROR_ENDPOINT_CONNECTED = -EISCONN,
287  TIZEN_ERROR_ENDPOINT_NOT_CONNECTED = -ENOTCONN,
288  TIZEN_ERROR_ENDPOINT_SHUTDOWN = -ESHUTDOWN,
289  TIZEN_ERROR_TOO_MANY_REFERENCES = -ETOOMANYREFS,
290  TIZEN_ERROR_CONNECTION_TIME_OUT = -ETIMEDOUT,
291  TIZEN_ERROR_CONNECTION_REFUSED = -ECONNREFUSED,
292  TIZEN_ERROR_HOST_DOWN = -EHOSTDOWN,
293  TIZEN_ERROR_NO_ROUTE_TO_HOST = -EHOSTUNREACH,
294  TIZEN_ERROR_ALREADY_IN_PROGRESS = -EALREADY,
295  TIZEN_ERROR_NOW_IN_PROGRESS = -EINPROGRESS,
296  TIZEN_ERROR_STALE_NFS_FILE_HANDLE = -ESTALE,
297  TIZEN_ERROR_STRUCTURE_UNCLEAN = -EUCLEAN,
298  TIZEN_ERROR_NOT_XENIX_NAMED_TYPE_FILE = -ENOTNAM,
299  TIZEN_ERROR_NO_XENIX_SEMAPHORES_AVAILABLE = -ENAVAIL,
300  TIZEN_ERROR_IS_NAMED_TYPE_FILE = -EISNAM,
301  TIZEN_ERROR_REMOTE_IO = -EREMOTEIO,
302  TIZEN_ERROR_QUOTA_EXCEEDED = -EDQUOT,
303  TIZEN_ERROR_NO_MEDIUM = -ENOMEDIUM,
304  TIZEN_ERROR_WRONG_MEDIUM_TYPE = -EMEDIUMTYPE,
305  TIZEN_ERROR_CANCELED = -ECANCELED,
306  TIZEN_ERROR_KEY_NOT_AVAILABLE = -ENOKEY,
307  TIZEN_ERROR_KEY_EXPIRED = -EKEYEXPIRED,
308  TIZEN_ERROR_KEY_REVOKED = -EKEYREVOKED,
309  TIZEN_ERROR_KEY_REJECTED = -EKEYREJECTED,
311  TIZEN_ERROR_OWNER_DEAD = -EOWNERDEAD,
313  TIZEN_ERROR_UNKNOWN = TIZEN_ERROR_MIN_PLATFORM_ERROR,
315  /* This is a place to add new errors here.
316  * Do not assign integer values explicitly. Values are auto-assigned.
317  */
318  TIZEN_ERROR_TIMED_OUT,
319  TIZEN_ERROR_NOT_SUPPORTED,
320  TIZEN_ERROR_USER_NOT_CONSENTED,
321  TIZEN_ERROR_END_OF_COLLECTION
322 } tizen_error_e;
323 
324 
336 int get_last_result(void);
337 
347 void set_last_result(int err);
348 
359 char *get_error_message(int err);
360 
365 #endif //LIBMDM_DOC_TIZEN_ERROR_H