mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-08 01:17:07 +00:00
feat(bt/bluedroid): Add new version of API for Bluedroid host stack initialization
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@@ -267,7 +267,7 @@ static void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
||||
break;
|
||||
}
|
||||
|
||||
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||
#if (CONFIG_EXAMPLE_SSP_ENABLED == true)
|
||||
/* when Security Simple Pairing user confirmation requested, this event comes */
|
||||
case ESP_BT_GAP_CFM_REQ_EVT:
|
||||
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: %"PRIu32, param->cfm_req.num_val);
|
||||
@@ -750,16 +750,22 @@ void app_main(void)
|
||||
ESP_LOGE(BT_AV_TAG, "%s enable controller failed", __func__);
|
||||
return;
|
||||
}
|
||||
if (esp_bluedroid_init() != ESP_OK) {
|
||||
ESP_LOGE(BT_AV_TAG, "%s initialize bluedroid failed", __func__);
|
||||
|
||||
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
|
||||
#if (CONFIG_EXAMPLE_SSP_ENABLED == false)
|
||||
bluedroid_cfg.ssp_en = false;
|
||||
#endif
|
||||
if ((ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg)) != ESP_OK) {
|
||||
ESP_LOGE(BT_AV_TAG, "%s initialize bluedroid failed: %s", __func__, esp_err_to_name(ret));
|
||||
return;
|
||||
}
|
||||
|
||||
if (esp_bluedroid_enable() != ESP_OK) {
|
||||
ESP_LOGE(BT_AV_TAG, "%s enable bluedroid failed", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||
#if (CONFIG_EXAMPLE_SSP_ENABLED == true)
|
||||
/* set default parameters for Secure Simple Pairing */
|
||||
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE;
|
||||
esp_bt_io_cap_t iocap = ESP_BT_IO_CAP_IO;
|
||||
|
||||
Reference in New Issue
Block a user