I'm working on a BLE peripheral using the NimBLE stack, and a key requirement is that it must only allow a single central device which has previously bonded with it to connect (until a button is pressed, clearing the stored bond and allowing a different central to bond). But figuring out how to implement this using the NimBLE library is proving very difficult.
I can either do this by doing directed advertising to the central that has bonded, or by terminating any connections (in the BLE_GAP_EVENT_CONNECT event) if there is no stored bond for the central that has just connected.
It also needs to work with private random addresses (as the phone randomises its own address and I will be using LE Privacy on the peripheral). This is the main problem I’m struggling to solve. How do I read the correctly resolved address from the stored bonds so I can do directed advertising to it, and how do I see if a stored bond exists for an existing connection?
Can this be done with the NimBLE stack and if so, how would I do it?
Thanks
NimBLE how to only allow previously bonded central to connect?
-
- Posts: 9
- Joined: Wed Jul 27, 2022 7:43 am
Re: NimBLE how to only allow previously bonded central to connect?
Hi,
I am thinking out aloud. If there is there is no bonding on the ESP32 then allow any device to bond. Once there is an established bond then no bonding to the ESP32 is allowed/rejected. In this instance only the first bonded Phone/Device would be able to establish connection.
I am thinking out aloud. If there is there is no bonding on the ESP32 then allow any device to bond. Once there is an established bond then no bonding to the ESP32 is allowed/rejected. In this instance only the first bonded Phone/Device would be able to establish connection.
Re: NimBLE how to only allow previously bonded central to connect?
Did you manage to do tihs?
Who is online
Users browsing this forum: Bing [Bot] and 153 guests