summaryrefslogtreecommitdiffstats
path: root/include/hardware/sensors.h
diff options
context:
space:
mode:
authorAravind Akella <aakella@google.com>2014-04-30 11:46:09 -0700
committerAravind Akella <aakella@google.com>2014-05-05 15:45:07 -0700
commitf895c6824f02ae5f4e7ca9b896bdd53f515ca12d (patch)
tree3c43a18a642a54bad56d6072c764a2bb1a96e485 /include/hardware/sensors.h
parent2616c9016e550ddec9545bbac8cca175f83256b0 (diff)
downloadhardware_libhardware-f895c6824f02ae5f4e7ca9b896bdd53f515ca12d.zip
hardware_libhardware-f895c6824f02ae5f4e7ca9b896bdd53f515ca12d.tar.gz
hardware_libhardware-f895c6824f02ae5f4e7ca9b896bdd53f515ca12d.tar.bz2
Define TILT sensor
Change-Id: Ic3c223488aa4a0d66b07ae3065e59f8e2fe69ceb
Diffstat (limited to 'include/hardware/sensors.h')
-rw-r--r--include/hardware/sensors.h38
1 files changed, 34 insertions, 4 deletions
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
index de4ac0d..d5be0c1 100644
--- a/include/hardware/sensors.h
+++ b/include/hardware/sensors.h
@@ -436,10 +436,14 @@ enum {
/*
* The sensors below are wake_up variants of the base sensor types defined
* above. When registered in batch mode, these sensors will wake up the AP when
- * their FIFOs are full. A separate FIFO has to be maintained for wake up
- * sensors and non wake up sensors. The non wake-up sensors need to overwrite
- * their FIFOs when they are full till the AP wakes up and the wake-up sensors
- * will wake-up the AP when their FIFOs are full without losing events.
+ * their FIFOs are full or when the batch timeout expires. A separate FIFO has
+ * to be maintained for wake up sensors and non wake up sensors. The non wake-up
+ * sensors need to overwrite their FIFOs when they are full till the AP wakes up
+ * and the wake-up sensors will wake-up the AP when their FIFOs are full or when
+ * the batch timeout expires without losing events.
+ * Note: Sensors of type SENSOR_TYPE_PROXIMITY are also wake up sensors and
+ * should be treated as such. Wake-up one-shot sensors like SIGNIFICANT_MOTION
+ * cannot be batched, hence the text about batch above doesn't apply to them.
*
* Define these sensors only if:
* 1) batching is supported.
@@ -503,6 +507,32 @@ enum {
#define SENSOR_TYPE_WAKE_UP_HEART_RATE (40)
#define SENSOR_STRING_TYPE_WAKE_UP_HEART_RATE "android.sensor.wake_up_heart_rate"
+/*
+ * SENSOR_TYPE_WAKE_UP_TILT_DETECTOR
+ * trigger-mode: special (setDelay has no impact)
+ * wake-up sensor: yes (set SENSOR_FLAG_WAKE_UP flag)
+ *
+ * A sensor of this type generates an event each time a tilt event is detected. A tilt event
+ * should be generated if the direction of the 2-seconds window average gravity changed by at least
+ * 35 degrees since the activation of the sensor.
+ * initial_estimated_gravity = average of accelerometer measurements over the first
+ * 1 second after activation.
+ * current_estimated_gravity = average of accelerometer measurements over the last 2 seconds.
+ * trigger when angle (initial_estimated_gravity, current_estimated_gravity) > 35 degrees
+ *
+ * Large accelerations without a change in phone orientation should not trigger a tilt event.
+ * For example, a sharp turn or strong acceleration while driving a car should not trigger a tilt
+ * event, even though the angle of the average acceleration might vary by more than 35 degrees.
+ *
+ * Typically, this sensor is implemented with the help of only an accelerometer. Other sensors can
+ * be used as well if they do not increase the power consumption significantly. This is a low power
+ * sensor that should allow the AP to go into suspend mode. Do not emulate this sensor in the HAL.
+ * Like other wake up sensors, the driver is expected to a hold a wake_lock with a timeout of 200 ms
+ * while reporting this event. The only allowed return value is 1.0.
+ */
+#define SENSOR_TYPE_WAKE_UP_TILT_DETECTOR (41)
+#define SENSOR_STRING_TYPE_WAKE_UP_TILT_DETECTOR "android.sensor.wake_up_tilt_detector"
+
/**
* Values returned by the accelerometer in various locations in the universe.
* all values are in SI units (m/s^2)