/* Function to compare two sets of bonding data to check if they belong to the same device.  */
bool is_duplicate_bonding_data(pm_peer_data_bonding_t const *p_bonding_data1, pm_peer_data_bonding_t const *p_bonding_data2)
/* Function to compare two sets of bonding data to check if they belong to the same device.  */
bool is_duplicate_bonding_data(pm_peer_data_bonding_t const *p_bonding_data1, pm_peer_data_bonding_t const *p_bonding_data2)
{
    bool valid_irk = is_valid_irk(&p_bonding_data1->peer_id.id_info);
    bool duplicate_irk = valid_irk &&
        (memcmp(p_bonding_data1->peer_id.id_info.irk,
        p_bonding_data2->peer_id.id_info.irk,
        BLE_GAP_SEC_KEY_LEN) == 0
    );
    bool duplicate_addr = addr_compare(&p_bonding_data1->peer_id.id_addr_info,
                                       &p_bonding_data2->peer_id.id_addr_info
    );
    return duplicate_irk || duplicate_addr;
}