4 * Copyright (c) 2016 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_TYPES_H__
21 #define __SENSOR_TYPES_H__
23 /* TODO: It is for compatibility with capi-system-sensor */
24 #define __SENSOR_COMMON_H__
28 #include <sensor_hal_types.h>
51 #define SENSOR_TYPE_SHIFT 32
52 #define SENSOR_EVENT_SHIFT 16
53 #define SENSOR_INDEX_MASK 0xFFFFFFFF
55 #define CONVERT_ID_TYPE(id) ((id) >> SENSOR_TYPE_SHIFT)
56 #define CONVERT_TYPE_EVENT(type) ((type) << SENSOR_EVENT_SHIFT | 0x1)
58 #define MICROSECONDS(tv) ((tv.tv_sec * 1000000ll) + tv.tv_usec)
60 #define SENSOR_UNKNOWN_TYPE "http://tizen.org/sensor/unknown"
61 #define SENSOR_UNKNOWN_NAME "Unknown"
63 typedef int64_t sensor_id_t;
64 typedef void *sensor_t;
66 typedef enum sensor_type_t {
69 ACCELEROMETER_SENSOR = 0,
73 ROTATION_VECTOR_SENSOR,
83 BIO_HRM_SENSOR = HRM_SENSOR,
85 BIO_LED_GREEN_SENSOR = HRM_LED_GREEN_SENSOR,
87 BIO_LED_IR_SENSOR = HRM_LED_IR_SENSOR,
89 BIO_LED_RED_SENSOR = HRM_LED_RED_SENSOR,
90 GYROSCOPE_UNCAL_SENSOR,
91 GEOMAGNETIC_UNCAL_SENSOR,
93 GEOMAGNETIC_RV_SENSOR,
95 HUMAN_PEDOMETER_SENSOR = 0x300,
96 HUMAN_SLEEP_MONITOR_SENSOR,
97 HUMAN_SLEEP_DETECTOR_SENSOR,
98 SLEEP_DETECTOR_SENSOR = HUMAN_SLEEP_DETECTOR_SENSOR,
99 HUMAN_STRESS_MONITOR_SENSOR,
100 STRESS_MONITOR_SENSOR = HUMAN_STRESS_MONITOR_SENSOR,
102 EXERCISE_WALKING_SENSOR = 0x400,
103 EXERCISE_RUNNING_SENSOR,
104 EXERCISE_HIKING_SENSOR,
105 EXERCISE_CYCLING_SENSOR,
106 EXERCISE_ELLIPTICAL_SENSOR,
107 EXERCISE_INDOOR_CYCLING_SENSOR,
108 EXERCISE_ROWING_SENSOR,
109 EXERCISE_STEPPER_SENSOR,
111 EXTERNAL_EXERCISE_SENSOR = 0x800,
112 EXERCISE_SENSOR = EXTERNAL_EXERCISE_SENSOR,
114 FUSION_SENSOR = 0x900,
115 AUTO_ROTATION_SENSOR,
116 AUTO_BRIGHTNESS_SENSOR,
118 GESTURE_MOVEMENT_SENSOR = 0x1200,
119 GESTURE_WRIST_UP_SENSOR,
120 GESTURE_WRIST_DOWN_SENSOR,
121 GESTURE_MOVEMENT_STATE_SENSOR,
122 GESTURE_FACE_DOWN_SENSOR,
124 ACTIVITY_TRACKER_SENSOR = 0x1A00,
125 ACTIVITY_LEVEL_MONITOR_SENSOR,
128 HRM_CTRL_SENSOR = 0x1A80,
130 WEAR_STATUS_SENSOR = 0x2000,
131 WEAR_ON_MONITOR_SENSOR,
132 NO_MOVE_DETECTOR_SENSOR,
134 STEP_LEVEL_MONITOR_SENSOR,
135 EXERCISE_STANDALONE_SENSOR,
136 EXERCISE_COACH_SENSOR = EXERCISE_STANDALONE_SENSOR,
139 AUTOSESSION_EXERCISE_SENSOR = WORKOUT_SENSOR,
140 CYCLE_MONITOR_SENSOR,
141 STAIR_TRACKER_SENSOR,
142 PRESSURE_INDICATOR_SENSOR,
143 PRESSURE_ALERT_SENSOR,
146 CONTEXT_SENSOR = 0x7000,
155 BIO_SENSOR = HRM_RAW_SENSOR,
162 CUSTOM_SENSOR = 0X9000,
165 typedef struct sensor_info2_t {
175 bool wakeup_supported;
176 const char *privilege;
180 typedef enum sensor_privilege_t {
181 SENSOR_PRIVILEGE_PUBLIC = 0,
182 } sensor_privilege_t;
184 typedef struct sensor_event_t {
185 unsigned int event_type;
186 sensor_id_t sensor_id;
187 unsigned int data_length;
192 * To prevent naming confliction as using same enums as sensor CAPI use
195 enum sensor_option_t {
196 SENSOR_OPTION_DEFAULT = 0,
197 SENSOR_OPTION_ON_IN_SCREEN_OFF = 1,
198 SENSOR_OPTION_ON_IN_POWERSAVE_MODE = 2,
199 SENSOR_OPTION_ALWAYS_ON = SENSOR_OPTION_ON_IN_SCREEN_OFF | SENSOR_OPTION_ON_IN_POWERSAVE_MODE,
203 typedef enum sensor_option_t sensor_option_e;
206 enum sensord_attribute_e {
207 SENSORD_ATTRIBUTE_AXIS_ORIENTATION = 1,
208 SENSORD_ATTRIBUTE_PAUSE_POLICY,
209 SENSORD_ATTRIBUTE_INTERVAL = 0x10,
210 SENSORD_ATTRIBUTE_MAX_BATCH_LATENCY,
211 SENSORD_ATTRIBUTE_PASSIVE_MODE,
212 SENSORD_ATTRIBUTE_FLUSH,
215 enum sensord_axis_e {
216 SENSORD_AXIS_DEVICE_ORIENTED = 1,
217 SENSORD_AXIS_DISPLAY_ORIENTED,
220 enum sensord_pause_e {
221 SENSORD_PAUSE_NONE = 0,
222 SENSORD_PAUSE_ON_DISPLAY_OFF = 1,
223 SENSORD_PAUSE_ON_POWERSAVE_MODE = 2,
224 SENSORD_PAUSE_ALL = 3,
228 enum poll_interval_t {
236 POLL_MAX_HZ_MS = 255000,
239 #define DEFAULT_INTERVAL POLL_10HZ_MS
241 enum sensor_interval_t {
242 SENSOR_INTERVAL_FASTEST = POLL_100HZ_MS,
243 SENSOR_INTERVAL_NORMAL = POLL_5HZ_MS,
246 enum proxi_change_state {
247 PROXIMITY_STATE_NEAR = 0,
248 PROXIMITY_STATE_FAR = 1,
251 enum auto_rotation_state {
252 AUTO_ROTATION_DEGREE_UNKNOWN = 0,
253 AUTO_ROTATION_DEGREE_0,
254 AUTO_ROTATION_DEGREE_90,
255 AUTO_ROTATION_DEGREE_180,
256 AUTO_ROTATION_DEGREE_270,
263 #include <sensor_deprecated.h>
265 #endif /* __SENSOR_TYPES_H__ */