【问题标题】:Bluez programmatic removal of BLE bonding info for individual deviceBluez 以编程方式删除单个设备的 BLE 绑定信息
【发布时间】:2017-12-30 10:08:15
【问题描述】:
我正在尝试将 gatt 连接到在连接后不保留绑定信息的 BLE 服务器设备。在 android 上,以编程方式“忘记”服务器绑定密钥是相当简单的。在 linux 上,我唯一能确定可行的方法是重新启动蓝牙服务或物理移除并重新插入我的 BLE 加密狗。
理想情况下,我正在寻找一种方法来从与 -lbluetooth 链接的程序中删除单个设备的绑定。不太理想的是系统调用可以在不弹跳蓝牙的情况下移除单个设备的绑定。
我也在寻找任何关于为什么一个绑定失败的见解,但不是两个设备都保留绑定信息。似乎重新绑定比连接失败要好。
【问题讨论】:
标签:
linux
bluetooth-lowenergy
bluez
【解决方案1】:
有趣的是,我还需要更改连接间隔。当我打电话给hci_open() 和hci_le_create_conn() 这样做时,我不再需要删除客户端上的绑定了。
dd = hci_open_dev(dev_id);
if (dd < 0) {
perror("Could not open HCI device");
return -1;
}
if (hci_le_create_conn(dd, interval, window, initiator_filter, peer_bdaddr_type,
bdaddr, own_bdaddr_type, min_interval, max_interval, latency, supervision_timeout,
min_ce_length, max_ce_length, &handle, 25000) < 0) {
perror("HCI Connection failed!");
} else {
printf("HCI connection interval updated: handle = %d\n", handle);
}
hci_close_dev(dd);