g_free(device->addr_list);
if (device->payload) {
- g_free(device->payload->duid);
+ g_free(device->payload->device_uid);
g_free(device->payload->bt_mac);
g_free(device->payload);
}
(*device)->payload->primary_key = tech->payload->primary_key;
(*device)->payload->secondary_key = tech->payload->secondary_key;
(*device)->payload->device_icon = tech->payload->device_icon;
- (*device)->payload->duid = g_memdup(tech->payload->duid, UAM_BLE_PAYLOAD_DUID_LEN);
+ (*device)->payload->device_uid = g_memdup(tech->payload->device_uid, UAM_BLE_PAYLOAD_DEVICE_UID_LEN);
(*device)->payload->bt_mac = g_memdup(tech->payload->bt_mac, UAM_BT_MAC_ADDRESS_STRING_LEN);
}
device->payload->primary_key = dev->payload.primary_key;
device->payload->secondary_key = dev->payload.secondary_key;
device->payload->device_icon = dev->payload.device_icon;
- device->payload->duid = g_memdup(&(dev->payload.duid), UAM_BLE_PAYLOAD_DUID_LEN);
+ device->payload->device_uid = g_memdup(&(dev->payload.device_uid), UAM_BLE_PAYLOAD_DEVICE_UID_LEN);
device->payload->bt_mac = g_memdup(&(dev->payload.bt_mac), UAM_BT_MAC_ADDRESS_STRING_LEN);
device->addr_list = g_new0(uas_address_info_t, device->num_addr);
device->last_seen = dev->last_seen;
g_strlcpy(device->device_id, dev->device_id, UAM_DEVICE_ID_MAX_STRING_LEN);
- memset(device->payload.duid, 0, UAM_BLE_PAYLOAD_DUID_LEN + 1);
+ memset(device->payload.device_uid, 0, UAM_BLE_PAYLOAD_DEVICE_UID_LEN + 1);
memset(device->payload.bt_mac, 0, UAM_BT_MAC_ADDRESS_STRING_LEN);
if (dev->payload) {
device->payload.primary_key = dev->payload->primary_key;
device->payload.device_icon = dev->payload->device_icon;
device->payload.secondary_key = dev->payload->secondary_key;
- if (dev->payload->duid)
- memcpy(device->payload.duid, dev->payload->duid, UAM_BLE_PAYLOAD_DUID_LEN);
+ if (dev->payload->device_uid)
+ memcpy(device->payload.device_uid, dev->payload->device_uid, UAM_BLE_PAYLOAD_DEVICE_UID_LEN);
if (dev->payload->bt_mac)
g_strlcpy(device->payload.bt_mac,
dev->payload->bt_mac, UAM_BT_MAC_ADDRESS_STRING_LEN);
tech_info->addresses = NULL;
if (tech_info->payload) {
- g_free(tech_info->payload->duid);
+ g_free(tech_info->payload->device_uid);
g_free(tech_info->payload->bt_mac);
g_free(tech_info->payload);
}
dev_payload->primary_key = payload->primary_key;
dev_payload->device_icon = payload->device_icon;
dev_payload->secondary_key = payload->secondary_key;
- if (payload->duid)
- memcpy(dev_payload->duid,
- payload->duid, UAM_BLE_PAYLOAD_DUID_LEN);
+ if (payload->device_uid)
+ memcpy(dev_payload->device_uid,
+ payload->device_uid, UAM_BLE_PAYLOAD_DEVICE_UID_LEN);
if (payload->bt_mac)
memcpy(dev_payload->bt_mac,
payload->bt_mac, UAM_BT_MAC_ADDRESS_STRING_LEN);
UAM_DEVICE_ID_MAX_STRING_LEN);
device->type = tech->tech_type;
device->discriminant = tech->discriminant;
- memset(device->payload.duid, 0, UAM_BLE_PAYLOAD_DUID_LEN + 1);
+ memset(device->payload.device_uid, 0, UAM_BLE_PAYLOAD_DEVICE_UID_LEN + 1);
memset(device->payload.bt_mac, 0, UAM_BT_MAC_ADDRESS_STRING_LEN);
device->last_seen = tech->last_seen;
__uam_copy_payload_info(&(device->payload), tech->payload);
tech->payload->primary_key = dev_info->payload.primary_key;
tech->payload->secondary_key = dev_info->payload.secondary_key;
tech->payload->device_icon = dev_info->payload.device_icon;
- tech->payload->duid = g_memdup(&(dev_info->payload.duid), UAM_BLE_PAYLOAD_DUID_LEN);
+ tech->payload->device_uid = g_memdup(&(dev_info->payload.device_uid), UAM_BLE_PAYLOAD_DEVICE_UID_LEN);
tech->payload->bt_mac = g_memdup(&(dev_info->payload.bt_mac), UAM_BT_MAC_ADDRESS_STRING_LEN);
tech->svc_list = svc_list;
tech->payload->primary_key = a_device->payload.primary_key;
tech->payload->secondary_key = a_device->payload.secondary_key;
tech->payload->device_icon = a_device->payload.device_icon;
- tech->payload->duid = g_memdup(&(a_device->payload.duid), UAM_BLE_PAYLOAD_DUID_LEN);
+ tech->payload->device_uid = g_memdup(&(a_device->payload.device_uid), UAM_BLE_PAYLOAD_DEVICE_UID_LEN);
tech->payload->bt_mac = g_memdup(&(a_device->payload.bt_mac), UAM_BT_MAC_ADDRESS_STRING_LEN);
/* Update device's updated information to database */
#define SELECT_ALL_DEVICES "SELECT device_id, tech_type, address, " \
"ip_address, last_seen, presence_state, os_type, " \
- "user_id, discriminant, primary_key, secondary_key, duid, device_icon FROM devices"
+ "user_id, discriminant, primary_key, secondary_key, device_uid, device_icon FROM devices"
#define SELECT_DEVICE "SELECT device_id, tech_type, address, " \
"ip_address, last_seen, presence_state, os_type, " \
- "user_id, discriminant, primary_key, secondary_key, duid, device_icon FROM devices " \
+ "user_id, discriminant, primary_key, secondary_key, device_uid, device_icon 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, last_seen, " \
"presence_state, os_type, user_id, discriminant, primary_key, " \
- "secondary_key, duid, device_icon)" \
+ "secondary_key, device_uid, device_icon)" \
"values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
#define UPDATE_LAST_SEEN "UPDATE devices " \
#define UPDATE_DEVICE "UPDATE devices " \
"SET (os_type, discriminant, ip_address, primary_key, " \
- "secondary_key, duid, device_icon) = (?, ?, ?, ?, ?, ?, ?) " \
+ "secondary_key, device_uid, device_icon) = (?, ?, ?, ?, ?, ?, ?) " \
"WHERE device_id = ? AND tech_type = ? AND address = ?"
#define DELETE_ALL_DEVICES "delete from devices "
error_code, handle_error);
DB_ACTION(sqlite3_bind_text(stmt, 5, &(payload.secondary_key), 1, SQLITE_TRANSIENT),
error_code, handle_error);
- DB_ACTION(sqlite3_bind_text(stmt, 6, payload.duid, UAM_BLE_PAYLOAD_DUID_LEN + 1, SQLITE_TRANSIENT),
+ DB_ACTION(sqlite3_bind_text(stmt, 6, payload.device_uid, UAM_BLE_PAYLOAD_DEVICE_UID_LEN + 1, SQLITE_TRANSIENT),
error_code, handle_error);
DB_ACTION(sqlite3_bind_text(stmt, 7, &(payload.device_icon), 1, SQLITE_TRANSIENT),
error_code, handle_error);
error_code, handle_error);
DB_ACTION(sqlite3_bind_text(stmt, 11, &(dev_info->payload.secondary_key), 1, SQLITE_TRANSIENT),
error_code, handle_error);
- DB_ACTION(sqlite3_bind_text(stmt, 12, dev_info->payload.duid, UAM_BLE_PAYLOAD_DUID_LEN + 1, SQLITE_TRANSIENT),
+ DB_ACTION(sqlite3_bind_text(stmt, 12, dev_info->payload.device_uid, UAM_BLE_PAYLOAD_DEVICE_UID_LEN + 1, SQLITE_TRANSIENT),
error_code, handle_error);
DB_ACTION(sqlite3_bind_text(stmt, 13, &(dev_info->payload.device_icon), 1, SQLITE_TRANSIENT),
error_code, 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);
- memset(info->dev_info.payload.duid, 0, UAM_BLE_PAYLOAD_DUID_LEN + 1);
+ memset(info->dev_info.payload.device_uid, 0, UAM_BLE_PAYLOAD_DEVICE_UID_LEN + 1);
buf = (char *)sqlite3_column_text(stmt, 9);
info->dev_info.payload.primary_key = buf ? *buf : 13;
buf = (char *)sqlite3_column_text(stmt, 10);
info->dev_info.payload.secondary_key = buf ? *buf : 1;
if ((char*)sqlite3_column_text(stmt, 11))
- memcpy(info->dev_info.payload.duid, (char *)sqlite3_column_text(stmt, 11),
- UAM_BLE_PAYLOAD_DUID_LEN);
+ memcpy(info->dev_info.payload.device_uid, (char *)sqlite3_column_text(stmt, 11),
+ UAM_BLE_PAYLOAD_DEVICE_UID_LEN);
buf = (char *)sqlite3_column_text(stmt, 12);
info->dev_info.payload.device_icon = buf ? *buf : 1;
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);
- memset(info->dev_info.payload.duid, 0, UAM_BLE_PAYLOAD_DUID_LEN + 1);
+ memset(info->dev_info.payload.device_uid, 0, UAM_BLE_PAYLOAD_DEVICE_UID_LEN + 1);
buf = (char *)sqlite3_column_text(stmt, 9);
info->dev_info.payload.primary_key = buf ? *buf : 13;
buf = (char *)sqlite3_column_text(stmt, 10);
info->dev_info.payload.secondary_key = buf ? *buf : 1;
if ((char*)sqlite3_column_text(stmt, 11))
- memcpy(info->dev_info.payload.duid, (char *)sqlite3_column_text(stmt, 11),
- UAM_BLE_PAYLOAD_DUID_LEN);
+ memcpy(info->dev_info.payload.device_uid, (char *)sqlite3_column_text(stmt, 11),
+ UAM_BLE_PAYLOAD_DEVICE_UID_LEN);
buf = (char *)sqlite3_column_text(stmt, 12);
info->dev_info.payload.device_icon = buf ? *buf : 1;