Fixed a problem that error codes of zigbee-lib (which are usesd in
[platform/core/connectivity/zigbee-manager.git] / zigbee-daemon / zigbee-lib / include / zblib_types.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Contact: Suresh Kumar N (suresh.n@samsung.com)
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 #ifndef __ZIGBEE_LIB_TYPES_H__
20 #define __ZIGBEE_LIB_TYPES_H__
21
22 /* --------------------------------------------------------------------------------------
23  * For Responses
24  * -------------------------------------------------------------------------------------*/
25
26 #include <errno.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #ifndef TIZEN_ERROR_NONE
33 #define TIZEN_ERROR_NONE 0 /**< Successful */
34 #endif
35
36 #ifndef TIZEN_ERROR_INVALID_PARAMETER
37 #define TIZEN_ERROR_INVALID_PARAMETER -EINVAL /**< Invalid function parameter */
38 #endif
39
40 #ifndef TIZEN_ERROR_RESULT_OUT_OF_RANGE
41 #define TIZEN_ERROR_RESULT_OUT_OF_RANGE -ERANGE /**< Math result not representable */
42 #endif
43
44 #ifndef TIZEN_ERROR_OUT_OF_MEMORY
45 #define TIZEN_ERROR_OUT_OF_MEMORY -ENOMEM /**< Out of memory */
46 #endif
47
48 #ifndef TIZEN_ERROR_IO_ERROR
49 #define TIZEN_ERROR_IO_ERROR -EIO /**< I/O error */
50 #endif
51
52 #ifndef TIZEN_ERROR_NO_DATA
53 #define TIZEN_ERROR_NO_DATA -ENODATA /**< No data available */
54 #endif
55
56 #ifndef TIZEN_ERROR_MIN_PLATFORM_ERROR
57 #define TIZEN_ERROR_MIN_PLATFORM_ERROR (-1073741824LL)  /* = -2147483648 / 2 */
58 #endif
59
60 #ifndef TIZEN_ERROR_NOT_SUPPORTED
61 #define TIZEN_ERROR_NOT_SUPPORTED TIZEN_ERROR_MIN_PLATFORM_ERROR + 2 /**< Not supported */
62 #endif
63
64 #ifndef TIZEN_ERROR_PERMISSION_DENIED
65 #define TIZEN_ERROR_PERMISSION_DENIED -EACCES /**< Permission denied */
66 #endif
67
68 #ifndef TIZEN_ERROR_ZIGBEE
69 #define TIZEN_ERROR_ZIGBEE -0x02F70000
70 #endif
71
72 /* Enumeration for zigbee library error code. */
73 typedef enum {
74         ZBLIB_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
75         ZBLIB_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< parameter error */
76         ZBLIB_ERROR_PARAMETER_OUT_OF_RANGE = TIZEN_ERROR_RESULT_OUT_OF_RANGE, /**< out of range error */
77         ZBLIB_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< out of memory */
78         ZBLIB_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< DBus error */
79         ZBLIB_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data available */
80         ZBLIB_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< not supported */
81         ZBLIB_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
82         ZBLIB_ERROR_INVALID_ENDPOINT = TIZEN_ERROR_ZIGBEE | 0x01, /**< endpoint 0 is reserved for ZDP */
83         ZBLIB_ERROR_INVALID_ADDRESS = TIZEN_ERROR_ZIGBEE | 0x01, /**< wrong address */
84         ZIGBEE_ERROR_OPERATION_FAILED = TIZEN_ERROR_ZIGBEE | 0x03, /**< Invalid data available */
85 } zblib_error_e;
86
87 #ifdef __cplusplus
88 }
89 #endif
90
91 #endif /* __ZIGBEE_LIB_TYPES_H__ */