BLE_GAP_EnableEncryption
C
uint16_t BLE_GAP_EnableEncryption(uint16_t connHandle, uint8_t *p_random, uint8_t *p_ediv, uint8_t *p_ltk);
Description
Authenticates and encrypts the connection using the provided encryption key.
Note
This command should only be used when the local device's role is Central.
Events generated
BLE_GAP_EVT_ENCRYPT_STATUS is generated when the encryption status is updated.
BLE_GAP_EVT_DISCONNECTED is generated if encryption fails.
Parameters
Parameter | Description |
---|---|
[in] connHandle | Connection handle associated with this connection. |
[in] p_random | Pointer to a 64-bit random number. |
[in] p_ediv | Pointer to a 16-bit encrypted diversifier. |
[in] p_ltk | Pointer to a 128-bit long-term key (LTK). |
Return values
Return value | Description |
---|---|
MBA_RES_SUCCESS | Successfully starts the encryption process. |
MBA_RES_OOM | Internal memory allocation failure occurred. |
MBA_RES_INVALID_PARA | The parameters provided are invalid. |
MBA_RES_COMMAND_DISALLOWED | Command disallowed due to a conflicting operation or state. |