fix(ble/bluedroid): change tGATT_BG_CONN_DEV to GATT_BG_CONN_DEV

(cherry picked from commit ac7812ef8d)

Co-authored-by: zhiweijian <zhiweijian@espressif.com>
This commit is contained in:
Zhi Wei Jian
2026-01-07 17:24:49 +08:00
parent ffe93c09ea
commit 174e4144fd
11 changed files with 42 additions and 40 deletions

View File

@@ -599,7 +599,9 @@ void bta_dm_disable (tBTA_DM_MSG *p_data)
#endif
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
#if (GATT_BG_CONN_DEV == TRUE)
BTM_BleClearBgConnDev();
#endif // (GATT_BG_CONN_DEV == TRUE)
#endif
if (BTM_GetNumAclLinks() == 0) {

View File

@@ -660,7 +660,7 @@ void btm_ble_initiate_select_conn(BD_ADDR bda)
BTM_TRACE_ERROR("btm_ble_initiate_select_conn failed");
}
}
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
/*******************************************************************************
**
** Function btm_ble_suspend_bg_conn
@@ -685,7 +685,7 @@ BOOLEAN btm_ble_suspend_bg_conn(void)
return FALSE;
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
/*******************************************************************************
**
@@ -721,9 +721,9 @@ static void btm_suspend_wl_activity(tBTM_BLE_WL_STATE wl_state)
*******************************************************************************/
void btm_resume_wl_activity(tBTM_BLE_WL_STATE wl_state)
{
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
btm_ble_resume_bg_conn();
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
if (wl_state & BTM_BLE_WL_ADV) {
#if (BLE_42_ADV_EN == TRUE)
btm_ble_start_adv();
@@ -750,7 +750,7 @@ static void btm_wl_update_to_controller(void)
btm_execute_wl_dev_operation();
}
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
/*******************************************************************************
**
** Function btm_ble_resume_bg_conn
@@ -780,7 +780,7 @@ BOOLEAN btm_ble_resume_bg_conn(void)
return ret;
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
/*******************************************************************************
**

View File

@@ -1015,6 +1015,7 @@ BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE bg_conn_type,
return started;
}
#if (GATT_BG_CONN_DEV == TRUE)
/*******************************************************************************
**
** Function BTM_BleClearBgConnDev
@@ -1032,10 +1033,9 @@ void BTM_BleClearBgConnDev(void)
{
btm_ble_start_auto_conn(FALSE);
btm_ble_clear_white_list(NULL);
#if (tGATT_BG_CONN_DEV == TRUE)
gatt_reset_bgdev_list();
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
}
#endif // #if (GATT_BG_CONN_DEV == TRUE)
/*******************************************************************************
**
@@ -3955,9 +3955,9 @@ BOOLEAN btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bd_addr, UINT8 st
now in order */
if (btm_ble_get_conn_st() == BLE_CONN_IDLE && status != HCI_ERR_HOST_REJECT_RESOURCES &&
!btm_send_pending_direct_conn()) {
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
bg_con = btm_ble_resume_bg_conn();
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
}
return bg_con;

View File

@@ -718,11 +718,11 @@ BOOLEAN btm_ble_suspend_resolving_list_activity(void)
btm_ble_stop_scan();
p_ble_cb->suspended_rl_state |= BTM_BLE_RL_SCAN;
}
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
if (btm_ble_suspend_bg_conn()) {
p_ble_cb->suspended_rl_state |= BTM_BLE_RL_INIT;
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
return TRUE;
}
@@ -750,11 +750,11 @@ void btm_ble_resume_resolving_list_activity(void)
btm_ble_start_scan();
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
if (p_ble_cb->suspended_rl_state & BTM_BLE_RL_INIT) {
btm_ble_resume_bg_conn();
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
p_ble_cb->suspended_rl_state = BTM_BLE_RL_IDLE;
}

View File

@@ -176,9 +176,9 @@ static void reset_complete(void)
btm_cb.ble_ctr_cb.conn_state = BLE_CONN_IDLE;
btm_cb.ble_ctr_cb.bg_conn_type = BTM_BLE_CONN_NONE;
btm_cb.ble_ctr_cb.p_select_cback = NULL;
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
gatt_reset_bgdev_list();
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
#endif

View File

@@ -464,11 +464,11 @@ void btm_ble_remove_from_white_list_complete(UINT8 *p, UINT16 evt_len);
void btm_ble_clear_white_list_complete(UINT8 *p, UINT16 evt_len);
void btm_ble_white_list_init(UINT8 white_list_size);
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
/* background connection function */
BOOLEAN btm_ble_suspend_bg_conn(void);
BOOLEAN btm_ble_resume_bg_conn(void);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
void btm_ble_initiate_select_conn(BD_ADDR bda);
BOOLEAN btm_ble_start_auto_conn(BOOLEAN start);

View File

