if (monitor->sensor_bitmask == monitor->presence_detected_bitmask) {
if (monitor->presence_cb)
monitor->presence_cb(UA_ERROR_NONE, monitor,
- monitor->presence_detected_bitmask, NULL, monitor->user_data);
+ monitor->presence_detected_bitmask, NULL, NULL, monitor->user_data);
}
monitor->presence_detected_bitmask = 0;
}
static void __ua_monitor_send_sensor_presence_cb(ua_monitor_s *monitor,
- ua_device_h device_handle, ua_sensor_e bitmask)
+ ua_device_h device_handle, ua_sensor_info_s *sensor_info)
{
FUNC_ENTRY;
+ ua_sensor_e bitmask = sensor_info->bitmask;
switch (monitor->presence_mode) {
case UA_DETECT_MODE_ALL_SENSOR:
/*
if ((monitor->presence_detected_bitmask & bitmask) == 0)
if (monitor->presence_cb)
monitor->presence_cb(UA_ERROR_NONE, monitor,
- bitmask, device_handle, monitor->user_data);
+ bitmask, device_handle, sensor_info, monitor->user_data);
monitor->presence_detected_bitmask |= bitmask;
return;
}
-static void __ua_sensor_presence_detected(ua_monitor_s *monitor,
- ua_sensor_e bitmask, char *account, long timestamp, char *device_id)
+static void __ua_sensor_presence_detected(ua_monitor_s *monitor, ua_sensor_info_s *sensor_info,
+ char *account, long timestamp, char *device_id)
{
FUNC_ENTRY;
int ret = UA_ERROR_NONE;
ua_user_state_info_s *user_state = NULL;
ua_device_h device_handle = NULL;
+ ua_sensor_e bitmask = sensor_info->bitmask;
ret_if(NULL == monitor);
return;
}
- __ua_monitor_send_sensor_presence_cb(monitor, device_handle, bitmask);
+ __ua_monitor_send_sensor_presence_cb(monitor, device_handle, sensor_info);
if (account && user_state) {
__ua_monitor_send_user_presence_cb(monitor, user_state);
if (!service || !g_strcmp0(service, monitor->service)) {
/* Presence detection ongoing */
- monitor->user_data = sensor_info;
- __ua_sensor_presence_detected(monitor, bitmask, account,
+ __ua_sensor_presence_detected(monitor, sensor_info, account,
timestamp, device_id);
}
}
}
static void __sensor_presence_detected_cb(int result, ua_monitor_h monitor,
- ua_sensor_e sensor, ua_device_h device_handle, void *user_data)
+ ua_sensor_e sensor, ua_device_h device_handle, ua_sensor_info_s *info,
+ void *user_data)
{
char buf[MENU_DATA_SIZE] = {0, };
char final_buf[MENU_DATA_SIZE * 4] = {0, };
msg("\n[%s] Sensor PRESENCE [%d]", pbuf, sensor);
free(pbuf);
- 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));