Removing oldest bonded device | Cypress Semiconductor
Removing oldest bonded device
I am trying to implement a FIFO policy in the bonded device list: when the list is full the oldest bonded device will be removed and the new bonding device will be inserted at the top.
I am using the function CyBle_GapRemoveOldestDeviceFromBondedList().
I am facing the following problem: when a bonded device updates the key the function CyBle_StoreBondingData() is executed. Correct, but from my tests this will result in moving the device at the top of the bonded device list.
You test it by following this procedure:
-Bond a iOS device: deviceA
-Bond a second device: deviceB
-Disable and re-enable the Bluetooth pheriferal in the deviceA, the iOS operating system will update the key
-Connect deviceA: function CyBle_StoreBondingData() will be executed because the key was updated
-Execute function CyBle_GapRemoveOldestDeviceFromBondedList(): deviceB will be removed instead of deviceA which was actually the oldest device bonded in the list!!!!!!
It looks like the function CyBle_StoreBondingData() is moving up the device in the bonded device list. This will result in a bonded device list not properly sorted and it will be impossible to implement a FIFO policy.
Has anybody faced the same problem?
Is there any work around?