Provide detected sensor information in ALL Mode accepted/tizen/unified/20191002.013420 submit/tizen/20191001.112138
authorAbhay Agarwal <ay.agarwal@samsung.com>
Tue, 1 Oct 2019 02:04:21 +0000 (11:04 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Tue, 1 Oct 2019 04:29:35 +0000 (13:29 +0900)
Change-Id: Ia5247115d8ecf22faff6cc48f826775ec77c55c5
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
packaging/capi-network-ua.spec
src/user-awareness-monitors.c
test/uat-detections.c

index dc7939839e659204db06b985796983d50246002e..5fd430d2e532ee0153d13302871dd4f1f476d0b2 100644 (file)
@@ -1,6 +1,6 @@
 Name: capi-network-ua
 Summary: User Awareness Framework CAPI
-Version: 0.10.2
+Version: 0.10.3
 Release: 1
 License: Apache-2.0
 Source0: %{name}-%{version}.tar.gz
index 9f1dc24a12db8cc95155c2227e4de4bee6d447e9..1235bda963eee269938c5436236a64f1d54ac0c4 100644 (file)
@@ -206,7 +206,7 @@ static void __ua_send_presence_detection()
                if (monitor->sensor_bitmask == monitor->presence_detected_bitmask) {
                        if (monitor->presence_cb)
                                monitor->presence_cb(UA_ERROR_NONE, monitor,
-                                               UA_SENSOR_MAX, NULL, monitor->user_data);
+                                               monitor->presence_detected_bitmask, NULL, monitor->user_data);
                }
 
                monitor->presence_detected_bitmask = 0;
index 03cf336aa444148de3062c34a16880267ada564f..ce6ce7733c90da51629dd0dac0239e27dcc8e652 100644 (file)
@@ -76,24 +76,34 @@ static void __sensor_presence_detected_cb(int result, ua_monitor_h monitor,
        char buf[MENU_DATA_SIZE] = {0, };
        char final_buf[MENU_DATA_SIZE * 4] = {0, };
        char *pbuf = uat_get_time();
-       msg("\n[%s] Device PRESENCE [%d]", pbuf, sensor);
+       msg("\n[%s] Sensor PRESENCE [%d]", pbuf, sensor);
        free(pbuf);
 
-       ua_sensor_info_s *info;
+       ua_sensor_info_s *info = NULL;
        info = user_data;
+
        if (UA_SENSOR_BLE == (UA_SENSOR_BLE & sensor)) {
                msgb("[%s] PRESENCE detected [%s]",
                        uat_get_sensor_bitmask_str(UA_SENSOR_BLE), uat_get_error_str(result));
-                       __sensor_presence_detected_device(device_handle);
        }
        if (UA_SENSOR_WIFI == (UA_SENSOR_WIFI & sensor)) {
                msgb("[%s] PRESENCE detected [%s]",
                        uat_get_sensor_bitmask_str(UA_SENSOR_WIFI), uat_get_error_str(result));
-                       __sensor_presence_detected_device(device_handle);
        }
-
        if (UA_SENSOR_LIGHT == (UA_SENSOR_LIGHT & sensor)) {
-               /* For sensor information */
+               msgb("[%s] PRESENCE detected [%s]",
+                       uat_get_sensor_bitmask_str(UA_SENSOR_LIGHT), uat_get_error_str(result));
+       }
+       if (UA_SENSOR_MOTION == (UA_SENSOR_MOTION & sensor)) {
+               msgb("[%s] PRESENCE detected [%s]",
+                       uat_get_sensor_bitmask_str(UA_SENSOR_MOTION), uat_get_error_str(result));
+       }
+
+       /* For device information */
+       if (device_handle)
+               __sensor_presence_detected_device(device_handle);
+       /* For sensor information */
+       if (info && (sensor & (UA_SENSOR_LIGHT | UA_SENSOR_MOTION))) {
                for (int i = 0; i < info->count ; i++) {
                        if (i >= 4)
                                break;
@@ -101,14 +111,9 @@ static void __sensor_presence_detected_cb(int result, ua_monitor_h monitor,
                        strncat(final_buf, buf, sizeof(buf) - strlen(buf) - 1);
                        memset(buf, 0, MENU_DATA_SIZE);
                }
-               msgb("[%s] PRESENCE detected at timestamp [%ld] value [%s] [%s]",
-                       uat_get_sensor_bitmask_str(UA_SENSOR_LIGHT), info->timestamp,
-                               final_buf, uat_get_error_str(result));
-       }
-       if (UA_SENSOR_MOTION == (UA_SENSOR_MOTION & sensor)) {
-               msgb("[%s] PRESENCE detected at timestamp [%ld] [%s]",
-                       uat_get_sensor_bitmask_str(UA_SENSOR_MOTION), info->timestamp,
-                       uat_get_error_str(result));
+               msgb("[%s] information detected at timestamp [%ld] value [%s]",
+                       uat_get_sensor_bitmask_str(info->bitmask), info->timestamp,
+                               final_buf);
        }
 }