From: Hongkuk, Son Date: Tue, 20 Oct 2015 11:51:43 +0000 (+0900) Subject: capi-sensor: sync with SPIN tizen_2.4 X-Git-Tag: submit/tizen/20151113.112518^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=192cb616de4effe7e4ec739f4ed3fe5399e15490;p=platform%2Fcore%2Fapi%2Fsensor.git capi-sensor: sync with SPIN tizen_2.4 Signed-off-by: Hongkuk, Son Change-Id: I9717ada136cf433586dc9450f25727af28d97b70 --- diff --git a/doc/sensor_doc.h b/doc/sensor_doc.h index 73f26b7..9140390 100644 --- a/doc/sensor_doc.h +++ b/doc/sensor_doc.h @@ -61,7 +61,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from Feature Element. + * More details on featuring your application can be found from Feature Element. * */ @@ -103,7 +103,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from Feature Element. + * More details on featuring your application can be found from Feature Element. * */ @@ -144,7 +144,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from Feature Element. + * More details on featuring your application can be found from Feature Element. * * */ diff --git a/include/sensor.h b/include/sensor.h index e884c63..26a4e40 100644 --- a/include/sensor.h +++ b/include/sensor.h @@ -417,6 +417,10 @@ int sensor_listener_unset_accuracy_cb(sensor_listener_h listener); /** * @brief Gets sensor data. + * @details This function may fail (return #SENSOR_ERROR_OPERATION_FAILED) if it is called before the sensor is ready. + * In case of interval-driven sensors, + * it is recommended to call the function after at least one sensor event is delivered. + * Otherwise, applications can retry to call this function to be sure that the sensor is ready. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] listener The listener handle @@ -428,6 +432,7 @@ int sensor_listener_unset_accuracy_cb(sensor_listener_h listener); * @retval #SENSOR_ERROR_INVALID_PARAMETER Invalid parameter * @retval #SENSOR_ERROR_NOT_SUPPORTED The sensor type is not supported in the current device * @retval #SENSOR_ERROR_IO_ERROR I/O error + * @retval #SENSOR_ERROR_OPERATION_FAILED Operation failed * * @pre In order to read sensor data, an application should call sensor_listener_start(). */ @@ -435,6 +440,11 @@ int sensor_listener_read_data(sensor_listener_h listener, sensor_event_s *event) /** * @brief Changes the interval at sensor measurements. + * @details The specified interval is only a suggested interval between sensor measurements. + * You will get at least one sensor measurement within the interval you specify, + * but the actual interval between sensor measurements can be affected by other applications and the system. + * To reduce the system overhead, it is recommended to set the longest interval that you can, + * because the system usually chooses the shortest interval among all intervals specified. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] listener The listener handle @@ -471,7 +481,7 @@ int sensor_listener_set_max_batch_latency(sensor_listener_h listener, unsigned i /** * @brief Changes the option of the sensor. - * @details If it is default, sensor data cannot be recieved when the LCD is off and in the power save mode. + * @details If it is default, sensor data cannot be received when the LCD is off and in the power save mode. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] listener The listener handle diff --git a/src/sensor.cpp b/src/sensor.cpp index c214e38..754f014 100644 --- a/src/sensor.cpp +++ b/src/sensor.cpp @@ -522,12 +522,22 @@ 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_change_event_max_batch_latency(listener->id, max_batch_latency)) +#ifdef BATCH_SUPPORT + int type; + unsigned int event_id; + + type = (int)listener->type; + event_id = type << SENSOR_SHIFT_TYPE | 0x1; + + if (!sensord_change_event_max_batch_latency(listener->id, event_id, max_batch_latency)) return SENSOR_ERROR_NOT_SUPPORTED; _D("success sensor_set_max_batch_latency"); return SENSOR_ERROR_NONE; +#else + return SENSOR_ERROR_NOT_SUPPORTED; +#endif /* BATCH_SUPPORT */ } int sensor_listener_set_option(sensor_listener_h listener, sensor_option_e option)