I'm using 2540 for both both central and peripheral roles. Central initiates the connection, but the peripheral initiates security (GAPBOND_PAIRING_MODE_INITIATE). Using the sniffer, I can see that the link is eventually encrypted, but regular traffic (read/write attributes) continues in the clear in parallel with security procedures.
The central device should hold off read/write of attributes until the link is encrypted, but how can the central know this event?
Central has registered callbacks with both the GAPBondMgr_Register() and GAPCentralRole_StartDevice(), but these callbacks do not indicate when encryption is complete. In fact, the only gap callbacks central sees are GAP_LINK_ESTABLISHED_EVENT and GAP_SLAVE_REQUESTED_SECURITY_EVENT and no bonding callbacks are called at all. Apparently, gapbondmgr.c thinks these callbacks are of interest only if the local device is initiating the pairing/bonding.
How can a central application detect when the link has been encrypted and its safe to begin data transfers?
TIA,
Richard