Provide user callback to applications as soon as possible
authorAbhay agarwal <ay.agarwal@samsung.com>
Mon, 14 Oct 2019 07:12:07 +0000 (12:42 +0530)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 14 Oct 2019 08:43:25 +0000 (17:43 +0900)
Provide user callback earlier instead of waiting for detection window to complete.
Callback is provided as soon as the AND/OR condition for a particular user is met.
This will result in missing of device/sensor information in callback provided for
the device/sensor detected after sending callback.

Change-Id: I7a5a1912a66ec932ef261f74f354d4717994decf
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
packaging/capi-network-ua.spec
src/user-awareness-monitors.c

index 41ee5fa94d687d0819de47dce99a17ad12a318f1..15b45fddf49dd4fe162e0aa3b608c4f61c22c8d8 100644 (file)
@@ -1,6 +1,6 @@
 Name: capi-network-ua
 Summary: User Awareness Framework CAPI
-Version: 0.11.8
+Version: 0.11.9
 Release: 1
 License: Apache-2.0
 Source0: %{name}-%{version}.tar.gz
index 2e9cd3a2c2fbc75b4b96900c7499b3dd43c8e2e7..39ab618f75c7542f4c94e3d2e61d37a8efc79eff 100644 (file)
@@ -472,6 +472,7 @@ static void __ua_sensor_presence_detected(ua_monitor_s *monitor,
        FUNC_ENTRY;
 
        GSList *l;
+       GSList *l1;
        int found = 0;
        int ret = UA_ERROR_NONE;
        ua_user_state_info_s *user_state = NULL;
@@ -522,6 +523,22 @@ static void __ua_sensor_presence_detected(ua_monitor_s *monitor,
 
        __ua_monitor_send_sensor_presence_cb(monitor, device_handle, sensor_info);
 
+       if (account && user_state) {
+               __ua_monitor_send_user_presence_cb(monitor, user_state);
+       }
+
+       if (!account) {
+               for (l1 = monitor->user_state; NULL != l1; l1 = g_slist_next(l1)) {
+                       ua_user_state_info_s *user_state = l1->data;
+
+                       if (user_state) {
+                               UA_DBG("user_state->account [%s]", user_state->account);
+                               __ua_monitor_send_user_presence_cb(monitor, user_state);
+                       }
+               }
+               __ua_monitor_send_env_user_presence_cb(monitor);
+       }
+
        FUNC_EXIT;
 }