summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLokesh <l.kasana@samsung.com>2019-07-16 10:39:11 +0530
committersaerome.kim <saerome.kim@samsung.com>2019-07-23 15:14:08 +0900
commit8901c713dfc475e26d11cc6f848a517e4d36aef3 (patch)
treeef97f1196ac91ad1975c42c2543c3b827722ff26
parentd3ed9fa37de5fd29a6dac435ac3c7ff71e98167e (diff)
downloaduser-awareness-8901c713dfc475e26d11cc6f848a517e4d36aef3.tar.gz
user-awareness-8901c713dfc475e26d11cc6f848a517e4d36aef3.tar.bz2
user-awareness-8901c713dfc475e26d11cc6f848a517e4d36aef3.zip
Changed start presence/absence detection according to service_handle
Change-Id: Ie996a9e9fdb34d2b7068874f1e4b6edd4db03bb1 Signed-off-by: Lokesh <l.kasana@samsung.com>
-rw-r--r--include/user-awareness-private.h15
-rw-r--r--include/user-awareness.h8
-rw-r--r--src/user-awareness-monitors.c22
-rw-r--r--src/user-awareness-service.c9
4 files changed, 48 insertions, 6 deletions
diff --git a/include/user-awareness-private.h b/include/user-awareness-private.h
index 824e32e..4a79e47 100644
--- a/include/user-awareness-private.h
+++ b/include/user-awareness-private.h
@@ -738,6 +738,21 @@ int _ua_is_device_exist(char *mobile_id, char *mac, ua_mac_type_e type,
gboolean *is_exist);
/**
+ * @brief Gets the service list.
+ * @since_tizen 5.5
+ *
+ * @remarks The returned value should not be released.
+ * @remarks The returned value is managed by the platform and will be released when destroying service list.
+ *
+ * @return not null on success, otherwise error
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+GSList *_ua_service_get_services(void);
+
+/**
* @brief Gets the user list.
* @since_tizen 5.5
*
diff --git a/include/user-awareness.h b/include/user-awareness.h
index 158fa9c..db2e19e 100644
--- a/include/user-awareness.h
+++ b/include/user-awareness.h
@@ -958,7 +958,7 @@ int ua_monitor_cancel_scan_devices(ua_monitor_h monitor);
* Therefore, the callback will be invoked when any user is detected by sensors.
*
* @param[in] handle The monitor handle
- * @param[in] service name, If service name is NULL then montior will start for default service.
+ * @param[in] service_handle The service handle. If service is NULL then montior will start for default service.
* @param[in] mode User detection mode. \n
* #UA_DETECT_MODE_ALL_SENSOR : Detection callback will be invoked only after a user is
* detected by all sensors added to monitor. \n
@@ -983,7 +983,7 @@ int ua_monitor_cancel_scan_devices(ua_monitor_h monitor);
*/
int ua_monitor_start_presence_detection(
ua_monitor_h handle,
- const char* service,
+ ua_service_h service_handle,
ua_detection_mode_e mode,
ua_presence_detected_cb callback,
void *user_data);
@@ -1019,7 +1019,7 @@ int ua_monitor_stop_presence_detection(
* Therefore, the callback will be invoked only when no user is detected by sensors.
*
* @param[in] handle The monitor handle
- * @param[in] service name, If service name is NULL then montior will start for default service.
+ * @param[in] service_handle The service handle. If service is NULL then montior will start for default service.
* @param[in] mode User detection mode. \n
* #UA_DETECT_MODE_ALL_SENSOR : Detection callback will be invoked only after no user is
* detected by all sensors added to monitor. \n
@@ -1044,7 +1044,7 @@ int ua_monitor_stop_presence_detection(
*/
int ua_monitor_start_absence_detection(
ua_monitor_h handle,
- const char* service,
+ ua_service_h service_handle,
ua_detection_mode_e mode,
ua_absence_detected_cb callback,
void *user_data);
diff --git a/src/user-awareness-monitors.c b/src/user-awareness-monitors.c
index 1d8a780..f2c6467 100644
--- a/src/user-awareness-monitors.c
+++ b/src/user-awareness-monitors.c
@@ -550,7 +550,7 @@ static int __ua_start_monitoring(unsigned int bitmask, char *service, ua_detecti
int ua_monitor_start_presence_detection(
ua_monitor_h handle,
- const char* service,
+ ua_service_h service_handle,
ua_detection_mode_e mode,
ua_presence_detected_cb callback,
void *user_data)
@@ -558,12 +558,21 @@ int ua_monitor_start_presence_detection(
FUNC_ENTRY;
int ret;
ua_monitor_s *monitor = (ua_monitor_s *)handle;
+ ua_service_info_s *service_info = (ua_service_info_s *)service_handle;
ua_detection_type_e detect = UA_PRESENCE_DETECTION;
+ char *service;
+ GSList *ua_services_list = _ua_service_get_services();
UA_VALIDATE_INPUT_PARAMETER(handle);
UA_VALIDATE_HANDLE(handle, ua_monitor_list);
retv_if(TRUE == monitor->presence_detection_started, UA_ERROR_NOW_IN_PROGRESS);
+ if (service_handle) {
+ UA_VALIDATE_HANDLE(service_handle, ua_services_list);
+ service = g_strdup(service_info->name);
+ } else
+ service = NULL;
+
if (monitor->service)
if ((service && g_strcmp0(monitor->service, service)) ||
(!service && g_strcmp0(monitor->service, UA_SERVICE_DEFAULT)))
@@ -604,7 +613,7 @@ int ua_monitor_start_presence_detection(
int ua_monitor_start_absence_detection(
ua_monitor_h handle,
- const char* service,
+ ua_service_h service_handle,
ua_detection_mode_e mode,
ua_absence_detected_cb callback,
void *user_data)
@@ -612,12 +621,21 @@ int ua_monitor_start_absence_detection(
FUNC_ENTRY;
int ret;
ua_monitor_s *monitor = (ua_monitor_s *)handle;
+ ua_service_info_s *service_info = (ua_service_info_s *)service_handle;
ua_detection_type_e detect = UA_ABSENCE_DETECTION;
+ char *service;
+ GSList *ua_services_list = _ua_service_get_services();
UA_VALIDATE_INPUT_PARAMETER(handle);
UA_VALIDATE_HANDLE(handle, ua_monitor_list);
retv_if(TRUE == monitor->absence_detection_started, UA_ERROR_NOW_IN_PROGRESS);
+ if (service_handle) {
+ UA_VALIDATE_HANDLE(service_handle, ua_services_list);
+ service = g_strdup(service_info->name);
+ } else
+ service = NULL;
+
if (monitor->service)
if ((service && g_strcmp0(monitor->service, service)) ||
(!service && g_strcmp0(monitor->service, UA_SERVICE_DEFAULT)))
diff --git a/src/user-awareness-service.c b/src/user-awareness-service.c
index f632e2c..b4dc1f1 100644
--- a/src/user-awareness-service.c
+++ b/src/user-awareness-service.c
@@ -878,3 +878,12 @@ int _ua_intr_get_default_service(void)
return UA_ERROR_NONE;
}
+/* LCOV_EXCL_START */
+GSList *_ua_service_get_services(void)
+{
+ FUNC_ENTRY;
+ FUNC_EXIT;
+ return ua_services_list;
+}
+/* LCOV_EXCL_STOP */
+