Home | History | Annotate | Download | only in sensorhal
      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 = 6.250f;
     28 const float kMaxSampleRateHzAccel = 400.0f;
     29 const float kAccelRangeG = 16.0f;
     30 extern const float kScaleAccel = (kAccelRangeG * 9.81f / 32768.0f);
     31 
     32 const float kMinSampleRateHzGyro = 6.250f;
     33 const float kMaxSampleRateHzGyro = 400.0f;
     34 
     35 const float kMinSampleRateHzMag = 3.125f;
     36 const float kMaxSampleRateHzMag = 50.0f;
     37 extern const float kScaleMag = 0.15f;
     38 
     39 const float kMinSampleRateHzPolling = 0.1f;
     40 const float kMaxSampleRateHzPolling = 25.0f;
     41 
     42 const float kMinSampleRateHzPressure = 0.1f;
     43 const float kMaxSampleRateHzPressure = 10.0f;
     44 
     45 const float kMinSampleRateHzTemperature = kMinSampleRateHzPolling;
     46 const float kMaxSampleRateHzTemperature = kMaxSampleRateHzPolling;
     47 
     48 const float kMinSampleRateHzProximity = kMinSampleRateHzPolling;
     49 const float kMaxSampleRateHzProximity = 5.0;
     50 
     51 const float kMinSampleRateHzLight = kMinSampleRateHzPolling;
     52 const float kMaxSampleRateHzLight = 5.0;
     53 
     54 const float kMinSampleRateHzOrientation = 12.5f;
     55 const float kMaxSampleRateHzOrientation = 200.0f;
     56 
     57 #ifdef DIRECT_REPORT_ENABLED
     58 constexpr uint32_t kDirectReportFlagAccel = (
     59         // support up to rate level fast (nominal 200Hz);
     60         (SENSOR_DIRECT_RATE_FAST << SENSOR_FLAG_SHIFT_DIRECT_REPORT)
     61         // support ashmem and gralloc direct channel
     62         | SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM
     63         | SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC);
     64 constexpr uint32_t kDirectReportFlagGyro = (
     65         // support up to rate level fast (nominal 200Hz);
     66         (SENSOR_DIRECT_RATE_FAST << SENSOR_FLAG_SHIFT_DIRECT_REPORT)
     67         // support ashmem and gralloc direct channel
     68         | SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM
     69         | SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC);
     70 constexpr uint32_t kDirectReportFlagMag = (
     71         // support up to rate level normal (nominal 50Hz);
     72         (SENSOR_DIRECT_RATE_NORMAL << SENSOR_FLAG_SHIFT_DIRECT_REPORT)
     73         // support ashmem and gralloc direct channel
     74         | SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM
     75         | SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC);
     76 #else
     77 constexpr uint32_t kDirectReportFlagAccel = 0;
     78 constexpr uint32_t kDirectReportFlagGyro = 0;
     79 constexpr uint32_t kDirectReportFlagMag = 0;
     80 #endif
     81 
     82 /*
     83  * The fowllowing max count is determined by the total number of blocks
     84  * avaliable in the shared nanohub buffer and number of samples each type of
     85  * event can hold within a buffer block.
     86  * For marlin's case, there are 239 blocks in the shared sensor buffer and
     87  * each block can hold 30 OneAxis Samples, 15 ThreeAxis Samples or 24
     88  * RawThreeAxies Samples.
     89  */
     90 const int kMaxOneAxisEventCount = 7170;
     91 const int kMaxThreeAxisEventCount = 3585;
     92 const int kMaxRawThreeAxisEventCount = 5736;
     93 
     94 const int kMinFifoReservedEventCount = 20;
     95 
     96 const char SENSOR_STRING_TYPE_INTERNAL_TEMPERATURE[] =
     97     "com.google.sensor.internal_temperature";
     98 const char SENSOR_STRING_TYPE_SYNC[] =
     99     "com.google.sensor.sync";
    100 const char SENSOR_STRING_TYPE_DOUBLE_TWIST[] =
    101     "com.google.sensor.double_twist";
    102 const char SENSOR_STRING_TYPE_DOUBLE_TAP[] =
    103     "com.google.sensor.double_tap";
    104 const char SENSOR_STRING_TYPE_DOUBLE_TOUCH[] =
    105     "com.google.sensor.double_touch";
    106 
    107 extern const sensor_t kSensorList[] = {
    108     {
    109         "TMD4903 Proximity Sensor",
    110         "AMS",
    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         (int32_t)(1.0E6f / 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     {
    127         "TMD4903 Light Sensor",
    128         "AMS",
    129         kVersion,
    130         COMMS_SENSOR_LIGHT,
    131         SENSOR_TYPE_LIGHT,
    132         43000.0f,                                  // maxRange (lx)
    133         10.0f,                                     // XXX resolution (lx)
    134         0.0f,                                      // XXX power
    135         (int32_t)(1.0E6f / kMaxSampleRateHzLight), // minDelay
    136         kMinFifoReservedEventCount,                // XXX fifoReservedEventCount
    137         kMaxOneAxisEventCount,                     // XXX fifoMaxEventCount
    138         SENSOR_STRING_TYPE_LIGHT,
    139         "",                                        // requiredPermission
    140         (long)(1.0E6f / kMinSampleRateHzLight),    // maxDelay
    141         SENSOR_FLAG_ON_CHANGE_MODE,
    142         { NULL, NULL }
    143     },
    144     {
    145         "BMI160 accelerometer",
    146         "Bosch",
    147         kVersion,
    148         COMMS_SENSOR_ACCEL,
    149         SENSOR_TYPE_ACCELEROMETER,
    150         GRAVITY_EARTH * kAccelRangeG,              // maxRange
    151         GRAVITY_EARTH * kAccelRangeG / 32768.0f,   // resolution
    152         0.0f,                                      // XXX power
    153         (int32_t)(1.0E6f / kMaxSampleRateHzAccel), // minDelay
    154         3000,                                      // XXX fifoReservedEventCount
    155         kMaxRawThreeAxisEventCount,                // XXX fifoMaxEventCount
    156         SENSOR_STRING_TYPE_ACCELEROMETER,
    157         "",                                        // requiredPermission
    158         (long)(1.0E6f / kMinSampleRateHzAccel),    // maxDelay
    159         SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagAccel,
    160         { NULL, NULL }
    161     },
    162     {
    163         "BMI160 gyroscope",
    164         "Bosch",
    165         kVersion,
    166         COMMS_SENSOR_GYRO,
    167         SENSOR_TYPE_GYROSCOPE,
    168         1000.0f * M_PI / 180.0f,                   // maxRange
    169         1000.0f * M_PI / (180.0f * 32768.0f),      // resolution
    170         0.0f,                                      // XXX power
    171         (int32_t)(1.0E6f / kMaxSampleRateHzGyro),  // minDelay
    172         kMinFifoReservedEventCount,                // XXX fifoReservedEventCount
    173         kMaxThreeAxisEventCount,                   // XXX fifoMaxEventCount
    174         SENSOR_STRING_TYPE_GYROSCOPE,
    175         "",                                        // requiredPermission
    176         (long)(1.0E6f / kMinSampleRateHzGyro),     // maxDelay
    177         SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagGyro,
    178         { NULL, NULL }
    179     },
    180     {
    181         "BMI160 gyroscope (uncalibrated)",
    182         "Bosch",
    183         kVersion,
    184         COMMS_SENSOR_GYRO_UNCALIBRATED,
    185         SENSOR_TYPE_GYROSCOPE_UNCALIBRATED,
    186         1000.0f * M_PI / 180.0f,                   // maxRange
    187         1000.0f * M_PI / (180.0f * 32768.0f),      // resolution
    188         0.0f,                                      // XXX power
    189         (int32_t)(1.0E6f / kMaxSampleRateHzGyro),  // minDelay
    190         kMinFifoReservedEventCount,                // XXX fifoReservedEventCount
    191         kMaxThreeAxisEventCount,                   // XXX fifoMaxEventCount
    192         SENSOR_STRING_TYPE_GYROSCOPE_UNCALIBRATED,
    193         "",                                        // requiredPermission
    194         (long)(1.0E6f / kMinSampleRateHzGyro),     // maxDelay
    195         SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagGyro,
    196         { NULL, NULL }
    197     },
    198     {
    199         "AK09915 magnetometer",
    200         "AKM",
    201         kVersion,
    202         COMMS_SENSOR_MAG,
    203         SENSOR_TYPE_MAGNETIC_FIELD,
    204         1300.0f,                                   // XXX maxRange
    205         0.0f,                                      // XXX resolution
    206         0.0f,                                      // XXX power
    207         (int32_t)(1.0E6f / kMaxSampleRateHzMag),   // minDelay
    208         600,                                       // XXX fifoReservedEventCount
    209         kMaxThreeAxisEventCount,                   // XXX fifoMaxEventCount
    210         SENSOR_STRING_TYPE_MAGNETIC_FIELD,
    211         "",                                        // requiredPermission
    212         (long)(1.0E6f / kMinSampleRateHzMag),      // maxDelay
    213         SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagMag,
    214         { NULL, NULL }
    215     },
    216     {
    217         "AK09915 magnetometer (uncalibrated)",
    218         "AKM",
    219         kVersion,
    220         COMMS_SENSOR_MAG_UNCALIBRATED,
    221         SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED,
    222         1300.0f,                                        // XXX maxRange
    223         0.0f,                                           // XXX resolution
    224         0.0f,                                           // XXX power
    225         (int32_t)(1.0E6f / kMaxSampleRateHzMag),        // minDelay
    226         600,                                            // XXX fifoReservedEventCount
    227         kMaxThreeAxisEventCount,                        // XXX fifoMaxEventCount
    228         SENSOR_STRING_TYPE_MAGNETIC_FIELD_UNCALIBRATED,
    229         "",                                             // requiredPermission
    230         (long)(1.0E6f / kMinSampleRateHzMag),           // maxDelay
    231         SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagMag,
    232         { NULL, NULL }
    233     },
    234     {
    235         "BMP285 pressure",
    236         "Bosch",
    237         kVersion,
    238         COMMS_SENSOR_PRESSURE,
    239         SENSOR_TYPE_PRESSURE,
    240         1100.0f,                                      // maxRange (hPa)
    241         0.005f,                                       // resolution (hPa)
    242         0.0f,                                         // XXX power
    243         (int32_t)(1.0E6f / kMaxSampleRateHzPressure), // minDelay
    244         300,                                          // XXX fifoReservedEventCount
    245         kMaxOneAxisEventCount,                        // XXX fifoMaxEventCount
    246         SENSOR_STRING_TYPE_PRESSURE,
    247         "",                                           // requiredPermission
    248         (long)(1.0E6f / kMinSampleRateHzPressure),    // maxDelay
    249         SENSOR_FLAG_CONTINUOUS_MODE,
    250         { NULL, NULL }
    251     },
    252     {
    253         "BMP285 temperature",
    254         "Bosch",
    255         kVersion,
    256         COMMS_SENSOR_TEMPERATURE,
    257         SENSOR_TYPE_INTERNAL_TEMPERATURE,
    258         85.0f,                                           // maxRange (degC)
    259         0.01,                                            // resolution (degC)
    260         0.0f,                                            // XXX power
    261         (int32_t)(1.0E6f / kMaxSampleRateHzTemperature), // minDelay
    262         kMinFifoReservedEventCount,                      // XXX fifoReservedEventCount
    263         kMaxOneAxisEventCount,                           // XXX fifoMaxEventCount
    264         SENSOR_STRING_TYPE_INTERNAL_TEMPERATURE,
    265         "",                                              // requiredPermission
    266         (long)(1.0E6f / kMinSampleRateHzTemperature),    // maxDelay
    267         SENSOR_FLAG_CONTINUOUS_MODE,
    268         { NULL, NULL }
    269     },
    270     {
    271         "Orientation",
    272         "Google",
    273         kVersion,
    274         COMMS_SENSOR_ORIENTATION,
    275         SENSOR_TYPE_ORIENTATION,
    276         360.0f,                                          // maxRange (deg)
    277         1.0f,                                            // XXX resolution (deg)
    278         0.0f,                                            // XXX power
    279         (int32_t)(1.0E6f / kMaxSampleRateHzOrientation), // minDelay
    280         kMinFifoReservedEventCount,                      // XXX fifoReservedEventCount
    281         kMaxThreeAxisEventCount,                         // XXX fifoMaxEventCount
    282         SENSOR_STRING_TYPE_ORIENTATION,
    283         "",                                              // requiredPermission
    284         (long)(1.0E6f / kMinSampleRateHzOrientation),    // maxDelay
    285         SENSOR_FLAG_CONTINUOUS_MODE,
    286         { NULL, NULL }
    287     },
    288     {
    289         "BMI160 Step detector",
    290         "Bosch",
    291         kVersion,
    292         COMMS_SENSOR_STEP_DETECTOR,
    293         SENSOR_TYPE_STEP_DETECTOR,
    294         1.0f,                                   // maxRange
    295         1.0f,                                   // XXX resolution
    296         0.0f,                                   // XXX power
    297         0,                                      // minDelay
    298         100,                                    // XXX fifoReservedEventCount
    299         kMaxOneAxisEventCount,                  // XXX fifoMaxEventCount
    300         SENSOR_STRING_TYPE_STEP_DETECTOR,
    301         "",                                     // requiredPermission
    302         0,                                      // maxDelay
    303         SENSOR_FLAG_SPECIAL_REPORTING_MODE,
    304         { NULL, NULL }
    305     },
    306     {
    307         "BMI160 Step counter",
    308         "Bosch",
    309         kVersion,
    310         COMMS_SENSOR_STEP_COUNTER,
    311         SENSOR_TYPE_STEP_COUNTER,
    312         1.0f,                                   // XXX maxRange
    313         1.0f,                                   // resolution
    314         0.0f,                                   // XXX power
    315         0,                                      // minDelay
    316         kMinFifoReservedEventCount,             // XXX fifoReservedEventCount
    317         kMaxOneAxisEventCount,                  // XXX fifoMaxEventCount
    318         SENSOR_STRING_TYPE_STEP_COUNTER,
    319         "",                                     // requiredPermission
    320         0,                                      // maxDelay
    321         SENSOR_FLAG_ON_CHANGE_MODE,
    322         { NULL, NULL }
    323     },
    324     {
    325         "Significant motion",
    326         "Google",
    327         kVersion,
    328         COMMS_SENSOR_SIGNIFICANT_MOTION,
    329         SENSOR_TYPE_SIGNIFICANT_MOTION,
    330         1.0f,                                   // maxRange
    331         1.0f,                                   // XXX resolution
    332         0.0f,                                   // XXX power
    333         -1,                                     // minDelay
    334         0,                                      // XXX fifoReservedEventCount
    335         0,                                      // XXX fifoMaxEventCount
    336         SENSOR_STRING_TYPE_SIGNIFICANT_MOTION,
    337         "",                                     // requiredPermission
    338         0,                                      // maxDelay
    339         SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ONE_SHOT_MODE,
    340         { NULL, NULL }
    341     },
    342     {
    343         "Gravity",
    344         "Google",
    345         kVersion,
    346         COMMS_SENSOR_GRAVITY,
    347         SENSOR_TYPE_GRAVITY,
    348         1000.0f,                                         // maxRange
    349         1.0f,                                            // XXX resolution
    350         0.0f,                                            // XXX power
    351         (int32_t)(1.0E6f / kMaxSampleRateHzOrientation), // minDelay
    352         kMinFifoReservedEventCount,                      // XXX fifoReservedEventCount
    353         kMaxThreeAxisEventCount,                         // XXX fifoMaxEventCount
    354         SENSOR_STRING_TYPE_GRAVITY,
    355         "",                                              // requiredPermission
    356         (long)(1.0E6f / kMinSampleRateHzOrientation),    // maxDelay
    357         SENSOR_FLAG_CONTINUOUS_MODE,
    358         { NULL, NULL }
    359     },
    360     {
    361         "Linear Acceleration",
    362         "Google",
    363         kVersion,
    364         COMMS_SENSOR_LINEAR_ACCEL,
    365         SENSOR_TYPE_LINEAR_ACCELERATION,
    366         1000.0f,                                         // maxRange
    367         1.0f,                                            // XXX resolution
    368         0.0f,                                            // XXX power
    369         (int32_t)(1.0E6f / kMaxSampleRateHzOrientation), // minDelay
    370         kMinFifoReservedEventCount,                      // XXX fifoReservedEventCount
    371         kMaxThreeAxisEventCount,                         // XXX fifoMaxEventCount
    372         SENSOR_STRING_TYPE_LINEAR_ACCELERATION,
    373         "",                                              // requiredPermission
    374         (long)(1.0E6f / kMinSampleRateHzOrientation),    // maxDelay
    375         SENSOR_FLAG_CONTINUOUS_MODE,
    376         { NULL, NULL }
    377     },
    378     {
    379         "Rotation Vector",
    380         "Google",
    381         kVersion,
    382         COMMS_SENSOR_ROTATION_VECTOR,
    383         SENSOR_TYPE_ROTATION_VECTOR,
    384         1000.0f,                                         // maxRange
    385         1.0f,                                            // XXX resolution
    386         0.0f,                                            // XXX power
    387         (int32_t)(1.0E6f / kMaxSampleRateHzOrientation), // minDelay
    388         kMinFifoReservedEventCount,                      // XXX fifoReservedEventCount
    389         kMaxThreeAxisEventCount,                         // XXX fifoMaxEventCount
    390         SENSOR_STRING_TYPE_ROTATION_VECTOR,
    391         "",                                              // requiredPermission
    392         (long)(1.0E6f / kMinSampleRateHzOrientation),    // maxDelay
    393         SENSOR_FLAG_CONTINUOUS_MODE,
    394         { NULL, NULL }
    395     },
    396     {
    397         "Geomagnetic Rotation Vector",
    398         "Google",
    399         kVersion,
    400         COMMS_SENSOR_GEO_MAG,
    401         SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR,
    402         1000.0f,                                         // maxRange
    403         1.0f,                                            // XXX resolution
    404         0.0f,                                            // XXX power
    405         (int32_t)(1.0E6f / kMaxSampleRateHzOrientation), // minDelay
    406         kMinFifoReservedEventCount,                      // XXX fifoReservedEventCount
    407         kMaxThreeAxisEventCount,                         // XXX fifoMaxEventCount
    408         SENSOR_STRING_TYPE_GEOMAGNETIC_ROTATION_VECTOR,
    409         "",                                              // requiredPermission
    410         (long)(1.0E6f / kMinSampleRateHzOrientation),    // maxDelay
    411         SENSOR_FLAG_CONTINUOUS_MODE,
    412         { NULL, NULL }
    413     },
    414     {
    415         "Game Rotation Vector",
    416         "Google",
    417         kVersion,
    418         COMMS_SENSOR_GAME_ROTATION_VECTOR,
    419         SENSOR_TYPE_GAME_ROTATION_VECTOR,
    420         1000.0f,                                         // maxRange
    421         1.0f,                                            // XXX resolution
    422         0.0f,                                            // XXX power
    423         (int32_t)(1.0E6f / kMaxSampleRateHzOrientation), // minDelay
    424         300,                                             // XXX fifoReservedEventCount
    425         kMaxThreeAxisEventCount,                         // XXX fifoMaxEventCount
    426         SENSOR_STRING_TYPE_GAME_ROTATION_VECTOR,
    427         "",                                              // requiredPermission
    428         (long)(1.0E6f / kMinSampleRateHzOrientation),    // maxDelay
    429         SENSOR_FLAG_CONTINUOUS_MODE,
    430         { NULL, NULL }
    431     },
    432     {
    433         "Tilt Detector",
    434         "Google",
    435         kVersion,
    436         COMMS_SENSOR_TILT,
    437         SENSOR_TYPE_TILT_DETECTOR,
    438         1.0f,                                   // maxRange
    439         1.0f,                                   // XXX resolution
    440         0.0f,                                   // XXX power
    441         0,                                      // minDelay
    442         kMinFifoReservedEventCount,             // XXX fifoReservedEventCount
    443         kMaxOneAxisEventCount,                  // XXX fifoMaxEventCount
    444         SENSOR_STRING_TYPE_TILT_DETECTOR,
    445         "",                                     // requiredPermission
    446         0,                                      // maxDelay
    447         SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_SPECIAL_REPORTING_MODE,
    448         { NULL, NULL }
    449     },
    450     {
    451         "Pickup Gesture",
    452         "Google",
    453         kVersion,
    454         COMMS_SENSOR_GESTURE,
    455         SENSOR_TYPE_PICK_UP_GESTURE,
    456         1.0f,                                   // maxRange
    457         1.0f,                                   // XXX resolution
    458         0.0f,                                   // XXX power
    459         -1,                                     // minDelay
    460         0,                                      // XXX fifoReservedEventCount
    461         0,                                      // XXX fifoMaxEventCount
    462         SENSOR_STRING_TYPE_PICK_UP_GESTURE,
    463         "",                                     // requiredPermission
    464         0,                                      // maxDelay
    465         SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ONE_SHOT_MODE,
    466         { NULL, NULL }
    467     },
    468     {
    469         "Sensors Sync",
    470         "Google",
    471         kVersion,
    472         COMMS_SENSOR_SYNC,
    473         SENSOR_TYPE_SYNC,
    474         1.0f,                                   // maxRange
    475         1.0f,                                   // XXX resolution
    476         0.1f,                                   // XXX power
    477         0,                                      // minDelay
    478         kMinFifoReservedEventCount,             // XXX fifoReservedEventCount
    479         kMaxOneAxisEventCount,                  // XXX fifoMaxEventCount
    480         SENSOR_STRING_TYPE_SYNC,
    481         "",                                     // requiredPermission
    482         0,                                      // maxDelay
    483         SENSOR_FLAG_SPECIAL_REPORTING_MODE,
    484         { NULL, NULL }
    485     },
    486     {
    487         "Double Twist",
    488         "Google",
    489         kVersion,
    490         COMMS_SENSOR_DOUBLE_TWIST,
    491         SENSOR_TYPE_DOUBLE_TWIST,
    492         1.0f,                                   // maxRange
    493         1.0f,                                   // XXX resolution
    494         0.1f,                                   // XXX power
    495         0,                                      // minDelay
    496         kMinFifoReservedEventCount,             // XXX fifoReservedEventCount
    497         kMaxOneAxisEventCount,                  // XXX fifoMaxEventCount
    498         SENSOR_STRING_TYPE_DOUBLE_TWIST,
    499         "",                                     // requiredPermission
    500         0,                                      // maxDelay
    501         SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_SPECIAL_REPORTING_MODE,
    502         { NULL, NULL }
    503     },
    504     {
    505         "Double Tap",
    506         "Google",
    507         kVersion,
    508         COMMS_SENSOR_DOUBLE_TAP,
    509         SENSOR_TYPE_DOUBLE_TAP,
    510         1.0f,                                   // maxRange
    511         1.0f,                                   // XXX resolution
    512         0.1f,                                   // XXX power
    513         0,                                      // minDelay
    514         kMinFifoReservedEventCount,             // XXX fifoReservedEventCount
    515         kMaxOneAxisEventCount,                  // XXX fifoMaxEventCount
    516         SENSOR_STRING_TYPE_DOUBLE_TAP,
    517         "",                                     // requiredPermission
    518         0,                                      // maxDelay
    519         SENSOR_FLAG_SPECIAL_REPORTING_MODE,
    520         { NULL, NULL }
    521     },
    522     {
    523         "Device Orientation",
    524         "Google",
    525         kVersion,
    526         COMMS_SENSOR_WINDOW_ORIENTATION,
    527         SENSOR_TYPE_DEVICE_ORIENTATION,
    528         3.0f,                                   // maxRange
    529         1.0f,                                   // XXX resolution
    530         0.1f,                                   // XXX power
    531         0,                                      // minDelay
    532         kMinFifoReservedEventCount,             // XXX fifoReservedEventCount
    533         kMaxOneAxisEventCount,                  // XXX fifoMaxEventCount
    534         SENSOR_STRING_TYPE_DEVICE_ORIENTATION,
    535         "",                                     // requiredPermission
    536         0,                                      // maxDelay
    537         SENSOR_FLAG_ON_CHANGE_MODE,
    538         { NULL, NULL }
    539     },
    540     {
    541         "Double Touch",
    542         "Google",
    543         kVersion,
    544         COMMS_SENSOR_DOUBLE_TOUCH,
    545         SENSOR_TYPE_DOUBLE_TOUCH,
    546         1.0f,                                   // maxRange
    547         1.0f,                                   // XXX resolution
    548         0.0f,                                   // XXX power
    549         -1,                                     // minDelay
    550         0,                                      // XXX fifoReservedEventCount
    551         0,                                      // XXX fifoMaxEventCount
    552         SENSOR_STRING_TYPE_DOUBLE_TOUCH,
    553         "",                                     // requiredPermission
    554         0,                                      // maxDelay
    555         SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ONE_SHOT_MODE,
    556         { NULL, NULL }
    557     },
    558     {
    559         "BMI160 accelerometer (uncalibrated)",
    560         "Bosch",
    561         kVersion,
    562         COMMS_SENSOR_ACCEL_UNCALIBRATED,
    563         SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED,
    564         GRAVITY_EARTH * kAccelRangeG,              // maxRange
    565         GRAVITY_EARTH * kAccelRangeG / 32768.0f,   // resolution
    566         0.0f,                                      // XXX power
    567         (int32_t)(1.0E6f / kMaxSampleRateHzAccel), // minDelay
    568         3000,                                      // XXX fifoReservedEventCount
    569         kMaxRawThreeAxisEventCount,                // XXX fifoMaxEventCount
    570         SENSOR_STRING_TYPE_ACCELEROMETER_UNCALIBRATED,
    571         "",                                        // requiredPermission
    572         (long)(1.0E6f / kMinSampleRateHzAccel),    // maxDelay
    573         SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagAccel,
    574         { NULL, NULL }
    575     },
    576 };
    577 
    578 extern const size_t kSensorCount = sizeof(kSensorList) / sizeof(sensor_t);
    579