4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #ifndef __SENSOR_COMMON_H__
21 #define __SENSOR_COMMON_H__
24 #define DEPRECATED __attribute__((deprecated))
33 * @defgroup SENSOR_FRAMEWORK SensorFW
34 * To support the unified API for the various sensors
38 * @defgroup SENSOR_FRAMEWORK_COMMON Sensor Framework Common API
39 * @ingroup SENSOR_FRAMEWORK
41 * These APIs are used to control the sensors.
65 ROTATION_VECTOR_SENSOR,
66 GEOMAGNETIC_RV_SENSOR,
79 UNCAL_GYROSCOPE_SENSOR,
80 UNCAL_GEOMAGNETIC_SENSOR
83 typedef unsigned int sensor_id_t;
85 typedef void *sensor_t;
88 SENSOR_PRIVILEGE_PUBLIC,
89 SENSOR_PRIVILEGE_INTERNAL,
93 #define SENSOR_DATA_VALUE_SIZE 16
96 * When modifying it, check copy_sensor_data()
98 typedef struct sensor_data_t {
100 * Use "accuracy" instead of "data_accuracy"
101 * which is going to be removed soon
105 int data_accuracy; //deprecated
109 unsigned long long timestamp;
110 unsigned long long time_stamp; //deprecated
114 * Use "value_count" instead of "values_num"
115 * which is going to be removed soon
119 int values_num; //deprecated
122 float values[SENSOR_DATA_VALUE_SIZE];
125 #define SENSOR_HUB_DATA_SIZE 4096
127 typedef struct sensorhub_data_t {
132 unsigned long long timestamp;
133 char hub_data[SENSOR_HUB_DATA_SIZE];
137 enum sensor_accuracy_t {
138 SENSOR_ACCURACY_UNDEFINED = -1,
139 SENSOR_ACCURACY_BAD = 0,
140 SENSOR_ACCURACY_NORMAL =1,
141 SENSOR_ACCURACY_GOOD = 2,
142 SENSOR_ACCURACY_VERYGOOD = 3
146 * To prevent naming confliction as using same enums as sensor CAPI use
149 enum sensor_option_t {
150 SENSOR_OPTION_DEFAULT = 0,
151 SENSOR_OPTION_ON_IN_SCREEN_OFF = 1,
152 SENSOR_OPTION_ON_IN_POWERSAVE_MODE = 2,
153 SENSOR_OPTION_ALWAYS_ON = SENSOR_OPTION_ON_IN_SCREEN_OFF | SENSOR_OPTION_ON_IN_POWERSAVE_MODE,
157 typedef enum sensor_option_t sensor_option_e;
160 enum sensor_interval_t {
161 SENSOR_INTERVAL_FASTEST = 0,
162 SENSOR_INTERVAL_NORMAL = 200,
169 CONDITION_GREAT_THAN,