diff --git a/components/bt/host/bluedroid/api/esp_gatt_common_api.c b/components/bt/host/bluedroid/api/esp_gatt_common_api.c index 1146750c7..7a26013b8 100644 --- a/components/bt/host/bluedroid/api/esp_gatt_common_api.c +++ b/components/bt/host/bluedroid/api/esp_gatt_common_api.c @@ -46,4 +46,13 @@ esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu) arg.set_mtu.mtu = mtu; return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatt_com_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); -} \ No newline at end of file +} + +#if (BLE_INCLUDED == TRUE) +extern uint16_t L2CA_GetFreePktBufferNum_LE(void); + +uint16_t esp_ble_get_sendable_packets_num () +{ + return L2CA_GetFreePktBufferNum_LE(); +} +#endif \ No newline at end of file diff --git a/components/bt/host/bluedroid/api/include/api/esp_gatt_common_api.h b/components/bt/host/bluedroid/api/include/api/esp_gatt_common_api.h index 42bdaf32b..bee2c28f0 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gatt_common_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gatt_common_api.h @@ -45,7 +45,7 @@ extern "C" { extern esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu); #if (BLE_INCLUDED == TRUE) -extern uint16_t L2CA_GetFreePkgBufferNum(void); +extern uint16_t esp_ble_get_sendable_packets_num (void); #endif #ifdef __cplusplus diff --git a/components/bt/host/bluedroid/stack/l2cap/l2c_api.c b/components/bt/host/bluedroid/stack/l2cap/l2c_api.c index cdc1103a0..6c97b3819 100644 --- a/components/bt/host/bluedroid/stack/l2cap/l2c_api.c +++ b/components/bt/host/bluedroid/stack/l2cap/l2c_api.c @@ -1873,7 +1873,7 @@ BOOLEAN L2CA_CheckIsCongest(UINT16 fixed_cid, UINT16 handle) } #if (BLE_INCLUDED == TRUE) -UINT16 L2CA_GetFreePkgBufferNum(void) +UINT16 L2CA_GetFreePktBufferNum_LE(void) { return l2cb.controller_le_xmit_window; } 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 8cd3d016e..300df3080 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 @@ -504,7 +504,7 @@ static void throughput_client_task(void *param) assert(res == pdTRUE); } else { if (is_connect) { - int free_buff_num = L2CA_GetFreePkgBufferNum(); + int free_buff_num = esp_ble_get_sendable_packets_num(); if(free_buff_num > 0) { for( ; free_buff_num > 0; free_buff_num--) { // the app data set to 490 just for divided into two packages to send in the low layer diff --git a/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/main/example_ble_server_throughput.c b/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/main/example_ble_server_throughput.c index f169b57e0..48dfd9255 100644 --- a/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/main/example_ble_server_throughput.c +++ b/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/main/example_ble_server_throughput.c @@ -624,7 +624,7 @@ void throughput_server_task(void *param) assert(res == pdTRUE); } else { if (is_connect) { - int free_buff_num = L2CA_GetFreePkgBufferNum(); + int free_buff_num = esp_ble_get_sendable_packets_num(); if(free_buff_num > 0) { for( ; free_buff_num > 0; free_buff_num--) { esp_ble_gatts_send_indicate(gl_profile_tab[PROFILE_A_APP_ID].gatts_if, gl_profile_tab[PROFILE_A_APP_ID].conn_id,