ble:set a esp api to get size of controller send packets buffer.

This commit is contained in:
gengyuchao 2020-01-10 16:32:47 +08:00
parent 189cd21660
commit 3366467980
5 changed files with 14 additions and 5 deletions

View file

@ -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);
}
}
#if (BLE_INCLUDED == TRUE)
extern uint16_t L2CA_GetFreePktBufferNum_LE(void);
uint16_t esp_ble_get_sendable_packets_num ()
{
return L2CA_GetFreePktBufferNum_LE();
}
#endif

View file

@ -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

View file

@ -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;
}

View file

@ -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

View file

@ -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,