-
-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bonding doesn't work #11
Comments
Can you try nRF connect on android device? There is logging in app (debug log level) that may be useful, also it will show if device is bonded or not. |
I just tested with your code snippet in the NimBLE_Server example using nRF connect from my phone and it bonded as expected. However when I turned my phone off and on and rebooted the esp32 I can see an error:
It seems NimBLE is storing the random public address from phones and using that as the store key instead of the IRK. This is something I need to bring up with the NimBLE team or set callback functions for the storage handling and implement it in the library. No quick fix it seems sadly 😦. |
Thanks for looking into it! Not something that is essential for my project, but would be very nice. |
@h2zero This suppose to be handled by low level driver. I think it can be posted on esp-idf issue tracker. |
@chegewara I don't think this is a case for the esp-idf specifically as the callbacks I and idf are using are built-in NimBLE functions meant for demonstration use, so they may be incomplete. I'll see what more I can find. |
Quick update on this issue, there is some additional parameters that need to be set in the library for bonding with phones to work.
In your code (for now) you should add: In the future I will make this the default setting, however it still does not recognize the client when reconnecting. I have tested this with IDF as well and it doesn't seem to work there either. So far I've narrowed it down to here, at this point it does not find the client key for some reason, either an error when created or searching. If anyone is eager to deep dive into the NimBLE stack I'm open to PR's lol. |
Today i had to implement BLE code with old library and bonding connection. I found something that may be applicable here too. I had to add this line of code:
|
Thanks @chegewara, NimBLE does things a bit differently by just setting global variable flags for that function. Which is the purpose of the Good news is though I have found the error, it happens due to the host based privacy code that espressif implemented and requires calling This is only a partial fix though as with an iPad or iPhone I get an insufficient encryption error, Android seems to work with it but some versions may not. I have instead modified the espressif code to work, needs more testing but if it works well I'll make a PR for IDF as well. |
Just pushed a fix for this, give it a try if you get a chance. |
Closing this for now as it has been resolved in commit fd8b72b. |
I have this to setup my security
And I am just wondering if I have the correct understanding of bonding. My thought was after my phone pairs with this it won't have to confirm the connection ever again, but every time I try to right that characteristic after I reboot the chip I get the pop up on my android device confirming that I want to connect.
Is it possible to just have it remain connected using the BLE_HS_IO_DISPLAY_YESNO or am I just confused about what should be happening.
The text was updated successfully, but these errors were encountered: