This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

CAF BLE state bond limit

Hi, I am trying to use the CAF BLE state  module to manage my bluetooth connection.

To understand how it works I have been testing the nRF desktop application, which makes extensive use of the CAF BLE state module. The documentation of nRF desktop  states the following: 

When turned on, the nRF Desktop peripherals are advertising until they go to the suspended state or connect through Bluetooth. The peripheral supports one wireless connection at a time, but it can be bonded with multiple peers.

And in CAF BLE state documenation I read the following:

CAF assumes that Bluetooth Peripheral device supports only one simultaneous connection and can have up to one bond per Bluetooth local identity.

This is hard enforced by the following code in ble_state.c:200:

		if ((bond_find_data.peer_count > 0) &&
		    bt_addr_le_cmp(bt_conn_get_dst(conn),
				   &bond_find_data.peer_address)) {
			bt_addr_le_to_str(&bond_find_data.peer_address, addr_str,
					sizeof(addr_str));
			LOG_INF("Already bonded to %s", log_strdup(addr_str));
			goto disconnect; 
		}

For now I have uncommented the line `goto: disconnect` from ble_state.c and that seems to work fine, I can now store bond information for multiple devices. 

So I have the following questions:

  • How should I use the CAF BLE state module regarding bonds? I would like to be able to store multiple bonds.
  • How can I delete bond information on the peripheral device (nRF52840)? 
  • I have noticed that if I delete bond information from my phone and try to reconnect to my peripheral device  it will refuse the connection. Is there any way to handle this behaviour so that I can allow the device to reconnect again?

Thanks a lot

Parents Reply Children
No Data
Related