From 7017c97cd09492775ebe27d2b8923f89503952b7 Mon Sep 17 00:00:00 2001 From: chakradhar Date: Sat, 22 Aug 2020 14:07:56 +0530 Subject: [PATCH] Addition of API location_manager_get_velocity_accuracy Change-Id: I4d9c3c8228c70b2c0afc5a8d925d7130cbec23b9 --- include/locations.h | 19 ++++++++++++++++++- src/locations.c | 24 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/include/locations.h b/include/locations.h index 5a121be..20cc8c8 100755 --- a/include/locations.h +++ b/include/locations.h @@ -607,7 +607,6 @@ int location_manager_get_location(location_manager_h manager, double *altitude, */ int location_manager_get_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp); - /** * @brief Gets the current accuracy information. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif @@ -629,6 +628,24 @@ int location_manager_get_velocity(location_manager_h manager, double *climb, dou */ int location_manager_get_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical); +/** + * @brief Gets the current velocity accuracy information. + * @since_tizen @6.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/location + * @param[in] manager The location manager handle + * @param[out] velocity_accuracy The velocity accuracy (m/s) + * @return @c 0 on success, + * otherwise a negative error value + * @retval #LOCATIONS_ERROR_NONE Successful + * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument + * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available + * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled + * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method + * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported + * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start(). + */ +int location_manager_get_velocity_accuracy(location_manager_h manager, double *velocity_accuracy); /** * @brief Gets the last position information which is recorded. diff --git a/src/locations.c b/src/locations.c index 18d86e7..62cae97 100755 --- a/src/locations.c +++ b/src/locations.c @@ -902,6 +902,30 @@ EXPORT_API int location_manager_get_accuracy(location_manager_h manager, locatio return LOCATIONS_ERROR_NONE; } +EXPORT_API int location_manager_get_velocity_accuracy(location_manager_h manager, double *velocity_accuracy) +{ + LOCATIONS_LOGD("location_manager_get_velocity_accuracy"); + LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported()); + LOCATIONS_NULL_ARG_CHECK(manager); + LOCATIONS_NULL_ARG_CHECK(velocity_accuracy); + location_manager_s *handle = (location_manager_s *) manager; + + int ret; + LocationPosition *pos = NULL; + LocationAccuracy *acc = NULL; + ret = location_get_position(handle->object, &pos, &acc); + if (ret != LOCATION_ERROR_NONE) + return __convert_error_code(ret); //LCOV_EXCL_LINE + + if (acc == NULL) + return __convert_error_code(LOCATION_ERROR_NOT_AVAILABLE); //LCOV_EXCL_LINE + + *velocity_accuracy = acc->vertical_accuracy; + location_position_free(pos); + location_accuracy_free(acc); + return LOCATIONS_ERROR_NONE; +} + EXPORT_API int location_manager_get_last_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp) { LOCATIONS_LOGD("location_manager_get_last_position"); -- 2.7.4