feat(ble/bluedroid): Support setting connection params when creating connection

This commit is contained in:
chenjianhua
2024-11-26 12:10:27 +08:00
parent 7e536a7ba1
commit e5789a8ca1
32 changed files with 351 additions and 150 deletions
@@ -817,12 +817,13 @@ 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 creat_conn_params;
esp_ble_gatt_creat_conn_params_t creat_conn_params = {0};
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;
creat_conn_params.phy_mask = 0x0;
esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if,
&creat_conn_params);
Isconnecting = true;
@@ -834,12 +835,13 @@ 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 creat_conn_params;
esp_ble_gatt_creat_conn_params_t creat_conn_params = {0};
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;
creat_conn_params.phy_mask = 0x0;
esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if,
&creat_conn_params);
Isconnecting = true;
@@ -851,12 +853,13 @@ 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 creat_conn_params;
esp_ble_gatt_creat_conn_params_t creat_conn_params = {0};
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;
creat_conn_params.phy_mask = 0x0;
esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if,
&creat_conn_params);
Isconnecting = true;
@@ -160,14 +160,15 @@ The scan stop triggers an ``ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT`` event which is
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 = {0};
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;
creat_conn_params.phy_mask = 0x0;
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;
@@ -177,14 +178,15 @@ The scan stop triggers an ``ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT`` event which is
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 = {0};
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;
creat_conn_params.phy_mask = 0x0;
esp_ble_gattc_enh_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if,
&esp_ble_gatt_create_conn);
&creat_conn_params);
Isconnecting = true;
}
@@ -194,14 +196,15 @@ The scan stop triggers an ``ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT`` event which is
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 = {0};
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;
creat_conn_params.phy_mask = 0x0;
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;