Re: Pairing/bonding Zephyr API? Pairing info?


frv
 
Edited

Hi Johan,

thanks for the feedback.

- conn.h and missing function void set_bondable():
Not sure what went wrong but in my git checkout I see after executing the command git branch in the zephyr/include/bluetooth/ : HEAD detached at v1.13.0
Nevertheless it is clear for me that this is not issue for my current problem.

- So why I need to know if I'm paired? Well maybe and probably my wrong doing of using the fixed passkey.... 

So my working flow is :
- in the BLE peripheral applic I use a fixed passkey that is randomly generated and set via the function call : bt_passkey_set
- my BLE central applic initiates the pairing process to the peripheral device. 
- at the central side, the passkey is asked that was generated in the peripheral.
- so after providing the correct passkey (can be done automatically via the BlueZ API, without manual interaction via a keyboard), the pairing is successfully.
- the BLE central applic can now successfully connect to the peripheral applic and subscribe to the "change" notifications of the heart rate measurement characteristic. 

 - now I restart/power cycle the nRF52 running the BLE peripheral applic, so I call again the "bt_passkey_set" as I don't check if the device is already paired (the reason for my question earlier). So this is probably already fishy... 

As the BLE Central application still sees that it is paired with the BLE peripheral, it just calls a function to make a connection, it will not initiate again a pairing process.
But the BLE peripheral, rejects the connection with returning an error, hci error code: 0x05, meaning authorization failure... 

However after rebuilding my Zephyr peripheral applic without the bt_passkey_set, I still get the connection rejection in the peripheral applic throwing the authorization failure as reason.

So what do I still do wrong? Forgive me I'm still learning... 

Best regards,
Frank

Join devel@lists.zephyrproject.org to automatically receive all group messages.