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__
25 #include <sensor_hal_types.h>
26 #include <sensor_types.h>
31 #define CLIENT_ID_INVALID -1
32 #define SENSOR_ID_INVALID -1
34 #define SENSOR_TYPE_SHIFT 32
35 #define SENSOR_INDEX_MASK 0xFFFFFFFF
51 } __attribute__((packed));
55 typedef int64_t sensor_id_t;
57 typedef void *sensor_t;
60 * To prevent naming confliction as using same enums as sensor CAPI use
63 enum sensor_option_t {
64 SENSOR_OPTION_DEFAULT = 0,
65 SENSOR_OPTION_ON_IN_SCREEN_OFF = 1,
66 SENSOR_OPTION_ON_IN_POWERSAVE_MODE = 2,
67 SENSOR_OPTION_ALWAYS_ON = SENSOR_OPTION_ON_IN_SCREEN_OFF | SENSOR_OPTION_ON_IN_POWERSAVE_MODE,
71 typedef enum sensor_option_t sensor_option_e;
74 enum poll_interval_t {
82 POLL_MAX_HZ_MS = 255000,
85 enum sensor_interval_t {
86 SENSOR_INTERVAL_FASTEST = POLL_100HZ_MS,
87 SENSOR_INTERVAL_NORMAL = POLL_5HZ_MS,
98 SENSOR_STATE_UNKNOWN = -1,
99 SENSOR_STATE_STOPPED = 0,
100 SENSOR_STATE_STARTED = 1,
101 SENSOR_STATE_PAUSED = 2
105 SENSOR_PRIVILEGE_PUBLIC,
106 SENSOR_PRIVILEGE_INTERNAL,
107 } sensor_privilege_t;
109 enum sensor_permission_t {
110 SENSOR_PERMISSION_NONE = 0,
111 SENSOR_PERMISSION_STANDARD = (1 << 0),
112 SENSOR_PERMISSION_BIO = (1 << 1)
115 typedef struct sensor_event_t {
116 unsigned int event_type;
117 sensor_id_t sensor_id;
118 unsigned int data_length;
129 typedef std::vector<unsigned int> event_type_vector;
130 #endif /* __cplusplus */
132 #endif /* __SENSOR_COMMON_H__ */