From 5145b366f7274856fdfd78f16bfde7cf6a774b67 Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Wed, 19 Nov 2025 11:33:44 +0800 Subject: [PATCH] fix(ble/bluedroid): delete bluedroid unused code --- .../bt/host/bluedroid/bta/dm/bta_dm_act.c | 2 ++ .../bt/host/bluedroid/bta/dm/bta_dm_main.c | 9 +----- .../bt/host/bluedroid/stack/btm/btm_acl.c | 6 ++-- .../bt/host/bluedroid/stack/btm/btm_ble_gap.c | 32 ------------------- .../bt/host/bluedroid/stack/btm/btm_inq.c | 2 ++ .../bluedroid/stack/btm/include/btm_int.h | 5 ++- .../bt/host/bluedroid/stack/btu/btu_hcif.c | 2 ++ .../stack/include/stack/btm_ble_api.h | 18 ----------- 8 files changed, 15 insertions(+), 61 deletions(-) diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c index 4fd35c54df..3ab02358b8 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c @@ -3446,11 +3446,13 @@ static void bta_dm_bl_change_cback (tBTM_BL_EVENT_DATA *p_data) p_msg->busy_level = p_data->update.busy_level; p_msg->busy_level_flags = p_data->update.busy_level_flags; break; +#if (CLASSIC_BT_INCLUDED == TRUE) case BTM_BL_ROLE_CHG_EVT: p_msg->new_role = p_data->role_chg.new_role; p_msg->hci_status = p_data->role_chg.hci_status; bdcpy(p_msg->bd_addr, p_data->role_chg.p_bda); break; +#endif // (CLASSIC_BT_INCLUDED == TRUE) case BTM_BL_COLLISION_EVT: bdcpy(p_msg->bd_addr, p_data->conn.p_bda); break; diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c index 377a2ac949..85de4aa5b5 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c @@ -135,7 +135,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = { bta_dm_ble_passkey_reply, /* BTA_DM_API_BLE_PASSKEY_REPLY_EVT */ bta_dm_ble_set_static_passkey, /* BTA_DM_API_BLE_SET_STATIC_PASSKEY_EVT */ bta_dm_ble_confirm_reply, /* BTA_DM_API_BLE_CONFIRM_REPLY_EVT */ - bta_dm_security_grant, + bta_dm_security_grant, /* BTA_DM_API_BLE_SEC_GRANT_EVT */ #endif ///SMP_INCLUDED == TRUE bta_dm_ble_set_bg_conn_type, bta_dm_ble_set_conn_params, /* BTA_DM_API_BLE_CONN_PARAM_EVT */ @@ -146,15 +146,8 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = { bta_dm_ble_scan, /* BTA_DM_API_BLE_SCAN_EVT */ #endif // #if (BLE_42_SCAN_EN == TRUE) bta_dm_ble_update_conn_params, /* BTA_DM_API_UPDATE_CONN_PARAM_EVT */ - /* This handler function added by - Yulong at 2016/9/9 to support the - random address setting for the APP */ bta_dm_ble_set_rand_address, /* BTA_DM_API_SET_RAND_ADDR_EVT*/ bta_dm_ble_clear_rand_address, /* BTA_DM_API_CLEAR_RAND_ADDR_EVT */ - /* This handler function added by - Yulong at 2016/10/19 to support - stop the ble advertising setting - by the APP */ #if BLE_PRIVACY_SPT == TRUE bta_dm_ble_config_local_privacy, /* BTA_DM_API_LOCAL_PRIVACY_EVT */ #endif diff --git a/components/bt/host/bluedroid/stack/btm/btm_acl.c b/components/bt/host/bluedroid/stack/btm/btm_acl.c index 6c3f7e4c31..cc77df53a7 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_acl.c +++ b/components/bt/host/bluedroid/stack/btm/btm_acl.c @@ -2049,6 +2049,7 @@ tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_CMPL return (BTM_UNKNOWN_ADDR); } +#if (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** ** Function BTM_ReadLinkQuality @@ -2132,7 +2133,6 @@ tBTM_STATUS BTM_SetAclPktTypes(BD_ADDR remote_bda, UINT16 pkt_types, tBTM_CMPL_C void btm_acl_pkt_types_changed(UINT8 status, UINT16 handle, UINT16 pkt_types) { -#if CLASSIC_BT_INCLUDED == TRUE BTM_TRACE_DEBUG ("btm_acl_pkt_types_changed\n"); tACL_CONN *conn = NULL; tBTM_SET_ACL_PKT_TYPES_RESULTS results; @@ -2153,8 +2153,8 @@ void btm_acl_pkt_types_changed(UINT8 status, UINT16 handle, UINT16 pkt_types) } btm_cb.devcb.p_set_acl_pkt_types_cmpl_cb = NULL; } -#endif } +#endif // (CLASSIC_BT_INCLUDED == TRUE) #if (BLE_INCLUDED == TRUE) @@ -2342,6 +2342,7 @@ err_out: } } +#if (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** ** Function btm_read_link_quality_complete @@ -2388,6 +2389,7 @@ void btm_read_link_quality_complete (UINT8 *p) (*p_cb)(&results); } } +#endif // (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c b/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c index 53adaa7bbc..6ea55dcba9 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c @@ -1482,38 +1482,6 @@ tBTM_STATUS BTM_BleStartAdv(void) return status; } #endif // #if (BLE_42_ADV_EN == TRUE) -/******************************************************************************* -** -** Function BTM_BleReadAdvParams -** -** Description This function is called to set advertising parameters. -** -** Parameters adv_int_min: minimum advertising interval -** adv_int_max: maximum advertising interval -** p_dir_bda: connectable direct initiator's LE device address -** chnl_map: advertising channel map. -** -** Returns void -** -*******************************************************************************/ -void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max, - tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP *p_chnl_map) -{ - tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var; - - BTM_TRACE_EVENT ("BTM_BleReadAdvParams "); - if (!controller_get_interface()->supports_ble()) { - return ; - } - - *adv_int_min = p_cb->adv_interval_min; - *adv_int_max = p_cb->adv_interval_max; - *p_chnl_map = p_cb->adv_chnl_map; - - if (p_dir_bda != NULL) { - memcpy(p_dir_bda, &p_cb->direct_bda, sizeof(tBLE_BD_ADDR)); - } -} #if (BLE_42_SCAN_EN == TRUE) tBTM_STATUS BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32 scan_window, diff --git a/components/bt/host/bluedroid/stack/btm/btm_inq.c b/components/bt/host/bluedroid/stack/btm/btm_inq.c index b6b7c47205..43f7db43fe 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_inq.c +++ b/components/bt/host/bluedroid/stack/btm/btm_inq.c @@ -1124,6 +1124,7 @@ tBTM_STATUS BTM_ClearInqDb (BD_ADDR p_bda) return (BTM_SUCCESS); } +#if (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** ** Function BTM_ReadInquiryRspTxPower @@ -1154,6 +1155,7 @@ tBTM_STATUS BTM_ReadInquiryRspTxPower (tBTM_CMPL_CB *p_cb) return (BTM_CMD_STARTED); } } +#endif // (CLASSIC_BT_INCLUDED == TRUE) /********************************************************************************* ********************************************************************************** diff --git a/components/bt/host/bluedroid/stack/btm/include/btm_int.h b/components/bt/host/bluedroid/stack/btm/include/btm_int.h index e3cfbe396b..42173e4e82 100644 --- a/components/bt/host/bluedroid/stack/btm/include/btm_int.h +++ b/components/bt/host/bluedroid/stack/btm/include/btm_int.h @@ -202,12 +202,15 @@ tBTM_CMPL_CB *p_rssi_cmpl_cb; /* Callback function to be called when tBTM_CMPL_CB *p_ble_ch_map_cmpl_cb; /* Callback function to be called when */ /* read channel map function completes */ - +#if (CLASSIC_BT_INCLUDED == TRUE) TIMER_LIST_ENT lnk_quality_timer; tBTM_CMPL_CB *p_lnk_qual_cmpl_cb;/* Callback function to be called when */ +#endif // (CLASSIC_BT_INCLUDED == TRUE) + /* read link quality function completes */ TIMER_LIST_ENT txpwer_timer; tBTM_CMPL_CB *p_txpwer_cmpl_cb; /* Callback function to be called when */ + /* read inq tx power function completes */ #if (CLASSIC_BT_INCLUDED == TRUE) TIMER_LIST_ENT qossu_timer; diff --git a/components/bt/host/bluedroid/stack/btu/btu_hcif.c b/components/bt/host/bluedroid/stack/btu/btu_hcif.c index df41b7a8af..40bc4f5152 100644 --- a/components/bt/host/bluedroid/stack/btu/btu_hcif.c +++ b/components/bt/host/bluedroid/stack/btu/btu_hcif.c @@ -1212,7 +1212,9 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l break; case HCI_GET_LINK_QUALITY: +#if (CLASSIC_BT_INCLUDED == TRUE) btm_read_link_quality_complete (p); +#endif // (CLASSIC_BT_INCLUDED == TRUE) break; #endif // #if (CLASSIC_BT_INCLUDED == TRUE) case HCI_READ_LOCAL_NAME: diff --git a/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h b/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h index 125f9a971e..45017bb93a 100644 --- a/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h +++ b/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h @@ -2074,24 +2074,6 @@ tBTM_STATUS BTM_BleSetRandAddress(BD_ADDR rand_addr); void BTM_BleClearRandAddress(void); -/******************************************************************************* -** -** Function BTM_BleSetAdvParams -** -** Description This function is called to set advertising parameters. -** -** Parameters adv_int_min: minimum advertising interval -** adv_int_max: maximum advertising interval -** p_dir_bda: connectable direct initiator's LE device address -** chnl_map: advertising channel map. -** -** Returns void -** -*******************************************************************************/ -//extern -void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max, - tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP *p_chnl_map); - /******************************************************************************* ** ** Function BTM_BleSetScanFilterParams