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

Return error by “pm_device_identities_list_set”

52832 & s112 & sd6.0 & sdk15.0

If you have multiple pairings on the same host will return error by “pm_device_identities_list_set”

err_code = BLE_ERROR_GAP_DEVICE_IDENTITIES_DUPLICATE.

if I ignore this error seems no issue.

pm_conn_sec_config_t conn_sec_config = {.allow_repairing = true};  

  case PM_EVT_PEER_DATA_UPDATE_SUCCEEDED:
        {
            if (     p_evt->params.peer_data_update_succeeded.flash_changed
                 && (p_evt->params.peer_data_update_succeeded.data_id == PM_PEER_DATA_ID_BONDING))
            {
                NRF_LOG_INFO("New Bond, add the peer to the whitelist if possible");
                NRF_LOG_INFO("\tm_whitelist_peer_cnt %d, MAX_PEERS_WLIST %d",
                               m_whitelist_peer_cnt + 1,
                               BLE_GAP_WHITELIST_ADDR_MAX_COUNT);
               // Note: You should check on what kind of white list policy your application should use.

                if (m_whitelist_peer_cnt < BLE_GAP_WHITELIST_ADDR_MAX_COUNT)
                {
                    // Bonded to a new peer, add it to the whitelist.
                    m_whitelist_peers[m_whitelist_peer_cnt++] = m_peer_id;
                                                                                NRF_LOG_INFO(" new peer ID %d", m_peer_id);
                                                                                
                    // The whitelist has been modified, update it in the Peer Manager.
                    err_code = pm_whitelist_set(m_whitelist_peers, m_whitelist_peer_cnt);
                    APP_ERROR_CHECK(err_code);

                    err_code = pm_device_identities_list_set(m_whitelist_peers, m_whitelist_peer_cnt);
                    if (err_code != NRF_ERROR_NOT_SUPPORTED)
                    {
                        APP_ERROR_CHECK(err_code);
                    }
                }
            }
        } break;

Parents Reply
  • Hi Hung, 

    I am base on SDK example code ,  In fact the parameter {.allow_repairing  = false} is default;  If I twice pairing on same host that will reject pairing but this is no allow in my case . if i change {.allow_repairing = true} then repairing is ok  that whitelist_peers will add a same peer id ,so "pm_device_identities_list_set " return error .  System will remove pervious peer id when reset. 

     // Setup the device identies list.
     // Some SoftDevices do not support this feature.
     ret = pm_device_identities_list_set(m_whitelist_peers, m_whitelist_peer_cnt);

    You see , Some SoftDevices do not support this feature, so if i mask it will  have any risk ? or how to fix it?

Children
Related