From: Abhay Agarwal Date: Thu, 20 May 2021 12:02:04 +0000 (+0530) Subject: Add API's to get distance and position X-Git-Tag: submit/tizen/20210629.001718~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53aa3cada0e019a3668183e12e62c43a26568e8c;p=platform%2Fcore%2Fapi%2Fuser-awareness.git Add API's to get distance and position Change-Id: Ie806f363b543500b3001780a512e8646cd35b29c Signed-off-by: Abhay Agarwal --- diff --git a/include/user-awareness-internal.h b/include/user-awareness-internal.h index 8f5790e..dd4d673 100755 --- a/include/user-awareness-internal.h +++ b/include/user-awareness-internal.h @@ -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 */ diff --git a/src/user-awareness-monitors.c b/src/user-awareness-monitors.c index 2d3f03e..f74deac 100755 --- a/src/user-awareness-monitors.c +++ b/src/user-awareness-monitors.c @@ -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) {