From: kibak.yoon Date: Tue, 5 Apr 2016 08:53:09 +0000 (+0900) Subject: capi-sensor: add returning NOT_SUPPORTED in sensor_set_max_batch_latency X-Git-Tag: accepted/tizen/common/20160427.053752^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F65280%2F1;p=platform%2Fcore%2Fapi%2Fsensor.git 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 --- 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;