In the current upstream, i face the below problem with BLE and settings.
I am running HID peripheral sample on nRF52832 board. I made a modification to call bt_unpair() before starting the advertisement.
This ensures that unpair is called everytime i reset the device and i am able to connect to next device(since CONFIG_BT_MAX_PAIRED = 1).
This is just to minimize my real application scenario to be able to connect to new host and also to reproduce this issue.
1) connect board to first android phone. device is connected and bonded.
2) Now i restart the device and also switch off BLE in the first phone.
3) connect board to second android phone. device is connected and bonded.
4) Now i restart the device and also switch off BLE in the second phone.
5) connect board to third phone. device is connected and bonded.
6) Now a warning is printed in the logs as below
"<wrn> bt_gatt: bt_gatt_attr_write_ccc: No space to store CCC cfg"
7) This happens when host subscribes for HID service. CCC is not updated. This affects the ability to send data to this third host.
I also saw that bt_gatt_clear_ccc() is called inside bt_unpair(). Hence i made sure to call so that i will have clear space for the new host i want to connect to. But still i get this warning everytime on the third host i want to connect.
Is this a bug or should i call a different API than bt_unpair() to clear the space for the new host i want to connect to?