summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-07-29 15:33:22 -0700
committerMathias Agopian <mathias@google.com>2010-07-29 15:33:22 -0700
commit1511e20fbbdfe7bf30b9de73f06fc981eb494f09 (patch)
tree9b494de324789a1fc8292a8709da89d90ea45650
parent1832f55760fff86d00b5d808b3da8f1e55a889e5 (diff)
downloadlibhardware-1511e20fbbdfe7bf30b9de73f06fc981eb494f09.tar.gz
improved comments and added a minDelay attribute to sensor_t
Change-Id: Ie00fe8260089614e15f1f8035b8392711dff048c
-rw-r--r--include/hardware/sensors.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
index 0a3d673c..6dccddd2 100644
--- a/include/hardware/sensors.h
+++ b/include/hardware/sensors.h
@@ -321,8 +321,12 @@ struct sensor_t {
float resolution;
/* rough estimate of this sensor's power consumption in mA */
float power;
+ /* minimum delay allowed between events in microseconds. A value of zero
+ * means that this sensor doesn't report events at a constant rate, but
+ * rather only when a new data is available */
+ int32_t minDelay;
/* reserved fields, must be zero */
- void* reserved[9];
+ void* reserved[8];
};
@@ -344,7 +348,10 @@ struct sensors_poll_device_t {
int handle, int enabled);
/**
- * Set the delay between sensor events in nanoseconds for a given sensor
+ * Set the delay between sensor events in nanoseconds for a given sensor.
+ * It is an error to set a delay inferior to the value defined by
+ * sensor_t::minDelay. If sensor_t::minDelay is zero, setDelay() is
+ * ignored and returns 0.
*
* @return 0 if successful, < 0 on error
*/
@@ -353,8 +360,10 @@ struct sensors_poll_device_t {
/**
* Returns an array of sensor data.
+ * This function must block until events are available.
*
* @return the number of events read on success, or -errno in case of an error.
+ * This function should never return 0 (no event).
*
*/
int (*poll)(struct sensors_poll_device_t *dev,