e34ec3f0e984e406d5ab34efc95996837e5e2c2c
[platform/hal/backend/tm1/sensor-tm1.git] / src / sensor_common.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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 _SENSOR_COMMON_H_
19 #define _SENSOR_COMMON_H_
20
21 #define SENSOR_EVENT_SHIFT 16
22 #define RAW_DATA_EVENT 0x0001
23
24 #define UNKNOWN_NAME "UNKNOWN"
25 #include <tizen.h>
26
27
28 enum sensorhub_enable_bit {
29         SENSORHUB_ACCELEROMETER_ENABLE_BIT = 0,
30         SENSORHUB_GYROSCOPE_ENABLE_BIT,
31         SENSORHUB_GEOMAGNETIC_UNCALIB_ENABLE_BIT,
32         SENSORHUB_GEOMAGNETIC_RAW_ENABLE_BIT,
33         SENSORHUB_GEOMAGNETIC_ENABLE_BIT,
34         SENSORHUB_PRESSURE_ENABLE_BIT,
35         SENSORHUB_GESTURE_ENABLE_BIT,
36         SENSORHUB_PROXIMITY_ENABLE_BIT,
37         SENSORHUB_TEMPERATURE_HUMIDITY_ENABLE_BIT,
38         SENSORHUB_LIGHT_ENABLE_BIT,
39         SENSORHUB_PROXIMITY_RAW_ENABLE_BIT,
40         SENSORHUB_ORIENTATION_ENABLE_BIT,
41         SENSORHUB_STEP_DETECTOR_ENABLE_BIT = 12,
42         SENSORHUB_SIG_MOTION_ENABLE_BIT,
43         SENSORHUB_GYRO_UNCALIB_ENABLE_BIT,
44         SENSORHUB_GAME_ROTATION_VECTOR_ENABLE_BIT = 15,
45         SENSORHUB_ROTATION_VECTOR_ENABLE_BIT,
46         SENSORHUB_STEP_COUNTER_ENABLE_BIT,
47         SENSORHUB_HRM_RAW_ENABLE_BIT,
48         SENSORHUB_HRM_RAW_FAC_ENABLE_BIT,
49         SENSORHUB_HRM_LIB_ENABLE_BIT,
50         SENSORHUB_TILT_MOTION,
51         SENSORHUB_UV_SENSOR,
52         SENSORHUB_PIR_ENABLE_BIT,
53         SENSORHUB_PIR_RAW_ENABLE_BIT,
54         SENSORHUB_GSR_ENABLE_BIT = 25,
55         SENSORHUB_ENABLE_BIT_MAX,
56 };
57
58
59 /**
60  * @brief   Enumeration for errors.
61  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
62  */
63 typedef enum {
64         SENSOR_ERROR_NONE                  = TIZEN_ERROR_NONE,                 /**< Successful */
65         SENSOR_ERROR_IO_ERROR              = TIZEN_ERROR_IO_ERROR,             /**< I/O error */
66         SENSOR_ERROR_INVALID_PARAMETER     = TIZEN_ERROR_INVALID_PARAMETER,    /**< Invalid parameter */
67         SENSOR_ERROR_NOT_SUPPORTED         = TIZEN_ERROR_NOT_SUPPORTED,        /**< Not supported */
68         SENSOR_ERROR_PERMISSION_DENIED     = TIZEN_ERROR_PERMISSION_DENIED,    /**< Permission denied */
69         SENSOR_ERROR_OUT_OF_MEMORY         = TIZEN_ERROR_OUT_OF_MEMORY,        /**< Out of memory */
70         SENSOR_ERROR_NO_DATA               = TIZEN_ERROR_NO_DATA,              /**< No data available
71                                                                                 @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
72         SENSOR_ERROR_NOT_NEED_CALIBRATION  = TIZEN_ERROR_SENSOR | 0x03,        /**< Sensor doesn't need calibration */
73         SENSOR_ERROR_OPERATION_FAILED      = TIZEN_ERROR_SENSOR | 0x06,        /**< Operation failed */
74         SENSOR_ERROR_NOT_AVAILABLE         = TIZEN_ERROR_SENSOR | 0x07,        /**< The sensor is supported, but currently not available
75                                                                                 @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
76 } sensor_error_e;
77
78
79 #endif /* __SENSOR_COMMON_H__ */