Showing results for 
Search instead for 
Did you mean: 

Knowledge Base Articles

Sending Slave Security request from the slave device in Bluetooth® LE using AnyCloud SDK - KBA233947

Community Manager
Community Manager

Sending Slave Security request from the slave device in Bluetooth® LE using AnyCloud SDK - KBA233947

Version: **

Sending a slave security request from the peripheral devices in the AnyCloud Bluetooth® LE project.

Slave Security Request (Section 2.4.6, Vol 3, Part H in BT 5.3 Specification) is an optional feature in the Bluetooth® spec that allows the slave (peripheral) device to request the master (central) to initate the pairing request. The slave device may request security by transmitting a security request command to the master. When a master device receives a security request command, it may encrypt the link, initiate the pairing procedure, or reject the request.


To initiate the security request in AnyClould SDK you need to call the wiced_bt_dev_sec_bond() API as soon as the connection is established. For example:

static wiced_bt_gatt_status_t app_bt_connect_callback(wiced_bt_gatt_connection_status_t *p_conn_status)
         wiced_bt_gatt_status_t status = WICED_BT_GATT_ERROR;
         wiced_result_t sec_bond_result = WICED_BT_SUCCESS;

    if (NULL != p_conn_status)


        if (p_conn_status->connected)
             /* Connection is established */
             /* Store the connection ID and peer BD Address */
             bt_conn_id = p_conn_status->conn_id;
             memcpy(bt_peer_addr, p_conn_status->bd_addr, BD_ADDR_LEN);

           /* Send security request from slave to initiate pairing */
             sec_bond_result = wiced_bt_dev_sec_bond(p_conn_status->bd_addr, p_conn_status->addr_type, BT_TRANSPORT_LE , 0, NULL);
            printf("Initiating Secure bond request, result %d", sec_bond_result);


Calling this function will trigger the Bluetooth® management event BTM_PAIRING_IO_CAPABILITIES_BLE_REQUEST_EVT.

The following HCI logs are captured from BySPY when the slave security request is sent

Security request sent from slave:


Master accepts security request and sends the pairing request:


Slave sends the pairing response:


The pairing process may or may not continue depending on the authentication requirements at both the ends.

Version history
Revision #:
1 of 1
Last update:
‎Sep 27, 2021 11:15 PM
Updated by: