Embassy
nrf-softdevice-s122

Crates

git

Versions

default

Flavors

pub unsafe fn sd_ble_gap_authenticate(
conn_handle: u16,
p_sec_params: *const ble_gap_sec_params_t
) -> u32
Expand description

@brief Initiate the GAP Authentication procedure.

@details In the central role, this function will send an SMP Pairing Request (or an SMP Pairing Failed if rejected).

@events @event{Depending on the security parameters set and the packet exchanges with the peer, the following events may be generated:} @event{@ref BLE_GAP_EVT_SEC_PARAMS_REQUEST} @event{@ref BLE_GAP_EVT_PASSKEY_DISPLAY} @event{@ref BLE_GAP_EVT_KEY_PRESSED} @event{@ref BLE_GAP_EVT_AUTH_KEY_REQUEST} @event{@ref BLE_GAP_EVT_LESC_DHKEY_REQUEST} @event{@ref BLE_GAP_EVT_CONN_SEC_UPDATE} @event{@ref BLE_GAP_EVT_AUTH_STATUS} @event{@ref BLE_GAP_EVT_TIMEOUT} @endevents

@mscs @mmsc{@ref BLE_GAP_CENTRAL_SEC_REQ_MSC} @mmsc{@ref BLE_GAP_CENTRAL_ENC_AUTH_MUTEX_MSC} @mmsc{@ref BLE_GAP_CENTRAL_PAIRING_JW_MSC} @mmsc{@ref BLE_GAP_CENTRAL_BONDING_JW_MSC} @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_MSC} @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_OOB_MSC} @mmsc{@ref BLE_GAP_CENTRAL_LESC_PAIRING_JW_MSC} @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_PD_MSC} @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} @endmscs

@param[in] conn_handle Connection handle. @param[in] p_sec_params Pointer to the @ref ble_gap_sec_params_t structure with the security parameters to be used during the pairing or bonding procedure. In the central role, this pointer may be NULL to reject a Security Request.

@retval ::NRF_SUCCESS Successfully initiated authentication procedure. @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. Either: - No link has been established. - An encryption is already executing or queued. @retval ::NRF_ERROR_NO_MEM The maximum number of authentication procedures that can run in parallel for the given role is reached. @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. @retval ::NRF_ERROR_NOT_SUPPORTED Setting of sign or link fields in @ref ble_gap_sec_kdist_t not supported. Distribution of own Identity Information is only supported if the Central Address Resolution characteristic is configured to be included or the Softdevice is configured to support peripheral roles only. See @ref ble_gap_cfg_car_incl_cfg_t and @ref ble_gap_cfg_role_count_t. @retval ::NRF_ERROR_TIMEOUT A SMP timeout has occurred, and further SMP operations on this link is prohibited.