@@ -67,8 +67,8 @@ esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gattc_if)
6767
6868 return (btc_transfer_context (& msg , & arg , sizeof (btc_ble_gattc_args_t ), NULL , NULL ) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL );
6969}
70- #if ( BLE_42_FEATURE_SUPPORT == TRUE )
71- 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 )
70+
71+ 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 )
7272{
7373 btc_msg_t msg = {0 };
7474 btc_ble_gattc_args_t arg ;
@@ -79,34 +79,38 @@ esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, e
7979 msg .pid = BTC_PID_GATTC ;
8080 msg .act = BTC_GATTC_ACT_OPEN ;
8181 arg .open .gattc_if = gattc_if ;
82- memcpy (arg .open .remote_bda , remote_bda , ESP_BD_ADDR_LEN );
83- arg .open .remote_addr_type = remote_addr_type ;
84- arg .open .is_direct = is_direct ;
85- arg .open .is_aux = false;
82+ memcpy (arg .open .remote_bda , esp_gatt_create_conn .remote_bda , ESP_BD_ADDR_LEN );
83+ arg .open .remote_addr_type = esp_gatt_create_conn .remote_addr_type ;
84+ arg .open .is_direct = esp_gatt_create_conn .is_direct ;
85+ arg .open .is_aux = esp_gatt_create_conn .is_aux ;
86+ arg .open .own_addr_type = esp_gatt_create_conn .own_addr_type ;
8687
8788 return (btc_transfer_context (& msg , & arg , sizeof (btc_ble_gattc_args_t ), NULL , NULL ) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL );
8889}
90+
91+ #if (BLE_42_FEATURE_SUPPORT == TRUE )
92+ 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 )
93+ {
94+ esp_ble_gatt_creat_conn_params_t esp_gatt_create_conn ;
95+ memcpy (esp_gatt_create_conn .remote_bda , remote_bda , ESP_BD_ADDR_LEN );
96+ esp_gatt_create_conn .remote_addr_type = remote_addr_type ;
97+ esp_gatt_create_conn .is_direct = is_direct ;
98+ esp_gatt_create_conn .is_aux = false;
99+ esp_gatt_create_conn .own_addr_type = 0xff ; //undefined, will use local value
100+ return esp_ble_gattc_enh_open (gattc_if , esp_gatt_create_conn );
101+ }
89102#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
90103
91104#if (BLE_50_FEATURE_SUPPORT == TRUE )
92105esp_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 )
93106{
94- btc_msg_t msg ;
95- btc_ble_gattc_args_t arg ;
96-
97- ESP_BLUEDROID_STATUS_CHECK (ESP_BLUEDROID_STATUS_ENABLED );
98-
99- msg .sig = BTC_SIG_API_CALL ;
100- msg .pid = BTC_PID_GATTC ;
101- msg .act = BTC_GATTC_ACT_AUX_OPEN ;
102- arg .open .gattc_if = gattc_if ;
103- memcpy (arg .open .remote_bda , remote_bda , ESP_BD_ADDR_LEN );
104- arg .open .remote_addr_type = remote_addr_type ;
105- arg .open .is_direct = is_direct ;
106- arg .open .is_aux = true;
107-
108- return (btc_transfer_context (& msg , & arg , sizeof (btc_ble_gattc_args_t ), NULL , NULL ) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL );
109-
107+ esp_ble_gatt_creat_conn_params_t esp_gatt_create_conn ;
108+ memcpy (esp_gatt_create_conn .remote_bda , remote_bda , ESP_BD_ADDR_LEN );
109+ esp_gatt_create_conn .remote_addr_type = remote_addr_type ;
110+ esp_gatt_create_conn .is_direct = is_direct ;
111+ esp_gatt_create_conn .is_aux = true;
112+ esp_gatt_create_conn .own_addr_type = 0xff ; //undefined, will use local value
113+ return esp_ble_gattc_enh_open (gattc_if , esp_gatt_create_conn );
110114}
111115#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
112116
0 commit comments