mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
add option to enable multi-connection
This commit is contained in:
@@ -971,6 +971,13 @@ config BT_ACL_CONNECTIONS
|
|||||||
help
|
help
|
||||||
Maximum BT/BLE connection count
|
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
|
config BT_ALLOCATION_FROM_SPIRAM_FIRST
|
||||||
bool "BT/BLE will first malloc the memory from the PSRAM"
|
bool "BT/BLE will first malloc the memory from the PSRAM"
|
||||||
depends on BT_BLUEDROID_ENABLED
|
depends on BT_BLUEDROID_ENABLED
|
||||||
|
@@ -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->srvc_hdl_chg = FALSE;
|
||||||
p_clcb->p_srcb->update_count = 0;
|
p_clcb->p_srcb->update_count = 0;
|
||||||
p_clcb->p_srcb->state = BTA_GATTC_SERV_DISC_ACT;
|
p_clcb->p_srcb->state = BTA_GATTC_SERV_DISC_ACT;
|
||||||
|
#if (BT_MULTI_CONNECTION_ENBALE == FALSE)
|
||||||
if (p_clcb->transport == BTA_TRANSPORT_LE) {
|
if (p_clcb->transport == BTA_TRANSPORT_LE) {
|
||||||
L2CA_EnableUpdateBleConnParams(p_clcb->p_srcb->server_bda, FALSE);
|
L2CA_EnableUpdateBleConnParams(p_clcb->p_srcb->server_bda, FALSE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* set all srcb related clcb into discovery ST */
|
/* set all srcb related clcb into discovery ST */
|
||||||
bta_gattc_set_discover_st(p_clcb->p_srcb);
|
bta_gattc_set_discover_st(p_clcb->p_srcb);
|
||||||
|
@@ -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
|
//server discover end, update connection parameters
|
||||||
#if BLE_INCLUDED == TRUE
|
#if BLE_INCLUDED == TRUE
|
||||||
|
#if (BT_MULTI_CONNECTION_ENBALE == FALSE)
|
||||||
if (p_clcb->transport == BTA_TRANSPORT_LE) {
|
if (p_clcb->transport == BTA_TRANSPORT_LE) {
|
||||||
L2CA_EnableUpdateBleConnParams(p_clcb->p_srcb->server_bda, TRUE);
|
L2CA_EnableUpdateBleConnParams(p_clcb->p_srcb->server_bda, TRUE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
//discover service complete, trigger callback
|
//discover service complete, trigger callback
|
||||||
tBTA_GATTC cb_data;
|
tBTA_GATTC cb_data;
|
||||||
cb_data.dis_cmpl.status = p_clcb->status;
|
cb_data.dis_cmpl.status = p_clcb->status;
|
||||||
|
@@ -210,6 +210,12 @@
|
|||||||
#define UC_BT_ACL_CONNECTIONS 5
|
#define UC_BT_ACL_CONNECTIONS 5
|
||||||
#endif
|
#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
|
//BT_BLE_ESTAB_LINK_CONN_TOUT
|
||||||
#ifdef CONFIG_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
|
#define UC_BT_BLE_ESTAB_LINK_CONN_TOUT CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT
|
||||||
|
@@ -249,6 +249,16 @@
|
|||||||
#define GATT_MAX_PHY_CHANNEL UC_BT_ACL_CONNECTIONS
|
#define GATT_MAX_PHY_CHANNEL UC_BT_ACL_CONNECTIONS
|
||||||
#endif /* 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
|
#ifdef UC_BT_BLE_ESTAB_LINK_CONN_TOUT
|
||||||
#define BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT UC_BT_BLE_ESTAB_LINK_CONN_TOUT
|
#define BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT UC_BT_BLE_ESTAB_LINK_CONN_TOUT
|
||||||
#endif
|
#endif
|
||||||
|
@@ -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)
|
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) {
|
if(p_cb->role == BTM_ROLE_MASTER) {
|
||||||
L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
|
L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#if (SMP_SLAVE_CON_PARAMS_UPD_ENABLE == TRUE)
|
#if (SMP_SLAVE_CON_PARAMS_UPD_ENABLE == TRUE)
|
||||||
else {
|
else {
|
||||||
tBTM_SEC_DEV_REC *p_rec = btm_find_dev (p_cb->pairing_bda);
|
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
|
some peripherals are not able to revert to fast connection parameters
|
||||||
during the start of service discovery. Connection paramter updates
|
during the start of service discovery. Connection paramter updates
|
||||||
get enabled again once service discovery completes. */
|
get enabled again once service discovery completes. */
|
||||||
|
#if (BT_MULTI_CONNECTION_ENBALE == FALSE)
|
||||||
L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
|
L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -1021,7 +1021,9 @@ void smp_proc_pairing_cmpl(tSMP_CB *p_cb)
|
|||||||
//clear flag
|
//clear flag
|
||||||
p_rec->ble.skip_update_conn_param = false;
|
p_rec->ble.skip_update_conn_param = false;
|
||||||
} else {
|
} else {
|
||||||
|
#if (BT_MULTI_CONNECTION_ENBALE == FALSE)
|
||||||
L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, TRUE);
|
L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, TRUE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user