This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Best Method to set up Passkey and Bonding?

I'm working in the ble_app_lbs example, with a PCA10001 eval board, softdevice 110, and Nordic's Master Control Panel.

In the example code, I've changed button 1's functionality to just toggle LED 1 when pressed (I wanted to make sure my code was seeing and acting on a button press). I want to use to button as a mechanism to start pairing and bonding. In the Master Control Panel my device shows up in the discovery list, and I can select it, and open the Service Discovery window.

Here's what I my device to do. The central sends a request to bond, if and when button 1 is pressed, the bonding will proceed. What's the best way to accomplish this, and is there a good example project that I can refer to?

Thanks, Clint

  • This MSC should be helpful.

    When you get the BLE_GAP_EVT_SEC_PARAMS_REQUEST event you can simply check if the button is pressed and return sd_ble_gap_sec_params_reply()with BLE_GAP_SEC_STATUS_SUCCESS if it is or for example BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP if it's not.

    You may have to modify the if/else that comes after sd_ble_gap_sec_params_reply() as well, so the peripheral doesn't believe it's paired.

    It seems Master Control Panel will disconnect if pairing fails.

    I tested this with ble_app_hrs.

Related