fix(ble/bluedroid): Remove esp_bluedroid_init() discard declaration

pull/13557/merge
zhiweijian 2024-04-03 15:28:09 +08:00
rodzic e169a5592c
commit 5725595d84
39 zmienionych plików z 78 dodań i 132 usunięć

Wyświetl plik

@ -70,7 +70,7 @@ esp_err_t esp_bluedroid_disable(void);
* - ESP_OK : Succeed
* - Other : Failed
*/
esp_err_t esp_bluedroid_init(void) __attribute__((deprecated("Please use esp_bluedroid_init_with_cfg")));
esp_err_t esp_bluedroid_init(void);
/**
* @brief Init and alloc the resource for bluetooth, must be prior to every bluetooth stuff.

Wyświetl plik

@ -238,8 +238,7 @@ esp_err_t simple_ble_start(simple_ble_cfg_t *cfg)
}
#endif
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(TAG, "%s init bluetooth failed %d", __func__, ret);
return ret;

Wyświetl plik

@ -249,7 +249,6 @@ security/secure-boot-v1.rst
security/index.rst
about.rst
resources.rst
migration-guides/release-5.x/5.2/bluetooth-classic.rst
migration-guides/release-5.x/5.2/ieee802154.rst
migration-guides/release-5.x/5.2/gcc.rst
migration-guides/release-5.x/5.2/protocols.rst

Wyświetl plik

@ -1,15 +0,0 @@
Bluetooth Classic
=================
:link_to_translation:`zh_CN:[中文]`
Bluedroid
---------
The following Bluedroid API have been removed:
- :component_file:`bt/host/bluedroid/api/include/api/esp_bt_main.h`
- Remove ``esp_err_t esp_bluedroid_init(void)``
- Bluedroid stack initialization API has been replaced by ``esp_err_t esp_bluedroid_init_with_cfg(esp_bluedroid_config_t *cfg)``. Macro ``BT_BLUEDROID_INIT_CONFIG_DEFAULT()`` provides the default configuration for the initialization. The original function can be deleted directly.

Wyświetl plik

@ -6,7 +6,6 @@ Migration from 5.1 to 5.2
.. toctree::
:maxdepth: 1
bluetooth-classic
gcc
:SOC_IEEE802154_SUPPORTED: ieee802154
peripherals

Wyświetl plik

@ -1,15 +0,0 @@
经典蓝牙
=================
:link_to_translation:`en:[English]`
Bluedroid
---------
以下 Bluedroid API 已被移除:
- :component_file:`bt/host/bluedroid/api/include/api/esp_bt_main.h`
- 移除 ``esp_err_t esp_bluedroid_init(void)``
- Bluedroid 协议栈初始化 API 已被替换为 ``esp_err_t esp_bluedroid_init_with_cfg(esp_bluedroid_config_t *cfg)``。宏 ``BT_BLUEDROID_INIT_CONFIG_DEFAULT()`` 用于提供默认的初始化参数。原来的初始化函数可以直接删除。

Wyświetl plik

@ -6,7 +6,6 @@
.. toctree::
:maxdepth: 1
bluetooth-classic
gcc
:SOC_IEEE802154_SUPPORTED: ieee802154
peripherals

Wyświetl plik

@ -639,8 +639,8 @@ void app_main(void)
}
ESP_LOGI(BLE_ANCS_TAG, "%s init bluetooth", __func__);
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(BLE_ANCS_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -659,8 +659,7 @@ void app_main(void)
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(EXAMPLE_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@ -111,7 +111,7 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t* par
return;
} else {
// The received adv data is a correct eddystone frame packet.
// Here, we get the eddystone infomation in eddystone_res, we can use the data in res to do other things.
// Here, we get the eddystone information in eddystone_res, we can use the data in res to do other things.
// For example, just print them:
ESP_LOGI(DEMO_TAG, "--------Eddystone Found----------");
esp_log_buffer_hex("EDDYSTONE_DEMO: Device address:", scan_result->scan_rst.bda, ESP_BD_ADDR_LEN);
@ -154,8 +154,7 @@ void esp_eddystone_appRegister(void)
void esp_eddystone_init(void)
{
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
esp_bluedroid_init_with_cfg(&bluedroid_cfg);
esp_bluedroid_init();
esp_bluedroid_enable();
esp_eddystone_appRegister();
}

Wyświetl plik

@ -216,8 +216,7 @@ void app_main(void)
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(HID_DEMO_TAG, "%s init bluedroid failed", __func__);
return;

Wyświetl plik

@ -156,8 +156,7 @@ void ble_ibeacon_appRegister(void)
void ble_ibeacon_init(void)
{
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
esp_bluedroid_init_with_cfg(&bluedroid_cfg);
esp_bluedroid_init();
esp_bluedroid_enable();
ble_ibeacon_appRegister();
}

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@ -228,14 +228,14 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
ESP_LOGE(GATTC_TAG, "Scan start failed: %s", esp_err_to_name(err));
break;
}
ESP_LOGI(GATTC_TAG, "Scan start successed");
ESP_LOGI(GATTC_TAG, "Scan start successfully");
break;
case ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT:
if ((err = param->scan_stop_cmpl.status) != ESP_BT_STATUS_SUCCESS) {
ESP_LOGE(GATTC_TAG, "Scan stop failed: %s", esp_err_to_name(err));
break;
}
ESP_LOGI(GATTC_TAG, "Scan stop successed");
ESP_LOGI(GATTC_TAG, "Scan stop successfully");
if (is_connect == false) {
ESP_LOGI(GATTC_TAG, "Connect to the remote device.");
esp_ble_gattc_open(gl_profile_tab[PROFILE_APP_ID].gattc_if, scan_rst.scan_rst.bda, scan_rst.scan_rst.ble_addr_type, true);
@ -409,11 +409,11 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
db = (esp_gattc_db_elem_t *)malloc(count*sizeof(esp_gattc_db_elem_t));
if(db == NULL){
ESP_LOGE(GATTC_TAG,"%s:malloc db falied",__func__);
ESP_LOGE(GATTC_TAG,"%s:malloc db failed",__func__);
break;
}
if(esp_ble_gattc_get_db(spp_gattc_if, spp_conn_id, spp_srv_start_handle, spp_srv_end_handle, db, &count) != ESP_GATT_OK){
ESP_LOGE(GATTC_TAG,"%s:get db falied",__func__);
ESP_LOGE(GATTC_TAG,"%s:get db failed",__func__);
break;
}
if(count != SPP_IDX_NB){
@ -553,7 +553,7 @@ void uart_task(void *pvParameters)
//Waiting for UART event.
if (xQueueReceive(spp_uart_queue, (void * )&event, (TickType_t)portMAX_DELAY)) {
switch (event.type) {
//Event of UART receving data
//Event of UART receiving data
case UART_DATA:
if (event.size && (is_connect == true) && (db != NULL) && ((db+SPP_IDX_SPP_DATA_RECV_VAL)->properties & (ESP_GATT_CHAR_PROP_BIT_WRITE_NR | ESP_GATT_CHAR_PROP_BIT_WRITE))) {
uint8_t * temp = NULL;
@ -625,8 +625,8 @@ void app_main(void)
}
ESP_LOGI(GATTC_TAG, "%s init bluetooth", __func__);
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTC_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -689,8 +689,8 @@ void app_main(void)
}
ESP_LOGI(GATTS_TABLE_TAG, "%s init bluetooth", __func__);
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTS_TABLE_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -569,8 +569,7 @@ void app_main(void)
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTC_TAG, "%s init bluetooth failed, error code = %x", __func__, ret);
return;

Wyświetl plik

@ -672,8 +672,8 @@ void app_main(void)
ESP_LOGE(GATTS_TAG, "%s enable controller failed", __func__);
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTS_TAG, "%s init bluetooth failed", __func__);
return;

Wyświetl plik

@ -469,8 +469,7 @@ void app_main(void)
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTC_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -25,7 +25,7 @@ This example is located in the examples folder of the ESP-IDF under the [bluetoo
#include "esp_gatt_common_api.h"
```
These `includes` are required for the FreeRTOS and underlaying system components to run, including the logging functionality and a library to store data in non-volatile flash memory. We are interested in `“bt.h”`, `“esp_bt_main.h”`, `"esp_gap_ble_api.h"` and `“esp_gattc_api.h”`, which expose the BLE APIs required to implement this example.
These `includes` are required for the FreeRTOS and underlying system components to run, including the logging functionality and a library to store data in non-volatile flash memory. We are interested in `“bt.h”`, `“esp_bt_main.h”`, `"esp_gap_ble_api.h"` and `“esp_gattc_api.h”`, which expose the BLE APIs required to implement this example.
* `bt.h`: configures the BT controller and VHCI from the host side.
* `esp_bt_main.h`: initializes and enables the Bluedroid stack.
@ -60,8 +60,7 @@ void app_main()
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTC_TAG, "%s init bluetooth failed, error code = %x", __func__, ret);
return;
@ -137,8 +136,7 @@ There are four Bluetooth modes supported:
After the initialization of the BT controller, the Bluedroid stack, which includes the common definitions and APIs for both BT Classic and BLE, is initialized and enabled by using:
```c
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
ret = esp_bluedroid_enable();
```
The main function ends by registering the GAP and GATT event handlers, as well as the Application Profile and set the maximum supported MTU size.

Wyświetl plik

@ -545,8 +545,7 @@ void app_main(void)
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTC_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -540,8 +540,8 @@ void app_main(void)
}
ESP_LOGI(GATTS_TABLE_TAG, "%s init bluetooth", __func__);
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTS_TABLE_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -702,8 +702,8 @@ void app_main(void)
ESP_LOGE(GATTS_TAG, "%s enable controller failed: %s", __func__, esp_err_to_name(ret));
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTS_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -62,8 +62,8 @@ The entry point to this example is the app_main() function:
ESP_LOGE(GATTS_TAG, "%s enable controller failed", __func__);
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTS_TAG, "%s init bluetooth failed", __func__);
return;
@ -132,8 +132,7 @@ There are four Bluetooth modes supported:
After the initialization of the BT controller, the Bluedroid stack, which includes the common definitions and APIs for both BT Classic and BLE, is initialized and enabled by using:
```c
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
ret = esp_bluedroid_enable();
```
The Bluetooth stack is up and running at this point in the program flow, however the functionality of the application has not been defined yet. The functionality is defined by reacting to events such as what happens when another device tries to read or write parameters and establish a connection. The two main managers of events are the GAP and GATT event handlers. The application needs to register a callback function for each event handler in order to let the application know which functions are going to handle the GAP and GATT events:

Wyświetl plik

@ -544,8 +544,7 @@ void app_main(void)
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTS_TABLE_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -101,8 +101,8 @@ void app_main()
}
ESP_LOGI(GATTS_TABLE_TAG, "%s init bluetooth", __func__);
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTS_TABLE_TAG, "%s init bluetooth failed", __func__);
return;

Wyświetl plik

@ -930,8 +930,7 @@ void app_main(void)
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTC_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -582,8 +582,7 @@ void app_main(void)
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTC_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -494,8 +494,8 @@ void app_main(void)
}
ESP_LOGI(GATTS_TABLE_TAG, "%s init bluetooth", __func__);
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTS_TABLE_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@ -148,7 +148,7 @@ static uint8_t raw_scan_rsp_data_coded[] = {
};
static esp_ble_gap_ext_adv_t ext_adv[4] = {
// instance, duration, peroid
// instance, duration, period
[0] = {0, 0, 0},
[1] = {1, 0, 0},
[2] = {2, 0, 0},
@ -213,8 +213,8 @@ void app_main(void)
ESP_LOGE(LOG_TAG, "%s enable controller failed: %s", __func__, esp_err_to_name(ret));
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(LOG_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -27,7 +27,7 @@ First, lets take a look at the include
#include "sdkconfig.h"
```
These includes are required for the FreeRTOS and underlaying system components to run, including the logging functionality and a library to store data in non-volatile flash memory. We are interested in `"esp_bt.h"`, `"esp_bt_main.h"`, `"esp_gap_ble_api.h"` and `"esp_gatts_api.h"`, which expose the BLE APIs required to implement this example.
These includes are required for the FreeRTOS and underlying system components to run, including the logging functionality and a library to store data in non-volatile flash memory. We are interested in `"esp_bt.h"`, `"esp_bt_main.h"`, `"esp_gap_ble_api.h"` and `"esp_gatts_api.h"`, which expose the BLE APIs required to implement this example.
* `esp_bt.h`: implements BT controller and VHCI configuration procedures from the host side.
* `esp_bt_main.h`: implements initialization and enabling of the Bluedroid stack.
@ -65,8 +65,8 @@ void app_main(void)
ESP_LOGE(LOG_TAG, "%s enable controller failed: %s", __func__, esp_err_to_name(ret));
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(LOG_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;
@ -145,8 +145,7 @@ There are four Bluetooth modes supported:
After the initialization of the BT controller, the Bluedroid stack, which includes the common definitions and APIs for both BT Classic and BLE, is initialized and enabled by using:
```c
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
ret = esp_bluedroid_enable();
```
The Bluetooth stack is up and running at this point in the program flow, however the functionality of the application has not been defined yet. The functionality is defined by reacting to events
@ -174,7 +173,7 @@ typedef struct {
uint32_t interval_min; /*!< ext adv minimum interval */
uint32_t interval_max; /*!< ext adv maximum interval */
esp_ble_adv_channel_t channel_map; /*!< ext adv channel map */
esp_ble_addr_type_t own_addr_type; /*!< ext adv own addresss type */
esp_ble_addr_type_t own_addr_type; /*!< ext adv own address type */
esp_ble_addr_type_t peer_addr_type; /*!< ext adv peer address type */
esp_bd_addr_t peer_addr; /*!< ext adv peer address */
esp_ble_adv_filter_t filter_policy; /*!< ext adv filter policy */

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@ -90,7 +90,7 @@ static uint8_t raw_ext_adv_data_2m[] = {
};
static esp_ble_gap_ext_adv_t ext_adv[1] = {
// instance, duration, peroid
// instance, duration, period
[0] = {EXT_ADV_HANDLE, 0, 0},
};
@ -164,8 +164,8 @@ void app_main(void)
ESP_LOGE(LOG_TAG, "%s enable controller failed: %s", __func__, esp_err_to_name(ret));
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(LOG_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -66,8 +66,8 @@ void app_main(void)
ESP_LOGE(LOG_TAG, "%s enable controller failed: %s", __func__, esp_err_to_name(ret));
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(LOG_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;
@ -152,8 +152,7 @@ There are four Bluetooth modes supported:
After the initialization of the BT controller, the Bluedroid stack, which includes the common definitions and APIs for both BT Classic and BLE, is initialized and enabled by using:
```c
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
ret = esp_bluedroid_enable();
```
The Bluetooth stack is up and running at this point in the program flow, however the functionality of the application has not been defined yet. The functionality is defined by reacting to events such as what happens when another device tries to read or write parameters and establish a connection. The two main managers of events are the GAP and GATT event handlers. The application needs to register a callback function for each event handler in order to let the application know which functions are going to handle the GAP and GATT events:
@ -178,7 +177,7 @@ typedef struct {
uint32_t interval_min; /*!< ext adv minimum interval */
uint32_t interval_max; /*!< ext adv maximum interval */
esp_ble_adv_channel_t channel_map; /*!< ext adv channel map */
esp_ble_addr_type_t own_addr_type; /*!< ext adv own addresss type */
esp_ble_addr_type_t own_addr_type; /*!< ext adv own address type */
esp_ble_addr_type_t peer_addr_type; /*!< ext adv peer address type */
esp_bd_addr_t peer_addr; /*!< ext adv peer address */
esp_ble_adv_filter_t filter_policy; /*!< ext adv filter policy */
@ -247,7 +246,7 @@ static uint8_t periodic_adv_raw_data[] = {
```c
static esp_ble_gap_ext_adv_t ext_adv[1] = {
// instance, duration, peroid
// instance, duration, period
[0] = {EXT_ADV_HANDLE, 0, 0},
};
```

Wyświetl plik

@ -159,8 +159,8 @@ void app_main(void)
ESP_LOGE(LOG_TAG, "%s enable controller failed: %s", __func__, esp_err_to_name(ret));
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(LOG_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -49,7 +49,7 @@ With this information, the scanner can synchronize with the advertiser and they
#include "freertos/semphr.h"
```
These `includes` are required for the FreeRTOS and underlaying system components to run, including the logging functionality and a library to store data in non-volatile flash memory. We are interested in `“bt.h”`, `“esp_bt_main.h”`, `"esp_gap_ble_api.h"` and `“esp_gattc_api.h”`, which expose the BLE APIs required to implement this example.
These `includes` are required for the FreeRTOS and underlying system components to run, including the logging functionality and a library to store data in non-volatile flash memory. We are interested in `“bt.h”`, `“esp_bt_main.h”`, `"esp_gap_ble_api.h"` and `“esp_gattc_api.h”`, which expose the BLE APIs required to implement this example.
* `esp_bt.h`: configures the BT controller and VHCI from the host side.
* `esp_bt_main.h`: initializes and enables the Bluedroid stack.
@ -86,8 +86,8 @@ void app_main(void)
ESP_LOGE(LOG_TAG, "%s enable controller failed: %s", __func__, esp_err_to_name(ret));
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(LOG_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;
@ -152,8 +152,7 @@ There are four Bluetooth modes supported:
After the initialization of the BT controller, the Bluedroid stack, which includes the common definitions and APIs for both BT Classic and BLE, is initialized and enabled by using:
```c
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
ret = esp_bluedroid_enable();
```
The main function ends by registering the GAP and GATT event handlers, as well as the Application Profile and set the maximum supported MTU size.
@ -190,7 +189,7 @@ The func will be called in the context of bin semaphore esp_ble_gap_set_ext_scan
* @brief ext scan parameters
*/
typedef struct {
esp_ble_addr_type_t own_addr_type; /*!< ext scan own addresss type */
esp_ble_addr_type_t own_addr_type; /*!< ext scan own address type */
esp_ble_scan_filter_t filter_policy; /*!< ext scan filter policy */
esp_ble_scan_duplicate_t scan_duplicate; /*!< ext scan duplicate scan */
esp_ble_ext_scan_cfg_mask_t cfg_mask; /*!< ext scan config mask */
@ -213,7 +212,7 @@ can.*/
uint16_t scan_window; /*!< ext scan window. The duration of the LE scan
. LE_Scan_Window shall be less than or equal to LE_Scan_Interval*/
//Range: 0x0004 to 0x4000 //Defaul
//Range: 0x0004 to 0x4000 //Default
t: 0x0010 (10 ms)
//Time = N * 0.625 msec
//Time Range: 2.5 msec to 10240 msec

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@ -262,7 +262,7 @@ static void bt_app_gap_start_up(void)
/* set discoverable and connectable mode, wait to be connected */
esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_GENERAL_DISCOVERABLE);
/* inititialize device information and status */
/* initialize device information and status */
bt_app_gap_init();
/* start to discover nearby Bluetooth devices */
@ -291,8 +291,7 @@ void app_main(void)
};
esp_bluedroid_attach_hci_driver(&operations);
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
if ((ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg)) != ESP_OK) {
if ((ret = esp_bluedroid_init()) != ESP_OK) {
ESP_LOGE(GAP_TAG, "%s initialize bluedroid failed: %s", __func__, esp_err_to_name(ret));
return;
}

Wyświetl plik

@ -1015,8 +1015,7 @@ void app_main(void)
return;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(COEX_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return;

Wyświetl plik

@ -32,8 +32,7 @@
esp_err_t esp_blufi_host_init(void)
{
int ret;
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
BLUFI_ERROR("%s init bluedroid failed: %s\n", __func__, esp_err_to_name(ret));
return ESP_FAIL;

Wyświetl plik

@ -61,8 +61,8 @@ esp_err_t bluetooth_init(void)
ESP_LOGE(TAG, "%s enable controller failed", __func__);
return ret;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(TAG, "%s init bluetooth failed", __func__);
return ret;

Wyświetl plik

@ -173,8 +173,7 @@ This demo calls the `bluetooth_init` function to:
After the initialization of the BT controller, the Bluedroid stack, which includes the common definitions and APIs for both BT Classic and BLE, is initialized and enabled by using:
```
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ret = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
ret = esp_bluedroid_init();
ret = esp_bluedroid_enable();
```

Wyświetl plik

@ -36,8 +36,8 @@ esp_err_t esp_ble_helper_init(void)
ESP_LOGE(TAG, "%s enable controller failed: %s", __func__, esp_err_to_name(err));
return err;
}
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
err = esp_bluedroid_init_with_cfg(&bluedroid_cfg);
err = esp_bluedroid_init();
if (err) {
ESP_LOGE(TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(err));
return err;