diff options
author | Aravind Akella <aakella@google.com> | 2015-06-23 22:24:37 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-23 22:24:38 +0000 |
commit | 077d354252f66c5b9b7353e9b0be5758bea997c6 (patch) | |
tree | 0a67b7ba71734be8cedd88fa74cbccd249a1034d | |
parent | d6f50b4a46a706b59cfee9e2e72b5c9bedc6eba1 (diff) | |
parent | c7f54134ca255810bea017c4c20ffe8cb86fe10e (diff) | |
download | hardware_libhardware-077d354252f66c5b9b7353e9b0be5758bea997c6.zip hardware_libhardware-077d354252f66c5b9b7353e9b0be5758bea997c6.tar.gz hardware_libhardware-077d354252f66c5b9b7353e9b0be5758bea997c6.tar.bz2 |
Merge "Define a flag for whether a sensor supports data_injection mode or not." into mnc-dev
-rw-r--r-- | include/hardware/sensors.h | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h index b8b550f..b368ee6 100644 --- a/include/hardware/sensors.h +++ b/include/hardware/sensors.h @@ -108,12 +108,12 @@ enum { */ SENSOR_HAL_NORMAL_MODE = 0, - /* - * Loopback mode. In this mode, the device shall not source data from the + /* + * Data Injection mode. In this mode, the device shall not source data from the * physical sensors as it would in normal mode. Instead sensor data is * injected by the sensor service. */ - SENSOR_HAL_LOOPBACK_MODE = 0x1 + SENSOR_HAL_DATA_INJECTION_MODE = 0x1 }; /* @@ -138,7 +138,16 @@ enum { SENSOR_FLAG_CONTINUOUS_MODE = 0, // 0000 SENSOR_FLAG_ON_CHANGE_MODE = 0x2, // 0010 SENSOR_FLAG_ONE_SHOT_MODE = 0x4, // 0100 - SENSOR_FLAG_SPECIAL_REPORTING_MODE = 0x6 // 0110 + SENSOR_FLAG_SPECIAL_REPORTING_MODE = 0x6, // 0110 + + /* + * Set this flag if the sensor supports data_injection mode and allows data to be injected + * from the SensorService. When in data_injection ONLY sensors with this flag set are injected + * sensor data and only sensors with this flag set are activated. Eg: Accelerometer and Step + * Counter sensors can be set with this flag and SensorService will inject accelerometer data + * and read the corresponding step counts. + */ + SENSOR_FLAG_SUPPORTS_DATA_INJECTION = 0x8 // 1000 }; /* @@ -148,6 +157,12 @@ enum { #define REPORTING_MODE_SHIFT (1) /* + * Mask and shift for data_injection mode sensor flags defined above. + */ +#define DATA_INJECTION_MASK (0x10) +#define DATA_INJECTION_SHIFT (4) + +/* * Sensor type * * Each sensor has a type which defines what this sensor measures and how @@ -838,9 +853,9 @@ struct sensors_module_t { * 0 - Normal operation. Default state of the module. * 1 - Loopback mode. Data is injected for the the supported * sensors by the sensor service in this mode. - * @return 0 on success + * @return 0 on success * -EINVAL if requested mode is not supported - * -EPERM if operation is not allowed + * -EPERM if operation is not allowed */ int (*set_operation_mode)(unsigned int mode); }; @@ -1043,8 +1058,8 @@ typedef struct sensors_poll_device_1 { /* * Inject a single sensor sample to be to this device. * data points to the sensor event to be injected - * @return 0 on success - * -EPERM if operation is not allowed + * @return 0 on success + * -EPERM if operation is not allowed * -EINVAL if sensor event cannot be injected */ int (*inject_sensor_data)(struct sensors_poll_device_1 *dev, const sensors_event_t *data); |