BLE_SMP_InitiatePairing
C
uint16_t BLE_SMP_InitiatePairing(uint16_t connHandle);
Description
Initiates the BLE pairing procedure.
Note
This function starts the pairing process between two previously unbonded devices, which involves the following phases: - Phase 1: Exchange of pairing features. - Phase 2: Depending on the pairing method (LE legacy or LE Secure Connections), generate either a Short Term Key (STK) or a Long Term Key (LTK). - Phase 3: Distribution of keys specific to the transport layer. The method used in Phase 2 is determined by the IO Capabilities and the Authentication request flag. In Phase 3, the keys distributed may include CSRK and IRK for LE Secure Connections, and additionally, the encryption key (LTK, EDIV, Rand) for LE Legacy pairing.
Events generated
BLE_SMP_EVT_PAIRING_COMPLETE is generated when the pairing is completed or fails. BLE_SMP_EVT_INPUT_PASSKEY_REQUEST is generated for numeric comparison confirmation. BLE_SMP_EVT_NUMERIC_COMPARISON_CONFIRM_REQUEST is generated when a passkey input is required. BLE_SMP_EVT_DISPLAY_PASSKEY_REQUEST is generated when a passkey needs to be displayed. BLE_SMP_EVT_NOTIFY_KEYS is generated upon completion of key distribution. BLE_SMP_EVT_PAIRING_REQUEST is generated when a pairing request is received. BLE_SMP_EVT_INPUT_OOB_DATA_REQUEST is generated for input of OOB data in legacy pairing. BLE_SMP_EVT_INPUT_SC_OOB_DATA_REQUEST is generated for input of OOB data in LE Secure Connections pairing. BLE_SMP_EVT_KEYPRESS is generated when a keypress notification is received from the remote device.
Parameters
Parameter | Description |
---|---|
[in] connHandle | Connection handle associated with this connection. |
Return values
Return value | Description |
---|---|
MBA_RES_SUCCESS | Pairing procedure initiated successfully. |
MBA_RES_FAIL | The specified connection handle is invalid. |