Hello,
I'm trying to implement BLE communication using MCUXpresso SDK version 26.03.
I have a question about the API function Gap_RemoveBond.
The remark states, "This API requires that there are no active connections at call time."
1. Does this mean it can only be used when there are no connected devices?
2. If Gap_RemoveBond cannot be used to remove a bond while an active connection exists, is there a way to remove bonding information while an active connection is active?
Additional information regarding the question
Suppose there are three devices:
・Peripheral device
・Central device A
・Central device B
takuya08_0-1788256233203.pngtakuya08_0-1788256233203.pngtakuya08_0-1788256233203.pngtakuya08_0-1788256233203.png
The Peripheral device is already bonded with both Central A and Central B.
When the Peripheral is actively connected to both Central A and Central B:
takuya08_1-1788256275044.pngtakuya08_1-1788256275044.pngtakuya08_1-1788256275044.pngtakuya08_1-1788256275044.png
Based on the remark, I understand that the Peripheral cannot delete the bonding information for Central A and B while they are connected.
Is there any way to delete bonding information during an active connection?
When the Peripheral is actively connected only to Central A:
takuya08_2-1788256364083.pngtakuya08_2-1788256364083.pngtakuya08_2-1788256364083.pngtakuya08_2-1788256364083.png
Is it impossible for the Peripheral to delete the bonding information for both Central A and Central B?
Or is it possible to delete only Central B's bonding information?
When the Peripheral is not connected to any device:
takuya08_3-1788256474725.pngtakuya08_3-1788256474725.pngtakuya08_3-1788256474725.pngtakuya08_3-1788256474725.png
Based on the remark, I understand that the Peripheral can delete the bonding information for both Central A and Central B in this case.
Thank you for your help.
Thank you for your response.
Based on your answer, I understand that bonding information cannot be deleted if even a single device is connected.
However, I would like to double-check to be sure.
2-1788256364083.png2-1788256364083.png2-1788256364083.png
If the peripheral has bond information stored for two devices, Central A and Central B, and it is currently connected to Central A, which of the following behaviors occurs?
1. The bond information for the unconnected Central B can be deleted.
2. Neither of the two bond information records can be deleted.
Hello, hope you are doing well.
Gap_RemoveBond() can only be called when there are no active BLE connections. The API documentation explicitly requires that all connections be disconnected before bond information is removed. The same restriction applies to Gap_RemoveAllBonds().
There is currently no API in the MCUXpresso SDK BLE Host Stack that supports deleting NVM bond data while any connection is active.
The recommended flow for removing a bond during an active use case is as follows:
Call Gap_Disconnect(deviceId) for the relevant connected peers, wait for the gConnEvtDisconnected_c connection event confirming disconnection, then call Gap_RemoveBond(nvmIndex).
Best regards,
Sofia.