Hi, i tried something similar where i wanted my app to connect to hc-05 bluetooth circuit connected to an arduino, what i did was after selecting the bluetooth address to connect to, i used the clock component to set an timer:
Where label3 contained the address of the bluetooth device i wanted to connect to
When clicking disconnect, send a ‘disconnect signal’ to the device so that it actively disconnects.
String value = pCharacteristic->getValue();
if (value == "disconnect") {
uint16_t connId = pServer->getConnId(); // get client ID
pServer->disconnect(connId);
Serial.print("disconnect");
pCharacteristic->setValue("ready"); // set pCharacteristic to other value or not, disconnect infinitely
}
Using this way, I reduced the total delay from 10 seconds to about 2 seconds.