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);
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();
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));
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));
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));
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));