From 534e505ff6f6486ff6897572dcd280e6c0e2e805 Mon Sep 17 00:00:00 2001 From: Zhi Wei Jian Date: Wed, 7 Jan 2026 17:24:03 +0800 Subject: [PATCH] fix(ble/bluedroid): Delete BLE_HOST_BLE_SCAN_PARAM_UNUSED (cherry picked from commit 5fdcc3bdea170a47eac4364502edb514f28760ce) Co-authored-by: zhiweijian --- .../bt/host/bluedroid/bta/dm/bta_dm_act.c | 20 ------ .../bt/host/bluedroid/bta/dm/bta_dm_api.c | 36 ----------- .../bt/host/bluedroid/bta/dm/bta_dm_main.c | 3 - .../bluedroid/bta/dm/include/bta_dm_int.h | 6 -- .../common/include/common/bt_target.h | 4 -- .../bt/host/bluedroid/stack/btm/btm_ble_gap.c | 61 ------------------- .../stack/include/stack/btm_ble_api.h | 23 ------- 7 files changed, 153 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 f4652cab73..867c3fb91d 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c @@ -5246,26 +5246,6 @@ void bta_dm_ble_set_conn_params (tBTA_DM_MSG *p_data) p_data->ble_set_conn_params.slave_latency, p_data->ble_set_conn_params.supervision_tout); } -#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) -/******************************************************************************* -** -** Function bta_dm_ble_set_conn_scan_params -** -** Description This function sets BLE scan parameters. -** -** Parameters: -** -*******************************************************************************/ -void bta_dm_ble_set_scan_params(tBTA_DM_MSG *p_data) -{ - BTM_BleSetScanParams(p_data->ble_set_scan_params.client_if, - p_data->ble_set_scan_params.scan_int, - p_data->ble_set_scan_params.scan_window, - p_data->ble_set_scan_params.scan_mode, - p_data->ble_set_scan_params.scan_param_setup_cback); -} -#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) - #if (BLE_42_SCAN_EN == TRUE) /******************************************************************************* ** diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c index c72d688ebe..1d9102129f 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c @@ -1456,42 +1456,6 @@ void BTA_DmSetBlePrefConnParams(BD_ADDR bd_addr, #endif } -#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) -/******************************************************************************* -** -** Function BTA_DmSetBleScanParams -** -** Description This function is called to set scan parameters -** -** Parameters: client_if - Client IF -** scan_interval - scan interval -** scan_window - scan window -** scan_mode - scan mode -** scan_param_setup_status_cback - Set scan param status callback -** -** Returns void -** -*******************************************************************************/ -void BTA_DmSetBleScanParams(tGATT_IF client_if, UINT32 scan_interval, - UINT32 scan_window, tBLE_SCAN_MODE scan_mode, - tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback) -{ - tBTA_DM_API_BLE_SCAN_PARAMS *p_msg; - - if ((p_msg = (tBTA_DM_API_BLE_SCAN_PARAMS *)osi_malloc(sizeof(tBTA_DM_API_BLE_SCAN_PARAMS))) != NULL) { - memset(p_msg, 0, sizeof(tBTA_DM_API_BLE_SCAN_PARAMS)); - p_msg->hdr.event = BTA_DM_API_BLE_SCAN_PARAM_EVT; - p_msg->client_if = client_if; - p_msg->scan_int = scan_interval; - p_msg->scan_window = scan_window; - p_msg->scan_mode = scan_mode; - p_msg->scan_param_setup_cback = scan_param_setup_cback; - - bta_sys_sendmsg(p_msg); - } -} -#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) - #if (BLE_42_SCAN_EN == TRUE) /******************************************************************************* ** 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 eeea850b1b..7d3f183dd7 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c @@ -142,9 +142,6 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_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 */ -#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) - bta_dm_ble_set_scan_params, /* BTA_DM_API_BLE_SCAN_PARAM_EVT */ -#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) #if (BLE_42_SCAN_EN == TRUE) bta_dm_ble_set_scan_fil_params, /* BTA_DM_API_BLE_SCAN_FIL_PARAM_EVT */ #endif // #if (BLE_42_SCAN_EN == TRUE) diff --git a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h index 275de8c370..8f80a2bc82 100644 --- a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h +++ b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h @@ -128,9 +128,6 @@ enum { #endif ///SMP_INCLUDED == TRUE BTA_DM_API_BLE_SET_BG_CONN_TYPE, BTA_DM_API_BLE_CONN_PARAM_EVT, -#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) - BTA_DM_API_BLE_SCAN_PARAM_EVT, -#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) /*******This event added by Yulong at 2016/10/25 to support the scan filter setting for the APP******/ #if (BLE_42_SCAN_EN == TRUE) @@ -1810,9 +1807,6 @@ typedef union { tBTA_DM_API_BLE_SEC_GRANT ble_sec_grant; tBTA_DM_API_BLE_SET_BG_CONN_TYPE ble_set_bd_conn_type; tBTA_DM_API_BLE_CONN_PARAMS ble_set_conn_params; -#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) - tBTA_DM_API_BLE_SCAN_PARAMS ble_set_scan_params; -#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) tBTA_DM_API_BLE_SCAN_FILTER_PARAMS ble_set_scan_fil_params; tBTA_DM_API_BLE_OBSERVE ble_observe; tBTA_DM_API_BLE_SCAN ble_scan; diff --git a/components/bt/host/bluedroid/common/include/common/bt_target.h b/components/bt/host/bluedroid/common/include/common/bt_target.h index b17b4b661f..fea7bc80b8 100644 --- a/components/bt/host/bluedroid/common/include/common/bt_target.h +++ b/components/bt/host/bluedroid/common/include/common/bt_target.h @@ -1602,10 +1602,6 @@ #define BLE_HOST_BLE_OBSERVE_EN FALSE #endif -#ifndef BLE_HOST_BLE_SCAN_PARAM_UNUSED -#define BLE_HOST_BLE_SCAN_PARAM_UNUSED FALSE -#endif - #ifndef BLE_HOST_SETUP_STORAGE_EN #define BLE_HOST_SETUP_STORAGE_EN FALSE #endif 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 e49cccaa77..e81c86f80a 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c @@ -1625,67 +1625,6 @@ void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max, } } -#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) -/******************************************************************************* -** -** Function BTM_BleSetScanParams -** -** Description This function is called to set scan parameters. -** -** Parameters client_if - Client IF -** scan_interval - Scan interval -** scan_window - Scan window -** scan_mode - Scan mode -** scan_setup_status_cback - Scan param setup status callback -** -** Returns void -** -*******************************************************************************/ -void BTM_BleSetScanParams(tGATT_IF client_if, UINT32 scan_interval, UINT32 scan_window, - tBLE_SCAN_MODE scan_mode, - tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback) -{ - tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var; - UINT32 max_scan_interval; - UINT32 max_scan_window; - - BTM_TRACE_EVENT ("%s\n", __func__); - if (!controller_get_interface()->supports_ble()) { - return; - } - - /* If not supporting extended scan support, use the older range for checking */ - if (btm_cb.cmn_ble_vsc_cb.extended_scan_support == 0) { - max_scan_interval = BTM_BLE_SCAN_INT_MAX; - max_scan_window = BTM_BLE_SCAN_WIN_MAX; - } else { - /* If supporting extended scan support, use the new extended range for checking */ - max_scan_interval = BTM_BLE_EXT_SCAN_INT_MAX; - max_scan_window = BTM_BLE_EXT_SCAN_WIN_MAX; - } - - if (BTM_BLE_ISVALID_PARAM(scan_interval, BTM_BLE_SCAN_INT_MIN, max_scan_interval) && - BTM_BLE_ISVALID_PARAM(scan_window, BTM_BLE_SCAN_WIN_MIN, max_scan_window) && - (scan_mode == BTM_BLE_SCAN_MODE_ACTI || scan_mode == BTM_BLE_SCAN_MODE_PASS)) { - p_cb->scan_type = scan_mode; - p_cb->scan_interval = scan_interval; - p_cb->scan_window = scan_window; - - if (scan_setup_status_cback != NULL) { - scan_setup_status_cback(client_if, BTM_SUCCESS); - } - } else { - if (scan_setup_status_cback != NULL) { - scan_setup_status_cback(client_if, BTM_ILLEGAL_VALUE); - } - - BTM_TRACE_ERROR("Illegal params: scan_interval = %d scan_window = %d\n", - scan_interval, scan_window); - } - -} -#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) - #if (BLE_42_SCAN_EN == TRUE) tBTM_STATUS BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32 scan_window, tBLE_SCAN_MODE scan_mode, UINT8 addr_type_own, UINT8 scan_duplicate_filter, tBTM_BLE_SFP scan_filter_policy, 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 e68ec80b1c..54511558f6 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 @@ -2193,29 +2193,6 @@ void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max, //extern void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB *p_cmn_vsc_cb); -#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) -/******************************************************************************* -** -** Function BTM_BleSetScanParams -** -** Description This function is called to set Scan parameters. -** -** Parameters client_if - Client IF value -** scan_interval - Scan interval -** scan_window - Scan window -** scan_type - Scan type -** scan_setup_status_cback - Scan setup status callback -** -** Returns void -** -*******************************************************************************/ -//extern -void BTM_BleSetScanParams(tGATT_IF client_if, UINT32 scan_interval, - UINT32 scan_window, tBLE_SCAN_MODE scan_type, - tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback); - -#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE) - /******************************************************************************* ** ** Function BTM_BleSetScanFilterParams