Add passkey request to BLE_SPP_SERVER_DEMO

danielone
Posts: 2
Joined: Sun Apr 08, 2018 2:44 pm

Add passkey request to BLE_SPP_SERVER_DEMO

Postby danielone » Sun Oct 07, 2018 10:11 am

Hi all,

I am a beginner with ESP32 and I am trying to add passkey request when a client connects to BLE_SPP_SERVER_DEMO application. I gave a look to the gatt security server example and I tried to merge the two but with no success so far.

In the BLE spp server demo I tried to add:

Code: Select all

esp_ble_auth_req_t auth_req = ESP_LE_AUTH_BOND;     //bonding with peer device after authentication
esp_ble_io_cap_t iocap = ESP_IO_CAP_OUT;           

esp_ble_gap_set_security_param(ESP_BLE_SM_AUTHEN_REQ_MODE, &auth_req, sizeof(uint8_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_IOCAP_MODE, &iocap, sizeof(uint8_t));
and then, in gap_event_handler

Code: Select all

case ESP_GAP_BLE_PASSKEY_NOTIF_EVT:  
        ///show the passkey number to the user to input it in the peer deivce.
        ESP_LOGI(GATTS_TABLE_TAG, "The passkey Notify number:%06d", param->ble_security.key_notif.passkey);
        break;
Just to see what happens, but the PASSKEY_NOTIF_EVT state is never reached and the client connects freely like in the basic example.

Can you kindly point me in the right direction? :)

Many thanks!

Who is online

Users browsing this forum: No registered users and 88 guests