12: uint8 t key_size = 16; //the key-size should be 7~16 bytes
513: uint8_t init_key = ESP BLE_ENC_ KEY MASK:| ESP_ BLE_ID_ KEY_MASK;
514: uint8_t rsp_key = ESP_BLE_ENC_ KEY_MASK | ESP BLE_ID_KEY_MASK;
515: //set static passkey
516: ** uint32 t passkey = 123456;**
517: uint8_t auth_option:= ESP_BLE_ONLY_ACCEPT_SPECIFIED_ AUTH_DISABLE;
518: uint8_t oob_support = ESP_BLE_OOB_DISABLE;
519 esp ble gap set security_ param(ESP BLE_SM_SET STATIC_ PASSKEY, &passkey, sizeof(uint32_t));
520: esp_ ble gap_ set security_ param(ESP BLE_ SM_AUTHEN REQ_MODE, &auth_req, sizeof(uint8_t)); //ble gap_sel- ecu
521: esp ble gap set security r param(ESP nam(eSP BLE SM IOCAP_MODE, &iocap, sizeof(uint8_t)),
522: esp ble gap set security param(ESP BLE_SM_MAX_ KEY_ SIZE, &key_size, sizeof(uint8_t));
523: esp ble gap set security_ param(ESP BLE SM ONLY ACCEPT SPECIFIED SEC_ AUTH, &auth_option, sizeof(uint8_t))
524: esp ble gap set_ security param(ESP BLE SM OOB SUPPORT, &oob_ support, sizeof(uint8_t));
525: /* If your BLE device-acts-as •a Slave, the-init_ key means-you-hope which-types of key-of the master shoul
526: and-the response key-means which key you-can-distribute to the-master;
527: If-your BLE device acts as a master, the response key-means you-hope which-types of key-of the slave show
528: and-the init key-means which-key-you-can-distribute to-the slave */
529: esp ble gap set security param(ESP BLE SM_SET_ INIT_KEY, &init_key, sizeof(uint8_t));
530: esp ble_gap_set security_param (ESP_BLE_SM_SET_ RSP_KEY, &rsp_ key, sizeof(uint8_t));