summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsaerome.kim <saerome.kim@samsung.com>2019-09-26 08:49:06 +0900
committersaerome.kim <saerome.kim@samsung.com>2019-09-26 15:47:28 +0900
commita56beb473553478ffd4094a8bd939e9b91230214 (patch)
tree70fe0d7f550cf374ff7ed30fe65c7930fd9fa75a
parent01b619b5e6d69527bd3f5a2185d5e25cbee30d30 (diff)
downloaduser-awareness-a56beb473553478ffd4094a8bd939e9b91230214.tar.gz
user-awareness-a56beb473553478ffd4094a8bd939e9b91230214.tar.bz2
user-awareness-a56beb473553478ffd4094a8bd939e9b91230214.zip
Changed presence_detected_cb in ua-test.
This version display sensor information when be called sensor callback. So we changed the name of the exsiting __device_presence_detected_cb and __device_absence_cb to __sensor_presence/absence_cb. Change-Id: I5b384d7e1917cad57d1545eab314ae653f0a675b Signed-off-by: saerome.kim <saerome.kim@samsung.com>
-rw-r--r--test/uat-detections.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/test/uat-detections.c b/test/uat-detections.c
index 088eb01..3fc5a06 100644
--- a/test/uat-detections.c
+++ b/test/uat-detections.c
@@ -48,9 +48,11 @@ static char g_presence_type[MENU_DATA_SIZE + 1] = "2"; /**< Selected PRESENCE ty
static char g_absence_type[MENU_DATA_SIZE + 1] = "2"; /**< Selected ABSENCE type */
static char g_scan_time_multiplier[MENU_DATA_SIZE + 1] = {0,}; /**< 10ms * what number */
-static void __device_presence_detected_cb(int result, ua_monitor_h monitor,
+static void __sensor_presence_detected_cb(int result, ua_monitor_h monitor,
ua_sensor_e sensor, void *user_data)
{
+ 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);
free(pbuf);
@@ -65,18 +67,26 @@ static void __device_presence_detected_cb(int result, ua_monitor_h monitor,
msgb("[%s] PRESENCE detected [%s]",
uat_get_sensor_bitmask_str(UA_SENSOR_WIFI), uat_get_error_str(result));
}
+
if (UA_SENSOR_LIGHT == (UA_SENSOR_LIGHT & sensor)) {
- msgb("[%s] PRESENCE detected at timestamp [%ld] lux [%f] [%s]",
+ /* For sensor information */
+ for (int i = 0; i < info->count; i++) {
+ snprintf(buf, MENU_DATA_SIZE, "%lF ", info->values[i]);
+ 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,
- info->values[0], uat_get_error_str(result));
+ 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));
+ uat_get_sensor_bitmask_str(UA_SENSOR_MOTION), info->timestamp,
+ uat_get_error_str(result));
}
}
-static void __device_absence_detected_cb(int result, ua_monitor_h monitor,
+static void __sensor_absence_detected_cb(int result, ua_monitor_h monitor,
ua_sensor_e sensor, void *user_data)
{
char *pbuf = uat_get_time();
@@ -314,7 +324,7 @@ static int run_ua_monitor_start_presence_detection(
ret = ua_monitor_start_presence_detection(g_ua_mon_h,
(g_service_str[0] == '\0' ? NULL : g_service_h),
- detection_mode, __device_presence_detected_cb, g_ua_mon_h);
+ detection_mode, __sensor_presence_detected_cb, g_ua_mon_h);
msg(" - ua_monitor_start_presence_detection() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
@@ -375,7 +385,7 @@ static int run_ua_monitor_start_absence_detection(
ret = ua_monitor_start_absence_detection(g_ua_mon_h,
(g_service_str[0] == '\0' ? NULL : g_service_h),
- detection_mode, __device_absence_detected_cb, g_ua_mon_h);
+ detection_mode, __sensor_absence_detected_cb, g_ua_mon_h);
msg(" - ua_monitor_start_absence_detection() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
@@ -454,7 +464,7 @@ static int run_ua_monitor_start_absence_presence(
ret = ua_monitor_start_absence_detection(g_ua_mon_h,
(g_service_str[0] == '\0' ? NULL : g_service_h),
- detection_mode, __device_absence_detected_cb, g_ua_mon_h);
+ detection_mode, __sensor_absence_detected_cb, g_ua_mon_h);
msg(" - ua_monitor_start_absence_detection() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
@@ -463,7 +473,7 @@ static int run_ua_monitor_start_absence_presence(
ret = ua_monitor_start_presence_detection(g_ua_mon_h,
(g_service_str[0] == '\0' ? NULL : g_service_h),
- detection_mode, __device_presence_detected_cb, g_ua_mon_h);
+ detection_mode, __sensor_presence_detected_cb, g_ua_mon_h);
msg(" - ua_monitor_start_presence_detection() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));