Description
Hi people,
I am a newbie, and I am using Adruino IDE to test ESP32 Bluetooth .
Currently, I am using the codes here: #793 (comment). Based on my test observations:
- In an "ESP32 ⇔ Android" bluetooth test connection,
There are no problems.
If a wrong password is intentionally keyed-in during bluetooth pairing, the initial bluetooth connection will eventually be terminated.
- However, In an "ESP32 ⇔ iPhone" bluetooth test connection,
Even if a wrong password is intentionally keyed-in during bluetooth pairing, the initial bluetooth connection will continue and not be automatically terminated.
With this...
I would like to know, if there is a flag or a function that would tell that the password authentication / pairing is not successful.
My idea is to terminate the connect once the pairing is not successful. Below is a onConnect/onDisconnect sample sketch, and I am assuming there is a some sort of PasswordAuthenticationSuccessful version of this.
bool deviceConnected = false;
class MyServerCallbacks : public BLEServerCallbacks {
void onConnect (BLEserver* pServer) { deviceConnected = true; };
void onDisconnect (BLEserver* pServer) { deviceConnected = false; };
}void loop () {
if (deviceConnected) { //write code here
}
else if (!deviceConnected) { //write code here
}
}
Hoping for someone's advice...