Use BLE_GAP_IO_CAPS_DISPLAY_YESNO binding pairing problem

hi,
I use sdk17.1, protocol stack version 7.2.I have some questions. I want to get the mobile phone confirmation event in nrf52833
after the mobile phone confirms the key, and then use the sd_ble_gap_auth_key_reply(); function to create a binding and connection with the mobile phone.
But I don’t know where to place this function. I have tried to place this function in BLE_GAP_EVT_SEC_PARAMS_REQUEST or BLE_GAP_EVT_AUTH_STATUS in ble_evt_handler(),
but neither can realize the default binding function of nrf52833; also place the PM_EVT_RAM_SLAVE_REQ_SECURITY in pm_evt_handler(). Function, the default binding function cannot be implemented either.
My sd_ble_gap_auth_key_reply() function:
/** @brief Function for accepting or rejecting a numeric comparison. */
static void num_comp_reply(bool accept)
{
    uint8_t    key_type;
    ret_code_t err_code;
//		NRF_LOG_INFO("m_conn_handle %d", m_conn_handle);
    if(m_conn_handle == BLE_CONN_HANDLE_INVALID)
    {
        return;
    }
    if(accept)
    {
//        NRF_LOG_INFO("Numeric Match");
        key_type = BLE_GAP_AUTH_KEY_TYPE_PASSKEY;
    }
    else
    {
//        NRF_LOG_INFO("Numeric REJECT");
        key_type = BLE_GAP_AUTH_KEY_TYPE_NONE;
    }

    err_code = sd_ble_gap_auth_key_reply(m_conn_handle,
                                         key_type,
                                         NULL);
    APP_ERROR_CHECK(err_code);
}

I just want to confirm whether the key and the key of nrf52833 are correct on the mobile phone. I don't need to input it, I just want to display it. what should I do?
Parents Reply Children
No Data
Related