@@ -1391,9 +1391,9 @@ void GATT_Deregister (tGATT_IF gatt_if)
}
}
}
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
gatt_deregister_bgdev_list(gatt_if);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
memset (p_reg, 0, sizeof(tGATT_REG));
}
@@ -1469,11 +1469,11 @@ BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_
if (is_direct) {
status = gatt_act_connect (p_reg, bd_addr, bd_addr_type, transport, is_aux, is_pawr_synced, adv_handle, subevent);
} else {
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
if (transport == BT_TRANSPORT_LE) {
status = gatt_update_auto_connect_dev(gatt_if, TRUE, bd_addr, TRUE);
} else
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
{
GATT_TRACE_ERROR("Unsupported transport for background connection");
}
@@ -1531,7 +1531,7 @@ BOOLEAN GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct
status = gatt_cancel_open(gatt_if, bd_addr);
}
} else {
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
if (!gatt_if) {
if (gatt_get_num_apps_for_bg_dev(bd_addr)) {
while (gatt_find_app_for_bg_dev(bd_addr, &temp_gatt_if)) {
@@ -1544,7 +1544,7 @@ BOOLEAN GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct
} else {
status = gatt_remove_bg_dev_for_app(gatt_if, bd_addr);
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
}
return status;

View File

@@ -935,23 +935,23 @@ static void gatt_send_conn_cback(tGATT_TCB *p_tcb)
{
UINT8 i;
tGATT_REG *p_reg;
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
tGATT_BG_CONN_DEV *p_bg_dev = NULL;
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
UINT16 conn_id;
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
p_bg_dev = gatt_find_bg_dev(p_tcb->peer_bda);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
/* notifying all applications for the connection up event */
for (i = 0, p_reg = gatt_cb.cl_rcb ; i < GATT_MAX_APPS; i++, p_reg++) {
if (p_reg->in_use) {
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
if (p_bg_dev && gatt_is_bg_dev_for_app(p_bg_dev, p_reg->gatt_if)) {
gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, TRUE, TRUE);
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
if (p_reg->app_cb.p_conn_cb) {
conn_id = GATT_CREATE_CONN_ID(p_tcb->tcb_idx, p_reg->gatt_if);
(*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, p_tcb->peer_bda, conn_id,

View File

@@ -2424,7 +2424,7 @@ void gatt_dbg_display_uuid(tBT_UUID bt_uuid)
}
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
/*******************************************************************************
**
** Function gatt_is_bg_dev_for_app
@@ -2805,7 +2805,7 @@ BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_
}
return ret;
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
#if (SMP_INCLUDED == TRUE)
/*******************************************************************************

View File

@@ -489,14 +489,14 @@ typedef struct {
UINT32 service_change;
} tGATT_SVC_CHG;
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
typedef struct {
tGATT_IF gatt_if[GATT_MAX_APPS];
tGATT_IF listen_gif[GATT_MAX_APPS];
BD_ADDR remote_bda;
BOOLEAN in_use;
} tGATT_BG_CONN_DEV;
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
#define GATT_SVC_CHANGED_CONNECTING 1 /* wait for connection */
#define GATT_SVC_CHANGED_SERVICE 2 /* GATT service discovery */
@@ -565,9 +565,9 @@ typedef struct {
#if (GATTS_INCLUDED == TRUE)
tGATT_HDL_CFG hdl_cfg;
#endif // (GATTS_INCLUDED == TRUE)
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
tGATT_BG_CONN_DEV bgconn_dev[GATT_MAX_BG_CONN_DEV];
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
#if (GATTC_INCLUDED == TRUE)
BOOLEAN auto_disc; /* internal use: true for auto discovering after connected */
#endif // (GATTC_INCLUDED == TRUE)
@@ -682,7 +682,7 @@ extern BOOLEAN gatt_add_an_item_to_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_L
extern BOOLEAN gatt_remove_an_item_from_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_remove);
extern tGATTS_SRV_CHG *gatt_add_srv_chg_clt(tGATTS_SRV_CHG *p_srv_chg);
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
/* for background connection */
extern BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_addr, BOOLEAN is_initiator);
extern BOOLEAN gatt_is_bg_dev_for_app(tGATT_BG_CONN_DEV *p_dev, tGATT_IF gatt_if);
@@ -692,7 +692,7 @@ extern BOOLEAN gatt_find_app_for_bg_dev(BD_ADDR bd_addr, tGATT_IF *p_gatt_if);
extern tGATT_BG_CONN_DEV *gatt_find_bg_dev(BD_ADDR remote_bda);
extern void gatt_deregister_bgdev_list(tGATT_IF gatt_if);
extern void gatt_reset_bgdev_list(void);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
/* server function */
extern UINT8 gatt_sr_find_i_rcb_by_handle(UINT16 handle);

View File

@@ -1104,11 +1104,11 @@ BOOLEAN l2cble_create_conn (tL2C_LCB *p_lcb)
L2CAP_TRACE_WARNING ("L2CAP - LE - cannot start new connection at conn st: %d", conn_st);
btm_ble_enqueue_direct_conn_req(p_lcb);
#if (tGATT_BG_CONN_DEV == TRUE)
#if (GATT_BG_CONN_DEV == TRUE)
if (conn_st == BLE_BG_CONN) {
btm_ble_suspend_bg_conn();
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
rt = TRUE;
}
return rt;