From c2e098c10ed9ecc4c7edbdf696327d82009cd97a Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Mon, 20 Jun 2022 22:29:56 +0800 Subject: [PATCH] bluedroid: Fix breaking change typos This commit fixes typos that are breaking changes (i.e., macros, types, and functions) in the bluedroid API. Migration notes for v5.0 have also been added. Closes https://github.com/espressif/esp-idf/issues/6887 --- .../bt/host/bluedroid/api/esp_gap_ble_api.c | 4 +- .../api/include/api/esp_gap_ble_api.h | 28 +++++++------- .../bluedroid/api/include/api/esp_gatt_defs.h | 4 +- .../bluedroid/api/include/api/esp_hf_defs.h | 4 +- .../btc/profile/std/gap/btc_gap_ble.c | 14 +++---- docs/conf_common.py | 3 +- docs/en/migration-guides/bluetooth.rst | 37 +++++++++++++++++++ docs/en/migration-guides/index.rst | 1 + docs/zh_CN/migration-guides/bluetooth.rst | 1 + docs/zh_CN/migration-guides/index.rst | 1 + 10 files changed, 69 insertions(+), 28 deletions(-) create mode 100644 docs/en/migration-guides/bluetooth.rst create mode 100644 docs/zh_CN/migration-guides/bluetooth.rst diff --git a/components/bt/host/bluedroid/api/esp_gap_ble_api.c b/components/bt/host/bluedroid/api/esp_gap_ble_api.c index b709f9e1f2..e076b48a5f 100644 --- a/components/bt/host/bluedroid/api/esp_gap_ble_api.c +++ b/components/bt/host/bluedroid/api/esp_gap_ble_api.c @@ -787,7 +787,7 @@ esp_err_t esp_ble_gap_read_phy(esp_bd_addr_t bd_addr) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } -esp_err_t esp_ble_gap_set_prefered_default_phy(esp_ble_gap_phy_mask_t tx_phy_mask, +esp_err_t esp_ble_gap_set_preferred_default_phy(esp_ble_gap_phy_mask_t tx_phy_mask, esp_ble_gap_phy_mask_t rx_phy_mask) { btc_msg_t msg; @@ -805,7 +805,7 @@ esp_err_t esp_ble_gap_set_prefered_default_phy(esp_ble_gap_phy_mask_t tx_phy_mas == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } -esp_err_t esp_ble_gap_set_prefered_phy(esp_bd_addr_t bd_addr, +esp_err_t esp_ble_gap_set_preferred_phy(esp_bd_addr_t bd_addr, esp_ble_gap_all_phys_t all_phys_mask, esp_ble_gap_phy_mask_t tx_phy_mask, esp_ble_gap_phy_mask_t rx_phy_mask, diff --git a/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h b/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h index 730dd6ac1c..24b146f879 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h @@ -167,8 +167,8 @@ typedef enum { ESP_GAP_BLE_SET_CHANNELS_EVT = 29, /*!< When setting BLE channels complete, the event comes */ #if (BLE_50_FEATURE_SUPPORT == TRUE) ESP_GAP_BLE_READ_PHY_COMPLETE_EVT, - ESP_GAP_BLE_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT, - ESP_GAP_BLE_SET_PREFERED_PHY_COMPLETE_EVT, + ESP_GAP_BLE_SET_PREFERRED_DEFAULT_PHY_COMPLETE_EVT, + ESP_GAP_BLE_SET_PREFERRED_PHY_COMPLETE_EVT, ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT, ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT, ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT, @@ -196,7 +196,7 @@ typedef enum { ESP_GAP_BLE_SCAN_TIMEOUT_EVT, ESP_GAP_BLE_ADV_TERMINATED_EVT, ESP_GAP_BLE_SCAN_REQ_RECEIVED_EVT, - ESP_GAP_BLE_CHANNEL_SELETE_ALGORITHM_EVT, + ESP_GAP_BLE_CHANNEL_SELECT_ALGORITHM_EVT, ESP_GAP_BLE_PERIODIC_ADV_REPORT_EVT, ESP_GAP_BLE_PERIODIC_ADV_SYNC_LOST_EVT, ESP_GAP_BLE_PERIODIC_ADV_SYNC_ESTAB_EVT, @@ -640,7 +640,7 @@ typedef enum { typedef enum{ ESP_BLE_WHITELIST_REMOVE = 0X00, /*!< remove mac from whitelist */ ESP_BLE_WHITELIST_ADD = 0X01, /*!< add address to whitelist */ -} esp_ble_wl_opration_t; +} esp_ble_wl_operation_t; #if (BLE_42_FEATURE_SUPPORT == TRUE) typedef enum { ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_ADD = 0, /*!< Add device info into duplicate scan exceptional list */ @@ -997,7 +997,7 @@ typedef union { struct ble_pkt_data_length_cmpl_evt_param { esp_bt_status_t status; /*!< Indicate the set pkt data length operation success status */ esp_ble_pkt_data_length_params_t params; /*!< pkt data length value */ - } pkt_data_lenth_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT */ + } pkt_data_length_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT */ /** * @brief ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT */ @@ -1039,7 +1039,7 @@ typedef union { */ struct ble_update_whitelist_cmpl_evt_param { esp_bt_status_t status; /*!< Indicate the add or remove whitelist operation success status */ - esp_ble_wl_opration_t wl_opration; /*!< The value is ESP_BLE_WHITELIST_ADD if add address to whitelist operation success, ESP_BLE_WHITELIST_REMOVE if remove address from the whitelist operation success */ + esp_ble_wl_operation_t wl_operation; /*!< The value is ESP_BLE_WHITELIST_ADD if add address to whitelist operation success, ESP_BLE_WHITELIST_REMOVE if remove address from the whitelist operation success */ } update_whitelist_cmpl; /*!< Event parameter of ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT */ #if (BLE_42_FEATURE_SUPPORT == TRUE) /** @@ -1070,17 +1070,17 @@ typedef union { esp_ble_gap_phy_t rx_phy; /*!< rx phy type */ } read_phy; /*!< Event parameter of ESP_GAP_BLE_READ_PHY_COMPLETE_EVT */ /** - * @brief ESP_GAP_BLE_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT + * @brief ESP_GAP_BLE_SET_PREFERRED_DEFAULT_PHY_COMPLETE_EVT */ struct ble_set_perf_def_phy_cmpl_evt_param { esp_bt_status_t status; /*!< Indicate perf default phy set status */ - } set_perf_def_phy; /*!< Event parameter of ESP_GAP_BLE_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT */ + } set_perf_def_phy; /*!< Event parameter of ESP_GAP_BLE_SET_PREFERRED_DEFAULT_PHY_COMPLETE_EVT */ /** - * @brief ESP_GAP_BLE_SET_PREFERED_PHY_COMPLETE_EVT + * @brief ESP_GAP_BLE_SET_PREFERRED_PHY_COMPLETE_EVT */ struct ble_set_perf_phy_cmpl_evt_param { esp_bt_status_t status; /*!< Indicate perf phy set status */ - } set_perf_phy; /*!< Event parameter of ESP_GAP_BLE_SET_PREFERED_PHY_COMPLETE_EVT */ + } set_perf_phy; /*!< Event parameter of ESP_GAP_BLE_SET_PREFERRED_PHY_COMPLETE_EVT */ /** * @brief ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT */ @@ -1236,12 +1236,12 @@ typedef union { esp_bd_addr_t scan_addr; /*!< scanner address */ } scan_req_received; /*!< Event parameter of ESP_GAP_BLE_SCAN_REQ_RECEIVED_EVT */ /** - * @brief ESP_GAP_BLE_CHANNEL_SELETE_ALGORITHM_EVT + * @brief ESP_GAP_BLE_CHANNEL_SELECT_ALGORITHM_EVT */ struct ble_channel_sel_alg_param { uint16_t conn_handle; /*!< connection handle */ uint8_t channel_sel_alg; /*!< channel selection algorithm */ - } channel_sel_alg; /*!< Event parameter of ESP_GAP_BLE_CHANNEL_SELETE_ALGORITHM_EVT */ + } channel_sel_alg; /*!< Event parameter of ESP_GAP_BLE_CHANNEL_SELECT_ALGORITHM_EVT */ /** * @brief ESP_GAP_BLE_PERIODIC_ADV_SYNC_LOST_EVT */ @@ -1849,7 +1849,7 @@ esp_err_t esp_ble_gap_read_phy(esp_bd_addr_t bd_addr); * - other : failed * */ -esp_err_t esp_ble_gap_set_prefered_default_phy(esp_ble_gap_phy_mask_t tx_phy_mask, esp_ble_gap_phy_mask_t rx_phy_mask); +esp_err_t esp_ble_gap_set_preferred_default_phy(esp_ble_gap_phy_mask_t tx_phy_mask, esp_ble_gap_phy_mask_t rx_phy_mask); /** * @brief This function is used to set the PHY preferences for the connection identified by the remote address. * The Controller might not be able to make the change (e.g. because the peer does not support the requested PHY) @@ -1865,7 +1865,7 @@ esp_err_t esp_ble_gap_set_prefered_default_phy(esp_ble_gap_phy_mask_t tx_phy_mas * - other : failed * */ -esp_err_t esp_ble_gap_set_prefered_phy(esp_bd_addr_t bd_addr, +esp_err_t esp_ble_gap_set_preferred_phy(esp_bd_addr_t bd_addr, esp_ble_gap_all_phys_t all_phys_mask, esp_ble_gap_phy_mask_t tx_phy_mask, esp_ble_gap_phy_mask_t rx_phy_mask, diff --git a/components/bt/host/bluedroid/api/include/api/esp_gatt_defs.h b/components/bt/host/bluedroid/api/include/api/esp_gatt_defs.h index 7bb71251e9..4a6ccbecf8 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gatt_defs.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gatt_defs.h @@ -201,8 +201,8 @@ typedef enum { ESP_GATT_MORE = 0x8a, /* 0x8a */ /* relate to BTA_GATT_MORE in bta/bta_gatt_api.h */ ESP_GATT_INVALID_CFG = 0x8b, /* 0x8b */ /* relate to BTA_GATT_INVALID_CFG in bta/bta_gatt_api.h */ ESP_GATT_SERVICE_STARTED = 0x8c, /* 0x8c */ /* relate to BTA_GATT_SERVICE_STARTED in bta/bta_gatt_api.h */ - ESP_GATT_ENCRYPED_MITM = ESP_GATT_OK, /* relate to BTA_GATT_ENCRYPED_MITM in bta/bta_gatt_api.h */ - ESP_GATT_ENCRYPED_NO_MITM = 0x8d, /* 0x8d */ /* relate to BTA_GATT_ENCRYPED_NO_MITM in bta/bta_gatt_api.h */ + ESP_GATT_ENCRYPTED_MITM = ESP_GATT_OK, /* relate to BTA_GATT_ENCRYPED_MITM in bta/bta_gatt_api.h */ + ESP_GATT_ENCRYPTED_NO_MITM = 0x8d, /* 0x8d */ /* relate to BTA_GATT_ENCRYPED_NO_MITM in bta/bta_gatt_api.h */ ESP_GATT_NOT_ENCRYPTED = 0x8e, /* 0x8e */ /* relate to BTA_GATT_NOT_ENCRYPTED in bta/bta_gatt_api.h */ ESP_GATT_CONGESTED = 0x8f, /* 0x8f */ /* relate to BTA_GATT_CONGESTED in bta/bta_gatt_api.h */ ESP_GATT_DUP_REG = 0x90, /* 0x90 */ /* relate to BTA_GATT_DUP_REG in bta/bta_gatt_api.h */ diff --git a/components/bt/host/bluedroid/api/include/api/esp_hf_defs.h b/components/bt/host/bluedroid/api/include/api/esp_hf_defs.h index fc2e192262..98c1d11165 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_hf_defs.h +++ b/components/bt/host/bluedroid/api/include/api/esp_hf_defs.h @@ -243,9 +243,9 @@ typedef enum { ESP_HF_CME_INCORRECT_PASSWORD = 16, /*!< incorrect password */ ESP_HF_CME_SIM_PIN2_REQUIRED = 17, /*!< SIM PIN2 required */ ESP_HF_CME_SIM_PUK2_REQUIRED = 18, /*!< SIM PUK2 required */ - ESP_HF_CME_MEMEORY_FULL = 20, /*!< memory full */ + ESP_HF_CME_MEMORY_FULL = 20, /*!< memory full */ ESP_HF_CME_INVALID_INDEX = 21, /*!< invalid index */ - ESP_HF_CME_MEMEORY_FAILURE = 23, /*!< memory failure */ + ESP_HF_CME_MEMORY_FAILURE = 23, /*!< memory failure */ ESP_HF_CME_TEXT_STRING_TOO_LONG = 24, /*!< test string too long */ ESP_HF_CME_INVALID_CHARACTERS_IN_TEXT_STRING = 25, /*!< invalid characters in text string */ ESP_HF_CME_DIAL_STRING_TOO_LONG = 26, /*!< dial string too long*/ diff --git a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c index cde7652825..6e4795821a 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c +++ b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c @@ -687,9 +687,9 @@ static void btc_set_pkt_length_callback(UINT8 status, tBTM_LE_SET_PKT_DATA_LENGT msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_GAP_BLE; msg.act = ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT; - param.pkt_data_lenth_cmpl.status = btc_btm_status_to_esp_status(status); - param.pkt_data_lenth_cmpl.params.rx_len = data_len_params->rx_len; - param.pkt_data_lenth_cmpl.params.tx_len = data_len_params->tx_len; + param.pkt_data_length_cmpl.status = btc_btm_status_to_esp_status(status); + param.pkt_data_length_cmpl.params.rx_len = data_len_params->rx_len; + param.pkt_data_length_cmpl.params.tx_len = data_len_params->tx_len; ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL); @@ -728,7 +728,7 @@ static void btc_add_whitelist_complete_callback(UINT8 status, tBTM_WL_OPERATION msg.pid = BTC_PID_GAP_BLE; msg.act = ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT; param.update_whitelist_cmpl.status = btc_hci_to_esp_status(status); - param.update_whitelist_cmpl.wl_opration = wl_opration; + param.update_whitelist_cmpl.wl_operation = wl_opration; ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL); @@ -824,12 +824,12 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event, break; } case BTA_DM_BLE_5_GAP_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT: { - msg.act = ESP_GAP_BLE_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT; + msg.act = ESP_GAP_BLE_SET_PREFERRED_DEFAULT_PHY_COMPLETE_EVT; param.set_perf_def_phy.status = btc_btm_status_to_esp_status(params->set_perf_def_phy.status); break; } case BTA_DM_BLE_5_GAP_SET_PREFERED_PHY_COMPLETE_EVT: { - msg.act = ESP_GAP_BLE_SET_PREFERED_PHY_COMPLETE_EVT; + msg.act = ESP_GAP_BLE_SET_PREFERRED_PHY_COMPLETE_EVT; param.set_perf_phy.status = btc_btm_status_to_esp_status(params->set_perf_phy.status); break; } @@ -971,7 +971,7 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event, break; } case BTA_DM_BLE_5_GAP_CHANNEL_SELETE_ALGORITHM_EVT: { - msg.act = ESP_GAP_BLE_CHANNEL_SELETE_ALGORITHM_EVT; + msg.act = ESP_GAP_BLE_CHANNEL_SELECT_ALGORITHM_EVT; param.channel_sel_alg.conn_handle = params->channel_sel.conn_handle; param.channel_sel_alg.channel_sel_alg = params->channel_sel.channel_sel_alg; break; diff --git a/docs/conf_common.py b/docs/conf_common.py index 5d25b718c2..0cb80ff1ee 100644 --- a/docs/conf_common.py +++ b/docs/conf_common.py @@ -34,7 +34,8 @@ BT_DOCS = ['api-guides/blufi.rst', 'api-reference/bluetooth/esp_blufi.rst', 'api-reference/bluetooth/esp-ble-mesh.rst', 'api-reference/bluetooth/index.rst', - 'api-reference/bluetooth/nimble/index.rst'] + 'api-reference/bluetooth/nimble/index.rst', + 'migration-guides/bluetooth.rst'] CLASSIC_BT_DOCS = ['api-reference/bluetooth/classic_bt.rst', 'api-reference/bluetooth/esp_a2dp.rst', diff --git a/docs/en/migration-guides/bluetooth.rst b/docs/en/migration-guides/bluetooth.rst new file mode 100644 index 0000000000..87f34ee998 --- /dev/null +++ b/docs/en/migration-guides/bluetooth.rst @@ -0,0 +1,37 @@ +Migrate Bluetooth to ESP-IDF 5.0 +================================ + +.. only:: SOC_CLASSIC_BT_SUPPORTED + + Bluedroid + --------- + + The following Bluedroid macros, types, and functions have been renamed: + + - :component_file:`bt/host/bluedroid/api/include/api/esp_gap_ble_api.h` + + - In :cpp:enum:`esp_gap_ble_cb_event_t` + + - ``ESP_GAP_BLE_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT`` renamed to ``ESP_GAP_BLE_SET_PREFERRED_DEFAULT_PHY_COMPLETE_EVT`` + - ``ESP_GAP_BLE_SET_PREFERED_PHY_COMPLETE_EVT`` renamed to ``ESP_GAP_BLE_SET_PREFERRED_PHY_COMPLETE_EVT`` + - ``ESP_GAP_BLE_CHANNEL_SELETE_ALGORITHM_EVT`` renamed to ``ESP_GAP_BLE_CHANNEL_SELECT_ALGORITHM_EVT`` + + - ``esp_ble_wl_opration_t`` renamed to :cpp:enum:`esp_ble_wl_operation_t` + - ``esp_ble_gap_cb_param_t.pkt_data_lenth_cmpl`` renamed to ``pkt_data_length_cmpl`` + - ``esp_ble_gap_cb_param_t.update_whitelist_cmpl.wl_opration`` renamed to ``wl_operation`` + - ``esp_ble_gap_set_prefered_default_phy`` renamed to :cpp:func:`esp_ble_gap_set_preferred_default_phy` + - ``esp_ble_gap_set_prefered_phy`` renamed to :cpp:func:`esp_ble_gap_set_preferred_phy` + + - :component_file:`bt/host/bluedroid/api/include/api/esp_gatt_defs.h` + + - In :cpp:enum:`esp_gatt_status_t` + + - ``ESP_GATT_ENCRYPED_MITM`` renamed to ``ESP_GATT_ENCRYPTED_MITM`` + - ``ESP_GATT_ENCRYPED_NO_MITM`` renamed to ``ESP_GATT_ENCRYPTED_NO_MITM`` + + - :component_file:`bt/host/bluedroid/api/include/api/esp_hf_defs.h` + + - In :cpp:enum:`esp_hf_cme_err_t` + + - ``ESP_HF_CME_MEMEORY_FULL`` renamed to ``ESP_HF_CME_MEMORY_FULL`` + - ``ESP_HF_CME_MEMEORY_FAILURE`` renamed to ``ESP_HF_CME_MEMORY_FAILURE`` \ No newline at end of file diff --git a/docs/en/migration-guides/index.rst b/docs/en/migration-guides/index.rst index 55cd234eb6..6c7fc2ef45 100644 --- a/docs/en/migration-guides/index.rst +++ b/docs/en/migration-guides/index.rst @@ -7,6 +7,7 @@ ESP-IDF 5.0 Migration Guides build-system windows-env + :SOC_BT_SUPPORTED: bluetooth ethernet freertos peripherals diff --git a/docs/zh_CN/migration-guides/bluetooth.rst b/docs/zh_CN/migration-guides/bluetooth.rst new file mode 100644 index 0000000000..6a892d9a7a --- /dev/null +++ b/docs/zh_CN/migration-guides/bluetooth.rst @@ -0,0 +1 @@ +.. include:: ../../en/migration-guides/bluetooth.rst diff --git a/docs/zh_CN/migration-guides/index.rst b/docs/zh_CN/migration-guides/index.rst index f4181d1fbe..b7e7ff26cf 100644 --- a/docs/zh_CN/migration-guides/index.rst +++ b/docs/zh_CN/migration-guides/index.rst @@ -7,6 +7,7 @@ ESP-IDF 5.0 迁移指南 build-system windows-env + :SOC_BT_SUPPORTED: bluetooth ethernet freertos peripherals