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

add option to enable multi-connection

zwj 4 лет назад
Родитель
Сommit
67b09d3db5

+ 7 - 0
components/bt/host/bluedroid/Kconfig.in

@@ -971,6 +971,13 @@ config BT_ACL_CONNECTIONS
     help
         Maximum BT/BLE connection count
 
+config BT_MULTI_CONNECTION_ENBALE
+    bool "Enable BLE multi-conections"
+    depends on BT_BLUEDROID_ENABLED
+    default y
+    help
+        Enable this option if there are multiple connections
+
 config BT_ALLOCATION_FROM_SPIRAM_FIRST
     bool "BT/BLE will first malloc the memory from the PSRAM"
     depends on BT_BLUEDROID_ENABLED

+ 2 - 1
components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c

@@ -973,10 +973,11 @@ void bta_gattc_start_discover(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
             p_clcb->p_srcb->srvc_hdl_chg = FALSE;
             p_clcb->p_srcb->update_count = 0;
             p_clcb->p_srcb->state = BTA_GATTC_SERV_DISC_ACT;
-
+            #if (BT_MULTI_CONNECTION_ENBALE == FALSE)
             if (p_clcb->transport == BTA_TRANSPORT_LE) {
                 L2CA_EnableUpdateBleConnParams(p_clcb->p_srcb->server_bda, FALSE);
             }
+            #endif
 
             /* set all srcb related clcb into discovery ST */
             bta_gattc_set_discover_st(p_clcb->p_srcb);

+ 2 - 0
components/bt/host/bluedroid/bta/gatt/bta_gattc_cache.c

@@ -616,9 +616,11 @@ static void bta_gattc_explore_srvc(UINT16 conn_id, tBTA_GATTC_SERV *p_srvc_cb)
 
     //server discover end, update connection parameters
 #if BLE_INCLUDED == TRUE
+    #if (BT_MULTI_CONNECTION_ENBALE == FALSE)
     if (p_clcb->transport == BTA_TRANSPORT_LE) {
         L2CA_EnableUpdateBleConnParams(p_clcb->p_srcb->server_bda, TRUE);
     }
+    #endif
     //discover service complete, trigger callback
     tBTA_GATTC cb_data;
     cb_data.dis_cmpl.status  = p_clcb->status;

+ 6 - 0
components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h

@@ -210,6 +210,12 @@
 #define UC_BT_ACL_CONNECTIONS                   5
 #endif
 
+#ifdef CONFIG_BT_MULTI_CONNECTION_ENBALE
+#define UC_BT_MULTI_CONNECTION_ENBALE            CONFIG_BT_MULTI_CONNECTION_ENBALE
+#else
+#define UC_BT_MULTI_CONNECTION_ENBALE            FALSE
+#endif
+
 //BT_BLE_ESTAB_LINK_CONN_TOUT
 #ifdef CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT
 #define UC_BT_BLE_ESTAB_LINK_CONN_TOUT          CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT

+ 10 - 0
components/bt/host/bluedroid/common/include/common/bt_target.h

@@ -249,6 +249,16 @@
 #define GATT_MAX_PHY_CHANNEL        UC_BT_ACL_CONNECTIONS
 #endif  /* UC_BT_ACL_CONNECTIONS */
 
+#ifdef UC_BT_MULTI_CONNECTION_ENBALE
+#define BT_MULTI_CONNECTION_ENBALE  UC_BT_MULTI_CONNECTION_ENBALE
+#endif
+
+#if(BT_MULTI_CONNECTION_ENBALE && (CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3))
+#define BLE_CE_LEN_MIN           5
+#else
+#define BLE_CE_LEN_MIN           0
+#endif
+
 #ifdef UC_BT_BLE_ESTAB_LINK_CONN_TOUT
 #define BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT UC_BT_BLE_ESTAB_LINK_CONN_TOUT
 #endif

+ 4 - 0
components/bt/host/bluedroid/stack/smp/smp_act.c

@@ -1540,9 +1540,11 @@ void smp_idle_terminate(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 *******************************************************************************/
 void smp_fast_conn_param(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 {
+#if (BT_MULTI_CONNECTION_ENBALE == FALSE)
     if(p_cb->role == BTM_ROLE_MASTER) {
         L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
     }
+#endif
 #if (SMP_SLAVE_CON_PARAMS_UPD_ENABLE == TRUE)
     else {
         tBTM_SEC_DEV_REC    *p_rec = btm_find_dev (p_cb->pairing_bda);
@@ -1554,7 +1556,9 @@ void smp_fast_conn_param(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
         some peripherals are not able to revert to fast connection parameters
         during the start of service discovery. Connection paramter updates
         get enabled again once service discovery completes. */
+        #if (BT_MULTI_CONNECTION_ENBALE == FALSE)
         L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
+        #endif
     }
 #endif
 }

+ 2 - 0
components/bt/host/bluedroid/stack/smp/smp_utils.c

@@ -1021,7 +1021,9 @@ void smp_proc_pairing_cmpl(tSMP_CB *p_cb)
             //clear flag
             p_rec->ble.skip_update_conn_param = false;
         } else {
+            #if (BT_MULTI_CONNECTION_ENBALE == FALSE)
             L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, TRUE);
+            #endif
         }
     }