From 1d1754e4b49ed14a567cc60ab683961cfd685273 Mon Sep 17 00:00:00 2001 From: zwj Date: Wed, 28 Oct 2020 14:19:58 +0800 Subject: [PATCH] - fix congest return value - fix system no rsp when doing disconnect - fix no congest event when ssc do writing performance --- .../bt/host/bluedroid/bta/gatt/bta_gattc_act.c | 15 +++++---------- .../bluedroid/btc/profile/std/gatt/btc_gattc.c | 12 ++++++++++++ components/bt/host/bluedroid/stack/btm/btm_sec.c | 2 ++ .../bt/host/bluedroid/stack/l2cap/l2c_api.c | 2 +- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c b/components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c index 20eed1ff5b..510c18aa08 100644 --- a/components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c +++ b/components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c @@ -68,6 +68,8 @@ static void bta_gattc_cong_cback (UINT16 conn_id, BOOLEAN congested); static void bta_gattc_req_cback (UINT16 conn_id, UINT32 trans_id, tGATTS_REQ_TYPE type, tGATTS_DATA *p_data); static tBTA_GATTC_FIND_SERVICE_CB bta_gattc_register_service_change_notify(UINT16 conn_id, BD_ADDR remote_bda); +extern void btc_gattc_congest_callback(tBTA_GATTC *param); + static const tGATT_CBACK bta_gattc_cl_cback = { bta_gattc_conn_cback, bta_gattc_cmpl_cback, @@ -2170,17 +2172,10 @@ static void bta_gattc_cmpl_sendmsg(UINT16 conn_id, tGATTC_OPTYPE op, ********************************************************************************/ static void bta_gattc_cong_cback (UINT16 conn_id, BOOLEAN congested) { - tBTA_GATTC_CLCB *p_clcb; tBTA_GATTC cb_data; - - if ((p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id)) != NULL) { - if (p_clcb->p_rcb->p_cback) { - cb_data.congest.conn_id = conn_id; - cb_data.congest.congested = congested; - - (*p_clcb->p_rcb->p_cback)(BTA_GATTC_CONGEST_EVT, &cb_data); - } - } + cb_data.congest.conn_id = conn_id; + cb_data.congest.congested = congested; + btc_gattc_congest_callback(&cb_data); } /******************************************************************************* diff --git a/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gattc.c b/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gattc.c index f542d26c3a..4a8321d8e1 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gattc.c +++ b/components/bt/host/bluedroid/btc/profile/std/gatt/btc_gattc.c @@ -1017,4 +1017,16 @@ void btc_gattc_cb_handler(btc_msg_t *msg) btc_gattc_free_req_data(msg); } +void btc_gattc_congest_callback(tBTA_GATTC *param) +{ + esp_ble_gattc_cb_param_t esp_param = {0}; + memset(&esp_param, 0, sizeof(esp_ble_gattc_cb_param_t)); + + uint8_t gattc_if = BTC_GATT_GET_GATT_IF(param->congest.conn_id); + esp_param.congest.conn_id = BTC_GATT_GET_CONN_ID(param->congest.conn_id); + esp_param.congest.congested = (param->congest.congested == TRUE) ? true : false; + btc_gattc_cb_to_app(ESP_GATTC_CONGEST_EVT, gattc_if, &esp_param); + +} + #endif ///GATTC_INCLUDED == TRUE diff --git a/components/bt/host/bluedroid/stack/btm/btm_sec.c b/components/bt/host/bluedroid/stack/btm/btm_sec.c index 649ac4e316..b6883201c4 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_sec.c +++ b/components/bt/host/bluedroid/stack/btm/btm_sec.c @@ -4573,7 +4573,9 @@ void btm_sec_disconnected (UINT16 handle, UINT8 reason) /* If page was delayed for disc complete, can do it now */ btm_cb.discing = FALSE; +#if (CLASSIC_BT_INCLUDED == TRUE) btm_acl_resubmit_page(); +#endif if (!p_dev_rec) { return; diff --git a/components/bt/host/bluedroid/stack/l2cap/l2c_api.c b/components/bt/host/bluedroid/stack/l2cap/l2c_api.c index f90f780441..7ccdb26a6b 100644 --- a/components/bt/host/bluedroid/stack/l2cap/l2c_api.c +++ b/components/bt/host/bluedroid/stack/l2cap/l2c_api.c @@ -1839,7 +1839,7 @@ UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf) fixed_queue_length(p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]->xmit_hold_q), p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]->buff_quota); osi_free(p_buf); - return (L2CAP_DW_FAILED); + return (L2CAP_DW_CONGESTED); } l2c_enqueue_peer_data (p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL], p_buf);