BOOLEAN btif_get_device_type(BD_ADDR bd_addr, int *addr_type, int *device_type)
{
    if (device_type == NULL || addr_type == NULL)
        return FALSE;

    bt_bdaddr_t bda;
    bdcpy(bda.address, bd_addr);

    char bd_addr_str[18] = {0};
    bd2str(&bda, &bd_addr_str);

    if (!btif_config_get_int("Remote", bd_addr_str, "DevType", device_type))
        return FALSE;

    if (!btif_config_get_int("Remote", bd_addr_str, "AddrType", addr_type))
        return FALSE;

    ALOGD("%s: Device [%s] type %d, addr. type %d", __FUNCTION__, bd_addr_str, *device_type, *addr_type);
    return TRUE;
}
コード例 #2
0
ファイル: btif_config.c プロジェクト: Emill/android_bluetooth
bool btif_get_address_type(const BD_ADDR bd_addr, int *p_addr_type)
{
    if (p_addr_type == NULL)
        return FALSE;

    bt_bdaddr_t bda;
    bdcpy(bda.address, bd_addr);

    bdstr_t bd_addr_str;
    bdaddr_to_string(&bda, bd_addr_str, sizeof(bd_addr_str));

    if (!btif_config_get_int(bd_addr_str, "AddrType", p_addr_type))
        return FALSE;

    LOG_DEBUG(LOG_TAG, "%s: Device [%s] address type %d", __FUNCTION__, bd_addr_str, *p_addr_type);
    return TRUE;
}