From f70a66997388eae9572e8436ab61f9d2c554b635 Mon Sep 17 00:00:00 2001 From: zhanghaipeng Date: Tue, 19 Nov 2024 17:28:43 +0800 Subject: [PATCH] fix(ble/bluedroid): Optimize BLE API "esp_ble_gattc_enh_open" --- .../bt/host/bluedroid/api/esp_gattc_api.c | 40 +++++++++--------- .../bluedroid/api/include/api/esp_gattc_api.h | 4 +- components/esp_hid/src/ble_hidh.c | 14 +++---- .../ble/ble_ancs/main/ble_ancs_demo.c | 14 +++---- .../ble/ble_spp_client/main/spp_client_demo.c | 14 +++---- .../main/example_ble_client_throughput.c | 14 +++---- .../ble/gatt_client/main/gattc_demo.c | 14 +++---- .../Gatt_Client_Example_Walkthrough.md | 2 +- .../main/example_ble_sec_gattc_demo.c | 2 +- .../main/gattc_multi_connect.c | 42 +++++++++---------- ...nt_Multi_Connection_Example_Walkthrough.md | 6 +-- .../main/ble50_sec_gattc_demo.c | 17 ++++---- .../gattc_gatts_coex/main/gattc_gatts_coex.c | 14 +++---- 13 files changed, 98 insertions(+), 99 deletions(-) diff --git a/components/bt/host/bluedroid/api/esp_gattc_api.c b/components/bt/host/bluedroid/api/esp_gattc_api.c index d59de8ed9d..4c41de97de 100644 --- a/components/bt/host/bluedroid/api/esp_gattc_api.c +++ b/components/bt/host/bluedroid/api/esp_gattc_api.c @@ -68,7 +68,7 @@ esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gattc_if) return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } -esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn_params_t esp_gatt_create_conn) +esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn_params_t *creat_conn_params) { btc_msg_t msg = {0}; btc_ble_gattc_args_t arg; @@ -79,11 +79,11 @@ esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn msg.pid = BTC_PID_GATTC; msg.act = BTC_GATTC_ACT_OPEN; arg.open.gattc_if = gattc_if; - memcpy(arg.open.remote_bda, esp_gatt_create_conn.remote_bda, ESP_BD_ADDR_LEN); - arg.open.remote_addr_type = esp_gatt_create_conn.remote_addr_type; - arg.open.is_direct = esp_gatt_create_conn.is_direct; - arg.open.is_aux= esp_gatt_create_conn.is_aux; - arg.open.own_addr_type = esp_gatt_create_conn.own_addr_type; + memcpy(arg.open.remote_bda, creat_conn_params->remote_bda, ESP_BD_ADDR_LEN); + arg.open.remote_addr_type = creat_conn_params->remote_addr_type; + arg.open.is_direct = creat_conn_params->is_direct; + arg.open.is_aux= creat_conn_params->is_aux; + arg.open.own_addr_type = creat_conn_params->own_addr_type; return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } @@ -91,26 +91,26 @@ esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn #if (BLE_42_FEATURE_SUPPORT == TRUE) esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, esp_ble_addr_type_t remote_addr_type, bool is_direct) { - esp_ble_gatt_creat_conn_params_t esp_gatt_create_conn; - memcpy(esp_gatt_create_conn.remote_bda, remote_bda, ESP_BD_ADDR_LEN); - esp_gatt_create_conn.remote_addr_type = remote_addr_type; - esp_gatt_create_conn.is_direct = is_direct; - esp_gatt_create_conn.is_aux = false; - esp_gatt_create_conn.own_addr_type = 0xff; //undefined, will use local value - return esp_ble_gattc_enh_open(gattc_if, esp_gatt_create_conn); + esp_ble_gatt_creat_conn_params_t creat_conn_params; + memcpy(creat_conn_params.remote_bda, remote_bda, ESP_BD_ADDR_LEN); + creat_conn_params.remote_addr_type = remote_addr_type; + creat_conn_params.is_direct = is_direct; + creat_conn_params.is_aux = false; + creat_conn_params.own_addr_type = 0xff; //undefined, will use local value + return esp_ble_gattc_enh_open(gattc_if, &creat_conn_params); } #endif // #if (BLE_42_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE) esp_err_t esp_ble_gattc_aux_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, esp_ble_addr_type_t remote_addr_type, bool is_direct) { - esp_ble_gatt_creat_conn_params_t esp_gatt_create_conn; - memcpy(esp_gatt_create_conn.remote_bda, remote_bda, ESP_BD_ADDR_LEN); - esp_gatt_create_conn.remote_addr_type = remote_addr_type; - esp_gatt_create_conn.is_direct = is_direct; - esp_gatt_create_conn.is_aux = true; - esp_gatt_create_conn.own_addr_type = 0xff; //undefined, will use local value - return esp_ble_gattc_enh_open(gattc_if, esp_gatt_create_conn); + esp_ble_gatt_creat_conn_params_t creat_conn_params; + memcpy(creat_conn_params.remote_bda, remote_bda, ESP_BD_ADDR_LEN); + creat_conn_params.remote_addr_type = remote_addr_type; + creat_conn_params.is_direct = is_direct; + creat_conn_params.is_aux = true; + creat_conn_params.own_addr_type = 0xff; //undefined, will use local value + return esp_ble_gattc_enh_open(gattc_if, &creat_conn_params); } #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) diff --git a/components/bt/host/bluedroid/api/include/api/esp_gattc_api.h b/components/bt/host/bluedroid/api/include/api/esp_gattc_api.h index 442fec2e53..a4fd3c9574 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gattc_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gattc_api.h @@ -319,14 +319,14 @@ esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gattc_if); * Note: Do not enable both BLE_42_FEATURE_SUPPORT and BLE_50_FEATURE_SUPPORT configuration options simultaneously. * * @param[in] gattc_if: GATT client access interface. - * @param[in] esp_gatt_create_conn: Structure containing connection parameters. + * @param[in] esp_gatt_create_conn: Pointer to the structure containing connection parameters. * * @return * - ESP_OK: Operation successful * - others: Operation failed * */ -esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn_params_t esp_gatt_create_conn); +esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn_params_t *esp_gatt_create_conn); /** * @brief Open a direct connection or add a background auto connection diff --git a/components/esp_hid/src/ble_hidh.c b/components/esp_hid/src/ble_hidh.c index 2f15710dca..ed8e88302b 100644 --- a/components/esp_hid/src/ble_hidh.c +++ b/components/esp_hid/src/ble_hidh.c @@ -724,14 +724,14 @@ esp_hidh_dev_t *esp_ble_hidh_dev_open(esp_bd_addr_t bda, esp_ble_addr_type_t add dev->ble.address_type = address_type; dev->ble.appearance = ESP_HID_APPEARANCE_GENERIC; - esp_ble_gatt_creat_conn_params_t esp_ble_gatt_create_conn; - memcpy(&esp_ble_gatt_create_conn.remote_bda, dev->bda, ESP_BD_ADDR_LEN); - esp_ble_gatt_create_conn.remote_addr_type = dev->ble.address_type; - esp_ble_gatt_create_conn.own_addr_type = BLE_ADDR_TYPE_PUBLIC; - esp_ble_gatt_create_conn.is_direct = true; - esp_ble_gatt_create_conn.is_aux = false; + esp_ble_gatt_creat_conn_params_t creat_conn_params; + memcpy(&creat_conn_params.remote_bda, dev->bda, ESP_BD_ADDR_LEN); + creat_conn_params.remote_addr_type = dev->ble.address_type; + creat_conn_params.own_addr_type = BLE_ADDR_TYPE_PUBLIC; + creat_conn_params.is_direct = true; + creat_conn_params.is_aux = false; ret = esp_ble_gattc_enh_open(hid_gattc_if, - esp_ble_gatt_create_conn); + &creat_conn_params); if (ret) { esp_hidh_dev_free_inner(dev); ESP_LOGE(TAG, "esp_ble_gattc_enh_open failed: %d", ret); diff --git a/examples/bluetooth/bluedroid/ble/ble_ancs/main/ble_ancs_demo.c b/examples/bluetooth/bluedroid/ble/ble_ancs/main/ble_ancs_demo.c index 6d8b3f6b12..6b7479423e 100644 --- a/examples/bluetooth/bluedroid/ble/ble_ancs/main/ble_ancs_demo.c +++ b/examples/bluetooth/bluedroid/ble/ble_ancs/main/ble_ancs_demo.c @@ -552,14 +552,14 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_ //esp_log_buffer_hex("bda", param->connect.remote_bda, 6); memcpy(gl_profile_tab[PROFILE_A_APP_ID].remote_bda, param->connect.remote_bda, 6); // create gattc virtual connection - esp_ble_gatt_creat_conn_params_t esp_ble_gatt_create_conn; - memcpy(&esp_ble_gatt_create_conn.remote_bda, gl_profile_tab[PROFILE_A_APP_ID].remote_bda, ESP_BD_ADDR_LEN); - esp_ble_gatt_create_conn.remote_addr_type = BLE_ADDR_TYPE_RANDOM; - esp_ble_gatt_create_conn.own_addr_type = BLE_ADDR_TYPE_RPA_PUBLIC; - esp_ble_gatt_create_conn.is_direct = true; - esp_ble_gatt_create_conn.is_aux = false; + esp_ble_gatt_creat_conn_params_t creat_conn_params; + memcpy(&creat_conn_params.remote_bda, gl_profile_tab[PROFILE_A_APP_ID].remote_bda, ESP_BD_ADDR_LEN); + creat_conn_params.remote_addr_type = BLE_ADDR_TYPE_RANDOM; + creat_conn_params.own_addr_type = BLE_ADDR_TYPE_RPA_PUBLIC; + creat_conn_params.is_direct = true; + creat_conn_params.is_aux = false; esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &creat_conn_params); break; case ESP_GATTC_DIS_SRVC_CMPL_EVT: ESP_LOGI(BLE_ANCS_TAG, "ESP_GATTC_DIS_SRVC_CMPL_EVT"); diff --git a/examples/bluetooth/bluedroid/ble/ble_spp_client/main/spp_client_demo.c b/examples/bluetooth/bluedroid/ble/ble_spp_client/main/spp_client_demo.c index ffa952c19b..bb396b6f7f 100644 --- a/examples/bluetooth/bluedroid/ble/ble_spp_client/main/spp_client_demo.c +++ b/examples/bluetooth/bluedroid/ble/ble_spp_client/main/spp_client_demo.c @@ -238,14 +238,14 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par ESP_LOGI(GATTC_TAG, "Scan stop successed"); if (is_connect == false) { ESP_LOGI(GATTC_TAG, "Connect to the remote device."); - esp_ble_gatt_creat_conn_params_t esp_ble_gatt_create_conn; - memcpy(&esp_ble_gatt_create_conn.remote_bda, scan_rst.scan_rst.bda,ESP_BD_ADDR_LEN); - esp_ble_gatt_create_conn.remote_addr_type = scan_rst.scan_rst.ble_addr_type; - esp_ble_gatt_create_conn.own_addr_type = BLE_ADDR_TYPE_PUBLIC; - esp_ble_gatt_create_conn.is_direct = true; - esp_ble_gatt_create_conn.is_aux = false; + esp_ble_gatt_creat_conn_params_t creat_conn_params; + memcpy(&creat_conn_params.remote_bda, scan_rst.scan_rst.bda,ESP_BD_ADDR_LEN); + creat_conn_params.remote_addr_type = scan_rst.scan_rst.ble_addr_type; + creat_conn_params.own_addr_type = BLE_ADDR_TYPE_PUBLIC; + creat_conn_params.is_direct = true; + creat_conn_params.is_aux = false; esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &creat_conn_params); } break; case ESP_GAP_BLE_SCAN_RESULT_EVT: { diff --git a/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/main/example_ble_client_throughput.c b/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/main/example_ble_client_throughput.c index 8980fcb0fa..792a076a39 100644 --- a/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/main/example_ble_client_throughput.c +++ b/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/main/example_ble_client_throughput.c @@ -401,14 +401,14 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par #endif esp_ble_gap_stop_scanning(); - esp_ble_gatt_creat_conn_params_t esp_ble_gatt_create_conn; - memcpy(&esp_ble_gatt_create_conn.remote_bda, scan_result->scan_rst.bda, ESP_BD_ADDR_LEN); - esp_ble_gatt_create_conn.remote_addr_type = scan_result->scan_rst.ble_addr_type; - esp_ble_gatt_create_conn.own_addr_type = BLE_ADDR_TYPE_PUBLIC; - esp_ble_gatt_create_conn.is_direct = true; - esp_ble_gatt_create_conn.is_aux = false; + esp_ble_gatt_creat_conn_params_t creat_conn_params; + memcpy(&creat_conn_params.remote_bda, scan_result->scan_rst.bda, ESP_BD_ADDR_LEN); + creat_conn_params.remote_addr_type = scan_result->scan_rst.ble_addr_type; + creat_conn_params.own_addr_type = BLE_ADDR_TYPE_PUBLIC; + creat_conn_params.is_direct = true; + creat_conn_params.is_aux = false; esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &creat_conn_params); } } } diff --git a/examples/bluetooth/bluedroid/ble/gatt_client/main/gattc_demo.c b/examples/bluetooth/bluedroid/ble/gatt_client/main/gattc_demo.c index d254c70c45..e5756e322f 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_client/main/gattc_demo.c +++ b/examples/bluetooth/bluedroid/ble/gatt_client/main/gattc_demo.c @@ -358,14 +358,14 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par connect = true; ESP_LOGI(GATTC_TAG, "Connect to the remote device"); esp_ble_gap_stop_scanning(); - esp_ble_gatt_creat_conn_params_t esp_ble_gatt_create_conn; - memcpy(&esp_ble_gatt_create_conn.remote_bda, scan_result->scan_rst.bda, ESP_BD_ADDR_LEN); - esp_ble_gatt_create_conn.remote_addr_type = scan_result->scan_rst.ble_addr_type; - esp_ble_gatt_create_conn.own_addr_type = BLE_ADDR_TYPE_PUBLIC; - esp_ble_gatt_create_conn.is_direct = true; - esp_ble_gatt_create_conn.is_aux = false; + esp_ble_gatt_creat_conn_params_t creat_conn_params; + memcpy(&creat_conn_params.remote_bda, scan_result->scan_rst.bda, ESP_BD_ADDR_LEN); + creat_conn_params.remote_addr_type = scan_result->scan_rst.ble_addr_type; + creat_conn_params.own_addr_type = BLE_ADDR_TYPE_PUBLIC; + creat_conn_params.is_direct = true; + creat_conn_params.is_aux = false; esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &creat_conn_params); } } } diff --git a/examples/bluetooth/bluedroid/ble/gatt_client/tutorial/Gatt_Client_Example_Walkthrough.md b/examples/bluetooth/bluedroid/ble/gatt_client/tutorial/Gatt_Client_Example_Walkthrough.md index 30756d9100..20e17e4e47 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_client/tutorial/Gatt_Client_Example_Walkthrough.md +++ b/examples/bluetooth/bluedroid/ble/gatt_client/tutorial/Gatt_Client_Example_Walkthrough.md @@ -377,7 +377,7 @@ We are interested in the `ESP_GAP_SEARCH_INQ_RES_EVT` event, which is called eve esp_ble_gatt_create_conn.is_direct = true; esp_ble_gatt_create_conn.is_aux = false; esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &esp_ble_gatt_create_conn); } } } diff --git a/examples/bluetooth/bluedroid/ble/gatt_security_client/main/example_ble_sec_gattc_demo.c b/examples/bluetooth/bluedroid/ble/gatt_security_client/main/example_ble_sec_gattc_demo.c index a8f244b072..cc88c736cb 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_security_client/main/example_ble_sec_gattc_demo.c +++ b/examples/bluetooth/bluedroid/ble/gatt_security_client/main/example_ble_sec_gattc_demo.c @@ -464,7 +464,7 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par esp_ble_gatt_create_conn.is_direct = true; esp_ble_gatt_create_conn.is_aux = false; esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &esp_ble_gatt_create_conn); } } } diff --git a/examples/bluetooth/bluedroid/ble/gattc_multi_connect/main/gattc_multi_connect.c b/examples/bluetooth/bluedroid/ble/gattc_multi_connect/main/gattc_multi_connect.c index 0067cf9a52..af4feaa125 100644 --- a/examples/bluetooth/bluedroid/ble/gattc_multi_connect/main/gattc_multi_connect.c +++ b/examples/bluetooth/bluedroid/ble/gattc_multi_connect/main/gattc_multi_connect.c @@ -792,14 +792,14 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par conn_device_a = true; ESP_LOGI(GATTC_TAG, "Searched device %s", remote_device_name[0]); esp_ble_gap_stop_scanning(); - esp_ble_gatt_creat_conn_params_t esp_ble_gatt_create_conn; - memcpy(&esp_ble_gatt_create_conn.remote_bda, scan_result->scan_rst.bda, ESP_BD_ADDR_LEN); - esp_ble_gatt_create_conn.remote_addr_type = scan_result->scan_rst.ble_addr_type; - esp_ble_gatt_create_conn.own_addr_type = BLE_ADDR_TYPE_PUBLIC; - esp_ble_gatt_create_conn.is_direct = true; - esp_ble_gatt_create_conn.is_aux = false; + esp_ble_gatt_creat_conn_params_t creat_conn_params; + memcpy(&creat_conn_params.remote_bda, scan_result->scan_rst.bda, ESP_BD_ADDR_LEN); + creat_conn_params.remote_addr_type = scan_result->scan_rst.ble_addr_type; + creat_conn_params.own_addr_type = BLE_ADDR_TYPE_PUBLIC; + creat_conn_params.is_direct = true; + creat_conn_params.is_aux = false; esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &creat_conn_params); Isconnecting = true; } break; @@ -809,14 +809,14 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par conn_device_b = true; ESP_LOGI(GATTC_TAG, "Searched device %s", remote_device_name[1]); esp_ble_gap_stop_scanning(); - esp_ble_gatt_creat_conn_params_t esp_ble_gatt_create_conn; - memcpy(&esp_ble_gatt_create_conn.remote_bda, scan_result->scan_rst.bda, ESP_BD_ADDR_LEN); - esp_ble_gatt_create_conn.remote_addr_type = scan_result->scan_rst.ble_addr_type; - esp_ble_gatt_create_conn.own_addr_type = BLE_ADDR_TYPE_PUBLIC; - esp_ble_gatt_create_conn.is_direct = true; - esp_ble_gatt_create_conn.is_aux = false; + esp_ble_gatt_creat_conn_params_t creat_conn_params; + memcpy(&creat_conn_params.remote_bda, scan_result->scan_rst.bda, ESP_BD_ADDR_LEN); + creat_conn_params.remote_addr_type = scan_result->scan_rst.ble_addr_type; + creat_conn_params.own_addr_type = BLE_ADDR_TYPE_PUBLIC; + creat_conn_params.is_direct = true; + creat_conn_params.is_aux = false; esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &creat_conn_params); Isconnecting = true; } @@ -826,14 +826,14 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par conn_device_c = true; ESP_LOGI(GATTC_TAG, "Searched device %s", remote_device_name[2]); esp_ble_gap_stop_scanning(); - esp_ble_gatt_creat_conn_params_t esp_ble_gatt_create_conn; - memcpy(&esp_ble_gatt_create_conn.remote_bda, scan_result->scan_rst.bda, ESP_BD_ADDR_LEN); - esp_ble_gatt_create_conn.remote_addr_type = scan_result->scan_rst.ble_addr_type; - esp_ble_gatt_create_conn.own_addr_type = BLE_ADDR_TYPE_PUBLIC; - esp_ble_gatt_create_conn.is_direct = true; - esp_ble_gatt_create_conn.is_aux = false; + esp_ble_gatt_creat_conn_params_t creat_conn_params; + memcpy(&creat_conn_params.remote_bda, scan_result->scan_rst.bda, ESP_BD_ADDR_LEN); + creat_conn_params.remote_addr_type = scan_result->scan_rst.ble_addr_type; + creat_conn_params.own_addr_type = BLE_ADDR_TYPE_PUBLIC; + creat_conn_params.is_direct = true; + creat_conn_params.is_aux = false; esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &creat_conn_params); Isconnecting = true; } break; diff --git a/examples/bluetooth/bluedroid/ble/gattc_multi_connect/tutorial/Gatt_Client_Multi_Connection_Example_Walkthrough.md b/examples/bluetooth/bluedroid/ble/gattc_multi_connect/tutorial/Gatt_Client_Multi_Connection_Example_Walkthrough.md index 6726b2e799..7f7439abd5 100644 --- a/examples/bluetooth/bluedroid/ble/gattc_multi_connect/tutorial/Gatt_Client_Multi_Connection_Example_Walkthrough.md +++ b/examples/bluetooth/bluedroid/ble/gattc_multi_connect/tutorial/Gatt_Client_Multi_Connection_Example_Walkthrough.md @@ -167,7 +167,7 @@ The scan stop triggers an ``ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT`` event which is esp_ble_gatt_create_conn.is_direct = true; esp_ble_gatt_create_conn.is_aux = false; esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &esp_ble_gatt_create_conn); Isconnecting = true; } break; @@ -184,7 +184,7 @@ The scan stop triggers an ``ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT`` event which is esp_ble_gatt_create_conn.is_direct = true; esp_ble_gatt_create_conn.is_aux = false; esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &esp_ble_gatt_create_conn); Isconnecting = true; } @@ -201,7 +201,7 @@ The scan stop triggers an ``ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT`` event which is esp_ble_gatt_create_conn.is_direct = true; esp_ble_gatt_create_conn.is_aux = false; esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &esp_ble_gatt_create_conn); Isconnecting = true; } break; diff --git a/examples/bluetooth/bluedroid/ble_50/ble50_security_client/main/ble50_sec_gattc_demo.c b/examples/bluetooth/bluedroid/ble_50/ble50_security_client/main/ble50_sec_gattc_demo.c index ea12996677..5ae2461975 100644 --- a/examples/bluetooth/bluedroid/ble_50/ble50_security_client/main/ble50_sec_gattc_demo.c +++ b/examples/bluetooth/bluedroid/ble_50/ble50_security_client/main/ble50_sec_gattc_demo.c @@ -497,15 +497,14 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par ESP_BLE_GAP_PHY_1M_PREF_MASK | ESP_BLE_GAP_PHY_2M_PREF_MASK | ESP_BLE_GAP_PHY_CODED_PREF_MASK , &phy_1m_conn_params, &phy_2m_conn_params, &phy_coded_conn_params); // create gattc virtual connection - esp_ble_gatt_creat_conn_params_t esp_ble_gatt_create_conn; - memcpy(&esp_ble_gatt_create_conn.remote_bda, param->ext_adv_report.params.addr, ESP_BD_ADDR_LEN); - esp_ble_gatt_create_conn.remote_addr_type = param->ext_adv_report.params.addr_type; - esp_ble_gatt_create_conn.own_addr_type = BLE_ADDR_TYPE_PUBLIC; - esp_ble_gatt_create_conn.is_direct = true; - esp_ble_gatt_create_conn.is_aux = true; - esp_ble_gattc_aux_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, - param->ext_adv_report.params.addr, - param->ext_adv_report.params.addr_type, true); + esp_ble_gatt_creat_conn_params_t creat_conn_params; + memcpy(&creat_conn_params.remote_bda, param->ext_adv_report.params.addr, ESP_BD_ADDR_LEN); + creat_conn_params.remote_addr_type = param->ext_adv_report.params.addr_type; + creat_conn_params.own_addr_type = BLE_ADDR_TYPE_PUBLIC; + creat_conn_params.is_direct = true; + creat_conn_params.is_aux = true; + esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, + &creat_conn_params); } break; diff --git a/examples/bluetooth/bluedroid/coex/gattc_gatts_coex/main/gattc_gatts_coex.c b/examples/bluetooth/bluedroid/coex/gattc_gatts_coex/main/gattc_gatts_coex.c index ca88f2f934..6f52025feb 100644 --- a/examples/bluetooth/bluedroid/coex/gattc_gatts_coex/main/gattc_gatts_coex.c +++ b/examples/bluetooth/bluedroid/coex/gattc_gatts_coex/main/gattc_gatts_coex.c @@ -306,14 +306,14 @@ static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param // Initiate GATT connection with the remote device, // If ble physical connection is set up, ESP_GATTS_CONNECT_EVT and ESP_GATTC_CONNECT_EVT event will come - esp_ble_gatt_creat_conn_params_t esp_ble_gatt_create_conn; - memcpy(&esp_ble_gatt_create_conn.remote_bda, scan_result->scan_rst.bda, ESP_BD_ADDR_LEN); - esp_ble_gatt_create_conn.remote_addr_type = scan_result->scan_rst.ble_addr_type; - esp_ble_gatt_create_conn.own_addr_type = BLE_ADDR_TYPE_PUBLIC; - esp_ble_gatt_create_conn.is_direct = true; - esp_ble_gatt_create_conn.is_aux = false; + esp_ble_gatt_creat_conn_params_t creat_conn_params; + memcpy(&creat_conn_params.remote_bda, scan_result->scan_rst.bda, ESP_BD_ADDR_LEN); + creat_conn_params.remote_addr_type = scan_result->scan_rst.ble_addr_type; + creat_conn_params.own_addr_type = BLE_ADDR_TYPE_PUBLIC; + creat_conn_params.is_direct = true; + creat_conn_params.is_aux = false; esp_ble_gattc_enh_open(gattc_profile_tab[GATTC_PROFILE_C_APP_ID].gattc_if, - esp_ble_gatt_create_conn); + &creat_conn_params); // Update peer gatt server address memcpy(peer_gatts_addr, scan_result->scan_rst.bda, sizeof(esp_bd_addr_t));