From d195ab67f8332cc3cf069439303bbb850a4bca61 Mon Sep 17 00:00:00 2001 From: Zhi Wei Jian Date: Wed, 7 Jan 2026 17:24:42 +0800 Subject: [PATCH] fix(ble/bluedroid): Delete BLE_HOST_STOP_ADV_UNUSED (cherry picked from commit 0e9b36cb559a8f20a3b98a8d75ebca2e84498b97) Co-authored-by: zhiweijian --- .../bt/host/bluedroid/bta/dm/bta_dm_act.c | 22 --------------- .../bt/host/bluedroid/bta/dm/bta_dm_api.c | 27 ------------------- .../bt/host/bluedroid/bta/dm/bta_dm_main.c | 3 --- .../bluedroid/bta/dm/include/bta_dm_int.h | 8 ------ .../host/bluedroid/bta/include/bta/bta_api.h | 3 --- .../common/include/common/bt_target.h | 4 --- 6 files changed, 67 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 867c3fb91d..4e41c74625 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c @@ -5346,28 +5346,6 @@ void bta_dm_ble_clear_rand_address(tBTA_DM_MSG *p_data) BTM_BleClearRandAddress(); } -#if (BLE_HOST_STOP_ADV_UNUSED == TRUE) -/******************************************************************************* -** -** Function bta_dm_ble_stop_advertising -** -** Description This function stop the BLE avdertising for the device. -** -** Parameters: void -** Explanation: This function added by Yulong at 2016/10/19 -*******************************************************************************/ -void bta_dm_ble_stop_advertising(tBTA_DM_MSG *p_data) -{ - if (p_data->hdr.event != BTA_DM_API_BLE_STOP_ADV_EVT) { - APPL_TRACE_ERROR("Invalid BTA event,can't stop the BLE adverting\n"); - } -#if (BLE_42_ADV_EN == TRUE) - btm_ble_stop_adv(); -#endif // #if (BLE_42_ADV_EN == TRUE) -} -#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE) - - #if BLE_PRIVACY_SPT == 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 1d9102129f..4396e0eaf8 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c @@ -2636,33 +2636,6 @@ extern void BTA_DmBleScan(BOOLEAN start, UINT32 duration, } #endif // #if (BLE_42_SCAN_EN == TRUE) -#if (BLE_HOST_STOP_ADV_UNUSED == TRUE) -/******************************************************************************* -** -** Function BTA_DmBleStopAdvertising -** -** Description This function set the random address for the APP -** -** Parameters void -** -** Returns void -** -** -*******************************************************************************/ -extern void BTA_DmBleStopAdvertising(void) -{ - BT_HDR *p_msg; - - APPL_TRACE_API("BTA_DmBleStopAdvertising\n"); - - if ((p_msg = (BT_HDR *) osi_malloc(sizeof(BT_HDR))) != NULL) { - memset(p_msg, 0, sizeof(BT_HDR)); - p_msg->event = BTA_DM_API_BLE_STOP_ADV_EVT; - bta_sys_sendmsg(p_msg); - } -} -#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE) - /******************************************************************************* ** ** Function BTA_DmSetRandAddress 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 7d3f183dd7..759d948d5b 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c @@ -161,9 +161,6 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = { Yulong at 2016/10/19 to support stop the ble advertising setting by the APP */ -#if (BLE_HOST_STOP_ADV_UNUSED == TRUE) - bta_dm_ble_stop_advertising, /* BTA_DM_API_BLE_STOP_ADV_EVT */ -#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE) #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/bta/dm/include/bta_dm_int.h b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h index 8f80a2bc82..a673121a50 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 @@ -144,11 +144,6 @@ enum { support the random address setting for the APP******/ BTA_DM_API_SET_RAND_ADDR_EVT, BTA_DM_API_CLEAR_RAND_ADDR_EVT, - /*******This event added by Yulong at 2016/10/19 to - support stop the ble advertising setting by the APP******/ -#if (BLE_HOST_STOP_ADV_UNUSED == TRUE) - BTA_DM_API_BLE_STOP_ADV_EVT, -#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE) #if BLE_PRIVACY_SPT == TRUE BTA_DM_API_LOCAL_PRIVACY_EVT, #endif @@ -2394,9 +2389,6 @@ extern void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data); extern void bta_dm_ble_disconnect (tBTA_DM_MSG *p_data); extern void bta_dm_ble_set_rand_address(tBTA_DM_MSG *p_data); extern void bta_dm_ble_clear_rand_address(tBTA_DM_MSG *p_data); -#if (BLE_HOST_STOP_ADV_UNUSED == TRUE) -extern void bta_dm_ble_stop_advertising(tBTA_DM_MSG *p_data); -#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE) extern void bta_dm_ble_config_local_privacy (tBTA_DM_MSG *p_data); extern void bta_dm_ble_config_local_icon (tBTA_DM_MSG *p_data); #if (BT_GATTS_KEY_MATERIAL_CHAR == TRUE) diff --git a/components/bt/host/bluedroid/bta/include/bta/bta_api.h b/components/bt/host/bluedroid/bta/include/bta/bta_api.h index 3a57b33709..7594df6a31 100644 --- a/components/bt/host/bluedroid/bta/include/bta/bta_api.h +++ b/components/bt/host/bluedroid/bta/include/bta/bta_api.h @@ -2865,9 +2865,6 @@ extern void BTA_DmBleScan(BOOLEAN start, UINT32 duration, tBTA_DM_SEARCH_CBACK *p_results_cb, tBTA_START_STOP_SCAN_CMPL_CBACK *p_start_stop_scan_cb); -#if (BLE_HOST_STOP_ADV_UNUSED == TRUE) -extern void BTA_DmBleStopAdvertising(void); -#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE) extern void BTA_DmSetRandAddress(BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *p_set_rand_addr_cback); extern void BTA_DmClearRandAddress(void); 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 2897b91793..cfcc88d152 100644 --- a/components/bt/host/bluedroid/common/include/common/bt_target.h +++ b/components/bt/host/bluedroid/common/include/common/bt_target.h @@ -1647,10 +1647,6 @@ #define BLE_HOST_READ_TX_POWER_EN FALSE #endif -#ifndef BLE_HOST_STOP_ADV_UNUSED -#define BLE_HOST_STOP_ADV_UNUSED FALSE -#endif - #ifndef BLE_HOST_BLE_OBSERVE_EN #define BLE_HOST_BLE_OBSERVE_EN FALSE #endif