unsigned int sensor_bitmask; /**< Detecting sensor's bitmask */
char account[UAM_USER_ACCOUNT_MAX_STRING_LEN]; /**< User account */
char service[UAM_SERVICE_MAX_STRING_LEN]; /**< Service name */
+ long timestamp; /**< Timestamp of detection */
} uam_detection_event_data_s;
/**
unsigned int sensor_bitmask;
char *account = NULL;
char *service = NULL;
+ long timestamp;
- g_variant_get(parameters, "(u&s&s)", &sensor_bitmask, &account, &service);
+ g_variant_get(parameters, "(u&s&sx)", &sensor_bitmask, &account,
+ &service, ×tamp);
UAM_DBG("Sensor: 0x%8.8X, User: %s", sensor_bitmask, account);
event = UAM_EVENT_USER_PRESENCE_DETECTED;
g_strlcpy(event_data.account, account,
UAM_USER_ACCOUNT_MAX_STRING_LEN);
g_strlcpy(event_data.service, service, UAM_SERVICE_MAX_STRING_LEN);
+ event_data.timestamp = timestamp;
__uam_send_event(event, result, &event_data,
event_info->cb, event_info->user_data);
unsigned int sensor_bitmask;
char *account = NULL;
char *service = NULL;
+ long timestamp;
- g_variant_get(parameters, "(u&s&s)", &sensor_bitmask, &account, &service);
+ g_variant_get(parameters, "(u&s&sx)", &sensor_bitmask, &account,
+ &service, ×tamp);
UAM_DBG("Sensor: 0x%8.8X, User: %s", sensor_bitmask, account);
event = UAM_EVENT_USER_ABSENCE_DETECTED;
g_strlcpy(event_data.account, account,
UAM_USER_ACCOUNT_MAX_STRING_LEN);
g_strlcpy(event_data.service, service, UAM_SERVICE_MAX_STRING_LEN);
+ event_data.timestamp = timestamp;
__uam_send_event(event, result, &event_data,
event_info->cb, event_info->user_data);
uam_tech_type_e tech_type;
GSList *addresses;
int presence_state;
- long long int timestamp;
+ long timestamp;
struct uam_db_device_info *device;
GSList *svc_list;
} uam_db_tech_info_t;
GSList *tech_list;
unsigned int supported_techs;
// int presence_state;
-// long long int timestamp;
+// long timestamp;
struct uam_db_user_info *user;
} uam_db_device_info_t;
char *account;
GSList *devices;
// int presence_state;
-// long long int timestamp;
+ long timestamp;
} uam_db_user_info_t;
int user_id;
uam_device_info_s dev_info;
int presence_state;
- long long timestamp;
+ long timestamp;
} db_device_info_t;
/* db init/deinit */
/* insert */
int _ua_device_db_insert_device_info(int user_id, const uam_device_info_s *dev_info,
- int presence_state, long long timestamp);
+ int presence_state, long timestamp);
/* update */
-int _ua_device_db_update_device_timestamp(char *device_id, int tech_type, char *address,
- unsigned long long timestamp);
+int _ua_device_db_update_device_timestamp(char *device_id, int tech_type,
+ char *address, long timestamp);
int _ua_device_db_update_device_presence(char *device_id, int tech_type, char *address,
int presence_state);
int _ua_device_db_update_device_ip_address(char *device_id, int tech_type, char *address,
if (UAM_DETECT_PRESENCE != mon->mode)
continue;
+ user->timestamp = (long) time(NULL);
_uam_manager_send_event(mon->name,
UAM_EVENT_USER_PRESENCE_DETECTED,
- g_variant_new("(uss)", sensor,
- user->account, svc->name));
+ g_variant_new("(ussx)", sensor,
+ user->account, svc->name,
+ user->timestamp));
UAM_DBG("Sent UAM_EVENT_USER_PRESENCE_DETECTED to %s"
- " for 0x%8.8X, User: %s Service: %s",
- mon->name, sensor, user->account, svc->name);
+ " for 0x%8.8X, User: %s Service: %s"
+ " timestamp [%ld]",
+ mon->name, sensor, user->account,
+ svc->name, user->timestamp);
}
}
if (!user)
continue;
+ user->timestamp = (long) time(NULL);
_uam_manager_send_event(mon->name,
UAM_EVENT_USER_ABSENCE_DETECTED,
- g_variant_new("(uss)", sensor,
- user->account, svc->name));
+ g_variant_new("(ussx)", sensor,
+ user->account, svc->name,
+ user->timestamp));
UAM_DBG("Sent UAM_EVENT_USER_ABSENCE_DETECTED to %s"
- " for 0x%8.8X, User: %s Service: %s",
- mon->name, sensor, user->account, svc->name);
+ " for 0x%8.8X, User: %s Service: %s"
+ " timestamp [%ld]",
+ mon->name, sensor, user->account,
+ svc->name, user->timestamp);
}
}
return error_code;
}
-int _ua_device_db_update_device_timestamp(char *device_id, int tech_type, char *address,
- unsigned long long timestamp)
+int _ua_device_db_update_device_timestamp(char *device_id, int tech_type,
+ char *address, long timestamp)
{
int error_code = UAM_ERROR_NONE;
sqlite3_stmt *stmt = update_timestamp;
goto handle_error;
}
- UAM_DBG("Device timestamp updated [%lld]", timestamp);
+ UAM_DBG("Device timestamp updated [%ld]", timestamp);
handle_error:
sqlite3_reset(stmt);
}
int _ua_device_db_insert_device_info(int user_id, const uam_device_info_s *dev_info,
- int presence_state, long long timestamp)
+ int presence_state, long timestamp)
{
FUNC_ENTRY;
int error_code = UAM_ERROR_NONE;
retv_if(NULL == dev_info, UAM_ERROR_INVALID_PARAMETER);
- UAM_INFO("%s-%d-%s-%s-%lld-%d-%d-%d", dev_info->device_id,
+ UAM_INFO("%s-%d-%s-%s-%ld-%d-%d-%d", dev_info->device_id,
dev_info->type, dev_info->mac, dev_info->ipv4_addr,
timestamp, presence_state, dev_info->operating_system, user_id);
info->dev_info.operating_system = sqlite3_column_int(stmt, 6);
info->user_id = sqlite3_column_int(stmt, 7);
- UAM_INFO("%s-%d-%s-%s-%lld-%d-%d-%d", info->dev_info.device_id, info->dev_info.type, info->dev_info.mac,
+ UAM_INFO("%s-%d-%s-%s-%ld-%d-%d-%d", info->dev_info.device_id, info->dev_info.type, info->dev_info.mac,
info->dev_info.ipv4_addr, info->timestamp, info->presence_state,
info->dev_info.operating_system, info->user_id);
}
info->dev_info.operating_system = sqlite3_column_int(stmt, 6);
info->user_id = sqlite3_column_int(stmt, 7);
- UAM_INFO("%s-%d-%s-%s-%lld-%d-%d-%d", info->dev_info.device_id, info->dev_info.type, info->dev_info.mac,
+ UAM_INFO("%s-%d-%s-%s-%ld-%d-%d-%d", info->dev_info.device_id, info->dev_info.type, info->dev_info.mac,
info->dev_info.ipv4_addr, info->timestamp, info->presence_state,
info->dev_info.operating_system, info->user_id);