diff options
author | Mathias Agopian <mathias@google.com> | 2010-07-29 16:51:38 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-07-29 18:18:00 -0700 |
commit | 050b56244ff46d43e4886018d7cd20f0b1dc02b9 (patch) | |
tree | 1c0cfcd08dbd18b386bebe5dd2cbeb1c945ccbda /native/include | |
parent | 3fb627525e077fa5452a99ac1e2a7e9c41995044 (diff) | |
download | frameworks_base-050b56244ff46d43e4886018d7cd20f0b1dc02b9.zip frameworks_base-050b56244ff46d43e4886018d7cd20f0b1dc02b9.tar.gz frameworks_base-050b56244ff46d43e4886018d7cd20f0b1dc02b9.tar.bz2 |
Added SensorManager.getMinDelay()
Exposed the new "min delay" sensor property through native and
java sensor apis. This allows the caller to know what is the
maximum rate at which a sensor can return events, or, if a sensor
works in "update" mode (events returned only when the value changes).
Also augmented SensorManager.regusterSensorEvent() so that it can
accept a value in microsecond in addition to the 4 constants already
defined.
Change-Id: If425e9979892666df8c989d7de3c362230fa19e0
Diffstat (limited to 'native/include')
-rw-r--r-- | native/include/android/sensor.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/native/include/android/sensor.h b/native/include/android/sensor.h index 00d95d8..b4ce024 100644 --- a/native/include/android/sensor.h +++ b/native/include/android/sensor.h @@ -121,6 +121,7 @@ typedef struct ASensorEvent { float temperature; float distance; float light; + float pressure; }; int32_t reserved1[4]; } ASensorEvent; @@ -188,7 +189,8 @@ int ASensorEventQueue_disableSensor(ASensorEventQueue* queue, ASensor const* sen /* * Sets the delivery rate of events in microseconds for the given sensor. * Note that this is a hint only, generally event will arrive at a higher - * rate. + * rate. It is an error to set a rate inferior to the value returned by + * ASensor_getMinDelay(). * Returns a negative error code on failure. */ int ASensorEventQueue_setEventRate(ASensorEventQueue* queue, ASensor const* sensor, int32_t usec); @@ -239,6 +241,13 @@ int ASensor_getType(ASensor const* sensor); */ float ASensor_getResolution(ASensor const* sensor); +/* + * Returns the 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. + */ +int ASensor_getMinDelay(ASensor const* sensor); + #ifdef __cplusplus }; |