From 4c370cc437309716b70f778622d28ca2cee7dbb3 Mon Sep 17 00:00:00 2001 From: weitianhua Date: Tue, 10 May 2022 16:01:15 +0800 Subject: [PATCH] component_bt: Fix build doc errors of bt 1. bluedroid: use standard function pointer define. 2. blufi: Change ESP_BD_ADDR_LEN into ESP_BLUFI_BD_ADDR_LEN 3. doc/sphinx_known_warnings: Remove fixed parts. --- .../bt/common/api/include/api/esp_blufi_api.h | 8 +-- .../esp/blufi/bluedroid_host/esp_blufi.c | 8 +-- .../profile/esp/blufi/nimble_host/esp_blufi.c | 6 +- .../bt/host/bluedroid/api/esp_hidd_api.c | 2 +- .../bt/host/bluedroid/api/esp_hidh_api.c | 2 +- .../bt/host/bluedroid/api/esp_spp_api.c | 3 +- .../bluedroid/api/include/api/esp_hidd_api.h | 2 +- .../bluedroid/api/include/api/esp_hidh_api.h | 2 +- .../bluedroid/api/include/api/esp_spp_api.h | 2 +- .../bluedroid/btc/profile/std/hid/btc_hd.c | 2 +- .../bluedroid/btc/profile/std/hid/btc_hh.c | 2 +- .../bluedroid/btc/profile/std/spp/btc_spp.c | 2 +- docs/sphinx-known-warnings.txt | 62 ------------------- 13 files changed, 21 insertions(+), 82 deletions(-) diff --git a/components/bt/common/api/include/api/esp_blufi_api.h b/components/bt/common/api/include/api/esp_blufi_api.h index e9add2c58b..a5d413ecdd 100644 --- a/components/bt/common/api/include/api/esp_blufi_api.h +++ b/components/bt/common/api/include/api/esp_blufi_api.h @@ -107,9 +107,9 @@ typedef struct { } esp_blufi_ap_record_t; /// Bluetooth address length -#define ESP_BD_ADDR_LEN 6 +#define ESP_BLUFI_BD_ADDR_LEN 6 /// Bluetooth device address -typedef uint8_t esp_bd_addr_t[ESP_BD_ADDR_LEN]; +typedef uint8_t esp_blufi_bd_addr_t[ESP_BLUFI_BD_ADDR_LEN]; /** * @brief BLUFI callback parameters union @@ -140,7 +140,7 @@ typedef union { * @brief ESP_BLUFI_EVENT_CONNECT */ struct blufi_connect_evt_param { - esp_bd_addr_t remote_bda; /*!< Blufi Remote bluetooth device address */ + esp_blufi_bd_addr_t remote_bda; /*!< Blufi Remote bluetooth device address */ uint8_t server_if; /*!< server interface */ uint16_t conn_id; /*!< Connection id */ } connect; /*!< Blufi callback param of ESP_BLUFI_EVENT_CONNECT */ @@ -149,7 +149,7 @@ typedef union { * @brief ESP_BLUFI_EVENT_DISCONNECT */ struct blufi_disconnect_evt_param { - esp_bd_addr_t remote_bda; /*!< Blufi Remote bluetooth device address */ + esp_blufi_bd_addr_t remote_bda; /*!< Blufi Remote bluetooth device address */ } disconnect; /*!< Blufi callback param of ESP_BLUFI_EVENT_DISCONNECT */ /* ESP_BLUFI_EVENT_REQ_WIFI_CONNECT */ /* No callback param */ diff --git a/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c b/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c index ff0b96600a..5fd18b4021 100644 --- a/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c +++ b/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c @@ -295,7 +295,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) BT_BD_ADDR_HEX(p_data->conn.remote_bda), p_data->conn.server_if, p_data->conn.reason, p_data->conn.conn_id); - memcpy(blufi_env.remote_bda, p_data->conn.remote_bda, sizeof(esp_bd_addr_t)); + memcpy(blufi_env.remote_bda, p_data->conn.remote_bda, ESP_BLUFI_BD_ADDR_LEN); blufi_env.conn_id = p_data->conn.conn_id; blufi_env.is_connected = true; blufi_env.recv_seq = blufi_env.send_seq = 0; @@ -303,7 +303,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_BLUFI; msg.act = ESP_BLUFI_EVENT_BLE_CONNECT; - memcpy(param.connect.remote_bda, p_data->conn.remote_bda, sizeof(esp_bd_addr_t)); + memcpy(param.connect.remote_bda, p_data->conn.remote_bda, ESP_BLUFI_BD_ADDR_LEN); param.connect.conn_id = BTC_GATT_GET_CONN_ID(p_data->conn.conn_id); conn_id = param.connect.conn_id; server_if = p_data->conn.server_if; @@ -320,7 +320,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) BT_BD_ADDR_HEX(p_data->conn.remote_bda), p_data->conn.server_if, p_data->conn.reason, p_data->conn.conn_id); - memcpy(blufi_env.remote_bda, p_data->conn.remote_bda, sizeof(esp_bd_addr_t)); + memcpy(blufi_env.remote_bda, p_data->conn.remote_bda, ESP_BLUFI_BD_ADDR_LEN); blufi_env.conn_id = p_data->conn.conn_id; blufi_env.recv_seq = blufi_env.send_seq = 0; blufi_env.sec_mode = 0x0; @@ -334,7 +334,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_BLUFI; msg.act = ESP_BLUFI_EVENT_BLE_DISCONNECT; - memcpy(param.disconnect.remote_bda, p_data->conn.remote_bda, sizeof(esp_bd_addr_t)); + memcpy(param.disconnect.remote_bda, p_data->conn.remote_bda, ESP_BLUFI_BD_ADDR_LEN); btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); break; } diff --git a/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c b/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c index f5786f5b8c..c8410ea37e 100644 --- a/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c +++ b/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c @@ -262,7 +262,7 @@ esp_blufi_gap_event(struct ble_gap_event *event, void *arg) rc = ble_gap_conn_find(event->connect.conn_handle, &desc); assert(rc == 0); - memcpy(param.connect.remote_bda, desc.peer_id_addr.val, sizeof(esp_bd_addr_t)); + memcpy(param.connect.remote_bda, desc.peer_id_addr.val, ESP_BLUFI_BD_ADDR_LEN); param.connect.conn_id = event->connect.conn_handle; /* save connection handle */ @@ -276,7 +276,7 @@ esp_blufi_gap_event(struct ble_gap_event *event, void *arg) return 0; case BLE_GAP_EVENT_DISCONNECT: ESP_LOGI(TAG, "disconnect; reason=%d\n", event->disconnect.reason); - memcpy(blufi_env.remote_bda, event->disconnect.conn.peer_id_addr.val, sizeof(esp_bd_addr_t)); + memcpy(blufi_env.remote_bda, event->disconnect.conn.peer_id_addr.val, ESP_BLUFI_BD_ADDR_LEN); blufi_env.is_connected = false; blufi_env.recv_seq = blufi_env.send_seq = 0; blufi_env.sec_mode = 0x0; @@ -293,7 +293,7 @@ esp_blufi_gap_event(struct ble_gap_event *event, void *arg) msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_BLUFI; msg.act = ESP_BLUFI_EVENT_BLE_DISCONNECT; - memcpy(param.disconnect.remote_bda, event->disconnect.conn.peer_id_addr.val, sizeof(esp_bd_addr_t)); + memcpy(param.disconnect.remote_bda, event->disconnect.conn.peer_id_addr.val, ESP_BLUFI_BD_ADDR_LEN); btc_transfer_context(&msg, ¶m, sizeof(esp_blufi_cb_param_t), NULL); return 0; diff --git a/components/bt/host/bluedroid/api/esp_hidd_api.c b/components/bt/host/bluedroid/api/esp_hidd_api.c index 21ac83b68e..1f886adaa2 100644 --- a/components/bt/host/bluedroid/api/esp_hidd_api.c +++ b/components/bt/host/bluedroid/api/esp_hidd_api.c @@ -15,7 +15,7 @@ #if (defined BTC_HD_INCLUDED && BTC_HD_INCLUDED == TRUE) -esp_err_t esp_bt_hid_device_register_callback(esp_hd_cb_t *callback) +esp_err_t esp_bt_hid_device_register_callback(esp_hd_cb_t callback) { ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED); diff --git a/components/bt/host/bluedroid/api/esp_hidh_api.c b/components/bt/host/bluedroid/api/esp_hidh_api.c index 21fea2b281..922babc543 100644 --- a/components/bt/host/bluedroid/api/esp_hidh_api.c +++ b/components/bt/host/bluedroid/api/esp_hidh_api.c @@ -15,7 +15,7 @@ #if (defined BTC_HH_INCLUDED && BTC_HH_INCLUDED == TRUE) -esp_err_t esp_bt_hid_host_register_callback(esp_hh_cb_t *callback) +esp_err_t esp_bt_hid_host_register_callback(esp_hh_cb_t callback) { ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED); diff --git a/components/bt/host/bluedroid/api/esp_spp_api.c b/components/bt/host/bluedroid/api/esp_spp_api.c index 1ec3bc4d7e..32e5f02ce2 100644 --- a/components/bt/host/bluedroid/api/esp_spp_api.c +++ b/components/bt/host/bluedroid/api/esp_spp_api.c @@ -19,7 +19,8 @@ static const uint8_t UUID_SPP[16] = {0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x10, 0 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB }; static tSDP_UUID sdp_uuid; -esp_err_t esp_spp_register_callback(esp_spp_cb_t *callback) + +esp_err_t esp_spp_register_callback(esp_spp_cb_t callback) { ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED); diff --git a/components/bt/host/bluedroid/api/include/api/esp_hidd_api.h b/components/bt/host/bluedroid/api/include/api/esp_hidd_api.h index 2ed77895e8..787dfb4cc4 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_hidd_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_hidd_api.h @@ -263,7 +263,7 @@ typedef union { * @param event: Event type * @param param: Point to callback parameter, currently is union type */ -typedef void (esp_hd_cb_t)(esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param); +typedef void (*esp_hd_cb_t)(esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param); /** * @brief This function is called to init callbacks with HID device module. diff --git a/components/bt/host/bluedroid/api/include/api/esp_hidh_api.h b/components/bt/host/bluedroid/api/include/api/esp_hidh_api.h index dd428f7cb6..9579c9228c 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_hidh_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_hidh_api.h @@ -280,7 +280,7 @@ typedef union { * @param event: Event type * @param param: Point to callback parameter, currently is union type */ -typedef void (esp_hh_cb_t)(esp_hidh_cb_event_t event, esp_hidh_cb_param_t *param); +typedef void (*esp_hh_cb_t)(esp_hidh_cb_event_t event, esp_hidh_cb_param_t *param); /** * @brief This function is called to init callbacks with HID host module. diff --git a/components/bt/host/bluedroid/api/include/api/esp_spp_api.h b/components/bt/host/bluedroid/api/include/api/esp_spp_api.h index 3ca7d8009e..4eaa1f4012 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_spp_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_spp_api.h @@ -197,7 +197,7 @@ typedef union { * @param event: Event type * @param param: Point to callback parameter, currently is union type */ -typedef void (esp_spp_cb_t)(esp_spp_cb_event_t event, esp_spp_cb_param_t *param); +typedef void (*esp_spp_cb_t)(esp_spp_cb_event_t event, esp_spp_cb_param_t *param); /** * @brief This function is called to init callbacks with SPP module. diff --git a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c index 0deccf1251..90bc298ac2 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c +++ b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c @@ -77,7 +77,7 @@ typedef void (bt_hid_copy_cb_t)(btc_msg_t *msg, void *p_dest, void *p_src); static inline void btc_hd_cb_to_app(esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param) { - esp_hd_cb_t *btc_hd_cb = (esp_hd_cb_t *)btc_profile_cb_get(BTC_PID_HD); + esp_hd_cb_t btc_hd_cb = (esp_hd_cb_t)btc_profile_cb_get(BTC_PID_HD); if (btc_hd_cb) { btc_hd_cb(event, param); } diff --git a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c index d0744c3236..8595e77040 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c +++ b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c @@ -66,7 +66,7 @@ static bdstr_t bdstr; static inline void btc_hh_cb_to_app(esp_hidh_cb_event_t event, esp_hidh_cb_param_t *param) { - esp_hh_cb_t *btc_hh_cb = (esp_hh_cb_t *)btc_profile_cb_get(BTC_PID_HH); + esp_hh_cb_t btc_hh_cb = (esp_hh_cb_t)btc_profile_cb_get(BTC_PID_HH); if (btc_hh_cb) { btc_hh_cb(event, param); } diff --git a/components/bt/host/bluedroid/btc/profile/std/spp/btc_spp.c b/components/bt/host/bluedroid/btc/profile/std/spp/btc_spp.c index 302836b45c..d5e2a604a3 100644 --- a/components/bt/host/bluedroid/btc/profile/std/spp/btc_spp.c +++ b/components/bt/host/bluedroid/btc/profile/std/spp/btc_spp.c @@ -266,7 +266,7 @@ static void spp_free_slot(spp_slot_t *slot) static inline void btc_spp_cb_to_app(esp_spp_cb_event_t event, esp_spp_cb_param_t *param) { - esp_spp_cb_t *btc_spp_cb = (esp_spp_cb_t *)btc_profile_cb_get(BTC_PID_SPP); + esp_spp_cb_t btc_spp_cb = (esp_spp_cb_t)btc_profile_cb_get(BTC_PID_SPP); if (btc_spp_cb) { btc_spp_cb(event, param); } diff --git a/docs/sphinx-known-warnings.txt b/docs/sphinx-known-warnings.txt index 34345f1a78..940b9d989d 100644 --- a/docs/sphinx-known-warnings.txt +++ b/docs/sphinx-known-warnings.txt @@ -8,68 +8,6 @@ # esp_ble_mesh_defs.inc:line: WARNING: Duplicate C++ declaration, also defined at api-reference/bluetooth/esp-ble-mesh:line. Declaration is '.. cpp:member:: uint16_t model_id'. -esp_bt_defs.inc:line: WARNING: Duplicate C declaration, also defined at api-reference/bluetooth/esp_blufi:line. -Declaration is '.. c:macro:: ESP_BD_ADDR_LEN'. -esp_bt_defs.inc:line: WARNING: Duplicate C++ declaration, also defined at api-reference/bluetooth/esp_blufi:line. -Declaration is '.. cpp:type:: uint8_t esp_bd_addr_t [ESP_BD_ADDR_LEN]'. -esp_hidd_api.inc:line: WARNING: Error in type declaration. -If typedef-like declaration: - Type must be either just a name or a typedef-like declaration. - If just a name: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 4] - void() esp_hd_cb_t (esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param) - ----^ - If typedef-like declaration: - Error in declarator - If declarator-id with parameters-and-qualifiers: - Invalid C++ declaration: Expected identifier in nested name. [error at 4] - void() esp_hd_cb_t (esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param) - ----^ - If parenthesis in noptr-declarator: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name. [error at 5] - void() esp_hd_cb_t (esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param) - -----^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name. [error at 5] - void() esp_hd_cb_t (esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param) - -----^ -If type alias or template alias: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 4] - void() esp_hd_cb_t (esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param) - ----^ - -esp_spp_api.inc:line: WARNING: Error in type declaration. -If typedef-like declaration: - Type must be either just a name or a typedef-like declaration. - If just a name: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 4] - void() esp_spp_cb_t (esp_spp_cb_event_t event, esp_spp_cb_param_t *param) - ----^ - If typedef-like declaration: - Error in declarator - If declarator-id with parameters-and-qualifiers: - Invalid C++ declaration: Expected identifier in nested name. [error at 4] - void() esp_spp_cb_t (esp_spp_cb_event_t event, esp_spp_cb_param_t *param) - ----^ - If parenthesis in noptr-declarator: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name. [error at 5] - void() esp_spp_cb_t (esp_spp_cb_event_t event, esp_spp_cb_param_t *param) - -----^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name. [error at 5] - void() esp_spp_cb_t (esp_spp_cb_event_t event, esp_spp_cb_param_t *param) - -----^ -If type alias or template alias: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 4] - void() esp_spp_cb_t (esp_spp_cb_event_t event, esp_spp_cb_param_t *param) - ----^ - rmt_encoder.inc:line: WARNING: Duplicate C++ declaration, also defined at api-reference/peripherals/rmt:line. Declaration is '.. cpp:type:: struct rmt_encoder_t rmt_encoder_t'. spi_master.inc:line: WARNING: Duplicate C++ declaration, also defined at api-reference/peripherals/spi_master:line.