2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef _SENSOR_HAL_TYPES_H_
19 #define _SENSOR_HAL_TYPES_H_
24 #define SENSOR_HAL_VERSION(maj, min) \
25 ((((maj) & 0xFFFF) << 24) | ((min) & 0xFFFF))
30 #endif /* __cplusplus */
34 * These types are used to controll the sensors
37 * acceleration values : meter per second^2 (m/s^2)
38 * magnetic values : micro-Tesla (uT)
39 * orientation values : degrees
40 * gyroscope values : degree/s
41 * temperature values : degrees centigrade
42 * proximity valeus : distance
44 * pressure values : hectopascal (hPa)
45 * humidity : relative humidity (%)
48 SENSOR_DEVICE_UNKNOWN = -2,
49 SENSOR_DEVICE_ALL = -1,
50 SENSOR_DEVICE_ACCELEROMETER,
51 SENSOR_DEVICE_GRAVITY,
52 SENSOR_DEVICE_LINEAR_ACCELERATION,
53 SENSOR_DEVICE_GEOMAGNETIC,
54 SENSOR_DEVICE_ROTATION_VECTOR,
55 SENSOR_DEVICE_ORIENTATION,
56 SENSOR_DEVICE_GYROSCOPE,
58 SENSOR_DEVICE_PROXIMITY,
59 SENSOR_DEVICE_PRESSURE,
60 SENSOR_DEVICE_ULTRAVIOLET,
61 SENSOR_DEVICE_TEMPERATURE,
62 SENSOR_DEVICE_HUMIDITY,
64 SENSOR_DEVICE_HRM_LED_GREEN,
65 SENSOR_DEVICE_HRM_LED_IR,
66 SENSOR_DEVICE_HRM_LED_RED,
67 SENSOR_DEVICE_GYROSCOPE_UNCAL,
68 SENSOR_DEVICE_GEOMAGNETIC_UNCAL,
69 SENSOR_DEVICE_GYROSCOPE_RV,
70 SENSOR_DEVICE_GEOMAGNETIC_RV,
72 SENSOR_DEVICE_HUMAN_PEDOMETER = 0x300,
73 SENSOR_DEVICE_HUMAN_SLEEP_MONITOR,
75 SENSOR_DEVICE_FUSION = 0x900,
76 SENSOR_DEVICE_AUTO_ROTATION,
77 SENSOR_DEVICE_AUTO_BRIGHTNESS,
79 SENSOR_DEVICE_CONTEXT = 0x1000,
82 SENSOR_DEVICE_PIR_LONG,
84 SENSOR_DEVICE_THERMOMETER,
85 SENSOR_DEVICE_PEDOMETER,
87 SENSOR_DEVICE_HRM_RAW,
89 SENSOR_DEVICE_ROTATION_VECTOR_RAW,
90 SENSOR_DEVICE_EXERCISE,
92 SENSOR_DEVICE_SIMSENSE,
95 SENSOR_DEVICE_GESTURE_MOVEMENT = 0x1200,
96 SENSOR_DEVICE_GESTURE_WRIST_UP,
97 SENSOR_DEVICE_GESTURE_WRIST_DOWN,
98 SENSOR_DEVICE_GESTURE_MOVEMENT_STATE,
100 SENSOR_DEVICE_WEAR_STATUS = 0x1A00,
101 SENSOR_DEVICE_WEAR_ON_MONITOR,
102 SENSOR_DEVICE_GPS_BATCH,
103 SENSOR_DEVICE_ACTIVITY_TRACKER,
104 SENSOR_DEVICE_SLEEP_DETECTOR,
105 SENSOR_DEVICE_NO_MOVE_DETECTOR = 0x1A80,
106 SENSOR_DEVICE_HRM_CTRL,
107 SENSOR_DEVICE_EXERCISE_COACH,
108 SENSOR_DEVICE_EXERCISE_HR,
109 SENSOR_DEVICE_RESTING_HR,
110 SENSOR_DEVICE_STEP_LEVEL_MONITOR,
111 SENSOR_DEVICE_ACTIVITY_LEVEL_MONITOR,
112 SENSOR_DEVICE_CYCLE_MONITOR,
113 SENSOR_DEVICE_STRESS_MONITOR,
114 SENSOR_DEVICE_AUTOSESSION_EXERCISE,
115 SENSOR_DEVICE_STAIR_TRACKER,
116 } sensor_device_type;
119 * A platform sensor handler is generated based on this handle
120 * This id can be assigned from HAL developer. so it has to be unique in 1 sensor_device.
122 typedef struct sensor_info_t {
125 sensor_device_type type;
126 unsigned int event_type; // for Internal API
127 const char *model_name;
134 bool wakeup_supported;
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
145 #define SENSOR_DATA_VALUE_SIZE 16
148 typedef struct sensor_data_t {
150 unsigned long long timestamp;
152 float values[SENSOR_DATA_VALUE_SIZE];
155 #define SENSORHUB_DATA_VALUE_SIZE 4096
157 /* sensorhub_data_t */
158 typedef struct sensorhub_data_t {
160 unsigned long long timestamp;
163 * Use "value_count" instead of "hub_data_size"
164 * which is going to be removed soon
168 int hub_data_size; /* deprecated */
172 * Use "values" instead of "hub_data"
173 * which is going to be removed soon
176 char values[SENSORHUB_DATA_VALUE_SIZE];
177 char hub_data[SENSORHUB_DATA_VALUE_SIZE]; /* deprecated */
181 #define SENSOR_PEDOMETER_DATA_DIFFS_SIZE 20
185 unsigned long long timestamp;
186 int value_count; /* value_count == 8 */
187 float values[SENSOR_DATA_VALUE_SIZE];
188 /* values = {step count, walk step count, run step count,
189 moving distance, calorie burned, last speed,
190 last stepping frequency (steps per sec),
191 last step status (walking, running, ...)} */
192 /* Additional data attributes (not in sensor_data_t)*/
206 } diffs[SENSOR_PEDOMETER_DATA_DIFFS_SIZE];
207 } sensor_pedometer_data_t;
209 enum sensor_attribute {
210 SENSOR_ATTR_ACTIVITY = 0x100,
213 enum sensor_activity {
214 SENSOR_ACTIVITY_UNKNOWN = 1,
215 SENSOR_ACTIVITY_STILL = 2,
216 SENSOR_ACTIVITY_WALKING = 4,
217 SENSOR_ACTIVITY_RUNNING = 8,
218 SENSOR_ACTIVITY_IN_VEHICLE = 16,
219 SENSOR_ACTIVITY_ON_BICYCLE = 32,
224 #endif /* __cplusplus */
226 #endif /* _SENSOR_HAL_TYPES_H_ */