Add API's to get distance and position 95/260395/2
authorAbhay Agarwal <ay.agarwal@samsung.com>
Thu, 20 May 2021 12:02:04 +0000 (17:32 +0530)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Fri, 25 Jun 2021 12:03:12 +0000 (17:33 +0530)
Change-Id: Ie806f363b543500b3001780a512e8646cd35b29c
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
include/user-awareness-internal.h
src/user-awareness-monitors.c

index 8f5790e1125e6c977e64684ade01e27af08cb8f9..dd4d6734a2d5b73a2c64448a031058a096f90ee1 100755 (executable)
@@ -349,6 +349,7 @@ int ua_service_get_device_discriminant(
                bool *discriminant);
 
 /**
+ * @internal
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Starts user location detection.
  * @since_tizen 6.5
@@ -378,6 +379,7 @@ int ua_monitor_start_location_detection(
                void *user_data);
 
 /**
+ * @internal
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @brief Stops user location detection.
  * @since_tizen 6.5
@@ -398,6 +400,39 @@ int ua_monitor_start_location_detection(
 int ua_monitor_stop_location_detection(
                        ua_monitor_h monitor);
 
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets the distance for the location handle.
+ * @since_tizen 6.5
+ *
+ * @param[in] location handle Location handle for location information.
+ * @param[out] distance distance of the detected device and user.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
+ */
+int ua_location_get_distance(ua_location_h location_handle, int *distance);
+
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets the position for the location handle.
+ * @since_tizen 6.5
+ *
+ * @param[in] location handle Location handle for location information.
+ * @param[out] x x-coordinate of the location.
+ * @param[out] y y-coordinate of the location.
+ * @param[out] z z-coordinate of the location.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #UA_ERROR_NOT_INITIALIZED Not initialized yet
+ */
+int ua_location_get_position(ua_location_h location_handle, int *x, int *y, int *z);
 
 /* Deprecated API's */
 
index 2d3f03ec7f95d385eeb69052bf17f77aaa6cafa3..f74deaca0ade8d548876e57248b2fec32c949dad 100755 (executable)
@@ -915,7 +915,6 @@ static void __ua_sensor_location_detected(ua_monitor_s *monitor,
        FUNC_EXIT;
 }
 
-
 void _ua_monitor_handle_scanned_device(int result, uam_device_info_s *uam_info)
 {
        FUNC_ENTRY;
@@ -1974,6 +1973,47 @@ int ua_monitor_stop_location_detection(ua_monitor_h handle)
        return UA_ERROR_NONE;
 }
 
+int ua_location_get_distance(ua_location_h location_handle, int *distance)
+{
+       FUNC_ENTRY;
+
+       ua_location_info_s *location = (ua_location_info_s*)location_handle;
+
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
+       UA_CHECK_INIT_STATUS();
+       UA_VALIDATE_INPUT_PARAMETER(distance);
+       UA_VALIDATE_INPUT_PARAMETER(location_handle);
+
+       *distance = location->distance;
+
+       FUNC_EXIT;
+       return UA_ERROR_NONE;
+
+}
+
+int ua_location_get_position(ua_location_h location_handle,
+                                       int *x, int* y, int* z)
+{
+       FUNC_ENTRY;
+
+       ua_location_info_s *location = (ua_location_info_s*)location_handle;
+
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
+       UA_CHECK_INIT_STATUS();
+       UA_VALIDATE_INPUT_PARAMETER(x);
+       UA_VALIDATE_INPUT_PARAMETER(y);
+       UA_VALIDATE_INPUT_PARAMETER(z);
+       UA_VALIDATE_INPUT_PARAMETER(location_handle);
+
+       *x = location->x;
+       *y = location->y;
+       *z = location->z;
+
+       FUNC_EXIT;
+       return UA_ERROR_NONE;
+
+}
+
 int ua_monitor_set_brightness_threshold(ua_monitor_h handle,
        int presence_threshold, int absence_threshold)
 {