Ben Fennema | 52301e4 | 2017-10-17 12:24:04 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | |
| 17 | #include "sensorlist.h" |
| 18 | |
| 19 | #include <math.h> |
| 20 | |
| 21 | #include "hubdefs.h" |
| 22 | |
| 23 | using namespace android; |
| 24 | |
| 25 | const int kVersion = 1; |
| 26 | |
| 27 | const float kMinSampleRateHzAccel = 0.8125f; |
| 28 | const float kMaxSampleRateHzAccel = 416.0f; |
| 29 | const float kAccelRangeG = 8.0f; |
| 30 | extern const float kScaleAccel = 0.00239364f; |
| 31 | |
| 32 | const float kMinSampleRateHzGyro = 0.8125f; |
| 33 | const float kMaxSampleRateHzGyro = 416.0f; |
| 34 | |
| 35 | const float kMinSampleRateHzMag = 0.8125f; |
| 36 | const float kMaxSampleRateHzMag = 104.0f; |
| 37 | extern const float kScaleMag = 0.15f; |
| 38 | |
| 39 | const float kMinSampleRateHzPressure = 1.0f; |
| 40 | const float kMaxSampleRateHzPressure = 75.0f; |
| 41 | |
| 42 | const float kMinSampleRateHzTemperature = 1.0f; |
| 43 | const float kMaxSampleRateHzTemperature = 75.0f; |
| 44 | |
| 45 | const float kMinSampleRateHzHumidity = 1.0f; |
| 46 | const float kMaxSampleRateHzHumidity = 12.5f; |
| 47 | |
| 48 | #ifdef HAVE_VL53L0X_DRIVER |
| 49 | const float kMinSampleRateHzProximity = 0.1f; |
| 50 | const float kMaxSampleRateHzProximity = 5.0f; |
| 51 | #endif |
| 52 | |
| 53 | const float kMinSampleRateHzLight = 10.0f; |
| 54 | const float kMaxSampleRateHzLight = 10.0f; |
| 55 | |
| 56 | const float kMinSampleRateHzOrientation = 12.5f; |
| 57 | const float kMaxSampleRateHzOrientation = 200.0f; |
| 58 | |
| 59 | #define MINDELAY(x) ((int32_t)ceil(1.0E6f/(x))) |
| 60 | |
| 61 | #ifdef DIRECT_REPORT_ENABLED |
| 62 | constexpr uint32_t kDirectReportFlagAccel = ( |
| 63 | // support up to rate level fast (nominal 200Hz); |
| 64 | (SENSOR_DIRECT_RATE_FAST << SENSOR_FLAG_SHIFT_DIRECT_REPORT) |
| 65 | // support ashmem and gralloc direct channel |
| 66 | | SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM |
| 67 | | SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC); |
| 68 | constexpr uint32_t kDirectReportFlagGyro = ( |
| 69 | // support up to rate level fast (nominal 200Hz); |
| 70 | (SENSOR_DIRECT_RATE_FAST << SENSOR_FLAG_SHIFT_DIRECT_REPORT) |
| 71 | // support ashmem and gralloc direct channel |
| 72 | | SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM |
| 73 | | SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC); |
| 74 | constexpr uint32_t kDirectReportFlagMag = ( |
| 75 | // support up to rate level normal (nominal 50Hz); |
| 76 | (SENSOR_DIRECT_RATE_NORMAL << SENSOR_FLAG_SHIFT_DIRECT_REPORT) |
| 77 | // support ashmem and gralloc direct channel |
| 78 | | SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM |
| 79 | | SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC); |
| 80 | #else |
| 81 | constexpr uint32_t kDirectReportFlagAccel = 0; |
| 82 | constexpr uint32_t kDirectReportFlagGyro = 0; |
| 83 | constexpr uint32_t kDirectReportFlagMag = 0; |
| 84 | #endif |
| 85 | |
| 86 | /* |
| 87 | * The following max count is determined by the total number of blocks |
| 88 | * avaliable in the shared nanohub buffer and number of samples each type of |
| 89 | * event can hold within a buffer block. |
| 90 | * For argonkey's case, there are 193 blocks in the shared sensor buffer and |
| 91 | * each block can hold 30 OneAxis Samples, 15 ThreeAxis Samples or 24 |
| 92 | * RawThreeAxis Samples. |
| 93 | */ |
| 94 | #ifdef HAVE_VL53L0X_DRIVER |
| 95 | const int kMaxOneAxisEventCount = 193*30; |
| 96 | const int kMaxThreeAxisEventCount = 193*15; |
| 97 | const int kMaxRawThreeAxisEventCount = 193*24; |
| 98 | #else |
| 99 | const int kMaxOneAxisEventCount = 183*30; |
| 100 | const int kMaxThreeAxisEventCount = 183*15; |
| 101 | const int kMaxRawThreeAxisEventCount = 183*24; |
| 102 | #endif |
| 103 | |
| 104 | const int kMinFifoReservedEventCount = 20; |
| 105 | |
| 106 | extern const sensor_t kSensorList[] = { |
| 107 | #ifdef HAVE_VL53L0X_DRIVER |
| 108 | { |
| 109 | "VL53L0X Proximity Sensor", |
| 110 | "STMicroelectronics", |
| 111 | kVersion, |
| 112 | COMMS_SENSOR_PROXIMITY, |
| 113 | SENSOR_TYPE_PROXIMITY, |
| 114 | 5.0f, // maxRange (cm) |
| 115 | 1.0f, // resolution (cm) |
| 116 | 0.0f, // XXX power |
| 117 | MINDELAY(kMaxSampleRateHzProximity), // minDelay |
| 118 | 300, // XXX fifoReservedEventCount |
| 119 | kMaxOneAxisEventCount, // XXX fifoMaxEventCount |
| 120 | SENSOR_STRING_TYPE_PROXIMITY, |
| 121 | "", // requiredPermission |
| 122 | (long)(1.0E6f / kMinSampleRateHzProximity), // maxDelay |
| 123 | SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ON_CHANGE_MODE, |
| 124 | { NULL, NULL } |
| 125 | }, |
| 126 | #endif |
| 127 | { |
| 128 | "ILS29034 Light Sensor", |
| 129 | "Intersil", |
| 130 | kVersion, |
| 131 | COMMS_SENSOR_LIGHT, |
| 132 | SENSOR_TYPE_LIGHT, |
| 133 | 43000.0f, // maxRange (lx) |
| 134 | 10.0f, // XXX resolution (lx) |
| 135 | 0.0f, // XXX power |
| 136 | MINDELAY(kMaxSampleRateHzLight), // minDelay |
| 137 | kMinFifoReservedEventCount, // XXX fifoReservedEventCount |
| 138 | kMaxOneAxisEventCount, // XXX fifoMaxEventCount |
| 139 | SENSOR_STRING_TYPE_LIGHT, |
| 140 | "", // requiredPermission |
| 141 | (long)(1.0E6f / kMinSampleRateHzLight), // maxDelay |
| 142 | SENSOR_FLAG_ON_CHANGE_MODE, |
| 143 | { NULL, NULL } |
| 144 | }, |
| 145 | { |
| 146 | "LSM6DSL accelerometer", |
| 147 | "STMicroelectronics", |
| 148 | kVersion, |
| 149 | COMMS_SENSOR_ACCEL, |
| 150 | SENSOR_TYPE_ACCELEROMETER, |
| 151 | GRAVITY_EARTH * kAccelRangeG, // maxRange |
| 152 | kScaleAccel, // resolution |
| 153 | 0.0f, // XXX power |
| 154 | MINDELAY(kMaxSampleRateHzAccel), // minDelay |
| 155 | 3000, // XXX fifoReservedEventCount |
| 156 | kMaxRawThreeAxisEventCount, // XXX fifoMaxEventCount |
| 157 | SENSOR_STRING_TYPE_ACCELEROMETER, |
| 158 | "", // requiredPermission |
| 159 | (long)(1.0E6f / kMinSampleRateHzAccel), // maxDelay |
| 160 | SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagAccel, |
| 161 | { NULL, NULL } |
| 162 | }, |
| 163 | { |
| 164 | "LSM6DSL accelerometer (uncalibrated)", |
| 165 | "STMicroelectronics", |
| 166 | kVersion, |
| 167 | COMMS_SENSOR_ACCEL_UNCALIBRATED, |
| 168 | SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED, |
| 169 | GRAVITY_EARTH * kAccelRangeG, // maxRange |
| 170 | kScaleAccel, // resolution |
| 171 | 0.0f, // XXX power |
| 172 | MINDELAY(kMaxSampleRateHzAccel), // minDelay |
| 173 | 3000, // XXX fifoReservedEventCount |
| 174 | kMaxRawThreeAxisEventCount, // XXX fifoMaxEventCount |
| 175 | SENSOR_STRING_TYPE_ACCELEROMETER_UNCALIBRATED, |
| 176 | "", // requiredPermission |
| 177 | (long)(1.0E6f / kMinSampleRateHzAccel), // maxDelay |
| 178 | SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagAccel, |
| 179 | { NULL, NULL } |
| 180 | }, |
| 181 | { |
| 182 | "LSM6DSL gyroscope", |
| 183 | "STMicroelectronics", |
| 184 | kVersion, |
| 185 | COMMS_SENSOR_GYRO, |
| 186 | SENSOR_TYPE_GYROSCOPE, |
| 187 | 2000.0f * M_PI / 180.0f, // maxRange |
| 188 | 0.07f * M_PI / 180.0f, // resolution |
| 189 | 0.0f, // XXX power |
| 190 | MINDELAY(kMaxSampleRateHzGyro), // minDelay |
| 191 | kMinFifoReservedEventCount, // XXX fifoReservedEventCount |
| 192 | kMaxThreeAxisEventCount, // XXX fifoMaxEventCount |
| 193 | SENSOR_STRING_TYPE_GYROSCOPE, |
| 194 | "", // requiredPermission |
| 195 | (long)(1.0E6f / kMinSampleRateHzGyro), // maxDelay |
| 196 | SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagGyro, |
| 197 | { NULL, NULL } |
| 198 | }, |
| 199 | { |
| 200 | "LSM6DSL gyroscope (uncalibrated)", |
| 201 | "STMicroelectronics", |
| 202 | kVersion, |
| 203 | COMMS_SENSOR_GYRO_UNCALIBRATED, |
| 204 | SENSOR_TYPE_GYROSCOPE_UNCALIBRATED, |
| 205 | 2000.0f * M_PI / 180.0f, // maxRange |
| 206 | 0.07f * M_PI / 180.0f, // resolution |
| 207 | 0.0f, // XXX power |
| 208 | MINDELAY(kMaxSampleRateHzGyro), // minDelay |
| 209 | kMinFifoReservedEventCount, // XXX fifoReservedEventCount |
| 210 | kMaxThreeAxisEventCount, // XXX fifoMaxEventCount |
| 211 | SENSOR_STRING_TYPE_GYROSCOPE_UNCALIBRATED, |
| 212 | "", // requiredPermission |
| 213 | (long)(1.0E6f / kMinSampleRateHzGyro), // maxDelay |
| 214 | SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagGyro, |
| 215 | { NULL, NULL } |
| 216 | }, |
| 217 | { |
| 218 | "LIS2MDL magnetometer", |
| 219 | "STMicroelectronics", |
| 220 | kVersion, |
| 221 | COMMS_SENSOR_MAG, |
| 222 | SENSOR_TYPE_MAGNETIC_FIELD, |
| 223 | 1300.0f, // XXX maxRange |
| 224 | kScaleMag, // XXX resolution |
| 225 | 0.0f, // XXX power |
| 226 | MINDELAY(kMaxSampleRateHzMag), // minDelay |
| 227 | 600, // XXX fifoReservedEventCount |
| 228 | kMaxThreeAxisEventCount, // XXX fifoMaxEventCount |
| 229 | SENSOR_STRING_TYPE_MAGNETIC_FIELD, |
| 230 | "", // requiredPermission |
| 231 | (long)(1.0E6f / kMinSampleRateHzMag), // maxDelay |
| 232 | SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagMag, |
| 233 | { NULL, NULL } |
| 234 | }, |
| 235 | { |
| 236 | "LIS2MDL magnetometer (uncalibrated)", |
| 237 | "STMicroelectronics", |
| 238 | kVersion, |
| 239 | COMMS_SENSOR_MAG_UNCALIBRATED, |
| 240 | SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED, |
| 241 | 1300.0f, // XXX maxRange |
| 242 | kScaleMag, // XXX resolution |
| 243 | 0.0f, // XXX power |
| 244 | MINDELAY(kMaxSampleRateHzMag), // minDelay |
| 245 | 600, // XXX fifoReservedEventCount |
| 246 | kMaxThreeAxisEventCount, // XXX fifoMaxEventCount |
| 247 | SENSOR_STRING_TYPE_MAGNETIC_FIELD_UNCALIBRATED, |
| 248 | "", // requiredPermission |
| 249 | (long)(1.0E6f / kMinSampleRateHzMag), // maxDelay |
| 250 | SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagMag, |
| 251 | { NULL, NULL } |
| 252 | }, |
| 253 | { |
| 254 | "LPS22HB pressure", |
| 255 | "STMicroelectronics", |
| 256 | kVersion, |
| 257 | COMMS_SENSOR_PRESSURE, |
| 258 | SENSOR_TYPE_PRESSURE, |
| 259 | 1100.0f, // maxRange (hPa) |
| 260 | 0.005f, // resolution (hPa) |
| 261 | 0.0f, // XXX power |
| 262 | MINDELAY(kMaxSampleRateHzPressure), // minDelay |
| 263 | 300, // XXX fifoReservedEventCount |
| 264 | kMaxOneAxisEventCount, // XXX fifoMaxEventCount |
| 265 | SENSOR_STRING_TYPE_PRESSURE, |
| 266 | "", // requiredPermission |
| 267 | (long)(1.0E6f / kMinSampleRateHzPressure), // maxDelay |
| 268 | SENSOR_FLAG_CONTINUOUS_MODE, |
| 269 | { NULL, NULL } |
| 270 | }, |
| 271 | { |
| 272 | "LPS22HB temperature", |
| 273 | "STMicroelectronics", |
| 274 | kVersion, |
| 275 | COMMS_SENSOR_AMBIENT_TEMPERATURE, |
| 276 | SENSOR_TYPE_AMBIENT_TEMPERATURE, |
| 277 | 85.0f, // maxRange (degC) |
| 278 | 0.01, // resolution (degC) |
| 279 | 0.0f, // XXX power |
| 280 | MINDELAY(kMaxSampleRateHzTemperature), // minDelay |
| 281 | kMinFifoReservedEventCount, // XXX fifoReservedEventCount |
| 282 | kMaxOneAxisEventCount, // XXX fifoMaxEventCount |
| 283 | SENSOR_STRING_TYPE_AMBIENT_TEMPERATURE, |
| 284 | "", // requiredPermission |
| 285 | (long)(1.0E6f / kMinSampleRateHzTemperature), // maxDelay |
| 286 | SENSOR_FLAG_CONTINUOUS_MODE, |
| 287 | { NULL, NULL } |
| 288 | }, |
| 289 | { |
| 290 | "HTS221 humidity", |
| 291 | "STMicroelectronics", |
| 292 | kVersion, |
| 293 | COMMS_SENSOR_HUMIDITY, |
| 294 | SENSOR_TYPE_RELATIVE_HUMIDITY, |
| 295 | 100.0f, // maxRange (%) |
| 296 | 0.001f, // resolution (%) |
| 297 | 0.0f, // XXX power |
| 298 | MINDELAY(kMaxSampleRateHzHumidity), // minDelay |
| 299 | 300, // XXX fifoReservedEventCount |
| 300 | kMaxOneAxisEventCount, // XXX fifoMaxEventCount |
| 301 | SENSOR_STRING_TYPE_RELATIVE_HUMIDITY, |
| 302 | "", // requiredPermission |
| 303 | (long)(1.0E6f / kMinSampleRateHzHumidity), // maxDelay |
| 304 | SENSOR_FLAG_CONTINUOUS_MODE, |
| 305 | { NULL, NULL } |
| 306 | }, |
| 307 | { |
| 308 | "Orientation", |
| 309 | "Google", |
| 310 | kVersion, |
| 311 | COMMS_SENSOR_ORIENTATION, |
| 312 | SENSOR_TYPE_ORIENTATION, |
| 313 | 360.0f, // maxRange (deg) |
| 314 | 1.0f, // XXX resolution (deg) |
| 315 | 0.0f, // XXX power |
| 316 | MINDELAY(kMaxSampleRateHzOrientation), // minDelay |
| 317 | kMinFifoReservedEventCount, // XXX fifoReservedEventCount |
| 318 | kMaxThreeAxisEventCount, // XXX fifoMaxEventCount |
| 319 | SENSOR_STRING_TYPE_ORIENTATION, |
| 320 | "", // requiredPermission |
| 321 | (long)(1.0E6f / kMinSampleRateHzOrientation), // maxDelay |
| 322 | SENSOR_FLAG_CONTINUOUS_MODE, |
| 323 | { NULL, NULL } |
| 324 | }, |
| 325 | { |
| 326 | "LSM6DSL Step detector", |
| 327 | "STMicroelectronics", |
| 328 | kVersion, |
| 329 | COMMS_SENSOR_STEP_DETECTOR, |
| 330 | SENSOR_TYPE_STEP_DETECTOR, |
| 331 | 1.0f, // maxRange |
| 332 | 1.0f, // XXX resolution |
| 333 | 0.0f, // XXX power |
| 334 | 0, // minDelay |
| 335 | 100, // XXX fifoReservedEventCount |
| 336 | kMaxOneAxisEventCount, // XXX fifoMaxEventCount |
| 337 | SENSOR_STRING_TYPE_STEP_DETECTOR, |
| 338 | "", // requiredPermission |
| 339 | 0, // maxDelay |
| 340 | SENSOR_FLAG_SPECIAL_REPORTING_MODE, |
| 341 | { NULL, NULL } |
| 342 | }, |
| 343 | { |
| 344 | "LSM6DSL Step counter", |
| 345 | "STMicroelectronics", |
| 346 | kVersion, |
| 347 | COMMS_SENSOR_STEP_COUNTER, |
| 348 | SENSOR_TYPE_STEP_COUNTER, |
| 349 | 65535.0f, // XXX maxRange |
| 350 | 1.0f, // resolution |
| 351 | 0.0f, // XXX power |
| 352 | 0, // minDelay |
| 353 | kMinFifoReservedEventCount, // XXX fifoReservedEventCount |
| 354 | kMaxOneAxisEventCount, // XXX fifoMaxEventCount |
| 355 | SENSOR_STRING_TYPE_STEP_COUNTER, |
| 356 | "", // requiredPermission |
| 357 | 0, // maxDelay |
| 358 | SENSOR_FLAG_ON_CHANGE_MODE, |
| 359 | { NULL, NULL } |
| 360 | }, |
| 361 | { |
| 362 | "LSM6DSL Significant motion", |
| 363 | "STMicroelectronics", |
| 364 | kVersion, |
| 365 | COMMS_SENSOR_SIGNIFICANT_MOTION, |
| 366 | SENSOR_TYPE_SIGNIFICANT_MOTION, |
| 367 | 1.0f, // maxRange |
| 368 | 1.0f, // XXX resolution |
| 369 | 0.0f, // XXX power |
| 370 | -1, // minDelay |
| 371 | 0, // XXX fifoReservedEventCount |
| 372 | 0, // XXX fifoMaxEventCount |
| 373 | SENSOR_STRING_TYPE_SIGNIFICANT_MOTION, |
| 374 | "", // requiredPermission |
| 375 | 0, // maxDelay |
| 376 | SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ONE_SHOT_MODE, |
| 377 | { NULL, NULL } |
| 378 | }, |
| 379 | { |
| 380 | "Gravity", |
| 381 | "Google", |
| 382 | kVersion, |
| 383 | COMMS_SENSOR_GRAVITY, |
| 384 | SENSOR_TYPE_GRAVITY, |
| 385 | 1000.0f, // maxRange |
| 386 | 1.0f, // XXX resolution |
| 387 | 0.0f, // XXX power |
| 388 | MINDELAY(kMaxSampleRateHzOrientation), // minDelay |
| 389 | kMinFifoReservedEventCount, // XXX fifoReservedEventCount |
| 390 | kMaxThreeAxisEventCount, // XXX fifoMaxEventCount |
| 391 | SENSOR_STRING_TYPE_GRAVITY, |
| 392 | "", // requiredPermission |
| 393 | (long)(1.0E6f / kMinSampleRateHzOrientation), // maxDelay |
| 394 | SENSOR_FLAG_CONTINUOUS_MODE, |
| 395 | { NULL, NULL } |
| 396 | }, |
| 397 | { |
| 398 | "Linear Acceleration", |
| 399 | "Google", |
| 400 | kVersion, |
| 401 | COMMS_SENSOR_LINEAR_ACCEL, |
| 402 | SENSOR_TYPE_LINEAR_ACCELERATION, |
| 403 | 1000.0f, // maxRange |
| 404 | 1.0f, // XXX resolution |
| 405 | 0.0f, // XXX power |
| 406 | MINDELAY(kMaxSampleRateHzOrientation), // minDelay |
| 407 | kMinFifoReservedEventCount, // XXX fifoReservedEventCount |
| 408 | kMaxThreeAxisEventCount, // XXX fifoMaxEventCount |
| 409 | SENSOR_STRING_TYPE_LINEAR_ACCELERATION, |
| 410 | "", // requiredPermission |
| 411 | (long)(1.0E6f / kMinSampleRateHzOrientation), // maxDelay |
| 412 | SENSOR_FLAG_CONTINUOUS_MODE, |
| 413 | { NULL, NULL } |
| 414 | }, |
| 415 | { |
| 416 | "Rotation Vector", |
| 417 | "Google", |
| 418 | kVersion, |
| 419 | COMMS_SENSOR_ROTATION_VECTOR, |
| 420 | SENSOR_TYPE_ROTATION_VECTOR, |
| 421 | 1.0f, // maxRange |
| 422 | 0.001f, // XXX resolution |
| 423 | 0.0f, // XXX power |
| 424 | MINDELAY(kMaxSampleRateHzOrientation), // minDelay |
| 425 | kMinFifoReservedEventCount, // XXX fifoReservedEventCount |
| 426 | kMaxThreeAxisEventCount, // XXX fifoMaxEventCount |
| 427 | SENSOR_STRING_TYPE_ROTATION_VECTOR, |
| 428 | "", // requiredPermission |
| 429 | (long)(1.0E6f / kMinSampleRateHzOrientation), // maxDelay |
| 430 | SENSOR_FLAG_CONTINUOUS_MODE, |
| 431 | { NULL, NULL } |
| 432 | }, |
| 433 | { |
| 434 | "Geomagnetic Rotation Vector", |
| 435 | "Google", |
| 436 | kVersion, |
| 437 | COMMS_SENSOR_GEO_MAG, |
| 438 | SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR, |
| 439 | 1.0f, // maxRange |
| 440 | 0.001f, // XXX resolution |
| 441 | 0.0f, // XXX power |
| 442 | MINDELAY(kMaxSampleRateHzOrientation), // minDelay |
| 443 | kMinFifoReservedEventCount, // XXX fifoReservedEventCount |
| 444 | kMaxThreeAxisEventCount, // XXX fifoMaxEventCount |
| 445 | SENSOR_STRING_TYPE_GEOMAGNETIC_ROTATION_VECTOR, |
| 446 | "", // requiredPermission |
| 447 | (long)(1.0E6f / kMinSampleRateHzOrientation), // maxDelay |
| 448 | SENSOR_FLAG_CONTINUOUS_MODE, |
| 449 | { NULL, NULL } |
| 450 | }, |
| 451 | { |
| 452 | "Game Rotation Vector", |
| 453 | "Google", |
| 454 | kVersion, |
| 455 | COMMS_SENSOR_GAME_ROTATION_VECTOR, |
| 456 | SENSOR_TYPE_GAME_ROTATION_VECTOR, |
| 457 | 1.0f, // maxRange |
| 458 | 0.001f, // XXX resolution |
| 459 | 0.0f, // XXX power |
| 460 | MINDELAY(kMaxSampleRateHzOrientation), // minDelay |
| 461 | 300, // XXX fifoReservedEventCount |
| 462 | kMaxThreeAxisEventCount, // XXX fifoMaxEventCount |
| 463 | SENSOR_STRING_TYPE_GAME_ROTATION_VECTOR, |
| 464 | "", // requiredPermission |
| 465 | (long)(1.0E6f / kMinSampleRateHzOrientation), // maxDelay |
| 466 | SENSOR_FLAG_CONTINUOUS_MODE, |
| 467 | { NULL, NULL } |
| 468 | }, |
| 469 | { |
| 470 | "Tilt Detector", |
| 471 | "Google", |
| 472 | kVersion, |
| 473 | COMMS_SENSOR_TILT, |
| 474 | SENSOR_TYPE_TILT_DETECTOR, |
| 475 | 1.0f, // maxRange |
| 476 | 1.0f, // XXX resolution |
| 477 | 0.0f, // XXX power |
| 478 | 0, // minDelay |
| 479 | kMinFifoReservedEventCount, // XXX fifoReservedEventCount |
| 480 | kMaxOneAxisEventCount, // XXX fifoMaxEventCount |
| 481 | SENSOR_STRING_TYPE_TILT_DETECTOR, |
| 482 | "", // requiredPermission |
| 483 | 0, // maxDelay |
| 484 | SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_SPECIAL_REPORTING_MODE, |
| 485 | { NULL, NULL } |
| 486 | }, |
| 487 | { |
| 488 | "Device Orientation", |
| 489 | "Google", |
| 490 | kVersion, |
| 491 | COMMS_SENSOR_WINDOW_ORIENTATION, |
| 492 | SENSOR_TYPE_DEVICE_ORIENTATION, |
| 493 | 3.0f, // maxRange |
| 494 | 1.0f, // XXX resolution |
| 495 | 0.1f, // XXX power |
| 496 | 0, // minDelay |
| 497 | kMinFifoReservedEventCount, // XXX fifoReservedEventCount |
| 498 | kMaxOneAxisEventCount, // XXX fifoMaxEventCount |
| 499 | SENSOR_STRING_TYPE_DEVICE_ORIENTATION, |
| 500 | "", // requiredPermission |
| 501 | 0, // maxDelay |
| 502 | SENSOR_FLAG_ON_CHANGE_MODE, |
| 503 | { NULL, NULL } |
| 504 | }, |
| 505 | }; |
| 506 | |
| 507 | extern const size_t kSensorCount = sizeof(kSensorList) / sizeof(sensor_t); |