summaryrefslogtreecommitdiff
path: root/native/android/sensor.cpp
diff options
context:
space:
mode:
authorAniroop Mathur <a.mathur@samsung.com>2015-11-03 02:02:09 +0530
committerPeng Xu <pengxu@google.com>2016-03-16 18:07:00 -0700
commitee5c18f038d952ce9378493386310899e4d51c84 (patch)
treecc06c6abc610a94408c52cf7a4a90643419137b9 /native/android/sensor.cpp
parent95972768013fe9da93fa4e3a396284acaaf67039 (diff)
Sensor: Add batch support for native applications
Currently, it is not possible for native applications to use the sensor in batch mode. As it is a 'C' header file so function overloading is not possible. Therefore, lets add a new function to enable the sensor, set the delay and batch timeout, all together. Change-Id: I565ec2d945d57f31ae11ed43bf9ba351aebd67a0 Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
Diffstat (limited to 'native/android/sensor.cpp')
-rw-r--r--native/android/sensor.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/native/android/sensor.cpp b/native/android/sensor.cpp
index 76c701a5b8ce..5cfe3004514c 100644
--- a/native/android/sensor.cpp
+++ b/native/android/sensor.cpp
@@ -105,6 +105,14 @@ int ASensorManager_destroyEventQueue(ASensorManager* manager,
/*****************************************************************************/
+int ASensorEventQueue_registerSensor(ASensorEventQueue* queue, ASensor const* sensor,
+ int32_t samplingPeriodUs, int maxBatchReportLatencyUs)
+{
+ return static_cast<SensorEventQueue*>(queue)->enableSensor(
+ static_cast<Sensor const*>(sensor)->getHandle(), samplingPeriodUs,
+ maxBatchReportLatencyUs, 0);
+}
+
int ASensorEventQueue_enableSensor(ASensorEventQueue* queue, ASensor const* sensor)
{
return static_cast<SensorEventQueue*>(queue)->enableSensor(