sensord: remove "c" prefix about all classes
[platform/core/system/sensord.git] / src / shared / sensor_common.h
1 /*
2  * libsensord-share
3  *
4  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
20 #ifndef _SENSOR_COMMON_H_
21 #define _SENSOR_COMMON_H_
22
23 #ifndef DEPRECATED
24 #define DEPRECATED __attribute__((deprecated))
25 #endif
26
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31
32 /**
33  * @defgroup SENSOR_FRAMEWORK SensorFW
34  * To support the unified API for the various sensors
35  */
36
37 /**
38  * @defgroup SENSOR_FRAMEWORK_COMMON Sensor Framework Common API
39  * @ingroup SENSOR_FRAMEWORK
40  *
41  * These APIs are used to control the sensors.
42  * @{
43  */
44
45 typedef unsigned int sensor_id_t;
46
47 typedef void *sensor_t;
48
49 typedef enum {
50         SENSOR_PRIVILEGE_PUBLIC,
51         SENSOR_PRIVILEGE_INTERNAL,
52 } sensor_privilege_t;
53
54
55 #define SENSOR_DATA_VALUE_SIZE 16
56
57 /*
58  *      When modifying it, check copy_sensor_data()
59  */
60 typedef struct sensor_data_t {
61 /*
62  *      Use "accuracy" instead of "data_accuracy"
63  *      which is going to be removed soon
64  */
65         union {
66                 int accuracy;
67                 int data_accuracy; //deprecated
68         };
69
70         union {
71                 unsigned long long timestamp;
72                 unsigned long long time_stamp; //deprecated
73         };
74
75 /*
76  *      Use "value_count" instead of "values_num"
77  *      which is going to be removed soon
78  */
79         union {
80                 int value_count;
81                 int values_num; //deprecated
82         };
83
84         float values[SENSOR_DATA_VALUE_SIZE];
85 } sensor_data_t;
86
87 #define SENSOR_HUB_DATA_SIZE    4096
88
89 typedef struct sensorhub_data_t {
90     int version;
91     int sensorhub;
92     int type;
93     int hub_data_size;
94     unsigned long long timestamp;
95     char hub_data[SENSOR_HUB_DATA_SIZE];
96     float data[16];
97 } sensorhub_data_t;
98
99 enum sensor_accuracy_t {
100         SENSOR_ACCURACY_UNDEFINED = -1,
101         SENSOR_ACCURACY_BAD = 0,
102         SENSOR_ACCURACY_NORMAL =1,
103         SENSOR_ACCURACY_GOOD = 2,
104         SENSOR_ACCURACY_VERYGOOD = 3
105 };
106
107 /*
108  *      To prevent naming confliction as using same enums as sensor CAPI use
109  */
110 #ifndef __SENSOR_H__
111 enum sensor_option_t {
112         SENSOR_OPTION_DEFAULT = 0,
113         SENSOR_OPTION_ON_IN_SCREEN_OFF = 1,
114         SENSOR_OPTION_ON_IN_POWERSAVE_MODE = 2,
115         SENSOR_OPTION_ALWAYS_ON = SENSOR_OPTION_ON_IN_SCREEN_OFF | SENSOR_OPTION_ON_IN_POWERSAVE_MODE,
116         SENSOR_OPTION_END
117 };
118
119 typedef enum sensor_option_t sensor_option_e;
120 #endif
121
122 /*
123  *      To prevent naming confliction as using same enums as sensor CAPI use
124  */
125 #ifndef __SENSOR_H__
126 enum sensor_wakeup_t {
127         SENSOR_WAKEUP_UNKNOWN = -1,
128         SENSOR_WAKEUP_OFF = 0,
129         SENSOR_WAKEUP_ON = 1,
130 };
131
132 typedef enum sensor_wakeup_t sensor_wakeup_e;
133 #endif
134
135 enum sensor_interval_t {
136         SENSOR_INTERVAL_FASTEST = 0,
137         SENSOR_INTERVAL_NORMAL = 200,
138 };
139
140
141 typedef enum {
142         CONDITION_NO_OP,
143         CONDITION_EQUAL,
144         CONDITION_GREAT_THAN,
145         CONDITION_LESS_THAN,
146 } condition_op_t;
147
148 #ifdef __cplusplus
149 }
150 #endif
151
152
153 #endif /* _SENSOR_COMMON_H_ */