From f24246ed14fc49f9fe1fed2f9e184cbbba6304fa Mon Sep 17 00:00:00 2001 From: Simo Piiroinen Date: Fri, 28 Sep 2018 10:28:42 +0300 Subject: [PATCH] [hybrisadaptor] Provide fallback values for sensor types. JB#43020 The code can't be compiled for devices that use older android hal versions that do not define all sensor types referred to in the code. Provide values for all sensor types that are not defined in the android header files. Signed-off-by: Simo Piiroinen --- core/hybrisadaptor.cpp | 82 +++++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 20 deletions(-) diff --git a/core/hybrisadaptor.cpp b/core/hybrisadaptor.cpp index 4bc734c5..bd05355f 100644 --- a/core/hybrisadaptor.cpp +++ b/core/hybrisadaptor.cpp @@ -34,54 +34,96 @@ #include #include +/* Older devices probably have old android hal and thus do + * not define sensor all sensor types that have been added + * later on -> In order to both use symbolic names and + * compile for all devices we need to fill in holes that + * android hal for some particular device might have. + */ +#ifndef SENSOR_TYPE_META_DATA +#define SENSOR_TYPE_META_DATA (0) +#endif #ifndef SENSOR_TYPE_ACCELEROMETER -#define SENSOR_TYPE_ACCELEROMETER (1) +#define SENSOR_TYPE_ACCELEROMETER (1) +#endif +#ifndef SENSOR_TYPE_GEOMAGNETIC_FIELD +#define SENSOR_TYPE_GEOMAGNETIC_FIELD (2) #endif #ifndef SENSOR_TYPE_MAGNETIC_FIELD -#define SENSOR_TYPE_MAGNETIC_FIELD (2) +#define SENSOR_TYPE_MAGNETIC_FIELD SENSOR_TYPE_GEOMAGNETIC_FIELD #endif #ifndef SENSOR_TYPE_ORIENTATION -#define SENSOR_TYPE_ORIENTATION (3) +#define SENSOR_TYPE_ORIENTATION (3) #endif #ifndef SENSOR_TYPE_GYROSCOPE -#define SENSOR_TYPE_GYROSCOPE (4) +#define SENSOR_TYPE_GYROSCOPE (4) #endif #ifndef SENSOR_TYPE_LIGHT -#define SENSOR_TYPE_LIGHT (5) +#define SENSOR_TYPE_LIGHT (5) #endif #ifndef SENSOR_TYPE_PRESSURE -#define SENSOR_TYPE_PRESSURE (6) +#define SENSOR_TYPE_PRESSURE (6) #endif #ifndef SENSOR_TYPE_TEMPERATURE -#define SENSOR_TYPE_TEMPERATURE (7) +#define SENSOR_TYPE_TEMPERATURE (7) #endif #ifndef SENSOR_TYPE_PROXIMITY -#define SENSOR_TYPE_PROXIMITY (8) +#define SENSOR_TYPE_PROXIMITY (8) #endif #ifndef SENSOR_TYPE_GRAVITY -#define SENSOR_TYPE_GRAVITY (9) +#define SENSOR_TYPE_GRAVITY (9) #endif #ifndef SENSOR_TYPE_LINEAR_ACCELERATION -#define SENSOR_TYPE_LINEAR_ACCELERATION (10) +#define SENSOR_TYPE_LINEAR_ACCELERATION (10) #endif #ifndef SENSOR_TYPE_ROTATION_VECTOR -#define SENSOR_TYPE_ROTATION_VECTOR (11) +#define SENSOR_TYPE_ROTATION_VECTOR (11) #endif #ifndef SENSOR_TYPE_RELATIVE_HUMIDITY -#define SENSOR_TYPE_RELATIVE_HUMIDITY (12) +#define SENSOR_TYPE_RELATIVE_HUMIDITY (12) #endif #ifndef SENSOR_TYPE_AMBIENT_TEMPERATURE -#define SENSOR_TYPE_AMBIENT_TEMPERATURE (13) +#define SENSOR_TYPE_AMBIENT_TEMPERATURE (13) +#endif +#ifndef SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED +#define SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED (14) +#endif +#ifndef SENSOR_TYPE_GAME_ROTATION_VECTOR +#define SENSOR_TYPE_GAME_ROTATION_VECTOR (15) +#endif +#ifndef SENSOR_TYPE_GYROSCOPE_UNCALIBRATED +#define SENSOR_TYPE_GYROSCOPE_UNCALIBRATED (16) +#endif +#ifndef SENSOR_TYPE_SIGNIFICANT_MOTION +#define SENSOR_TYPE_SIGNIFICANT_MOTION (17) +#endif +#ifndef SENSOR_TYPE_STEP_DETECTOR +#define SENSOR_TYPE_STEP_DETECTOR (18) #endif -//#define SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED (14) -//#define SENSOR_TYPE_GAME_ROTATION_VECTOR (15) -//#define SENSOR_TYPE_GYROSCOPE_UNCALIBRATED (16) -//#define SENSOR_TYPE_SIGNIFICANT_MOTION (17) -//#define SENSOR_TYPE_STEP_DETECTOR (18) #ifndef SENSOR_TYPE_STEP_COUNTER -#define SENSOR_TYPE_STEP_COUNTER (19) +#define SENSOR_TYPE_STEP_COUNTER (19) +#endif +#ifndef SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR +#define SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR (20) +#endif +#ifndef SENSOR_TYPE_HEART_RATE +#define SENSOR_TYPE_HEART_RATE (21) +#endif +#ifndef SENSOR_TYPE_TILT_DETECTOR +#define SENSOR_TYPE_TILT_DETECTOR (22) +#endif +#ifndef SENSOR_TYPE_WAKE_GESTURE +#define SENSOR_TYPE_WAKE_GESTURE (23) +#endif +#ifndef SENSOR_TYPE_GLANCE_GESTURE +#define SENSOR_TYPE_GLANCE_GESTURE (24) +#endif +#ifndef SENSOR_TYPE_PICK_UP_GESTURE +#define SENSOR_TYPE_PICK_UP_GESTURE (25) +#endif +#ifndef SENSOR_TYPE_WRIST_TILT_GESTURE +#define SENSOR_TYPE_WRIST_TILT_GESTURE (26) #endif -//#define SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR (20) /* ========================================================================= * * UTILITIES