This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Multilink Demo Bonding

I'm trying to figure out how the bonding works in the multilink demo. It seems like the central device only goes through the bonding if the peripheral has the multilink service running on it. ie right here:

    case BLE_GATTC_EVT_WRITE_RSP:
    if ((p_ble_evt->evt.gattc_evt.gatt_status == BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION) || (p_ble_evt->evt.gattc_evt.gatt_status == BLE_GATT_STATUS_ATTERR_INSUF_ENCRYPTION))
    {
        uint32_t err_code = dm_security_setup_req(&p_client->handle);
        APP_ERROR_CHECK(err_code);
    }

What exactly is the write response event, and where should I be looking to change the conditions under which bonding should occur?

  • @Danbujak: The way we managed bonding/security with ble_app_multilink_central is that we will try to encrypt the link either if when trying to write to write to a characteristic we get the BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION response ( insufficient authentication) or when there is a security request from the slave (DM_EVT_SECURITY_SETUP event).

    This is very similar to how the central on the phone (Android / iOS) works.

    If you have a look at the hrs_central example, we actually start bonding right after we finish service discovery ( BLE_HRS_C_EVT_DISCOVERY_COMPLETE event)

    This is pretty much your design choice.

Related