fix(ble/bluedroid): Fixed bt buuld error

fix(ble/bluedroid): disable power management if bt is disabled


(cherry picked from commit 6f27074c1e)

Co-authored-by: zhiweijian <zhiweijian@espressif.com>
This commit is contained in:
Zhi Wei Jian
2026-01-07 17:24:52 +08:00
parent dda286a528
commit 8f040d13fb
25 changed files with 144 additions and 61 deletions
@@ -844,9 +844,10 @@ typedef enum {
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ALL_LIST = 0xFFFF, /*!< duplicate scan exceptional all list */
} esp_duplicate_scan_exceptional_list_type_t;
#endif //#if (BLE_42_FEATURE_SUPPORT == TRUE)
typedef uint8_t esp_duplicate_info_t[ESP_BD_ADDR_LEN];
#endif //#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#define ESP_BLE_GAP_SET_EXT_ADV_PROP_NONCONN_NONSCANNABLE_UNDIRECTED (0 << 0) /*!< Non-Connectable and Non-Scannable Undirected advertising */
@@ -1915,7 +1916,6 @@ typedef union {
esp_bt_status_t status; /*!< Indicate the add or remove whitelist operation success status */
esp_ble_wl_operation_t wl_operation; /*!< The value is ESP_BLE_WHITELIST_ADD if add address to whitelist operation success, ESP_BLE_WHITELIST_REMOVE if remove address from the whitelist operation success */
} update_whitelist_cmpl; /*!< Event parameter of ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT */
#if (BLE_42_FEATURE_SUPPORT == TRUE)
/**
* @brief ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT
*/
@@ -1925,7 +1925,6 @@ typedef union {
uint16_t length; /*!< The length of device_info */
esp_duplicate_info_t device_info; /*!< device information, when subcode is ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_CLEAN, the value is invalid */
} update_duplicate_exceptional_list_cmpl; /*!< Event parameter of ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT */
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
/**
* @brief ESP_GAP_BLE_SET_CHANNELS_EVT
*/
@@ -488,7 +488,9 @@ static void bta_dm_sys_hw_cback( tBTA_SYS_HW_EVT status )
#endif
/* hw is ready, go on with BTA DM initialization */
memset(&bta_dm_search_cb, 0x00, sizeof(bta_dm_search_cb));
#if (CLASSIC_BT_INCLUDED == TRUE)
memset(&bta_dm_conn_srvcs, 0x00, sizeof(bta_dm_conn_srvcs));
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
memset(&bta_dm_di_cb, 0, sizeof(tBTA_DM_DI_CB));
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
@@ -32,6 +32,8 @@
#include "stack/btm_api.h"
#include "osi/allocator.h"
#if (CLASSIC_BT_INCLUDED == TRUE)
#if BTA_DYNAMIC_MEMORY == FALSE
tBTA_DM_CONNECTED_SRVCS bta_dm_conn_srvcs;
#else
@@ -1171,3 +1173,5 @@ tBTA_DM_CONTRL_STATE bta_dm_pm_obtain_controller_state(void)
}
#endif
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
@@ -1609,12 +1609,14 @@ typedef union {
tBTA_DM_API_CFG_COEX_STATUS cfg_coex_status;
#endif
tBTA_DM_API_SEND_VENDOR_HCI_CMD vendor_hci_cmd;
#if CLASSIC_BT_INCLUDED
tBTA_DM_API_CONFIG_EIR config_eir;
tBTA_DM_API_SET_AFH_CHANNELS set_afh_channels;
tBTA_DM_API_PAGE_TO_SET set_page_timeout;
tBTA_DM_API_PAGE_TO_GET get_page_timeout;
tBTA_DM_API_SET_ACL_PKT_TYPES set_acl_pkt_types;
#endif /* CLASSIC_BT_INCLUDED */
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
tBTA_DM_API_SET_MIN_ENC_KEY_SIZE set_min_enc_key_size;
#endif
@@ -1188,6 +1188,11 @@ typedef void (tBTA_DM_ENCRYPT_CBACK) (BD_ADDR bd_addr, tBTA_TRANSPORT transport,
#define BTA_DM_BLE_SEC_MITM BTM_BLE_SEC_ENCRYPT_MITM
typedef tBTM_BLE_SEC_ACT tBTA_DM_BLE_SEC_ACT;
#define BTA_DM_CONTRL_UNKNOWN 0 /* Unknown state */
#define BTA_DM_CONTRL_ACTIVE 1 /* ACL link on, SCO link ongoing, sniff mode */
#define BTA_DM_CONTRL_SCAN 2 /* Scan state - paging/inquiry/trying to connect*/
#define BTA_DM_CONTRL_IDLE 3 /* Idle state - page scan, LE advt, inquiry scan */
typedef UINT8 tBTA_DM_CONTRL_STATE;
typedef UINT8 tBTA_DM_BLE_ADV_STATE;
@@ -543,7 +543,7 @@ void bta_sys_deregister(UINT8 id)
**
** Function bta_sys_is_register
**
** Description Called by other BTA subsystems to get registeration
** Description Called by other BTA subsystems to get registration
** status.
**
**
@@ -724,7 +724,7 @@ void bta_sys_disable(tBTA_SYS_HW_MODULE module)
bta_id_max = BTA_ID_BLUETOOTH_MAX;
break;
default:
APPL_TRACE_WARNING("bta_sys_disable: unkown module");
APPL_TRACE_WARNING("bta_sys_disable: unknown module");
return;
}
@@ -764,4 +764,4 @@ UINT16 bta_sys_get_sys_features (void)
{
return bta_sys_cb.sys_features;
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
@@ -168,6 +168,7 @@ uint32_t btc_get_ble_status(void)
status |= BIT(BTC_BLE_STATUS_CONN);
}
#if ((SMP_INCLUDED == TRUE) || (BLE_PRIVACY_SPT == TRUE))
// Address resolve status
extern uint8_t btm_get_ble_addr_resolve_disable_status(void);
uint8_t addr_resolve_disable = btm_get_ble_addr_resolve_disable_status();
@@ -175,6 +176,7 @@ uint32_t btc_get_ble_status(void)
BTC_TRACE_WARNING("%s address resolve disabled", __func__);
status |= BIT(BTC_BLE_STATUS_ADDR_RESOLVE_DISABLE);
}
#endif // #if ((SMP_INCLUDED == TRUE) || (BLE_PRIVACY_SPT == TRUE))
#if (SMP_INCLUDED == TRUE)
// Number of recorded devices
@@ -470,37 +470,6 @@ static void btc_stop_adv_callback(uint8_t status)
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
void btc_update_duplicate_exceptional_list_callback(tBTA_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
msg.act = ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT;
param.update_duplicate_exceptional_list_cmpl.status = status;
param.update_duplicate_exceptional_list_cmpl.subcode = subcode;
if(length > sizeof(param.update_duplicate_exceptional_list_cmpl.device_info)) {
length = sizeof(param.update_duplicate_exceptional_list_cmpl.device_info);
}
param.update_duplicate_exceptional_list_cmpl.length = length;
memcpy(param.update_duplicate_exceptional_list_cmpl.device_info, device_info, length);
ret = btc_transfer_context(&msg, &param, sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
}
static void btc_ble_update_duplicate_exceptional_list(uint8_t subcode, uint32_t info_type, BD_ADDR device_info,
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_ignore_list_cback)
{
BTA_DmUpdateDuplicateExceptionalList(subcode, info_type, device_info, p_update_duplicate_ignore_list_cback);
}
#endif // ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
#if (BLE_42_ADV_EN == TRUE)
static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBTA_START_ADV_CMPL_CBACK start_adv_cback)
{
@@ -737,6 +706,38 @@ static void btc_stop_scan_callback(tBTA_STATUS status)
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
#if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
void btc_update_duplicate_exceptional_list_callback(tBTA_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
msg.act = ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT;
param.update_duplicate_exceptional_list_cmpl.status = status;
param.update_duplicate_exceptional_list_cmpl.subcode = subcode;
if(length > sizeof(param.update_duplicate_exceptional_list_cmpl.device_info)) {
length = sizeof(param.update_duplicate_exceptional_list_cmpl.device_info);
}
param.update_duplicate_exceptional_list_cmpl.length = length;
memcpy(param.update_duplicate_exceptional_list_cmpl.device_info, device_info, length);
ret = btc_transfer_context(&msg, &param, sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
}
static void btc_ble_update_duplicate_exceptional_list(uint8_t subcode, uint32_t info_type, BD_ADDR device_info,
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_ignore_list_cback)
{
BTA_DmUpdateDuplicateExceptionalList(subcode, info_type, device_info, p_update_duplicate_ignore_list_cback);
}
#endif // ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
void btc_update_conn_param_callback (UINT8 status, BD_ADDR bd_addr, tBTM_LE_UPDATE_CONN_PRAMS *update_conn_params)
{
esp_ble_gap_cb_param_t param;
@@ -231,13 +231,15 @@ typedef union {
esp_bd_addr_t remote_bda;
esp_ble_wl_addr_type_t wl_addr_type;
} update_white_list;
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
//BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST
struct update_duplicate_exceptional_list_args {
uint8_t subcode;
uint32_t info_type;
esp_duplicate_info_t device_info;
} update_duplicate_exceptional_list;
#endif // ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
#if (BLE_42_FEATURE_SUPPORT == TRUE)
//BTC_GAP_BLE_ACT_SET_CONN_PARAMS
struct set_conn_params_args {
esp_bd_addr_t bd_addr;
@@ -264,10 +264,12 @@ void BTE_DeinitStack(void)
bta_ag_cb_ptr = NULL;
}
#endif
#if (CLASSIC_BT_INCLUDED == TRUE)
if (bta_dm_conn_srvcs_ptr){
osi_free(bta_dm_conn_srvcs_ptr);
bta_dm_conn_srvcs_ptr = NULL;
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
if (bta_dm_di_cb_ptr){
osi_free(bta_dm_di_cb_ptr);
@@ -445,16 +447,20 @@ bt_status_t BTE_InitStack(void)
goto error_exit;
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
if ((bta_dm_conn_srvcs_ptr = (tBTA_DM_CONNECTED_SRVCS *)osi_malloc(sizeof(tBTA_DM_CONNECTED_SRVCS))) == NULL) {
goto error_exit;
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
memset((void *)bta_sys_cb_ptr, 0, sizeof(tBTA_SYS_CB));
memset((void *)bta_dm_cb_ptr, 0, sizeof(tBTA_DM_CB));
memset((void *)bta_dm_search_cb_ptr, 0, sizeof(tBTA_DM_SEARCH_CB));
#if (CLASSIC_BT_INCLUDED == TRUE)
memset((void *)bta_dm_di_cb_ptr, 0, sizeof(tBTA_DM_DI_CB));
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
memset((void *)bta_dm_conn_srvcs_ptr, 0, sizeof(tBTA_DM_CONNECTED_SRVCS));
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
//memset((void *)bta_prm_cb_ptr, 0, sizeof(tBTA_PRM_CB));
#if (defined BTA_HF_INCLUDED && BTA_HF_INCLUDED == TRUE)
@@ -75,7 +75,9 @@ void btm_acl_init (void)
btm_cb.p_bl_changed_cb = NULL;
#endif
btm_cb.p_acl_db_list = list_new(osi_free_func);
#if (CLASSIC_BT_INCLUDED == TRUE)
btm_cb.p_pm_mode_db_list = list_new(osi_free_func);
#endif// #if (CLASSIC_BT_INCLUDED == TRUE)
/* Initialize nonzero defaults */
btm_cb.btm_def_link_super_tout = HCI_DEFAULT_INACT_TOUT;
@@ -296,12 +298,14 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, UINT8 bdn[BTM_MAX_REM_BD_NAME_L
#endif
#if (CLASSIC_BT_INCLUDED == TRUE)
p->switch_role_state = BTM_ACL_SWKEY_STATE_IDLE;
#endif // (CLASSIC_BT_INCLUDED == TRUE)
p->p_pm_mode_db = btm_pm_sm_alloc();
#if BTM_PM_DEBUG == TRUE
BTM_TRACE_DEBUG( "btm_pm_sm_alloc handle:%d st:%d", hci_handle, p->p_pm_mode_db->state);
#endif // BTM_PM_DEBUG
#endif // (CLASSIC_BT_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
btm_sec_update_legacy_auth_state(p, BTM_ACL_LEGACY_AUTH_NONE);
@@ -491,8 +495,9 @@ void btm_acl_removed (BD_ADDR bda, tBT_TRANSPORT transport)
}
#endif
#if (CLASSIC_BT_INCLUDED == TRUE)
list_remove(btm_cb.p_pm_mode_db_list, p->p_pm_mode_db);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/* Clear the ACL connection data */
memset(p, 0, sizeof(tACL_CONN));
if (list_remove(btm_cb.p_acl_db_list, p)) {
@@ -2233,6 +2238,7 @@ void BTM_BleGetPeriodicAdvListSize(uint8_t *size)
#endif ///BLE_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE
/*******************************************************************************
**
** Function btm_read_channel_map_complete
@@ -2287,7 +2293,7 @@ void btm_read_channel_map_complete(UINT8 *p)
(*p_cb)(&results);
}
}
#endif // #if BLE_INCLUDED == TRUE
/*******************************************************************************
**
@@ -2702,7 +2708,9 @@ void btm_acl_chk_peer_pkt_type_support (tACL_CONN *p, UINT16 *p_pkt_type)
void btm_acl_free(void)
{
list_free(btm_cb.p_acl_db_list);
#if (CLASSIC_BT_INCLUDED == TRUE)
list_free(btm_cb.p_pm_mode_db_list);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
}
/*******************************************************************************
@@ -139,7 +139,7 @@ void btm_update_scanner_filter_policy(tBTM_BLE_SFP scan_policy)
p_inq->sfp = scan_policy;
p_inq->scan_type = p_inq->scan_type == BTM_BLE_SCAN_MODE_NONE ? BTM_BLE_SCAN_MODE_ACTI : p_inq->scan_type;
btsnd_hcic_ble_set_scan_params(p_inq->scan_type, (UINT16)scan_interval,
(UINT16)scan_window,
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type,
@@ -495,7 +495,7 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start, tBTM_START_STOP_ADV_CMPL_CBACK *p_s
#endif
if (start) {
// "start" should not be ture
// "start" should not be true
#if (0)
/* update adv params */
if (!btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min :
@@ -902,6 +902,7 @@ void BTM_BleConfigConnParams(uint16_t int_min, uint16_t int_max, uint16_t latenc
}
#if BLE_PRIVACY_SPT == TRUE
#if (BLE_42_SCAN_EN == TRUE)
/*******************************************************************************
**
** Function btm_ble_resolve_random_addr_on_adv
@@ -942,6 +943,7 @@ static void btm_ble_resolve_random_addr_on_adv(void *p_rec, void *p)
return;
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif
/*******************************************************************************
@@ -1301,10 +1303,10 @@ tBTM_STATUS BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval,
if (BTM_BleUpdateOwnType(&addr_type_own, NULL) != 0) {
return BTM_ILLEGAL_VALUE;
}
max_scan_interval = BTM_BLE_SCAN_INT_MAX;
max_scan_window = BTM_BLE_SCAN_WIN_MAX;
osi_mutex_lock(&scan_param_lock, OSI_MUTEX_MAX_TIMEOUT);
@@ -183,8 +183,9 @@ static void reset_complete(void)
#endif // #if (GATT_BG_CONN_DEV == TRUE)
#endif
#if (CLASSIC_BT_INCLUDED == TRUE)
btm_pm_reset();
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
l2c_link_processs_num_bufs(controller->get_acl_buffer_count_classic());
#if BTM_SCO_HCI_INCLUDED == TRUE
@@ -2183,6 +2183,8 @@ void btm_inq_rmt_name_failed (void)
btm_sec_rmt_name_request_complete (NULL, NULL, HCI_ERR_UNSPECIFIED);
#endif ///SMP_INCLUDED == TRUE
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btm_read_linq_tx_power_complete
@@ -2218,6 +2220,7 @@ void btm_read_linq_tx_power_complete(UINT8 *p)
}
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function BTM_WriteEIR
@@ -45,6 +45,8 @@
//#include "bt_utils.h"
//#include "osi/include/log.h"
#include "osi/allocator.h"
#if (CLASSIC_BT_INCLUDED == TRUE)
/*****************************************************************************/
/* to handle different modes */
/*****************************************************************************/
@@ -968,3 +970,5 @@ static const char *mode_to_string(tBTM_PM_MODE mode)
}
}
#endif
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
@@ -211,7 +211,7 @@ static BOOLEAN btm_serv_trusted(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_SEC_SERV_REC *
}
return (FALSE);
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Function BTM_SecRegister
@@ -274,6 +274,7 @@ BOOLEAN BTM_SecRegisterLinkKeyNotificationCallback (tBTM_LINK_KEY_CALLBACK *p_ca
btm_cb.api.p_link_key_callback = p_callback;
return TRUE;
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@@ -410,6 +411,7 @@ void BTM_SetPinType (UINT8 pin_type, PIN_CODE pin_code, UINT8 pin_code_len)
}
#endif ///CLASSIC_BT_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function BTM_SetPairableMode
@@ -455,6 +457,8 @@ void BTM_SetSecureConnectionsOnly (BOOLEAN secure_connections_only_mode)
btm_cb.devcb.secure_connections_only = secure_connections_only_mode;
btm_cb.security_mode = BTM_SEC_MODE_SC;
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#define BTM_NO_AVAIL_SEC_SERVICES ((UINT16) 0xffff)
/*******************************************************************************
@@ -2779,10 +2783,12 @@ void btm_create_conn_cancel_complete (UINT8 *p, UINT16 evt_len)
case HCI_ERR_CONNECTION_EXISTS:
case HCI_ERR_NO_CONNECTION:
default:
#if (SMP_INCLUDED == TRUE)
/* Notify application of the error */
if (btm_cb.api.p_bond_cancel_cmpl_callback) {
btm_cb.api.p_bond_cancel_cmpl_callback(BTM_ERR_PROCESSING);
}
#endif // #if (SMP_INCLUDED == TRUE)
break;
}
}
@@ -4549,10 +4555,11 @@ void btm_sec_connected (UINT8 *bda, UINT16 handle, UINT8 status, UINT8 enc_mode)
/* commands events and data at the same time. */
/* Set the packet types to the default allowed by the device */
btm_set_packet_types (p_acl_cb, btm_cb.btm_acl_pkt_types_supported);
#if (CLASSIC_BT_INCLUDED == TRUE)
if (btm_cb.btm_def_link_policy) {
BTM_SetLinkPolicy (p_acl_cb->remote_addr, &btm_cb.btm_def_link_policy);
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif
}
btm_acl_created (bda, p_dev_rec->dev_class, p_dev_rec->sec_bd_name, handle, HCI_ROLE_SLAVE, BT_TRANSPORT_BR_EDR);
@@ -4639,10 +4646,10 @@ BOOLEAN btm_sec_disconnected (UINT16 handle, UINT8 reason)
tBTM_SEC_CALLBACK *p_callback = NULL;
tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
#if (CLASSIC_BT_INCLUDED == TRUE)
/* If page was delayed for disc complete, can do it now */
btm_cb.discing = FALSE;
#if (CLASSIC_BT_INCLUDED == TRUE)
btm_acl_resubmit_page();
#endif
@@ -199,17 +199,20 @@ tBTM_CMPL_CB *p_rln_cmpl_cb; /* Callback function to be called when
TIMER_LIST_ENT rssi_timer;
tBTM_CMPL_CB *p_rssi_cmpl_cb; /* Callback function to be called when */
/* read rssi function completes */
#if BLE_INCLUDED == TRUE
tBTM_CMPL_CB *p_ble_ch_map_cmpl_cb; /* Callback function to be called when */
#endif // #if BLE_INCLUDED == TRUE
/* 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)
#if (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 */
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/* read inq tx power function completes */
#if (CLASSIC_BT_INCLUDED == TRUE)
@@ -274,10 +277,11 @@ UINT32 test_local_sign_cntr;
#endif
#endif /* BLE_INCLUDED */
tBTM_IO_CAP loc_io_caps; /* IO capability of the local device */
#if (SMP_INCLUDED == TRUE)
tBTM_AUTH_REQ loc_auth_req; /* the auth_req flag */
BOOLEAN secure_connections_only; /* Rejects service level 0 connections if */
#endif // #if (SMP_INCLUDED == TRUE)
/* itself or peer device doesn't support */
/* secure connections */
} tBTM_DEVCB;
@@ -880,11 +884,12 @@ typedef struct {
/****************************************************
** Power Management
****************************************************/
#if (CLASSIC_BT_INCLUDED == TRUE)
list_t *p_pm_mode_db_list;
tBTM_PM_RCB pm_reg_db[BTM_MAX_PM_RECORDS + 1]; /* per application/module */
UINT16 pm_pend_link_hdl; /* the index of acl_db, which has a pending PM cmd */
UINT8 pm_pend_id; /* the id pf the module, which has a pending PM cmd */
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/*****************************************************
** Device control
*****************************************************/
@@ -924,7 +929,7 @@ typedef struct {
#if BTM_SCO_INCLUDED == TRUE
tSCO_CB sco_cb;
#endif
#if (SMP_INCLUDED == TRUE)
/*****************************************************
** Security Management
*****************************************************/
@@ -933,18 +938,22 @@ typedef struct {
#define BTM_SEC_MAX_RMT_NAME_CALLBACKS 2
tBTM_RMT_NAME_CALLBACK *p_rmt_name_callback[BTM_SEC_MAX_RMT_NAME_CALLBACKS];
#endif // #if (SMP_INCLUDED == TRUE)
#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_collided_dev_rec;
#endif ///SMP_INCLUDED == TRUE
UINT8 security_mode;
UINT32 dev_rec_count; /* Counter used for device record timestamp */
#if (SMP_INCLUDED == TRUE)
TIMER_LIST_ENT sec_collision_tle;
UINT32 collision_start_time;
UINT32 max_collision_delay;
UINT32 dev_rec_count; /* Counter used for device record timestamp */
UINT8 security_mode;
BOOLEAN pairing_disabled;
BOOLEAN connect_only_paired;
BOOLEAN security_mode_changed; /* mode changed during bonding */
BOOLEAN sec_req_pending; /* TRUE if a request is pending */
#endif // #if (SMP_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
BOOLEAN pin_type_changed; /* pin type changed during bonding */
#endif ///CLASSIC_BT_INCLUDED == TRUE
@@ -961,10 +970,12 @@ typedef struct {
UINT8 disc_reason; /* for legacy devices */
UINT16 disc_handle; /* for legacy devices */
#endif ///CLASSIC_BT_INCLUDED == TRUE
#if (SMP_INCLUDED == TRUE)
tBTM_PAIRING_STATE pairing_state; /* The current pairing state */
UINT8 pairing_flags; /* The current pairing flags */
BD_ADDR pairing_bda; /* The device currently pairing */
TIMER_LIST_ENT pairing_tle; /* Timer for pairing process */
#endif // #if (SMP_INCLUDED == TRUE)
#endif ///SMP_INCLUDED == TRUE
#if SMP_INCLUDED == TRUE || CLASSIC_BT_INCLUDED == TRUE
@@ -1226,7 +1226,9 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
btm_read_rssi_complete (p, evt_len);
break;
case HCI_BLE_READ_CHNL_MAP:
#if BLE_INCLUDED == TRUE
btm_read_channel_map_complete (p);
#endif // #if BLE_INCLUDED == TRUE
break;
case HCI_READ_TRANSMIT_POWER_LEVEL:
break;
@@ -573,8 +573,8 @@ typedef struct {
#endif // (GATTC_INCLUDED == TRUE)
#if (GATTS_INCLUDED == TRUE)
UINT8 srv_chg_mode; /* internal use: service change mode */
#endif // (GATTS_INCLUDED == TRUE)
tGATTS_RSP rsp; /* use to read internal service attribute */
#endif // (GATTS_INCLUDED == TRUE)
} tGATT_CB;
typedef struct{
@@ -488,7 +488,9 @@ typedef struct {
list_t *p_lcb_pool; /* Link Control Block pool */
list_t *p_ccb_pool; /* Channel Control Block pool */
#if (CLASSIC_BT_INCLUDED == TRUE)
tL2C_RCB rcb_pool[MAX_L2CAP_CLIENTS]; /* Registration info pool */
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 desire_role; /* desire to be master/slave when accepting a connection */
@@ -500,8 +502,10 @@ typedef struct {
list_t *rcv_pending_q; /* Recv pending queue */
TIMER_LIST_ENT rcv_hold_tle; /* Timer list entry for rcv hold */
tL2C_LCB *p_cur_hcit_lcb; /* Current HCI Transport buffer */
// tL2C_LCB *p_cur_hcit_lcb; /* Current HCI Transport buffer */
#if (CLASSIC_BT_INCLUDED == TRUE)
UINT16 num_links_active; /* Number of links active */
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
UINT16 non_flushable_pbf; /* L2CAP_PKT_START_NON_FLUSHABLE if controller supports */
@@ -530,13 +534,16 @@ typedef struct {
tL2C_RCB ble_rcb_pool[BLE_MAX_L2CAP_CLIENTS]; /* Registration info pool */
#endif
#if (CLASSIC_BT_INCLUDED == TRUE)
tL2CA_ECHO_DATA_CB *p_echo_data_cb; /* Echo data callback */
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (defined(L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE) && (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == TRUE))
UINT16 high_pri_min_xmit_quota; /* Minimum number of ACL credit for high priority link */
#endif /* (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == TRUE) */
#if (CLASSIC_BT_INCLUDED == TRUE)
UINT16 dyn_psm;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
} tL2C_CB;
@@ -1143,6 +1143,7 @@ void l2c_link_processs_ble_num_bufs (UINT16 num_lm_ble_bufs)
l2cb.num_lm_ble_bufs = l2cb.controller_le_xmit_window = num_lm_ble_bufs;
}
#if (BLE_INCLUDED == TRUE)
/*******************************************************************************
**
** Function l2c_ble_link_adjust_allocation
@@ -1262,6 +1263,7 @@ void l2c_ble_link_adjust_allocation (void)
}
}
}
#endif // #if (BLE_INCLUDED == TRUE)
#if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
/*******************************************************************************
@@ -736,7 +736,7 @@ void l2c_info_timeout (tL2C_LCB *p_lcb)
#endif ///CLASSIC_BT_INCLUDED == TRUE
}
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function l2c_link_adjust_allocation
@@ -857,7 +857,7 @@ void l2c_link_adjust_allocation (void)
}
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function l2c_link_adjust_chnl_allocation
@@ -1013,7 +1013,9 @@ void l2c_pin_code_request (BD_ADDR bd_addr)
*******************************************************************************/
BOOLEAN l2c_link_check_power_mode (tL2C_LCB *p_lcb)
{
#if (CLASSIC_BT_INCLUDED == TRUE)
tBTM_PM_MODE mode;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
tL2C_CCB *p_ccb;
BOOLEAN need_to_active = FALSE;
@@ -1033,6 +1035,7 @@ BOOLEAN l2c_link_check_power_mode (tL2C_LCB *p_lcb)
/* if we have packets to send */
if ( need_to_active ) {
#if (CLASSIC_BT_INCLUDED == TRUE)
/* check power mode */
if (BTM_ReadPowerMode(p_lcb->remote_bd_addr, &mode) == BTM_SUCCESS) {
if ( mode == BTM_PM_STS_PENDING ) {
@@ -1041,6 +1044,7 @@ BOOLEAN l2c_link_check_power_mode (tL2C_LCB *p_lcb)
return TRUE;
}
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
}
return FALSE;
}
@@ -859,8 +859,10 @@ void l2c_init (void)
l2c_cb_ptr = (tL2C_CB *)osi_malloc(sizeof(tL2C_CB));
#endif /* #if L2C_DYNAMIC_MEMORY */
memset (&l2cb, 0, sizeof (tL2C_CB));
#if (CLASSIC_BT_INCLUDED == TRUE)
/* the psm is increased by 2 before being used */
l2cb.dyn_psm = 0xFFF;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
l2cb.p_ccb_pool = list_new(osi_free_func);
if (l2cb.p_ccb_pool == NULL) {
@@ -113,8 +113,10 @@ tL2C_LCB *l2cu_allocate_lcb (BD_ADDR p_bd_addr, BOOLEAN is_bonding, tBT_TRANSPOR
} else
#endif
{
#if (CLASSIC_BT_INCLUDED == TRUE)
l2cb.num_links_active++;
l2c_link_adjust_allocation();
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
}
p_lcb->link_xmit_data_q = list_new(NULL);
return (p_lcb);
@@ -261,11 +263,13 @@ void l2cu_release_lcb (tL2C_LCB *p_lcb)
} else
#endif
{
#if (CLASSIC_BT_INCLUDED == TRUE)
if (l2cb.num_links_active >= 1) {
l2cb.num_links_active--;
}
l2c_link_adjust_allocation();
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
}
/* Check for ping outstanding */
@@ -1799,6 +1803,7 @@ tL2C_CCB *l2cu_find_ccb_by_remote_cid (tL2C_LCB *p_lcb, UINT16 remote_cid)
return (NULL);
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function l2cu_allocate_rcb
@@ -1828,6 +1833,7 @@ tL2C_RCB *l2cu_allocate_rcb (UINT16 psm)
/* If here, no free RCB found */
return (NULL);
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE)
/*******************************************************************************
@@ -1907,7 +1913,7 @@ void l2cu_disconnect_chnl (tL2C_CCB *p_ccb)
}
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function l2cu_find_rcb_by_psm
@@ -1932,6 +1938,7 @@ tL2C_RCB *l2cu_find_rcb_by_psm (UINT16 psm)
/* If here, no match found */
return (NULL);
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE)
/*******************************************************************************