]> granicus.if.org Git - esp-idf/commitdiff
component/bt: fix no adv packets
authorzwj <zhiweijian@espressif.com>
Thu, 28 Jun 2018 09:49:41 +0000 (17:49 +0800)
committerzwj <zhiweijian@espressif.com>
Thu, 28 Jun 2018 09:49:41 +0000 (17:49 +0800)
components/bt/bluedroid/stack/btm/btm_ble.c
components/bt/bluedroid/stack/l2cap/l2c_ble.c

index 2d3c751724fb02c559e867a07ec28fb89010a3d4..838aaec6c2b1a6da25267048563b5b4a8e0efa9d 100644 (file)
@@ -1948,14 +1948,6 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced)
             handle = HCID_GET_HANDLE (handle);
 
             btm_ble_connected(bda, handle, HCI_ENCRYPT_MODE_DISABLED, role, bda_type, match);
-            if(role == HCI_ROLE_SLAVE) {
-                //clear p_cb->state, controller will stop adv when ble connected.
-                tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
-                if(p_cb) {
-                    p_cb->adv_mode = BTM_BLE_ADV_DISABLE;
-                    p_cb->state = BTM_BLE_STOP_ADV; 
-                }
-            }
             l2cble_conn_comp (handle, role, bda, bda_type, conn_interval,
                               conn_latency, conn_timeout);
 
index b967295170f49aeeeab2c8c26890c62d934f53ad..7329552106a721f215b8d5bc4005a49c2db6d1d2 100644 (file)
@@ -261,6 +261,15 @@ void l2cble_notify_le_connection (BD_ADDR bda)
     tACL_CONN *p_acl = btm_bda_to_acl(bda, BT_TRANSPORT_LE) ;
 
     if (p_lcb != NULL && p_acl != NULL && p_lcb->link_state != LST_CONNECTED) {
+
+        if(p_acl->link_role == HCI_ROLE_SLAVE) {
+            //clear p_cb->state, controller will stop adv when ble connected.
+            tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
+            if(p_cb) {
+                p_cb->adv_mode = BTM_BLE_ADV_DISABLE;
+                p_cb->state = BTM_BLE_STOP_ADV;
+            }
+        }
         /* update link status */
         btm_establish_continue(p_acl);
         /* update l2cap link status and send callback */