mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-29 18:27:20 +02:00
fix(ble/bluedroid): Optimize BLE API "esp_ble_gattc_enh_open"
This commit is contained in:
committed by
chenjianhua
parent
2904494228
commit
3a85b1b6ce
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -672,14 +672,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->addr.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->addr.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);
|
||||
|
@ -565,14 +565,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");
|
||||
|
@ -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 successfully");
|
||||
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: {
|
||||
|
@ -408,14 +408,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -368,14 +368,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -470,7 +470,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -817,14 +817,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;
|
||||
@ -834,14 +834,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;
|
||||
|
||||
}
|
||||
@ -851,14 +851,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;
|
||||
|
@ -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;
|
||||
|
@ -502,15 +502,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;
|
||||
|
@ -307,14 +307,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));
|
||||
|
Reference in New Issue
Block a user