OSDN Git Service

LE COC: Indicate channel open on ConnectRsp recv
authorHansong Zhang <hsz@google.com>
Mon, 28 Sep 2020 20:15:10 +0000 (13:15 -0700)
committerHansong Zhang <hsz@google.com>
Tue, 29 Sep 2020 00:59:49 +0000 (17:59 -0700)
Also don't auto send ConnectRsp for LE. Need to clean up config.

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I4e148d0d0d6597ef8d1d9115db8c8ba6f92a1b8e

stack/l2cap/l2c_csm.cc

index 91e3540..de695f9 100644 (file)
@@ -450,8 +450,10 @@ static void l2c_csm_term_w4_sec_comp(tL2C_CCB* p_ccb, uint16_t event,
         L2CAP_TRACE_API("L2CAP - Calling Connect_Ind_Cb(), CID: 0x%04x",
                         p_ccb->local_cid);
 
-        l2c_csm_send_connect_rsp(p_ccb);
-        l2c_csm_send_config_req(p_ccb);
+        if (p_ccb->p_lcb->transport != BT_TRANSPORT_LE) {
+          l2c_csm_send_connect_rsp(p_ccb);
+          l2c_csm_send_config_req(p_ccb);
+        }
       } else {
         /*
         ** L2CAP Connect Response will be sent out by 3 sec timer expiration
@@ -561,6 +563,9 @@ static void l2c_csm_w4_l2cap_connect_rsp(tL2C_CCB* p_ccb, uint16_t event,
         /* Connection is completed */
         alarm_cancel(p_ccb->l2c_ccb_timer);
         p_ccb->chnl_state = CST_OPEN;
+        (*p_ccb->p_rcb->api.pL2CA_ConnectInd_Cb)(
+            p_ccb->p_lcb->remote_bd_addr, p_ccb->local_cid, p_ccb->p_rcb->psm,
+            p_ccb->remote_id);
       } else {
         p_ccb->chnl_state = CST_CONFIG;
         alarm_set_on_mloop(p_ccb->l2c_ccb_timer, L2CAP_CHNL_CFG_TIMEOUT_MS,