Merge branch 'feat/remove_the_deprecated_api_and_parameter' into 'master'

feat(bt): remove the deprecated functions and parameters

Closes BT-4042

See merge request espressif/esp-idf!40435
This commit is contained in:
Wang Meng Yang
2025-08-20 19:36:37 +08:00
66 changed files with 221 additions and 338 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -21,40 +21,11 @@ static inline void btc_dev_cb_to_app(esp_bt_dev_cb_event_t event, esp_bt_dev_cb_
}
}
static void btc_dev_get_dev_name_callback(UINT8 status, char *name)
{
esp_bt_dev_cb_param_t param;
bt_status_t ret;
btc_msg_t msg = {0};
memset(&param, 0, sizeof(esp_bt_dev_cb_param_t));
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_DEV;
msg.act = ESP_BT_DEV_NAME_RES_EVT;
param.name_res.status = btc_btm_status_to_esp_status(status);
param.name_res.name = name;
ret = btc_transfer_context(&msg, &param, sizeof(esp_bt_dev_cb_param_t), btc_dev_cb_arg_deep_copy, btc_dev_cb_arg_deep_free);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
}
void btc_dev_call_arg_deep_free(btc_msg_t *msg)
{
BTC_TRACE_DEBUG("%s \n", __func__);
btc_dev_args_t *arg = (btc_dev_args_t *)msg->arg;
switch (msg->act) {
case BTC_DEV_ACT_SET_DEVICE_NAME:{
if (arg->set_dev_name.device_name) {
osi_free(arg->set_dev_name.device_name);
}
break;
}
case BTC_DEV_ACT_GET_DEVICE_NAME:
#if (ESP_COEX_VSC_INCLUDED == TRUE)
case BTC_DEV_ACT_CFG_COEX_STATUS:
#endif
@@ -68,21 +39,10 @@ void btc_dev_call_arg_deep_free(btc_msg_t *msg)
void btc_dev_call_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
{
BTC_TRACE_DEBUG("%s \n", __func__);
btc_dev_args_t *dst = (btc_dev_args_t *)p_dest;
btc_dev_args_t *src = (btc_dev_args_t *)p_src;
UNUSED(p_dest);
UNUSED(p_src);
switch (msg->act) {
case BTC_DEV_ACT_SET_DEVICE_NAME:{
dst->set_dev_name.device_name = (char *)osi_malloc((BTC_MAX_LOC_BD_NAME_LEN + 1) * sizeof(char));
if (dst->set_dev_name.device_name) {
BCM_STRNCPY_S(dst->set_dev_name.device_name, src->set_dev_name.device_name, BTC_MAX_LOC_BD_NAME_LEN);
dst->set_dev_name.device_name[BTC_MAX_LOC_BD_NAME_LEN] = '\0';
} else {
BTC_TRACE_ERROR("%s %d no mem\n",__func__, msg->act);
}
break;
}
case BTC_DEV_ACT_GET_DEVICE_NAME:
#if (ESP_COEX_VSC_INCLUDED == TRUE)
case BTC_DEV_ACT_CFG_COEX_STATUS:
#endif
@@ -96,7 +56,7 @@ void btc_dev_call_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
void btc_dev_cb_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
{
esp_bt_dev_cb_param_t *src = (esp_bt_dev_cb_param_t *)p_src;
esp_bt_dev_cb_param_t *dst = (esp_bt_dev_cb_param_t *) p_dest;
esp_bt_dev_cb_param_t *dst = (esp_bt_dev_cb_param_t *) p_dest;
switch (msg->act) {
case ESP_BT_DEV_NAME_RES_EVT:{
@@ -135,19 +95,12 @@ void btc_dev_cb_arg_deep_free(btc_msg_t *msg)
void btc_dev_call_handler(btc_msg_t *msg)
{
btc_dev_args_t *arg = (btc_dev_args_t *)msg->arg;
BTC_TRACE_DEBUG("%s act %d\n", __FUNCTION__, msg->act);
switch (msg->act) {
case BTC_DEV_ACT_SET_DEVICE_NAME:
BTA_DmSetDeviceName(arg->set_dev_name.device_name, BT_DEVICE_TYPE_DUMO);
break;
case BTC_DEV_ACT_GET_DEVICE_NAME:
BTA_DmGetDeviceName(btc_dev_get_dev_name_callback, BT_DEVICE_TYPE_DUMO);
break;
#if (ESP_COEX_VSC_INCLUDED == TRUE)
case BTC_DEV_ACT_CFG_COEX_STATUS:
btc_dev_args_t *arg = (btc_dev_args_t *)msg->arg;
BTA_DmCfgCoexStatus(arg->cfg_coex_status.op,
arg->cfg_coex_status.type,
arg->cfg_coex_status.status);
@@ -12,11 +12,7 @@
#include "btc/btc_task.h"
typedef enum {
BTC_DEV_ACT_SET_DEVICE_NAME,
BTC_DEV_ACT_GET_DEVICE_NAME,
#if (ESP_COEX_VSC_INCLUDED == TRUE)
BTC_DEV_ACT_CFG_COEX_STATUS,
#endif
} btc_dev_act_t;
/* btc_dev_args_t */
@@ -572,26 +572,6 @@ static bt_status_t btc_hf_cmee_response(bt_bdaddr_t *bd_addr, esp_hf_at_response
return BT_STATUS_FAIL;
}
// +CIEV<...> for device status update
static bt_status_t btc_hf_indchange_notification(bt_bdaddr_t *bd_addr,
esp_hf_call_status_t call_state,
esp_hf_call_setup_status_t call_setup_state,
esp_hf_network_state_t ntk_state, int signal)
{
int idx = btc_hf_idx_by_bdaddr(bd_addr);
CHECK_HF_INIT(idx);
if (is_connected(idx, bd_addr)) {
/* Send all indicators to BTA.
* BTA will make sure no duplicates are sent out*/
send_indicator_update(BTA_AG_IND_CALL, call_state);
send_indicator_update(BTA_AG_IND_CALLSETUP, call_setup_state);
send_indicator_update(BTA_AG_IND_SERVICE, ntk_state);
send_indicator_update(BTA_AG_IND_SIGNAL, signal);
return BT_STATUS_SUCCESS;
}
return BT_STATUS_FAIL;
}
// +CIEV<...> for device status update, send other indicators, e.g. roaming, battery, call held and bearer
bt_status_t btc_hf_ciev_report(bt_bdaddr_t *bd_addr, tBTA_AG_IND_TYPE indicator, uint16_t value)
{
@@ -1200,14 +1180,6 @@ void btc_hf_call_handler(btc_msg_t *msg)
break;
}
case BTC_HF_IND_NOTIFICATION_EVT:
{
btc_hf_indchange_notification(&arg->ind_change.remote_addr,
arg->ind_change.call_state, arg->ind_change.call_setup_state,
arg->ind_change.ntk_state, arg->ind_change.signal);
break;
}
case BTC_HF_CIEV_REPORT_EVT:
{
btc_hf_ciev_report(&arg->ciev_rep.remote_addr, arg->ciev_rep.ind.type, arg->ciev_rep.ind.value);
@@ -52,8 +52,6 @@ typedef struct _bluetooth_sdp_hdr_overlay {
int32_t profile_version;
int user1_ptr_len;
uint8_t *user1_ptr;
int user2_ptr_len; // not used
uint8_t *user2_ptr; // not used
} bluetooth_sdp_hdr_overlay;
typedef struct _bluetooth_sdp_raw_record {
@@ -43,7 +43,6 @@ typedef enum
//AT_RESPONSE
BTC_HF_UNAT_RESPONSE_EVT,
BTC_HF_CME_ERR_EVT,
BTC_HF_IND_NOTIFICATION_EVT,
BTC_HF_CIEV_REPORT_EVT,
BTC_HF_CIND_RESPONSE_EVT,
BTC_HF_COPS_RESPONSE_EVT,
@@ -102,15 +101,6 @@ typedef union
esp_hf_cme_err_t error_code;
} ext_at;
// BTC_HF_IND_NOTIFICATION_EVT
struct indchange_status {
bt_bdaddr_t remote_addr;
esp_hf_call_status_t call_state;
esp_hf_call_setup_status_t call_setup_state;
esp_hf_network_state_t ntk_state;
int signal;
} ind_change;
//BTC_HF_CIEV_REPORT_EVT
struct ciev_args {
bt_bdaddr_t remote_addr;