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 c7cc7ed318..c0e75d95c1 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c @@ -998,18 +998,6 @@ void bta_dm_clear_white_list(tBTA_DM_MSG *p_data) BTM_BleClearWhitelist(p_data->white_list.update_wl_cb); #endif } -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) -void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data) -{ -#if (BLE_INCLUDED == TRUE) - if (p_data->read_tx_power.read_tx_power_cb != NULL) { - BTM_BleReadAdvTxPower(p_data->read_tx_power.read_tx_power_cb); - } else { - APPL_TRACE_ERROR("%s(), the callback function can't be NULL.", __func__); - } -#endif ///BLE_INCLUDED == TRUE -} -#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) void bta_dm_read_rssi(tBTA_DM_MSG *p_data) { 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 68c3dfb059..850155de4a 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c @@ -493,18 +493,6 @@ void BTA_DmClearWhiteList(tBTA_UPDATE_WHITELIST_CBACK *update_wl_cb) } } -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) -void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb) -{ - tBTA_DM_API_READ_ADV_TX_POWER *p_msg; - if ((p_msg = (tBTA_DM_API_READ_ADV_TX_POWER *)osi_malloc(sizeof(tBTA_DM_API_READ_ADV_TX_POWER))) != NULL) { - p_msg->hdr.event = BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT; - p_msg->read_tx_power_cb = cmpl_cb; - bta_sys_sendmsg(p_msg); - } -} -#endif // BLE_HOST_READ_TX_POWER_EN - void BTA_DmBleReadChannelMap(BD_ADDR remote_device, tBTA_CMPL_CB *p_callback) { if (!remote_device || !p_callback) { 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 407f595408..6a2f9eabc6 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c @@ -184,9 +184,6 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = { bta_dm_ble_set_channels, /* BTA_DM_API_BLE_SET_CHANNELS_EVT */ bta_dm_update_white_list, /* BTA_DM_API_UPDATE_WHITE_LIST_EVT */ bta_dm_clear_white_list, /* BTA_DM_API_CLEAR_WHITE_LIST_EVT */ -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) - bta_dm_ble_read_adv_tx_power, /* BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT */ -#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) bta_dm_read_rssi, /* BTA_DM_API_READ_RSSI_EVT */ #if BLE_INCLUDED == TRUE bta_dm_ble_update_duplicate_exceptional_list,/* BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT */ 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 42760f79de..18607a16be 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 @@ -170,9 +170,6 @@ enum { BTA_DM_API_BLE_SET_CHANNELS_EVT, BTA_DM_API_UPDATE_WHITE_LIST_EVT, BTA_DM_API_CLEAR_WHITE_LIST_EVT, -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) - BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT, -#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) BTA_DM_API_READ_RSSI_EVT, #if BLE_INCLUDED == TRUE BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT, @@ -447,13 +444,6 @@ typedef struct { tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK *exceptional_list_cb; }tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST; -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) -typedef struct { - BT_HDR hdr; - tBTA_CMPL_CB *read_tx_power_cb; -}tBTA_DM_API_READ_ADV_TX_POWER; -#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) - #endif ///BLE_INCLUDED == TRUE typedef struct { @@ -1645,9 +1635,6 @@ typedef union { #if (BLE_INCLUDED == TRUE) tBTA_DM_API_BLE_SET_CHANNELS ble_set_channels; tBTA_DM_API_UPDATE_WHITE_LIST white_list; -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) - tBTA_DM_API_READ_ADV_TX_POWER read_tx_power; -#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) #endif ///BLE_INCLUDED == TRUE tBTA_DM_API_READ_RSSI rssi; 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 d14d0ced9f..733799a1da 100644 --- a/components/bt/host/bluedroid/common/include/common/bt_target.h +++ b/components/bt/host/bluedroid/common/include/common/bt_target.h @@ -1618,10 +1618,6 @@ #define BLE_INCLUDED FALSE #endif -#ifndef BLE_HOST_READ_TX_POWER_EN -#define BLE_HOST_READ_TX_POWER_EN 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_acl.c b/components/bt/host/bluedroid/stack/btm/btm_acl.c index 24ffea9fa9..6c3f7e4c31 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_acl.c +++ b/components/bt/host/bluedroid/stack/btm/btm_acl.c @@ -2092,65 +2092,6 @@ tBTM_STATUS BTM_ReadLinkQuality (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb) return (BTM_UNKNOWN_ADDR); } -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) -/******************************************************************************* -** -** Function BTM_ReadTxPower -** -** Description This function is called to read the current -** TX power of the connection. The tx power level results -** are returned in the callback. -** (tBTM_RSSI_RESULTS) -** -** Returns BTM_CMD_STARTED if successfully initiated or error code -** -*******************************************************************************/ -tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb) -{ - tACL_CONN *p; - BOOLEAN ret; -#define BTM_READ_RSSI_TYPE_CUR 0x00 -#define BTM_READ_RSSI_TYPE_MAX 0X01 - - BTM_TRACE_API ("BTM_ReadTxPower: RemBdAddr: %02x%02x%02x%02x%02x%02x\n", - remote_bda[0], remote_bda[1], remote_bda[2], - remote_bda[3], remote_bda[4], remote_bda[5]); - - /* If someone already waiting on the version, do not allow another */ - if (btm_cb.devcb.p_tx_power_cmpl_cb) { - return (BTM_BUSY); - } - - p = btm_bda_to_acl(remote_bda, transport); - if (p != (tACL_CONN *)NULL) { - btu_start_timer (&btm_cb.devcb.tx_power_timer, BTU_TTYPE_BTM_ACL, - BTM_DEV_REPLY_TIMEOUT); - - btm_cb.devcb.p_tx_power_cmpl_cb = p_cb; - -#if BLE_INCLUDED == TRUE - if (p->transport == BT_TRANSPORT_LE) { - memcpy(btm_cb.devcb.read_tx_pwr_addr, remote_bda, BD_ADDR_LEN); - ret = btsnd_hcic_ble_read_adv_chnl_tx_power(); - } else -#endif - { - ret = btsnd_hcic_read_tx_power (p->hci_handle, BTM_READ_RSSI_TYPE_CUR); - } - if (!ret) { - btm_cb.devcb.p_tx_power_cmpl_cb = NULL; - btu_stop_timer (&btm_cb.devcb.tx_power_timer); - return (BTM_NO_RESOURCES); - } else { - return (BTM_CMD_STARTED); - } - } - - /* If here, no BD Addr found */ - return (BTM_UNKNOWN_ADDR); -} -#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) - tBTM_STATUS BTM_SetAclPktTypes(BD_ADDR remote_bda, UINT16 pkt_types, tBTM_CMPL_CB *p_cb) { #if CLASSIC_BT_INCLUDED == TRUE @@ -2264,35 +2205,6 @@ tBTM_STATUS BTM_ReadChannelMap(BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb) return BTM_UNKNOWN_ADDR; } -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) -tBTM_STATUS BTM_BleReadAdvTxPower(tBTM_CMPL_CB *p_cb) -{ - BOOLEAN ret; - tBTM_TX_POWER_RESULTS result; - /* If someone already waiting on the version, do not allow another */ - if (btm_cb.devcb.p_tx_power_cmpl_cb) { - result.status = BTM_BUSY; - (*p_cb)(&result); - return (BTM_BUSY); - } - - btm_cb.devcb.p_tx_power_cmpl_cb = p_cb; - btu_start_timer (&btm_cb.devcb.tx_power_timer, BTU_TTYPE_BTM_ACL, - BTM_DEV_REPLY_TIMEOUT); - ret = btsnd_hcic_ble_read_adv_chnl_tx_power(); - - if(!ret) { - btm_cb.devcb.p_tx_power_cmpl_cb = NULL; - btu_stop_timer (&btm_cb.devcb.tx_power_timer); - result.status = BTM_NO_RESOURCES; - (*p_cb)(&result); - return (BTM_NO_RESOURCES); - } else { - return BTM_CMD_STARTED; - } -} -#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) - void BTM_BleGetWhiteListSize(uint16_t *length) { tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb; @@ -2316,79 +2228,6 @@ void BTM_BleGetPeriodicAdvListSize(uint8_t *size) #endif ///BLE_INCLUDED == TRUE -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) -/******************************************************************************* -** -** Function btm_read_tx_power_complete -** -** Description This function is called when the command complete message -** is received from the HCI for the read tx power request. -** -** Returns void -** -*******************************************************************************/ -void btm_read_tx_power_complete (UINT8 *p, UINT16 evt_len, BOOLEAN is_ble) -{ - tBTM_CMPL_CB *p_cb = btm_cb.devcb.p_tx_power_cmpl_cb; - tBTM_TX_POWER_RESULTS results; - UINT16 handle; - tACL_CONN *p_acl_cb = NULL; - BTM_TRACE_DEBUG ("btm_read_tx_power_complete\n"); - btu_stop_timer (&btm_cb.devcb.tx_power_timer); - - /* If there was a callback registered for read rssi, call it */ - btm_cb.devcb.p_tx_power_cmpl_cb = NULL; - - if (p_cb) { - if (evt_len < 1) { - BTM_TRACE_ERROR("Bogus event packet, too short\n"); - results.status = BTM_ERR_PROCESSING; - goto err_out; - } - - STREAM_TO_UINT8 (results.hci_status, p); - - if (results.hci_status == HCI_SUCCESS) { - results.status = BTM_SUCCESS; - - if (!is_ble) { - if (evt_len < 1 + 3) { - BTM_TRACE_ERROR("Bogus event packet, too short\n"); - results.status = BTM_ERR_PROCESSING; - goto err_out; - } - STREAM_TO_UINT16 (handle, p); - STREAM_TO_UINT8 (results.tx_power, p); - - /* Search through the list of active channels for the correct BD Addr */ - p_acl_cb = btm_handle_to_acl(handle); - if (p_acl_cb) { - memcpy (results.rem_bda, p_acl_cb->remote_addr, BD_ADDR_LEN); - } - } -#if BLE_INCLUDED == TRUE - else { - if (evt_len < 1 + 1) { - BTM_TRACE_ERROR("Bogus event packet, too short\n"); - results.status = BTM_ERR_PROCESSING; - goto err_out; - } - STREAM_TO_UINT8 (results.tx_power, p); - memcpy(results.rem_bda, btm_cb.devcb.read_tx_pwr_addr, BD_ADDR_LEN); - } -#endif - BTM_TRACE_DEBUG ("BTM TX power Complete: tx_power %d, hci status 0x%02x\n", - results.tx_power, results.hci_status); - } else { - results.status = BTM_ERR_PROCESSING; - } - -err_out: - (*p_cb)(&results); - } -} -#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) - /******************************************************************************* ** ** Function btm_read_channel_map_complete 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 57fa5f002d..e3cfbe396b 100644 --- a/components/bt/host/bluedroid/stack/btm/include/btm_int.h +++ b/components/bt/host/bluedroid/stack/btm/include/btm_int.h @@ -221,11 +221,6 @@ tBTM_CMPL_CB *p_switch_role_cb; /* Callback function to be called when /* requested switch role is completed */ #endif // (CLASSIC_BT_INCLUDED == TRUE) -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) -TIMER_LIST_ENT tx_power_timer; -tBTM_CMPL_CB *p_tx_power_cmpl_cb;/* Callback function to be called */ -#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) - #if CLASSIC_BT_INCLUDED == TRUE TIMER_LIST_ENT afh_channels_timer; tBTM_CMPL_CB *p_afh_channels_cmpl_cb; /* Callback function to be called When */ diff --git a/components/bt/host/bluedroid/stack/btu/btu_hcif.c b/components/bt/host/bluedroid/stack/btu/btu_hcif.c index 0e81c9a160..df41b7a8af 100644 --- a/components/bt/host/bluedroid/stack/btu/btu_hcif.c +++ b/components/bt/host/bluedroid/stack/btu/btu_hcif.c @@ -1227,9 +1227,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l btm_read_channel_map_complete (p); break; case HCI_READ_TRANSMIT_POWER_LEVEL: -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) - btm_read_tx_power_complete(p, evt_len, FALSE); -#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) break; #if (CLASSIC_BT_INCLUDED == TRUE) case HCI_CREATE_CONNECTION_CANCEL: @@ -1309,9 +1306,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l break; case HCI_BLE_READ_ADV_CHNL_TX_POWER: -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) - btm_read_tx_power_complete(p, evt_len, TRUE); -#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) break; #if (BLE_42_ADV_EN == TRUE) case HCI_BLE_WRITE_ADV_ENABLE: diff --git a/components/bt/host/bluedroid/stack/include/stack/btm_api.h b/components/bt/host/bluedroid/stack/include/stack/btm_api.h index 74af148f03..3f932d087d 100644 --- a/components/bt/host/bluedroid/stack/include/stack/btm_api.h +++ b/components/bt/host/bluedroid/stack/include/stack/btm_api.h @@ -3030,28 +3030,6 @@ tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_CMPL ** *******************************************************************************/ tBTM_STATUS BTM_ReadChannelMap(BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb); -#if (BLE_HOST_READ_TX_POWER_EN == TRUE) -/******************************************************************************* -** -** Function BTM_ReadTxPower -** -** Description This function is called to read the current connection -** TX power of the connection. The TX power level results -** are returned in the callback. -** (tBTM_RSSI_RESULTS) -** -** Returns BTM_CMD_STARTED if command issued to controller. -** BTM_NO_RESOURCES if couldn't allocate memory to issue command -** BTM_UNKNOWN_ADDR if no active link with bd addr specified -** BTM_BUSY if command is already in progress -** -*******************************************************************************/ -//extern -tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda, - tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb); - -tBTM_STATUS BTM_BleReadAdvTxPower(tBTM_CMPL_CB *p_cb); -#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) void BTM_BleGetWhiteListSize(uint16_t *length);