ua-api: Add support for start/stop location detection 85/260385/1
authorAbhay Agarwal <ay.agarwal@samsung.com>
Tue, 4 May 2021 05:29:48 +0000 (10:59 +0530)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Thu, 24 Jun 2021 04:09:40 +0000 (09:39 +0530)
Change-Id: I8d626d1d43c96da90385934759483ffd96071432
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
include/ua-api.h
include/ua-internal.h
ua-api/src/ua-api.c

index 915ccef..eb4e07a 100755 (executable)
@@ -380,6 +380,42 @@ int _uam_start_absence_detection(unsigned int bitmask, const char *service);
 int _uam_stop_absence_detection(unsigned int bitmask, const char *service);
 
 /**
+ * @brief Starts location detection.
+ * @since_tizen 6.5
+ *
+ * @param[in] bitmask Bitmask to detect
+ * @param[in] service Service name
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_start_location_detection(unsigned int bitmask, const char *service);
+
+/**
+ * @brief Stops location detection.
+ * @since_tizen 6.5
+ *
+ * @param[in] bitmask Bitmask to detect
+ * @param[in] service Service name
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UAM_ERROR_NONE Successful
+ * @retval #UAM_ERROR_INVALID_PARAMETER Invalid parameters
+ * @retval #UAM_ERROR_INTERNAL Internal error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _uam_stop_location_detection(unsigned int bitmask, const char *service);
+
+/**
  * @brief Starts active devices searching.
  * @since_tizen 5.5
  *
index 0e3e2e0..41156af 100755 (executable)
@@ -62,6 +62,8 @@ extern "C" {
        REQUEST(UAM_REQUEST_STOP_PRESENCE_DETECTION) \
        REQUEST(UAM_REQUEST_START_ABSENCE_DETECTION) \
        REQUEST(UAM_REQUEST_STOP_ABSENCE_DETECTION) \
+       REQUEST(UAM_REQUEST_START_LOCATION_DETECTION) \
+       REQUEST(UAM_REQUEST_STOP_LOCATION_DETECTION) \
        REQUEST(UAM_REQUEST_SET_LOW_POWER_MODE) \
        REQUEST(UAM_REQUEST_START_SEARCH_ACTIVE_DEVICES) \
        REQUEST(UAM_REQUEST_STOP_SEARCH_ACTIVE_DEVICES) \
index cb3336b..ec39dc1 100755 (executable)
@@ -726,6 +726,56 @@ UAM_EXPORT_API int _uam_stop_absence_detection(unsigned int bitmask,
        return ret;
 }
 
+UAM_EXPORT_API int _uam_start_location_detection(unsigned int bitmask,
+       const char *service)
+{
+       FUNC_ENTRY;
+       int ret;
+       char svc_str[UAM_SERVICE_MAX_STRING_LEN];
+
+       UAM_VALIDATE_INPUT_PARAMETER(service);
+
+       UAM_INIT_PARAMS();
+       UAM_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &bitmask, sizeof(unsigned int));
+       g_strlcpy(svc_str, service, UAM_SERVICE_MAX_STRING_LEN);
+       g_array_append_vals(in_param2, svc_str, sizeof(svc_str));
+
+       ret = _uam_sync_request(UAM_REQUEST_START_LOCATION_DETECTION,
+                       in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       UAM_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       FUNC_EXIT;
+       return ret;
+}
+
+UAM_EXPORT_API int _uam_stop_location_detection(unsigned int bitmask,
+       const char *service)
+{
+       FUNC_ENTRY;
+       int ret;
+       char svc_str[UAM_SERVICE_MAX_STRING_LEN];
+
+       UAM_VALIDATE_INPUT_PARAMETER(service);
+
+       UAM_INIT_PARAMS();
+       UAM_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &bitmask, sizeof(unsigned int));
+       g_strlcpy(svc_str, service, UAM_SERVICE_MAX_STRING_LEN);
+       g_array_append_vals(in_param2, svc_str, sizeof(svc_str));
+
+       ret = _uam_sync_request(UAM_REQUEST_STOP_LOCATION_DETECTION,
+                       in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       UAM_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       FUNC_EXIT;
+       return ret;
+}
+
 UAM_EXPORT_API int _uam_is_sensor_ready(unsigned int sensor, gboolean* status)
 {
        FUNC_ENTRY;