mirror of
https://github.com/espressif/esp-idf.git
synced 2026-01-13 21:10:21 +00:00
fix(ble/bluedroid): disable some member in tBTA_SYS_CB
(cherry picked from commit 280385acf4)
Co-authored-by: zhiweijian <zhiweijian@espressif.com>
This commit is contained in:
@@ -93,7 +93,9 @@ static void bta_dm_eir_search_services( tBTM_INQ_RESULTS *p_result,
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
static void bta_dm_search_timer_cback (TIMER_LIST_ENT *p_tle);
|
||||
static void bta_dm_disable_conn_down_timer_cback (TIMER_LIST_ENT *p_tle);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
static void bta_dm_adjust_roles(BOOLEAN delay_role_switch);
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
@@ -532,10 +534,9 @@ static void bta_dm_sys_hw_cback( tBTA_SYS_HW_EVT status )
|
||||
the DM_ENABLE_EVT to be sent only after all the init steps are complete */
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
BTM_ReadLocalDeviceNameFromController((tBTM_CMPL_CB *)bta_dm_local_name_cback);
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
bta_sys_rm_register((tBTA_SYS_CONN_CBACK *)bta_dm_rm_cback);
|
||||
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (BTA_DM_PM_INCLUDED == TRUE)
|
||||
/* initialize bluetooth low power manager */
|
||||
bta_dm_init_pm();
|
||||
@@ -672,8 +673,9 @@ static void bta_dm_disable_timer_cback (TIMER_LIST_ENT *p_tle)
|
||||
}
|
||||
} else {
|
||||
bta_dm_cb.disabling = FALSE;
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
bta_sys_remove_uuid(UUID_SERVCLASS_PNP_INFORMATION);
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
bta_dm_cb.p_sec_cback(BTA_DM_DISABLE_EVT, NULL);
|
||||
}
|
||||
}
|
||||
@@ -3652,13 +3654,13 @@ void bta_dm_acl_change(tBTA_DM_MSG *p_data)
|
||||
return;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* Collision report from Stack: Notify profiles */
|
||||
if (p_data->acl_change.event == BTM_BL_COLLISION_EVT) {
|
||||
bta_sys_notify_collision (p_bda);
|
||||
return;
|
||||
}
|
||||
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (is_new) {
|
||||
for (i = 0; i < bta_dm_cb.device_list.count; i++) {
|
||||
if (!bdcmp( bta_dm_cb.device_list.peer_device[i].peer_bdaddr, p_bda)
|
||||
@@ -3827,6 +3829,7 @@ static void bta_dm_disable_conn_down_timer_cback (TIMER_LIST_ENT *p_tle)
|
||||
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_rm_cback
|
||||
@@ -3899,7 +3902,6 @@ static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id,
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_delay_role_switch_cback
|
||||
|
||||
@@ -73,8 +73,10 @@ tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK *p_cback)
|
||||
bta_sys_register (BTA_ID_DM, &bta_dm_reg );
|
||||
bta_sys_register (BTA_ID_DM_SEARCH, &bta_dm_search_reg );
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* if UUID list is not provided as static data */
|
||||
bta_sys_eir_register(bta_dm_eir_update_uuid);
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_ENABLE *) osi_malloc(sizeof(tBTA_DM_API_ENABLE))) != NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_ENABLE_EVT;
|
||||
|
||||
@@ -764,10 +764,12 @@ void bta_gattc_conn(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
}
|
||||
|
||||
if (p_clcb->p_rcb) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* there is no RM for GATT */
|
||||
if (p_clcb->transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_conn_open(BTA_ID_GATTC, BTA_ALL_APP_ID, p_clcb->bda);
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
tBTA_GATT_STATUS status = BTA_GATT_OK;
|
||||
if (p_data && p_data->int_conn.already_connect) {
|
||||
//clear already_connect
|
||||
@@ -870,11 +872,11 @@ void bta_gattc_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
cb_data.close.reason = p_clcb->reason;
|
||||
cb_data.close.status = p_clcb->status;
|
||||
bdcpy(cb_data.close.remote_bda, p_clcb->bda);
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (p_clcb->transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_conn_close( BTA_ID_GATTC , BTA_ALL_APP_ID, p_clcb->bda);
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (p_data->hdr.event == BTA_GATTC_API_CLOSE_EVT) {
|
||||
cb_data.close.status = GATT_Disconnect(p_data->hdr.layer_specific);
|
||||
} else if (p_data->hdr.event == BTA_GATTC_INT_DISCONN_EVT) {
|
||||
@@ -1338,11 +1340,13 @@ void bta_gattc_confirm(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
!= GATT_SUCCESS) {
|
||||
APPL_TRACE_ERROR("bta_gattc_confirm to handle [0x%04x] failed", handle);
|
||||
} else {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* if over BR_EDR, inform PM for mode change */
|
||||
if (p_clcb->transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_busy(BTA_ID_GATTC, BTA_ALL_APP_ID, p_clcb->bda);
|
||||
bta_sys_idle(BTA_ID_GATTC, BTA_ALL_APP_ID, p_clcb->bda);
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
@@ -2202,13 +2206,13 @@ static void bta_gattc_cmpl_cback(UINT16 conn_id, tGATTC_OPTYPE op, tGATT_STATUS
|
||||
APPL_TRACE_ERROR("bta_gattc_cmpl_cback unknown conn_id = %d, ignore data", conn_id);
|
||||
return;
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* if over BR_EDR, inform PM for mode change */
|
||||
if (p_clcb->transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_busy(BTA_ID_GATTC, BTA_ALL_APP_ID, p_clcb->bda);
|
||||
bta_sys_idle(BTA_ID_GATTC, BTA_ALL_APP_ID, p_clcb->bda);
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
bta_gattc_cmpl_sendmsg(conn_id, op, status, p_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -695,12 +695,13 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
|
||||
p_msg->api_indicate.len,
|
||||
p_msg->api_indicate.value);
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* if over BR_EDR, inform PM for mode change */
|
||||
if (transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_busy(BTA_ID_GATTS, BTA_ALL_APP_ID, remote_bda);
|
||||
bta_sys_idle(BTA_ID_GATTS, BTA_ALL_APP_ID, remote_bda);
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
} else {
|
||||
APPL_TRACE_ERROR("Unknown connection ID: %d fail sending notification",
|
||||
p_msg->api_indicate.hdr.layer_specific);
|
||||
@@ -839,10 +840,11 @@ void bta_gatts_close (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
|
||||
p_rcb = bta_gatts_find_app_rcb_by_app_if(gatt_if);
|
||||
|
||||
if (p_rcb && p_rcb->p_cback) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_conn_close( BTA_ID_GATTS , BTA_ALL_APP_ID, remote_bda);
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
close.status = status;
|
||||
close.conn_id = p_msg->hdr.layer_specific;
|
||||
(*p_rcb->p_cback)(BTA_GATTS_CLOSE_EVT, (tBTA_GATTS *)&close);
|
||||
@@ -925,12 +927,13 @@ static void bta_gatts_send_request_cback (UINT16 conn_id,
|
||||
conn_id, trans_id, req_type);
|
||||
|
||||
if (p_rcb && p_rcb->p_cback) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* if over BR_EDR, inform PM for mode change */
|
||||
if (transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_busy(BTA_ID_GATTS, BTA_ALL_APP_ID, cb_data.req_data.remote_bda);
|
||||
bta_sys_idle(BTA_ID_GATTS, BTA_ALL_APP_ID, cb_data.req_data.remote_bda);
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
cb_data.req_data.conn_id = conn_id;
|
||||
cb_data.req_data.trans_id = trans_id;
|
||||
cb_data.req_data.p_data = (tBTA_GATTS_REQ_DATA *)p_data;
|
||||
@@ -980,6 +983,7 @@ static void bta_gatts_conn_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
|
||||
p_reg = bta_gatts_find_app_rcb_by_app_if(gatt_if);
|
||||
|
||||
if (p_reg && p_reg->p_cback) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* there is no RM for GATT */
|
||||
if (transport == BTA_TRANSPORT_BR_EDR) {
|
||||
if (connected) {
|
||||
@@ -988,6 +992,7 @@ static void bta_gatts_conn_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
|
||||
bta_sys_conn_close( BTA_ID_GATTS , BTA_ALL_APP_ID, bda);
|
||||
}
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if(evt == BTA_GATTS_CONNECT_EVT) {
|
||||
tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr(bda, BT_TRANSPORT_LE);
|
||||
if(p_lcb != NULL) {
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef void (tBTA_SYS_DISABLE)(void);
|
||||
/* HW modules */
|
||||
enum {
|
||||
BTA_SYS_HW_BLUETOOTH,
|
||||
BTA_SYS_HW_RT,
|
||||
// BTA_SYS_HW_RT,
|
||||
|
||||
BTA_SYS_MAX_HW_MODULES
|
||||
};
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "bta_sys_int.h"
|
||||
#include "bta/utl.h"
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_sys_rm_register
|
||||
@@ -661,3 +663,5 @@ BOOLEAN bta_sys_vs_hdl(UINT16 evt, void *p)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
@@ -750,7 +750,7 @@ void bta_sys_set_trace_level(UINT8 level)
|
||||
{
|
||||
appl_trace_level = level;
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_sys_get_sys_features
|
||||
@@ -764,3 +764,4 @@ UINT16 bta_sys_get_sys_features (void)
|
||||
{
|
||||
return bta_sys_cb.sys_features;
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
@@ -56,8 +56,8 @@ typedef struct {
|
||||
tBTA_SYS_HW_STATE state;
|
||||
tBTA_SYS_HW_CBACK *sys_hw_cback[BTA_SYS_MAX_HW_MODULES]; /* enable callback for each HW modules */
|
||||
UINT32 sys_hw_module_active; /* bitmask of all active modules */
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
UINT16 sys_features; /* Bitmask of sys features */
|
||||
|
||||
tBTA_SYS_CONN_CBACK *prm_cb; /* role management callback registered by DM */
|
||||
tBTA_SYS_CONN_CBACK *ppm_cb; /* low power management callback registered by DM */
|
||||
tBTA_SYS_CONN_CBACK *p_policy_cb; /* link policy change callback registered by DM */
|
||||
@@ -72,6 +72,7 @@ typedef struct {
|
||||
#endif
|
||||
/* VS event handler */
|
||||
tBTA_SYS_VS_EVT_HDLR *p_vs_evt_hdlr;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
} tBTA_SYS_CB;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user