summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhay Agarwal <ay.agarwal@samsung.com>2019-10-01 11:04:21 +0900
committersaerome.kim <saerome.kim@samsung.com>2019-10-01 13:29:35 +0900
commitc7b6910a4cfdff3523e55a0be896744f13bc844d (patch)
tree0c6015301b0c7ff794b9534142aa2256a857e518
parent2c1ce84dc57579d98be803be3431783357f07210 (diff)
downloaduser-awareness-c7b6910a4cfdff3523e55a0be896744f13bc844d.tar.gz
user-awareness-c7b6910a4cfdff3523e55a0be896744f13bc844d.tar.bz2
user-awareness-c7b6910a4cfdff3523e55a0be896744f13bc844d.zip
Provide detected sensor information in ALL Modesubmit/tizen/20191001.112138accepted/tizen/unified/20191002.013420
Change-Id: Ia5247115d8ecf22faff6cc48f826775ec77c55c5 Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
-rw-r--r--packaging/capi-network-ua.spec2
-rw-r--r--src/user-awareness-monitors.c2
-rw-r--r--test/uat-detections.c33
3 files changed, 21 insertions, 16 deletions
diff --git a/packaging/capi-network-ua.spec b/packaging/capi-network-ua.spec
index dc79398..5fd430d 100644
--- a/packaging/capi-network-ua.spec
+++ b/packaging/capi-network-ua.spec
@@ -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
diff --git a/src/user-awareness-monitors.c b/src/user-awareness-monitors.c
index 9f1dc24..1235bda 100644
--- a/src/user-awareness-monitors.c
+++ b/src/user-awareness-monitors.c
@@ -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;
diff --git a/test/uat-detections.c b/test/uat-detections.c
index 03cf336..ce6ce77 100644
--- a/test/uat-detections.c
+++ b/test/uat-detections.c
@@ -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);
}
}