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

Bond Manager Issue

Although there are some posts dealing with bond manager issues, I have not been able to find a similar issue. I am using part of the BLE code from nRFready Desktop 2 v1.0.4. I've found an issue with how the master GAP Address type are stored by the bond manager.

At a disconnection event the master bond is stored as follows:


            case BLE_GAP_EVT_DISCONNECTED:
            s_conn_handle = BLE_CONN_HANDLE_INVALID;
        
            err_code=ble_bondmngr_bonded_masters_store();
        
            s_direct_adv_cnt   = APP_DIRECTED_ADV_TIMEOUT;
            s_advertising_mode = BLE_DIRECTED_ADV;        
            break;

If the device start advertising again, the following code is use to decided between direct or whitelist advertising:


    if (s_advertising_mode == BLE_DIRECTED_ADV)
    {
        err_code = ble_bondmngr_master_addr_get(s_last_connected_master, &peer_address);
        if (err_code != NRF_SUCCESS)
        {
            s_advertising_mode = BLE_FAST_ADV_WHITELIST;
        }
    }

The problem is that the function ble_bondmngr_master_addr_get is always returning and err_code = NRF_ERROR_INVALID_PARAM, looking at the definition of this function:

uint32_t ble_bondmngr_master_addr_get(int8_t master_handle, ble_gap_addr_t * p_master_addr)
{
    if (
        (master_handle == INVALID_MASTER_HANDLE) ||
        (master_handle >= m_masters_in_db_count) ||
        (p_master_addr == NULL)                  ||
        (
         m_masters_db[master_handle].bond.master_addr.addr_type
         ==
         BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE
        )
       )
    {
        return NRF_ERROR_INVALID_PARAM;
    }

    *p_master_addr = m_masters_db[master_handle].bond.master_addr;
    return NRF_SUCCESS;
}

The last condition is true ( m_masters_db[master_handle].bond.master_addr.addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE). And here is the issue, the address type is not stored or configured in the bond manager at all. I may have missed a function call or any SVC but I dunno where this variable is inizialited and where is stored in the bond manager.

Thanks for your help.

Parents Reply Children
No Data
Related