Replies: 2 comments 4 replies
-
This should work automatically as the nimble core library will delete the oldest paired device that is not connected. There may be a bug upstream if that is not the case. |
Beta Was this translation helpful? Give feedback.
-
@h2zero |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have an application that allows up to 3 connections to a Nimble server. I am using a confirmation pin for pairing. What I would like to be able to do is to allow new connections to be made if less than 3 connections are currently in use. However, what I find is that once 3 connections have been made it is necessary to delete one of the bonds on the server before another connection can successfully pair. I'm struggling to see a way of doing this nicely, and in a reasonably automatic way. What works is to use the NimBLEDevice::deleteBond(NimBLEAddress) and get the NimBLEAddress from the NimBLEDevice::getBondedAddress(0) command, but then that bond could be used by a connection that is currently in use. Is there a way of matching the bond information with currently connected clients?
The reason for needing to control the bonded device list is that devices which have successfully paired and have a bond can then reconnect without having to go through the pairing process again.
For testing I have a simple sketch (attached) which I'm uploading to an ESP32 dev module, and then I'm using LightBlue to connect and listen to the characteristic. I have set up the ESP module so that a switch between pin 23 and ground acts as the confirmation for pairing (press this whilst the blue light on the dev board is on before clicking on pair on LightBlue). I have LightBlue running on a mix of iOs and Android devices.
When running the sketch, to delete bond(0) using the serial monitor in the Arduino IDE type any text in the input bar and press enter.
Hope this all makes sense! I am aware that I have lots to learn so any help to point me in the right direction would be much appreciated.
NimBLE_ServerTesting2.txt
Beta Was this translation helpful? Give feedback.
All reactions