(*device_list)[indx].operating_system = db_info->os;
g_strlcpy((*device_list)[indx].device_id, db_info->device_id,
UAM_DEVICE_ID_MAX_STRING_LEN);
+ g_strlcpy((*device_list)[indx].payload, tech->payload,
+ UAM_PAYLOAD_MAX_STRING_LEN);
(*device_list)[indx].discriminant = tech->discriminant;
(*device_list)[indx].last_seen = tech->timestamp;
(*device_list)[indx++].type = tech->tech_type;
g_strlcpy(device->device_id, tech->device->device_id,
UAM_DEVICE_ID_MAX_STRING_LEN);
device->type = tech->tech_type;
- device->discriminant= tech->discriminant;
+ device->discriminant = tech->discriminant;
+ g_strlcpy(device->payload, tech->payload,
+ UAM_PAYLOAD_MAX_STRING_LEN);
FUNC_EXIT;
return UAM_ERROR_NONE;
tech->timestamp = timestamp;
tech->device = device;
tech->discriminant = dev_info->discriminant;
+ tech->payload = g_strdup(dev_info->payload);
tech->svc_list = svc_list;
g_slist_foreach(tech->svc_list, __print_service, tech);
UAM_DEVICE_ID_MAX_STRING_LEN);
(*device_list)[indx].last_seen = tech->timestamp;
(*device_list)[indx].discriminant = tech->discriminant;
+ g_strlcpy((*device_list)[indx].payload, tech->payload,
+ UAM_PAYLOAD_MAX_STRING_LEN);
(*device_list)[indx++].type = tech->tech_type;
}
#define SELECT_ALL_DEVICES "SELECT device_id, tech_type, address, " \
"ip_address, timestamp, presence_state, os_type, " \
- "user_id, discriminant FROM devices"
+ "user_id, discriminant, payload FROM devices"
#define SELECT_DEVICE "SELECT device_id, tech_type, address, " \
"ip_address, timestamp, presence_state, os_type, " \
- "user_id, discriminant FROM devices WHERE device_id = ? AND tech_type = ? " \
+ "user_id, discriminant, payload FROM devices WHERE device_id = ? AND tech_type = ? " \
"AND address = ?"
#define SELECT_DEVICE_NUMBER "SELECT device_number FROM devices " \
#define INSERT_DEVICE "insert into devices " \
"(device_id, tech_type, address, ip_address, timestamp, " \
- "presence_state, os_type, user_id, discriminant, device_number)" \
- "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
+ "presence_state, os_type, user_id, discriminant, payload, device_number)" \
+ "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
#define UPDATE_TIMESTAMP "UPDATE devices " \
"SET timestamp = ? WHERE device_id = ? AND tech_type = ? AND address = ?"
retv_if(NULL == dev_info, UAM_ERROR_INVALID_PARAMETER);
- UAM_INFO("%s-%d-%s-%s-%ld-%d-%d-%d-%d", dev_info->device_id,
+ UAM_INFO("%s-%d-%s-%s-%ld-%d-%d-%d-%d-%s", dev_info->device_id,
dev_info->type, dev_info->mac, dev_info->ipv4_addr,
timestamp, presence_state, dev_info->operating_system, dev_info->discriminant,
- user_id);
+ user_id, dev_info->payload);
DB_ACTION(sqlite3_bind_text(stmt, 1, dev_info->device_id, -1, SQLITE_TRANSIENT),
error_code, handle_error);
error_code, handle_error);
DB_ACTION(sqlite3_bind_int(stmt, 9, dev_info->discriminant),
error_code, handle_error);
- DB_ACTION(sqlite3_bind_int(stmt, 10, max_device_number + 1),
+ DB_ACTION(sqlite3_bind_text(stmt, 10, dev_info->payload, -1, SQLITE_TRANSIENT),
+ error_code, handle_error);
+ DB_ACTION(sqlite3_bind_int(stmt, 11, max_device_number + 1),
error_code, handle_error);
if (sqlite3_step(stmt) != SQLITE_DONE) {
info->dev_info.operating_system = sqlite3_column_int(stmt, 6);
info->user_id = sqlite3_column_int(stmt, 7);
info->dev_info.discriminant = sqlite3_column_int(stmt, 8);
+ g_strlcpy(info->dev_info.payload, (char *)sqlite3_column_text(stmt, 9),
+ UAM_PAYLOAD_MAX_STRING_LEN);
- UAM_INFO("%s-%d-%s-%s-%ld-%d-%d-%d-%d",
+ UAM_INFO("%s-%d-%s-%s-%ld-%d-%d-%d-%d-%s",
info->dev_info.device_id,
info->dev_info.type,
info->dev_info.mac,
info->dev_info.operating_system,
info->user_id,
info->dev_info.discriminant);
+ info->dev_info.payload);
}
handle_error:
info->dev_info.operating_system = sqlite3_column_int(stmt, 6);
info->user_id = sqlite3_column_int(stmt, 7);
info->dev_info.discriminant = sqlite3_column_int(stmt, 8);
+ g_strlcpy(info->dev_info.payload, (char *)sqlite3_column_text(stmt, 9),
+ UAM_PAYLOAD_MAX_STRING_LEN);
- UAM_INFO("%s-%d-%s-%s-%ld-%d-%d-%d-%d",
+ UAM_INFO("%s-%d-%s-%s-%ld-%d-%d-%d-%d-%s",
info->dev_info.device_id,
info->dev_info.type,
info->dev_info.mac,
info->dev_info.operating_system,
info->user_id,
info->dev_info.discriminant);
+ info->dev_info.payload);
device_list = g_slist_append(device_list, info);
break;