Addition of API location_manager_get_velocity_accuracy 49/242049/1
authorchakradhar <v.pogiri@samsung.com>
Sat, 22 Aug 2020 08:37:56 +0000 (14:07 +0530)
committerchakradhar <v.pogiri@samsung.com>
Sat, 22 Aug 2020 08:37:56 +0000 (14:07 +0530)
Change-Id: I4d9c3c8228c70b2c0afc5a8d925d7130cbec23b9

include/locations.h
src/locations.c

index 5a121be..20cc8c8 100755 (executable)
@@ -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.
index 18d86e7..62cae97 100755 (executable)
@@ -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");