0
votes

I am trying to connect gatt to a BLE server device that does not retain bonding information post-connection. On android it is fairly trivial to programmatically 'forget' about the servers bonding keys. On linux, the only thing I can figure out that works is to heavy handedly restart the Bluetooth service or to physically remove and reinsert my BLE dongle.

I am ideally looking for a way to remove a bond for an individual device from a program linked against -lbluetooth. Less desirable would be a system call that removes bonding of an individual device without bouncing Bluetooth.

I am also looking for any insight into why bonding fails if one, but not both devices retain bonding info. Seems like it would be better to re-bond in than case than to fail to connect.

1

1 Answers

1
votes

Interestingly, I also needed to change my connection interval. When I called hci_open() and hci_le_create_conn() to do that, my need to delete bonds on the client went away.

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);