diff options
-rw-r--r-- | packaging/capi-network-ua.spec | 2 | ||||
-rw-r--r-- | src/user-awareness-monitors.c | 2 | ||||
-rw-r--r-- | test/uat-detections.c | 33 |
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); } } |