From 56003aac46c0d70beafadf723e8e52f5a71ff1aa Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Tue, 5 Apr 2016 17:53:09 +0900 Subject: [PATCH] capi-sensor: add returning NOT_SUPPORTED in sensor_set_max_batch_latency * if max_batch_count is 0, it means that batching feature is not supported on this sensor. so checking max_batch_count is added. Change-Id: I466b7406cdb5dfeeb584d0f23bbe8e6d2011ffcf Signed-off-by: kibak.yoon --- src/sensor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sensor.cpp b/src/sensor.cpp index befb32c..a1daebb 100644 --- a/src/sensor.cpp +++ b/src/sensor.cpp @@ -510,6 +510,7 @@ int sensor_listener_set_max_batch_latency(sensor_listener_h listener, unsigned i { int id; int type; + int max_batch_count; unsigned int event_id; _D("called sensor_set_max_batch_latency : listener[0x%x], max_batch_latency[%d]", listener, max_batch_latency); @@ -520,6 +521,12 @@ int sensor_listener_set_max_batch_latency(sensor_listener_h listener, unsigned i if (listener->magic != SENSOR_LISTENER_MAGIC) return SENSOR_ERROR_INVALID_PARAMETER; + if (!sensord_get_max_batch_count(listener->sensor, &max_batch_count)) + return SENSOR_ERROR_OPERATION_FAILED; + + if (max_batch_count == 0) + return SENSOR_ERROR_NOT_SUPPORTED; + id = listener->id; type = (int)listener->type; event_id = type << SENSOR_SHIFT_TYPE | 0x1; -- 2.7.4