esp32-snippets
esp32-snippets copied to clipboard
How to prevent remote-control from disconnecting after 2 minutes
I have a cheap BLE remote-control from aliexpress and I was able to modify the BLE_client example to find it when its advertising and get notifications from it.
The only problem I have left is that after 2 minutes from the last button press it disconnects and doesn't advertise any more so I can't reconnect.
What's the standard way to prevent this from happening? When I'm pairing this remote to a windows machine it stays active indefinitely and is operable even after hours or being idle. How does it do that?
I noticed that there is a .updateConnParams() method that has a timeout parameter, but that's a server method, not client. Is there a way to affect these parameters from the client? Or maybe there's a way to ping it just before 2 minutes are up so keeps the connection alive?
A related question - Even if I turn the Windows machine off and on again after some hours, it still seem to remain "paired" and doesn't need to go through the advertisment procedure again. How can I replicate this with the ESP32?