Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 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 |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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. |
| 15 | */ |
| 16 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 17 | /** |
Leon Scroggins III | 4883c52 | 2020-01-30 15:10:11 -0500 | [diff] [blame] | 18 | * Structures and functions to receive and process sensor events in |
| 19 | * native code. |
| 20 | * |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 21 | * @addtogroup Sensor |
| 22 | * @{ |
| 23 | */ |
| 24 | |
| 25 | /** |
| 26 | * @file sensor.h |
| 27 | */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 28 | |
| 29 | #ifndef ANDROID_SENSOR_H |
| 30 | #define ANDROID_SENSOR_H |
| 31 | |
| 32 | /****************************************************************** |
| 33 | * |
| 34 | * IMPORTANT NOTICE: |
| 35 | * |
| 36 | * This file is part of Android's set of stable system headers |
| 37 | * exposed by the Android NDK (Native Development Kit). |
| 38 | * |
| 39 | * Third-party source AND binary code relies on the definitions |
| 40 | * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES. |
| 41 | * |
| 42 | * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES) |
| 43 | * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS |
| 44 | * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY |
| 45 | * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES |
| 46 | */ |
| 47 | |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 48 | #include <android/looper.h> |
| 49 | |
Dan Albert | 8f860fd | 2017-04-25 12:24:28 -0700 | [diff] [blame] | 50 | #include <stdbool.h> |
Peng Xu | da8385c | 2017-02-28 20:19:47 -0800 | [diff] [blame] | 51 | #include <sys/types.h> |
| 52 | #include <math.h> |
| 53 | #include <stdint.h> |
| 54 | |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 55 | #ifdef __cplusplus |
| 56 | extern "C" { |
| 57 | #endif |
| 58 | |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 59 | typedef struct AHardwareBuffer AHardwareBuffer; |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 60 | |
Peng Xu | da8385c | 2017-02-28 20:19:47 -0800 | [diff] [blame] | 61 | #define ASENSOR_RESOLUTION_INVALID (nanf("")) |
| 62 | #define ASENSOR_FIFO_COUNT_INVALID (-1) |
| 63 | #define ASENSOR_DELAY_INVALID INT32_MIN |
Brian Stack | 8228fa7 | 2019-01-04 14:15:13 -0800 | [diff] [blame] | 64 | #define ASENSOR_INVALID (-1) |
Peng Xu | da8385c | 2017-02-28 20:19:47 -0800 | [diff] [blame] | 65 | |
Elliott Hughes | f78be36 | 2018-01-23 15:33:56 -0800 | [diff] [blame] | 66 | /* (Keep in sync with hardware/sensors-base.h and Sensor.java.) */ |
| 67 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 68 | /** |
| 69 | * Sensor types. |
Elliott Hughes | f78be36 | 2018-01-23 15:33:56 -0800 | [diff] [blame] | 70 | * |
| 71 | * See |
| 72 | * [android.hardware.SensorEvent#values](https://developer.android.com/reference/android/hardware/SensorEvent.html#values) |
| 73 | * for detailed explanations of the data returned for each of these types. |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 74 | */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 75 | enum { |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 76 | /** |
Peng Xu | 37317b6 | 2017-03-07 17:49:31 -0800 | [diff] [blame] | 77 | * Invalid sensor type. Returned by {@link ASensor_getType} as error value. |
| 78 | */ |
| 79 | ASENSOR_TYPE_INVALID = -1, |
| 80 | /** |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 81 | * {@link ASENSOR_TYPE_ACCELEROMETER} |
| 82 | * reporting-mode: continuous |
| 83 | * |
| 84 | * All values are in SI units (m/s^2) and measure the acceleration of the |
| 85 | * device minus the force of gravity. |
| 86 | */ |
Johan Euphrosine | 7d319fc | 2015-08-20 18:13:43 -0700 | [diff] [blame] | 87 | ASENSOR_TYPE_ACCELEROMETER = 1, |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 88 | /** |
| 89 | * {@link ASENSOR_TYPE_MAGNETIC_FIELD} |
| 90 | * reporting-mode: continuous |
| 91 | * |
| 92 | * All values are in micro-Tesla (uT) and measure the geomagnetic |
| 93 | * field in the X, Y and Z axis. |
| 94 | */ |
Johan Euphrosine | 7d319fc | 2015-08-20 18:13:43 -0700 | [diff] [blame] | 95 | ASENSOR_TYPE_MAGNETIC_FIELD = 2, |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 96 | /** |
| 97 | * {@link ASENSOR_TYPE_GYROSCOPE} |
| 98 | * reporting-mode: continuous |
| 99 | * |
| 100 | * All values are in radians/second and measure the rate of rotation |
| 101 | * around the X, Y and Z axis. |
| 102 | */ |
Johan Euphrosine | 7d319fc | 2015-08-20 18:13:43 -0700 | [diff] [blame] | 103 | ASENSOR_TYPE_GYROSCOPE = 4, |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 104 | /** |
| 105 | * {@link ASENSOR_TYPE_LIGHT} |
| 106 | * reporting-mode: on-change |
| 107 | * |
| 108 | * The light sensor value is returned in SI lux units. |
| 109 | */ |
Johan Euphrosine | 7d319fc | 2015-08-20 18:13:43 -0700 | [diff] [blame] | 110 | ASENSOR_TYPE_LIGHT = 5, |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 111 | /** |
Elliott Hughes | f78be36 | 2018-01-23 15:33:56 -0800 | [diff] [blame] | 112 | * {@link ASENSOR_TYPE_PRESSURE} |
| 113 | * |
| 114 | * The pressure sensor value is returned in hPa (millibar). |
| 115 | */ |
| 116 | ASENSOR_TYPE_PRESSURE = 6, |
| 117 | /** |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 118 | * {@link ASENSOR_TYPE_PROXIMITY} |
| 119 | * reporting-mode: on-change |
| 120 | * |
| 121 | * The proximity sensor which turns the screen off and back on during calls is the |
| 122 | * wake-up proximity sensor. Implement wake-up proximity sensor before implementing |
| 123 | * a non wake-up proximity sensor. For the wake-up proximity sensor set the flag |
| 124 | * SENSOR_FLAG_WAKE_UP. |
| 125 | * The value corresponds to the distance to the nearest object in centimeters. |
| 126 | */ |
Johan Euphrosine | 7d319fc | 2015-08-20 18:13:43 -0700 | [diff] [blame] | 127 | ASENSOR_TYPE_PROXIMITY = 8, |
| 128 | /** |
Elliott Hughes | f78be36 | 2018-01-23 15:33:56 -0800 | [diff] [blame] | 129 | * {@link ASENSOR_TYPE_GRAVITY} |
| 130 | * |
| 131 | * All values are in SI units (m/s^2) and measure the direction and |
| 132 | * magnitude of gravity. When the device is at rest, the output of |
| 133 | * the gravity sensor should be identical to that of the accelerometer. |
| 134 | */ |
| 135 | ASENSOR_TYPE_GRAVITY = 9, |
| 136 | /** |
Johan Euphrosine | 7d319fc | 2015-08-20 18:13:43 -0700 | [diff] [blame] | 137 | * {@link ASENSOR_TYPE_LINEAR_ACCELERATION} |
| 138 | * reporting-mode: continuous |
| 139 | * |
| 140 | * All values are in SI units (m/s^2) and measure the acceleration of the |
| 141 | * device not including the force of gravity. |
| 142 | */ |
Elliott Hughes | f78be36 | 2018-01-23 15:33:56 -0800 | [diff] [blame] | 143 | ASENSOR_TYPE_LINEAR_ACCELERATION = 10, |
| 144 | /** |
| 145 | * {@link ASENSOR_TYPE_ROTATION_VECTOR} |
| 146 | */ |
| 147 | ASENSOR_TYPE_ROTATION_VECTOR = 11, |
| 148 | /** |
| 149 | * {@link ASENSOR_TYPE_RELATIVE_HUMIDITY} |
| 150 | * |
| 151 | * The relative humidity sensor value is returned in percent. |
| 152 | */ |
| 153 | ASENSOR_TYPE_RELATIVE_HUMIDITY = 12, |
| 154 | /** |
| 155 | * {@link ASENSOR_TYPE_AMBIENT_TEMPERATURE} |
| 156 | * |
| 157 | * The ambient temperature sensor value is returned in Celcius. |
| 158 | */ |
| 159 | ASENSOR_TYPE_AMBIENT_TEMPERATURE = 13, |
| 160 | /** |
| 161 | * {@link ASENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED} |
| 162 | */ |
| 163 | ASENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 14, |
| 164 | /** |
| 165 | * {@link ASENSOR_TYPE_GAME_ROTATION_VECTOR} |
| 166 | */ |
| 167 | ASENSOR_TYPE_GAME_ROTATION_VECTOR = 15, |
| 168 | /** |
| 169 | * {@link ASENSOR_TYPE_GYROSCOPE_UNCALIBRATED} |
| 170 | */ |
| 171 | ASENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 16, |
| 172 | /** |
| 173 | * {@link ASENSOR_TYPE_SIGNIFICANT_MOTION} |
| 174 | */ |
| 175 | ASENSOR_TYPE_SIGNIFICANT_MOTION = 17, |
| 176 | /** |
| 177 | * {@link ASENSOR_TYPE_STEP_DETECTOR} |
| 178 | */ |
| 179 | ASENSOR_TYPE_STEP_DETECTOR = 18, |
| 180 | /** |
| 181 | * {@link ASENSOR_TYPE_STEP_COUNTER} |
| 182 | */ |
| 183 | ASENSOR_TYPE_STEP_COUNTER = 19, |
| 184 | /** |
| 185 | * {@link ASENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR} |
| 186 | */ |
| 187 | ASENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 20, |
| 188 | /** |
| 189 | * {@link ASENSOR_TYPE_HEART_RATE} |
| 190 | */ |
| 191 | ASENSOR_TYPE_HEART_RATE = 21, |
| 192 | /** |
| 193 | * {@link ASENSOR_TYPE_POSE_6DOF} |
| 194 | */ |
| 195 | ASENSOR_TYPE_POSE_6DOF = 28, |
| 196 | /** |
| 197 | * {@link ASENSOR_TYPE_STATIONARY_DETECT} |
| 198 | */ |
| 199 | ASENSOR_TYPE_STATIONARY_DETECT = 29, |
| 200 | /** |
| 201 | * {@link ASENSOR_TYPE_MOTION_DETECT} |
| 202 | */ |
| 203 | ASENSOR_TYPE_MOTION_DETECT = 30, |
| 204 | /** |
| 205 | * {@link ASENSOR_TYPE_HEART_BEAT} |
| 206 | */ |
| 207 | ASENSOR_TYPE_HEART_BEAT = 31, |
| 208 | /** |
Brian Stack | ccd8843 | 2019-01-08 17:04:18 -0800 | [diff] [blame] | 209 | * This sensor type is for delivering additional sensor information aside |
| 210 | * from sensor event data. |
| 211 | * |
| 212 | * Additional information may include: |
| 213 | * - {@link ASENSOR_ADDITIONAL_INFO_INTERNAL_TEMPERATURE} |
| 214 | * - {@link ASENSOR_ADDITIONAL_INFO_SAMPLING} |
| 215 | * - {@link ASENSOR_ADDITIONAL_INFO_SENSOR_PLACEMENT} |
| 216 | * - {@link ASENSOR_ADDITIONAL_INFO_UNTRACKED_DELAY} |
| 217 | * - {@link ASENSOR_ADDITIONAL_INFO_VEC3_CALIBRATION} |
| 218 | * |
| 219 | * This type will never bind to a sensor. In other words, no sensor in the |
| 220 | * sensor list can have the type {@link ASENSOR_TYPE_ADDITIONAL_INFO}. |
| 221 | * |
| 222 | * If a device supports the sensor additional information feature, it will |
| 223 | * report additional information events via {@link ASensorEvent} and will |
| 224 | * have {@link ASensorEvent#type} set to |
| 225 | * {@link ASENSOR_TYPE_ADDITIONAL_INFO} and {@link ASensorEvent#sensor} set |
| 226 | * to the handle of the reporting sensor. |
| 227 | * |
| 228 | * Additional information reports consist of multiple frames ordered by |
| 229 | * {@link ASensorEvent#timestamp}. The first frame in the report will have |
| 230 | * a {@link AAdditionalInfoEvent#type} of |
| 231 | * {@link ASENSOR_ADDITIONAL_INFO_BEGIN}, and the last frame in the report |
| 232 | * will have a {@link AAdditionalInfoEvent#type} of |
| 233 | * {@link ASENSOR_ADDITIONAL_INFO_END}. |
| 234 | * |
| 235 | */ |
| 236 | ASENSOR_TYPE_ADDITIONAL_INFO = 33, |
| 237 | /** |
Elliott Hughes | f78be36 | 2018-01-23 15:33:56 -0800 | [diff] [blame] | 238 | * {@link ASENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT} |
| 239 | */ |
| 240 | ASENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT = 34, |
| 241 | /** |
| 242 | * {@link ASENSOR_TYPE_ACCELEROMETER_UNCALIBRATED} |
| 243 | */ |
| 244 | ASENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 35, |
Anthony Stange | fdb1fc8 | 2020-01-16 15:02:48 -0500 | [diff] [blame] | 245 | /** |
| 246 | * {@link ASENSOR_TYPE_HINGE_ANGLE} |
Anthony Stange | d7a703c | 2020-02-18 12:02:22 -0500 | [diff] [blame] | 247 | * reporting-mode: on-change |
| 248 | * |
| 249 | * The hinge angle sensor value is returned in degrees. |
Anthony Stange | fdb1fc8 | 2020-01-16 15:02:48 -0500 | [diff] [blame] | 250 | */ |
| 251 | ASENSOR_TYPE_HINGE_ANGLE = 36, |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 252 | }; |
| 253 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 254 | /** |
| 255 | * Sensor accuracy measure. |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 256 | */ |
| 257 | enum { |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 258 | /** no contact */ |
Etienne Le Grand | 630e31d | 2014-05-22 17:15:08 -0700 | [diff] [blame] | 259 | ASENSOR_STATUS_NO_CONTACT = -1, |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 260 | /** unreliable */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 261 | ASENSOR_STATUS_UNRELIABLE = 0, |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 262 | /** low accuracy */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 263 | ASENSOR_STATUS_ACCURACY_LOW = 1, |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 264 | /** medium accuracy */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 265 | ASENSOR_STATUS_ACCURACY_MEDIUM = 2, |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 266 | /** high accuracy */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 267 | ASENSOR_STATUS_ACCURACY_HIGH = 3 |
| 268 | }; |
| 269 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 270 | /** |
Aravind Akella | 0e025c5 | 2014-06-03 19:19:57 -0700 | [diff] [blame] | 271 | * Sensor Reporting Modes. |
| 272 | */ |
| 273 | enum { |
Peng Xu | 37317b6 | 2017-03-07 17:49:31 -0800 | [diff] [blame] | 274 | /** invalid reporting mode */ |
| 275 | AREPORTING_MODE_INVALID = -1, |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 276 | /** continuous reporting */ |
Aravind Akella | 0e025c5 | 2014-06-03 19:19:57 -0700 | [diff] [blame] | 277 | AREPORTING_MODE_CONTINUOUS = 0, |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 278 | /** reporting on change */ |
Aravind Akella | 0e025c5 | 2014-06-03 19:19:57 -0700 | [diff] [blame] | 279 | AREPORTING_MODE_ON_CHANGE = 1, |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 280 | /** on shot reporting */ |
Aravind Akella | 0e025c5 | 2014-06-03 19:19:57 -0700 | [diff] [blame] | 281 | AREPORTING_MODE_ONE_SHOT = 2, |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 282 | /** special trigger reporting */ |
Peng Xu | 37317b6 | 2017-03-07 17:49:31 -0800 | [diff] [blame] | 283 | AREPORTING_MODE_SPECIAL_TRIGGER = 3 |
Aravind Akella | 0e025c5 | 2014-06-03 19:19:57 -0700 | [diff] [blame] | 284 | }; |
| 285 | |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 286 | /** |
| 287 | * Sensor Direct Report Rates. |
| 288 | */ |
| 289 | enum { |
| 290 | /** stopped */ |
| 291 | ASENSOR_DIRECT_RATE_STOP = 0, |
| 292 | /** nominal 50Hz */ |
| 293 | ASENSOR_DIRECT_RATE_NORMAL = 1, |
| 294 | /** nominal 200Hz */ |
| 295 | ASENSOR_DIRECT_RATE_FAST = 2, |
| 296 | /** nominal 800Hz */ |
| 297 | ASENSOR_DIRECT_RATE_VERY_FAST = 3 |
| 298 | }; |
| 299 | |
| 300 | /** |
| 301 | * Sensor Direct Channel Type. |
| 302 | */ |
| 303 | enum { |
| 304 | /** shared memory created by ASharedMemory_create */ |
| 305 | ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY = 1, |
| 306 | /** AHardwareBuffer */ |
| 307 | ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER = 2 |
| 308 | }; |
| 309 | |
Brian Stack | ccd8843 | 2019-01-08 17:04:18 -0800 | [diff] [blame] | 310 | /** |
| 311 | * Sensor Additional Info Types. |
| 312 | * |
| 313 | * Used to populate {@link AAdditionalInfoEvent#type}. |
| 314 | */ |
| 315 | enum { |
| 316 | /** Marks the beginning of additional information frames */ |
| 317 | ASENSOR_ADDITIONAL_INFO_BEGIN = 0, |
| 318 | |
| 319 | /** Marks the end of additional information frames */ |
| 320 | ASENSOR_ADDITIONAL_INFO_END = 1, |
| 321 | |
| 322 | /** |
| 323 | * Estimation of the delay that is not tracked by sensor timestamps. This |
| 324 | * includes delay introduced by sensor front-end filtering, data transport, |
| 325 | * etc. |
| 326 | * float[2]: delay in seconds, standard deviation of estimated value |
| 327 | */ |
| 328 | ASENSOR_ADDITIONAL_INFO_UNTRACKED_DELAY = 0x10000, |
| 329 | |
| 330 | /** float: Celsius temperature */ |
| 331 | ASENSOR_ADDITIONAL_INFO_INTERNAL_TEMPERATURE, |
| 332 | |
| 333 | /** |
| 334 | * First three rows of a homogeneous matrix, which represents calibration to |
| 335 | * a three-element vector raw sensor reading. |
| 336 | * float[12]: 3x4 matrix in row major order |
| 337 | */ |
| 338 | ASENSOR_ADDITIONAL_INFO_VEC3_CALIBRATION, |
| 339 | |
| 340 | /** |
| 341 | * Location and orientation of sensor element in the device frame: origin is |
| 342 | * the geometric center of the mobile device screen surface; the axis |
| 343 | * definition corresponds to Android sensor definitions. |
| 344 | * float[12]: 3x4 matrix in row major order |
| 345 | */ |
| 346 | ASENSOR_ADDITIONAL_INFO_SENSOR_PLACEMENT, |
| 347 | |
| 348 | /** |
| 349 | * float[2]: raw sample period in seconds, |
| 350 | * standard deviation of sampling period |
| 351 | */ |
| 352 | ASENSOR_ADDITIONAL_INFO_SAMPLING, |
| 353 | }; |
| 354 | |
Aravind Akella | 0e025c5 | 2014-06-03 19:19:57 -0700 | [diff] [blame] | 355 | /* |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 356 | * A few useful constants |
| 357 | */ |
| 358 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 359 | /** Earth's gravity in m/s^2 */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 360 | #define ASENSOR_STANDARD_GRAVITY (9.80665f) |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 361 | /** Maximum magnetic field on Earth's surface in uT */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 362 | #define ASENSOR_MAGNETIC_FIELD_EARTH_MAX (60.0f) |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 363 | /** Minimum magnetic field on Earth's surface in uT*/ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 364 | #define ASENSOR_MAGNETIC_FIELD_EARTH_MIN (30.0f) |
| 365 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 366 | /** |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 367 | * A sensor event. |
| 368 | */ |
| 369 | |
Peng Xu | 70b9838 | 2017-08-07 14:09:11 -0700 | [diff] [blame] | 370 | /* NOTE: changes to these structs have to be backward compatible */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 371 | typedef struct ASensorVector { |
| 372 | union { |
| 373 | float v[3]; |
| 374 | struct { |
| 375 | float x; |
| 376 | float y; |
| 377 | float z; |
| 378 | }; |
| 379 | struct { |
| 380 | float azimuth; |
| 381 | float pitch; |
| 382 | float roll; |
| 383 | }; |
| 384 | }; |
| 385 | int8_t status; |
| 386 | uint8_t reserved[3]; |
| 387 | } ASensorVector; |
| 388 | |
Aravind Akella | 724d91d | 2013-06-27 12:04:23 -0700 | [diff] [blame] | 389 | typedef struct AMetaDataEvent { |
| 390 | int32_t what; |
| 391 | int32_t sensor; |
| 392 | } AMetaDataEvent; |
| 393 | |
| 394 | typedef struct AUncalibratedEvent { |
Peng Xu | 9e72046 | 2016-01-26 18:48:54 -0800 | [diff] [blame] | 395 | union { |
| 396 | float uncalib[3]; |
| 397 | struct { |
| 398 | float x_uncalib; |
| 399 | float y_uncalib; |
| 400 | float z_uncalib; |
| 401 | }; |
Aravind Akella | 724d91d | 2013-06-27 12:04:23 -0700 | [diff] [blame] | 402 | }; |
Peng Xu | 9e72046 | 2016-01-26 18:48:54 -0800 | [diff] [blame] | 403 | union { |
| 404 | float bias[3]; |
| 405 | struct { |
| 406 | float x_bias; |
| 407 | float y_bias; |
| 408 | float z_bias; |
| 409 | }; |
Aravind Akella | 724d91d | 2013-06-27 12:04:23 -0700 | [diff] [blame] | 410 | }; |
Aravind Akella | 724d91d | 2013-06-27 12:04:23 -0700 | [diff] [blame] | 411 | } AUncalibratedEvent; |
| 412 | |
Etienne Le Grand | 630e31d | 2014-05-22 17:15:08 -0700 | [diff] [blame] | 413 | typedef struct AHeartRateEvent { |
Peng Xu | 9e72046 | 2016-01-26 18:48:54 -0800 | [diff] [blame] | 414 | float bpm; |
| 415 | int8_t status; |
Etienne Le Grand | 630e31d | 2014-05-22 17:15:08 -0700 | [diff] [blame] | 416 | } AHeartRateEvent; |
| 417 | |
Peng Xu | 2576cb6 | 2016-01-20 00:22:09 -0800 | [diff] [blame] | 418 | typedef struct ADynamicSensorEvent { |
Peng Xu | 9e72046 | 2016-01-26 18:48:54 -0800 | [diff] [blame] | 419 | int32_t connected; |
| 420 | int32_t handle; |
Peng Xu | 2576cb6 | 2016-01-20 00:22:09 -0800 | [diff] [blame] | 421 | } ADynamicSensorEvent; |
| 422 | |
Brian Stack | ccd8843 | 2019-01-08 17:04:18 -0800 | [diff] [blame] | 423 | typedef struct AAdditionalInfoEvent { |
Peng Xu | 9e72046 | 2016-01-26 18:48:54 -0800 | [diff] [blame] | 424 | int32_t type; |
| 425 | int32_t serial; |
| 426 | union { |
| 427 | int32_t data_int32[14]; |
| 428 | float data_float[14]; |
| 429 | }; |
| 430 | } AAdditionalInfoEvent; |
| 431 | |
Peng Xu | 70b9838 | 2017-08-07 14:09:11 -0700 | [diff] [blame] | 432 | /* NOTE: changes to this struct has to be backward compatible */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 433 | typedef struct ASensorEvent { |
| 434 | int32_t version; /* sizeof(struct ASensorEvent) */ |
| 435 | int32_t sensor; |
| 436 | int32_t type; |
| 437 | int32_t reserved0; |
| 438 | int64_t timestamp; |
| 439 | union { |
Mathias Agopian | ba02cd2 | 2013-07-03 16:20:57 -0700 | [diff] [blame] | 440 | union { |
| 441 | float data[16]; |
| 442 | ASensorVector vector; |
| 443 | ASensorVector acceleration; |
| 444 | ASensorVector magnetic; |
| 445 | float temperature; |
| 446 | float distance; |
| 447 | float light; |
| 448 | float pressure; |
Aravind Akella | 724d91d | 2013-06-27 12:04:23 -0700 | [diff] [blame] | 449 | float relative_humidity; |
| 450 | AUncalibratedEvent uncalibrated_gyro; |
| 451 | AUncalibratedEvent uncalibrated_magnetic; |
| 452 | AMetaDataEvent meta_data; |
Etienne Le Grand | 630e31d | 2014-05-22 17:15:08 -0700 | [diff] [blame] | 453 | AHeartRateEvent heart_rate; |
Peng Xu | 2576cb6 | 2016-01-20 00:22:09 -0800 | [diff] [blame] | 454 | ADynamicSensorEvent dynamic_sensor_meta; |
Peng Xu | 9e72046 | 2016-01-26 18:48:54 -0800 | [diff] [blame] | 455 | AAdditionalInfoEvent additional_info; |
Mathias Agopian | ba02cd2 | 2013-07-03 16:20:57 -0700 | [diff] [blame] | 456 | }; |
| 457 | union { |
| 458 | uint64_t data[8]; |
| 459 | uint64_t step_counter; |
| 460 | } u64; |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 461 | }; |
Aravind Akella | 9a844cf | 2014-02-11 18:58:52 -0800 | [diff] [blame] | 462 | |
| 463 | uint32_t flags; |
| 464 | int32_t reserved1[3]; |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 465 | } ASensorEvent; |
| 466 | |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 467 | struct ASensorManager; |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 468 | /** |
| 469 | * {@link ASensorManager} is an opaque type to manage sensors and |
| 470 | * events queues. |
| 471 | * |
| 472 | * {@link ASensorManager} is a singleton that can be obtained using |
| 473 | * ASensorManager_getInstance(). |
| 474 | * |
| 475 | * This file provides a set of functions that uses {@link |
| 476 | * ASensorManager} to access and list hardware sensors, and |
| 477 | * create and destroy event queues: |
| 478 | * - ASensorManager_getSensorList() |
| 479 | * - ASensorManager_getDefaultSensor() |
| 480 | * - ASensorManager_getDefaultSensorEx() |
| 481 | * - ASensorManager_createEventQueue() |
| 482 | * - ASensorManager_destroyEventQueue() |
| 483 | */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 484 | typedef struct ASensorManager ASensorManager; |
| 485 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 486 | |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 487 | struct ASensorEventQueue; |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 488 | /** |
| 489 | * {@link ASensorEventQueue} is an opaque type that provides access to |
| 490 | * {@link ASensorEvent} from hardware sensors. |
| 491 | * |
| 492 | * A new {@link ASensorEventQueue} can be obtained using ASensorManager_createEventQueue(). |
| 493 | * |
| 494 | * This file provides a set of functions to enable and disable |
| 495 | * sensors, check and get events, and set event rates on a {@link |
| 496 | * ASensorEventQueue}. |
| 497 | * - ASensorEventQueue_enableSensor() |
| 498 | * - ASensorEventQueue_disableSensor() |
| 499 | * - ASensorEventQueue_hasEvents() |
| 500 | * - ASensorEventQueue_getEvents() |
| 501 | * - ASensorEventQueue_setEventRate() |
Brian Stack | 65089d5 | 2019-01-11 10:52:07 -0800 | [diff] [blame] | 502 | * - ASensorEventQueue_requestAdditionalInfoEvents() |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 503 | */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 504 | typedef struct ASensorEventQueue ASensorEventQueue; |
| 505 | |
| 506 | struct ASensor; |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 507 | /** |
| 508 | * {@link ASensor} is an opaque type that provides information about |
| 509 | * an hardware sensors. |
| 510 | * |
| 511 | * A {@link ASensor} pointer can be obtained using |
| 512 | * ASensorManager_getDefaultSensor(), |
| 513 | * ASensorManager_getDefaultSensorEx() or from a {@link ASensorList}. |
| 514 | * |
| 515 | * This file provides a set of functions to access properties of a |
| 516 | * {@link ASensor}: |
| 517 | * - ASensor_getName() |
| 518 | * - ASensor_getVendor() |
| 519 | * - ASensor_getType() |
| 520 | * - ASensor_getResolution() |
| 521 | * - ASensor_getMinDelay() |
| 522 | * - ASensor_getFifoMaxEventCount() |
| 523 | * - ASensor_getFifoReservedEventCount() |
| 524 | * - ASensor_getStringType() |
| 525 | * - ASensor_getReportingMode() |
| 526 | * - ASensor_isWakeUpSensor() |
Brian Stack | 8228fa7 | 2019-01-04 14:15:13 -0800 | [diff] [blame] | 527 | * - ASensor_getHandle() |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 528 | */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 529 | typedef struct ASensor ASensor; |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 530 | /** |
| 531 | * {@link ASensorRef} is a type for constant pointers to {@link ASensor}. |
| 532 | * |
| 533 | * This is used to define entry in {@link ASensorList} arrays. |
| 534 | */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 535 | typedef ASensor const* ASensorRef; |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 536 | /** |
| 537 | * {@link ASensorList} is an array of reference to {@link ASensor}. |
| 538 | * |
| 539 | * A {@link ASensorList} can be initialized using ASensorManager_getSensorList(). |
| 540 | */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 541 | typedef ASensorRef const* ASensorList; |
| 542 | |
| 543 | /*****************************************************************************/ |
| 544 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 545 | /** |
Svet Ganov | 5fa32d4 | 2015-05-07 10:50:59 -0700 | [diff] [blame] | 546 | * Get a reference to the sensor manager. ASensorManager is a singleton |
| 547 | * per package as different packages may have access to different sensors. |
| 548 | * |
| 549 | * Deprecated: Use ASensorManager_getInstanceForPackage(const char*) instead. |
| 550 | * |
| 551 | * Example: |
| 552 | * |
| 553 | * ASensorManager* sensorManager = ASensorManager_getInstance(); |
| 554 | * |
| 555 | */ |
Ryan Prichard | 92b1ebe | 2018-07-19 20:32:19 -0700 | [diff] [blame] | 556 | #if __ANDROID_API__ >= 26 |
Svet Ganov | 5fa32d4 | 2015-05-07 10:50:59 -0700 | [diff] [blame] | 557 | __attribute__ ((deprecated)) ASensorManager* ASensorManager_getInstance(); |
Peng Xu | 477db44 | 2017-07-17 16:40:50 -0700 | [diff] [blame] | 558 | #else |
| 559 | ASensorManager* ASensorManager_getInstance(); |
| 560 | #endif |
Svet Ganov | 5fa32d4 | 2015-05-07 10:50:59 -0700 | [diff] [blame] | 561 | |
Ryan Prichard | 92b1ebe | 2018-07-19 20:32:19 -0700 | [diff] [blame] | 562 | #if __ANDROID_API__ >= 26 |
Peng Xu | 80df016 | 2017-08-05 19:00:23 -0700 | [diff] [blame] | 563 | /** |
Svet Ganov | 5fa32d4 | 2015-05-07 10:50:59 -0700 | [diff] [blame] | 564 | * Get a reference to the sensor manager. ASensorManager is a singleton |
| 565 | * per package as different packages may have access to different sensors. |
| 566 | * |
| 567 | * Example: |
| 568 | * |
Peng Xu | 80df016 | 2017-08-05 19:00:23 -0700 | [diff] [blame] | 569 | * ASensorManager* sensorManager = ASensorManager_getInstanceForPackage("foo.bar.baz"); |
Svet Ganov | 5fa32d4 | 2015-05-07 10:50:59 -0700 | [diff] [blame] | 570 | * |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 571 | * Available since API level 26. |
Svet Ganov | 5fa32d4 | 2015-05-07 10:50:59 -0700 | [diff] [blame] | 572 | */ |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 573 | ASensorManager* ASensorManager_getInstanceForPackage(const char* packageName) __INTRODUCED_IN(26); |
Ryan Prichard | 92b1ebe | 2018-07-19 20:32:19 -0700 | [diff] [blame] | 574 | #endif |
Svet Ganov | 5fa32d4 | 2015-05-07 10:50:59 -0700 | [diff] [blame] | 575 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 576 | /** |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 577 | * Returns the list of available sensors. |
| 578 | */ |
| 579 | int ASensorManager_getSensorList(ASensorManager* manager, ASensorList* list); |
| 580 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 581 | /** |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 582 | * Returns the default sensor for the given type, or NULL if no sensor |
Aravind Akella | b37ba39 | 2014-08-05 14:53:07 -0700 | [diff] [blame] | 583 | * of that type exists. |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 584 | */ |
| 585 | ASensor const* ASensorManager_getDefaultSensor(ASensorManager* manager, int type); |
| 586 | |
Ryan Prichard | 92b1ebe | 2018-07-19 20:32:19 -0700 | [diff] [blame] | 587 | #if __ANDROID_API__ >= 21 |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 588 | /** |
Aravind Akella | b37ba39 | 2014-08-05 14:53:07 -0700 | [diff] [blame] | 589 | * Returns the default sensor with the given type and wakeUp properties or NULL if no sensor |
| 590 | * of this type and wakeUp properties exists. |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 591 | * |
| 592 | * Available since API level 21. |
Aravind Akella | b37ba39 | 2014-08-05 14:53:07 -0700 | [diff] [blame] | 593 | */ |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 594 | ASensor const* ASensorManager_getDefaultSensorEx(ASensorManager* manager, int type, bool wakeUp) __INTRODUCED_IN(21); |
Ryan Prichard | 92b1ebe | 2018-07-19 20:32:19 -0700 | [diff] [blame] | 595 | #endif |
Aravind Akella | b37ba39 | 2014-08-05 14:53:07 -0700 | [diff] [blame] | 596 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 597 | /** |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 598 | * Creates a new sensor event queue and associate it with a looper. |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 599 | * |
| 600 | * "ident" is a identifier for the events that will be returned when |
| 601 | * calling ALooper_pollOnce(). The identifier must be >= 0, or |
| 602 | * ALOOPER_POLL_CALLBACK if providing a non-NULL callback. |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 603 | */ |
| 604 | ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager, |
| 605 | ALooper* looper, int ident, ALooper_callbackFunc callback, void* data); |
| 606 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 607 | /** |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 608 | * Destroys the event queue and free all resources associated to it. |
| 609 | */ |
| 610 | int ASensorManager_destroyEventQueue(ASensorManager* manager, ASensorEventQueue* queue); |
| 611 | |
Ryan Prichard | 92b1ebe | 2018-07-19 20:32:19 -0700 | [diff] [blame] | 612 | #if __ANDROID_API__ >= 26 |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 613 | /** |
| 614 | * Create direct channel based on shared memory |
| 615 | * |
| 616 | * Create a direct channel of {@link ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY} to be used |
| 617 | * for configuring sensor direct report. |
| 618 | * |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 619 | * Available since API level 26. |
| 620 | * |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 621 | * \param manager the {@link ASensorManager} instance obtained from |
| 622 | * {@link ASensorManager_getInstanceForPackage}. |
| 623 | * \param fd file descriptor representing a shared memory created by |
| 624 | * {@link ASharedMemory_create} |
| 625 | * \param size size to be used, must be less or equal to size of shared memory. |
| 626 | * |
| 627 | * \return a positive integer as a channel id to be used in |
| 628 | * {@link ASensorManager_destroyDirectChannel} and |
| 629 | * {@link ASensorManager_configureDirectReport}, or value less or equal to 0 for failures. |
| 630 | */ |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 631 | int ASensorManager_createSharedMemoryDirectChannel(ASensorManager* manager, int fd, size_t size) __INTRODUCED_IN(26); |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 632 | |
| 633 | /** |
| 634 | * Create direct channel based on AHardwareBuffer |
| 635 | * |
| 636 | * Create a direct channel of {@link ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER} type to be used |
| 637 | * for configuring sensor direct report. |
| 638 | * |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 639 | * Available since API level 26. |
| 640 | * |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 641 | * \param manager the {@link ASensorManager} instance obtained from |
| 642 | * {@link ASensorManager_getInstanceForPackage}. |
| 643 | * \param buffer {@link AHardwareBuffer} instance created by {@link AHardwareBuffer_allocate}. |
| 644 | * \param size the intended size to be used, must be less or equal to size of buffer. |
| 645 | * |
| 646 | * \return a positive integer as a channel id to be used in |
| 647 | * {@link ASensorManager_destroyDirectChannel} and |
| 648 | * {@link ASensorManager_configureDirectReport}, or value less or equal to 0 for failures. |
| 649 | */ |
| 650 | int ASensorManager_createHardwareBufferDirectChannel( |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 651 | ASensorManager* manager, AHardwareBuffer const * buffer, size_t size) __INTRODUCED_IN(26); |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 652 | |
| 653 | /** |
| 654 | * Destroy a direct channel |
| 655 | * |
| 656 | * Destroy a direct channel previously created using {@link ASensorManager_createDirectChannel}. |
| 657 | * The buffer used for creating direct channel does not get destroyed with |
| 658 | * {@link ASensorManager_destroy} and has to be close or released separately. |
| 659 | * |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 660 | * Available since API level 26. |
| 661 | * |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 662 | * \param manager the {@link ASensorManager} instance obtained from |
| 663 | * {@link ASensorManager_getInstanceForPackage}. |
| 664 | * \param channelId channel id (a positive integer) returned from |
| 665 | * {@link ASensorManager_createSharedMemoryDirectChannel} or |
| 666 | * {@link ASensorManager_createHardwareBufferDirectChannel}. |
| 667 | */ |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 668 | void ASensorManager_destroyDirectChannel(ASensorManager* manager, int channelId) __INTRODUCED_IN(26); |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 669 | |
| 670 | /** |
| 671 | * Configure direct report on channel |
| 672 | * |
| 673 | * Configure sensor direct report on a direct channel: set rate to value other than |
| 674 | * {@link ASENSOR_DIRECT_RATE_STOP} so that sensor event can be directly |
Peng Xu | ec53d02 | 2017-04-06 18:02:29 -0700 | [diff] [blame] | 675 | * written into the shared memory region used for creating the buffer. It returns a positive token |
| 676 | * which can be used for identify sensor events from different sensors on success. Calling with rate |
| 677 | * {@link ASENSOR_DIRECT_RATE_STOP} will stop direct report of the sensor specified in the channel. |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 678 | * |
| 679 | * To stop all active sensor direct report configured to a channel, set sensor to NULL and rate to |
| 680 | * {@link ASENSOR_DIRECT_RATE_STOP}. |
| 681 | * |
| 682 | * In order to successfully configure a direct report, the sensor has to support the specified rate |
| 683 | * and the channel type, which can be checked by {@link ASensor_getHighestDirectReportRateLevel} and |
| 684 | * {@link ASensor_isDirectChannelTypeSupported}, respectively. |
| 685 | * |
| 686 | * Example: |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 687 | * |
Peng Xu | 80df016 | 2017-08-05 19:00:23 -0700 | [diff] [blame] | 688 | * ASensorManager *manager = ...; |
| 689 | * ASensor *sensor = ...; |
| 690 | * int channelId = ...; |
| 691 | * |
| 692 | * ASensorManager_configureDirectReport(manager, sensor, channel_id, ASENSOR_DIRECT_RATE_FAST); |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 693 | * |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 694 | * Available since API level 26. |
| 695 | * |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 696 | * \param manager the {@link ASensorManager} instance obtained from |
| 697 | * {@link ASensorManager_getInstanceForPackage}. |
| 698 | * \param sensor a {@link ASensor} to denote which sensor to be operate. It can be NULL if rate |
| 699 | * is {@link ASENSOR_DIRECT_RATE_STOP}, denoting stopping of all active sensor |
| 700 | * direct report. |
| 701 | * \param channelId channel id (a positive integer) returned from |
| 702 | * {@link ASensorManager_createSharedMemoryDirectChannel} or |
| 703 | * {@link ASensorManager_createHardwareBufferDirectChannel}. |
| 704 | * |
Peng Xu | ec53d02 | 2017-04-06 18:02:29 -0700 | [diff] [blame] | 705 | * \return positive token for success or negative error code. |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 706 | */ |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 707 | int ASensorManager_configureDirectReport(ASensorManager* manager, |
| 708 | ASensor const* sensor, int channelId, int rate) __INTRODUCED_IN(26); |
Ryan Prichard | 92b1ebe | 2018-07-19 20:32:19 -0700 | [diff] [blame] | 709 | #endif /* __ANDROID_API__ >= 26 */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 710 | |
| 711 | /*****************************************************************************/ |
| 712 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 713 | /** |
Peng Xu | 80df016 | 2017-08-05 19:00:23 -0700 | [diff] [blame] | 714 | * Enable the selected sensor with sampling and report parameters |
| 715 | * |
| 716 | * Enable the selected sensor at a specified sampling period and max batch report latency. |
| 717 | * To disable sensor, use {@link ASensorEventQueue_disableSensor}. |
| 718 | * |
| 719 | * \param queue {@link ASensorEventQueue} for sensor event to be report to. |
| 720 | * \param sensor {@link ASensor} to be enabled. |
| 721 | * \param samplingPeriodUs sampling period of sensor in microseconds. |
| 722 | * \param maxBatchReportLatencyus maximum time interval between two batch of sensor events are |
| 723 | * delievered in microseconds. For sensor streaming, set to 0. |
| 724 | * \return 0 on success or a negative error code on failure. |
Aniroop Mathur | da94fd8 | 2015-11-03 01:47:46 +0530 | [diff] [blame] | 725 | */ |
| 726 | int ASensorEventQueue_registerSensor(ASensorEventQueue* queue, ASensor const* sensor, |
Peng Xu | da8385c | 2017-02-28 20:19:47 -0800 | [diff] [blame] | 727 | int32_t samplingPeriodUs, int64_t maxBatchReportLatencyUs); |
Aniroop Mathur | da94fd8 | 2015-11-03 01:47:46 +0530 | [diff] [blame] | 728 | |
| 729 | /** |
Peng Xu | 80df016 | 2017-08-05 19:00:23 -0700 | [diff] [blame] | 730 | * Enable the selected sensor at default sampling rate. |
| 731 | * |
| 732 | * Start event reports of a sensor to specified sensor event queue at a default rate. |
| 733 | * |
| 734 | * \param queue {@link ASensorEventQueue} for sensor event to be report to. |
| 735 | * \param sensor {@link ASensor} to be enabled. |
| 736 | * |
| 737 | * \return 0 on success or a negative error code on failure. |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 738 | */ |
| 739 | int ASensorEventQueue_enableSensor(ASensorEventQueue* queue, ASensor const* sensor); |
| 740 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 741 | /** |
Peng Xu | 80df016 | 2017-08-05 19:00:23 -0700 | [diff] [blame] | 742 | * Disable the selected sensor. |
| 743 | * |
| 744 | * Stop event reports from the sensor to specified sensor event queue. |
| 745 | * |
| 746 | * \param queue {@link ASensorEventQueue} to be changed |
| 747 | * \param sensor {@link ASensor} to be disabled |
| 748 | * \return 0 on success or a negative error code on failure. |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 749 | */ |
| 750 | int ASensorEventQueue_disableSensor(ASensorEventQueue* queue, ASensor const* sensor); |
| 751 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 752 | /** |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 753 | * Sets the delivery rate of events in microseconds for the given sensor. |
Peng Xu | 80df016 | 2017-08-05 19:00:23 -0700 | [diff] [blame] | 754 | * |
| 755 | * This function has to be called after {@link ASensorEventQueue_enableSensor}. |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 756 | * Note that this is a hint only, generally event will arrive at a higher |
| 757 | * rate. It is an error to set a rate inferior to the value returned by |
| 758 | * ASensor_getMinDelay(). |
Peng Xu | 80df016 | 2017-08-05 19:00:23 -0700 | [diff] [blame] | 759 | * |
| 760 | * \param queue {@link ASensorEventQueue} to which sensor event is delivered. |
| 761 | * \param sensor {@link ASensor} of which sampling rate to be updated. |
| 762 | * \param usec sensor sampling period (1/sampling rate) in microseconds |
| 763 | * \return 0 on sucess or a negative error code on failure. |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 764 | */ |
| 765 | int ASensorEventQueue_setEventRate(ASensorEventQueue* queue, ASensor const* sensor, int32_t usec); |
| 766 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 767 | /** |
Peng Xu | 80df016 | 2017-08-05 19:00:23 -0700 | [diff] [blame] | 768 | * Determine if a sensor event queue has pending event to be processed. |
| 769 | * |
| 770 | * \param queue {@link ASensorEventQueue} to be queried |
| 771 | * \return 1 if the queue has events; 0 if it does not have events; |
| 772 | * or a negative value if there is an error. |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 773 | */ |
| 774 | int ASensorEventQueue_hasEvents(ASensorEventQueue* queue); |
| 775 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 776 | /** |
Peng Xu | 80df016 | 2017-08-05 19:00:23 -0700 | [diff] [blame] | 777 | * Retrieve pending events in sensor event queue |
| 778 | * |
| 779 | * Retrieve next available events from the queue to a specified event array. |
| 780 | * |
| 781 | * \param queue {@link ASensorEventQueue} to get events from |
| 782 | * \param events pointer to an array of {@link ASensorEvents}. |
| 783 | * \param count max number of event that can be filled into array event. |
| 784 | * \return number of events returned on success; negative error code when |
| 785 | * no events are pending or an error has occurred. |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 786 | * |
| 787 | * Examples: |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 788 | * |
Peng Xu | 80df016 | 2017-08-05 19:00:23 -0700 | [diff] [blame] | 789 | * ASensorEvent event; |
| 790 | * ssize_t numEvent = ASensorEventQueue_getEvents(queue, &event, 1); |
| 791 | * |
| 792 | * ASensorEvent eventBuffer[8]; |
| 793 | * ssize_t numEvent = ASensorEventQueue_getEvents(queue, eventBuffer, 8); |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 794 | * |
| 795 | */ |
Peng Xu | da8385c | 2017-02-28 20:19:47 -0800 | [diff] [blame] | 796 | ssize_t ASensorEventQueue_getEvents(ASensorEventQueue* queue, ASensorEvent* events, size_t count); |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 797 | |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 798 | #if __ANDROID_API__ >= 29 |
Brian Stack | 65089d5 | 2019-01-11 10:52:07 -0800 | [diff] [blame] | 799 | /** |
| 800 | * Request that {@link ASENSOR_TYPE_ADDITIONAL_INFO} events to be delivered on |
| 801 | * the given {@link ASensorEventQueue}. |
| 802 | * |
| 803 | * Sensor data events are always delivered to the {@ASensorEventQueue}. |
| 804 | * |
| 805 | * The {@link ASENSOR_TYPE_ADDITIONAL_INFO} events will be returned through |
| 806 | * {@link ASensorEventQueue_getEvents}. The client is responsible for checking |
| 807 | * {@link ASensorEvent#type} to determine the event type prior to handling of |
| 808 | * the event. |
| 809 | * |
| 810 | * The client must be tolerant of any value for |
| 811 | * {@link AAdditionalInfoEvent#type}, as new values may be defined in the future |
| 812 | * and may delivered to the client. |
| 813 | * |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 814 | * Available since API level 29. |
| 815 | * |
Brian Stack | 65089d5 | 2019-01-11 10:52:07 -0800 | [diff] [blame] | 816 | * \param queue {@link ASensorEventQueue} to configure |
| 817 | * \param enable true to request {@link ASENSOR_TYPE_ADDITIONAL_INFO} events, |
| 818 | * false to stop receiving events |
| 819 | * \return 0 on success or a negative error code on failure |
| 820 | */ |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 821 | int ASensorEventQueue_requestAdditionalInfoEvents(ASensorEventQueue* queue, bool enable) __INTRODUCED_IN(29); |
| 822 | #endif /* __ANDROID_API__ >= 29 */ |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 823 | |
| 824 | /*****************************************************************************/ |
| 825 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 826 | /** |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 827 | * Returns this sensor's name (non localized) |
| 828 | */ |
| 829 | const char* ASensor_getName(ASensor const* sensor); |
| 830 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 831 | /** |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 832 | * Returns this sensor's vendor's name (non localized) |
| 833 | */ |
| 834 | const char* ASensor_getVendor(ASensor const* sensor); |
| 835 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 836 | /** |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 837 | * Return this sensor's type |
| 838 | */ |
| 839 | int ASensor_getType(ASensor const* sensor); |
| 840 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 841 | /** |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 842 | * Returns this sensors's resolution |
| 843 | */ |
| 844 | float ASensor_getResolution(ASensor const* sensor); |
| 845 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 846 | /** |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 847 | * Returns the minimum delay allowed between events in microseconds. |
| 848 | * A value of zero means that this sensor doesn't report events at a |
| 849 | * constant rate, but rather only when a new data is available. |
| 850 | */ |
| 851 | int ASensor_getMinDelay(ASensor const* sensor); |
| 852 | |
Ryan Prichard | 92b1ebe | 2018-07-19 20:32:19 -0700 | [diff] [blame] | 853 | #if __ANDROID_API__ >= 21 |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 854 | /** |
Aravind Akella | 7001804 | 2014-04-07 22:52:37 +0000 | [diff] [blame] | 855 | * Returns the maximum size of batches for this sensor. Batches will often be |
| 856 | * smaller, as the hardware fifo might be used for other sensors. |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 857 | * |
| 858 | * Available since API level 21. |
Aravind Akella | 7001804 | 2014-04-07 22:52:37 +0000 | [diff] [blame] | 859 | */ |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 860 | int ASensor_getFifoMaxEventCount(ASensor const* sensor) __INTRODUCED_IN(21); |
Aravind Akella | 7001804 | 2014-04-07 22:52:37 +0000 | [diff] [blame] | 861 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 862 | /** |
Aravind Akella | 7001804 | 2014-04-07 22:52:37 +0000 | [diff] [blame] | 863 | * Returns the hardware batch fifo size reserved to this sensor. |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 864 | * |
| 865 | * Available since API level 21. |
Aravind Akella | 7001804 | 2014-04-07 22:52:37 +0000 | [diff] [blame] | 866 | */ |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 867 | int ASensor_getFifoReservedEventCount(ASensor const* sensor) __INTRODUCED_IN(21); |
Aravind Akella | 7001804 | 2014-04-07 22:52:37 +0000 | [diff] [blame] | 868 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 869 | /** |
Aravind Akella | 7001804 | 2014-04-07 22:52:37 +0000 | [diff] [blame] | 870 | * Returns this sensor's string type. |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 871 | * |
| 872 | * Available since API level 21. |
Aravind Akella | 7001804 | 2014-04-07 22:52:37 +0000 | [diff] [blame] | 873 | */ |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 874 | const char* ASensor_getStringType(ASensor const* sensor) __INTRODUCED_IN(21); |
Aravind Akella | 7001804 | 2014-04-07 22:52:37 +0000 | [diff] [blame] | 875 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 876 | /** |
Aravind Akella | 0e025c5 | 2014-06-03 19:19:57 -0700 | [diff] [blame] | 877 | * Returns the reporting mode for this sensor. One of AREPORTING_MODE_* constants. |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 878 | * |
| 879 | * Available since API level 21. |
Aravind Akella | 0e025c5 | 2014-06-03 19:19:57 -0700 | [diff] [blame] | 880 | */ |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 881 | int ASensor_getReportingMode(ASensor const* sensor) __INTRODUCED_IN(21); |
Aravind Akella | 0e025c5 | 2014-06-03 19:19:57 -0700 | [diff] [blame] | 882 | |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 883 | /** |
Aravind Akella | b37ba39 | 2014-08-05 14:53:07 -0700 | [diff] [blame] | 884 | * Returns true if this is a wake up sensor, false otherwise. |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 885 | * |
| 886 | * Available since API level 21. |
Aravind Akella | b37ba39 | 2014-08-05 14:53:07 -0700 | [diff] [blame] | 887 | */ |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 888 | bool ASensor_isWakeUpSensor(ASensor const* sensor) __INTRODUCED_IN(21); |
Ryan Prichard | 92b1ebe | 2018-07-19 20:32:19 -0700 | [diff] [blame] | 889 | #endif /* __ANDROID_API__ >= 21 */ |
Aravind Akella | b37ba39 | 2014-08-05 14:53:07 -0700 | [diff] [blame] | 890 | |
Ryan Prichard | 92b1ebe | 2018-07-19 20:32:19 -0700 | [diff] [blame] | 891 | #if __ANDROID_API__ >= 26 |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 892 | /** |
| 893 | * Test if sensor supports a certain type of direct channel. |
| 894 | * |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 895 | * Available since API level 26. |
| 896 | * |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 897 | * \param sensor a {@link ASensor} to denote the sensor to be checked. |
| 898 | * \param channelType Channel type constant, either |
| 899 | * {@ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY} |
| 900 | * or {@link ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER}. |
| 901 | * \returns true if sensor supports the specified direct channel type. |
| 902 | */ |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 903 | bool ASensor_isDirectChannelTypeSupported(ASensor const* sensor, int channelType) __INTRODUCED_IN(26); |
| 904 | |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 905 | /** |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 906 | * Get the highest direct rate level that a sensor supports. |
| 907 | * |
| 908 | * Available since API level 26. |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 909 | * |
| 910 | * \param sensor a {@link ASensor} to denote the sensor to be checked. |
| 911 | * |
| 912 | * \return a ASENSOR_DIRECT_RATE_... enum denoting the highest rate level supported by the sensor. |
| 913 | * If return value is {@link ASENSOR_DIRECT_RATE_STOP}, it means the sensor |
| 914 | * does not support direct report. |
| 915 | */ |
Elliott Hughes | 9db409b | 2018-06-18 12:28:46 -0700 | [diff] [blame] | 916 | int ASensor_getHighestDirectReportRateLevel(ASensor const* sensor) __INTRODUCED_IN(26); |
Ryan Prichard | 92b1ebe | 2018-07-19 20:32:19 -0700 | [diff] [blame] | 917 | #endif /* __ANDROID_API__ >= 26 */ |
Peng Xu | 47cddca | 2017-02-15 23:31:22 -0800 | [diff] [blame] | 918 | |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 919 | #if __ANDROID_API__ >= 29 |
Brian Stack | 8228fa7 | 2019-01-04 14:15:13 -0800 | [diff] [blame] | 920 | /** |
| 921 | * Returns the sensor's handle. |
| 922 | * |
| 923 | * The handle identifies the sensor within the system and is included in the |
| 924 | * {@link ASensorEvent#sensor} field of sensor events, including those sent with type |
| 925 | * {@link ASENSOR_TYPE_ADDITIONAL_INFO}. |
| 926 | * |
| 927 | * A sensor's handle is able to be used to map {@link ASENSOR_TYPE_ADDITIONAL_INFO} events to the |
| 928 | * sensor that generated the event. |
| 929 | * |
| 930 | * It is important to note that the value returned by {@link ASensor_getHandle} is not the same as |
| 931 | * the value returned by the Java API {@link android.hardware.Sensor#getId} and no mapping exists |
| 932 | * between the values. |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 933 | * |
| 934 | * Available since API level 29. |
Brian Stack | 8228fa7 | 2019-01-04 14:15:13 -0800 | [diff] [blame] | 935 | */ |
Elliott Hughes | 3d70e53 | 2019-10-29 08:59:39 -0700 | [diff] [blame] | 936 | int ASensor_getHandle(ASensor const* sensor) __INTRODUCED_IN(29); |
| 937 | #endif /* __ANDROID_API__ >= 29 */ |
Brian Stack | 8228fa7 | 2019-01-04 14:15:13 -0800 | [diff] [blame] | 938 | |
Mathias Agopian | e1c61d3 | 2012-03-23 14:19:36 -0700 | [diff] [blame] | 939 | #ifdef __cplusplus |
| 940 | }; |
| 941 | #endif |
| 942 | |
| 943 | #endif // ANDROID_SENSOR_H |
Johan Euphrosine | bf6d5e0 | 2015-03-27 17:15:43 -0700 | [diff] [blame] | 944 | |
| 945 | /** @} */ |