Hi,
I added below my callback function when I connect with my phone to the my custom Tracker SoM-based app. My device OS is 4.0.0. I am using a custom version of Tracker Edge.
I would like all BLE transactions to be encrypted, hence at each connection to the Tracker SoM I launch a pairing procedure if not done yet.
What I would expect is:
- First connection from phone, pairing request, user needs to click on Accept.
- Disconnect the BLE device
- Reconnect, device is already paired, no new pairing request needed.
What I see is that when I reconnect, the logs says again that an unpaired device connected and the BLE goes unresponsive for ~30s. Then it says BLE disconnected and if then I try again to connect, I got a brand new pairing request.
Why is the paired device not kept in the Tracker SoM memory? Is there any way to avoid those 30s disconnection period?
I also see that if I force the deletion of the pairing information on my phone between two connections, then it works fine.
void cb_BLE_connected (const BlePeerDevice& peer, void* context)
{
Loglib.info("BLE device connected");
if (BLE.isPaired(peer) == false) {
Loglib.info("An unpaired device just connected!");
if (BLE.startPairing(peer) != SYSTEM_ERROR_NONE) {
Loglib.error ("Couldn't launch pairing with device");
BLE.disconnect(peer);
} else {
Loglib.info ("Device pairing successful!");
}
} else {
Loglib.info("Already paired device connected");
}
}
Side question: Is there a way to do bonding instead of pairing? I see that the question was already asked here but there never was any reply: Bluetooth Paired Argon Works Only Once - #5 by Colleen.
Best regards,
A.P.