Просмотр исходного кода

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

gengyuchao 6 лет назад
Родитель
Сommit
3366467980

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

+ 1 - 1
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

+ 1 - 1
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;
 }

+ 1 - 1
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

+ 1 - 1
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,