1.After the separate, can save 15k~25k ram & 240k~460k code size(depending on the menuconfig).
#if (SDP_INCLUDED == TRUE)
static void bta_dm_sdp_callback (UINT16 sdp_status);
#endif ///SDP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, UINT8 *service_name, UINT8 service_id, BOOLEAN is_originator);
static UINT8 bta_dm_pin_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, BOOLEAN min_16_digit);
static UINT8 bta_dm_new_link_key_cback(BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, LINK_KEY key, UINT8 key_type);
static UINT8 bta_dm_authentication_complete_cback(BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, int result);
+#endif ///SMP_INCLUDED == TRUE
static void bta_dm_local_name_cback(BD_ADDR bd_addr);
static BOOLEAN bta_dm_check_av(UINT16 event);
static void bta_dm_bl_change_cback (tBTM_BL_EVENT_DATA *p_data);
static void bta_dm_policy_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
/* Extended Inquiry Response */
-#if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE)
+#if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE && SMP_INCLUDED == TRUE)
static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data);
#endif /* (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE) */
#if (SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE)
static char *bta_dm_get_remname(void);
#endif ///SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
static void bta_dm_bond_cancel_complete_cback(tBTM_STATUS result);
+#endif ///SMP_INCLUDED == TRUE
#if (SDP_INCLUDED == TRUE)
static BOOLEAN bta_dm_read_remote_device_name (BD_ADDR bd_addr, tBT_TRANSPORT transport);
static void bta_dm_discover_device(BD_ADDR remote_bd_addr);
#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
#if ((defined SMP_INCLUDED) && (SMP_INCLUDED == TRUE))
static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_DATA *p_data);
-#endif
static void bta_dm_ble_id_key_cback (UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key);
+#endif ///SMP_INCLUDED == TRUE
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE)
static void bta_dm_gattc_register(void);
static void btm_dm_start_gatt_discovery(BD_ADDR bd_addr);
#define BTA_DM_BLE_ADV_CHNL_MAP (BTM_BLE_ADV_CHNL_37|BTM_BLE_ADV_CHNL_38|BTM_BLE_ADV_CHNL_39)
#endif
#endif
-
+#if (SMP_INCLUDED == TRUE)
static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr);
+#endif ///SMP_INCLUDED == TRUE
static void bta_dm_observe_results_cb(tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
static void bta_dm_observe_cmpl_cb(void *p_result);
static void bta_dm_delay_role_switch_cback(TIMER_LIST_ENT *p_tle);
};
/* bta security callback */
+#if (SMP_INCLUDED == TRUE)
const tBTM_APPL_INFO bta_security = {
&bta_dm_authorize_cback,
&bta_dm_pin_cback,
&bta_dm_authentication_complete_cback,
&bta_dm_bond_cancel_complete_cback,
#if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE)
- &bta_dm_sp_cback
+ &bta_dm_sp_cback,
#else
NULL
#endif
#if BLE_INCLUDED == TRUE
-#if SMP_INCLUDED == TRUE
- , &bta_dm_ble_smp_cback
-#endif
- , &bta_dm_ble_id_key_cback
-#endif
+ &bta_dm_ble_smp_cback,
+ &bta_dm_ble_id_key_cback,
+#endif ///BLE_INCLUDED == TRUE
};
+#endif ///SMP_INCLUDED == TRUE
+#if (SDP_INCLUDED == TRUE)
#define MAX_DISC_RAW_DATA_BUF (1024)
UINT8 g_disc_raw_data_buf[MAX_DISC_RAW_DATA_BUF];
-
+#endif ///SDP_INCLUDED == TRUE
extern DEV_CLASS local_device_default_class;
/*******************************************************************************
/* hw is ready, go on with BTA DM initialization */
memset(&bta_dm_search_cb, 0x00, sizeof(bta_dm_search_cb));
+#if (BTM_SSR_INCLUDED == TRUE)
memset(&bta_dm_conn_srvcs, 0x00, sizeof(bta_dm_conn_srvcs));
+#endif ///BTM_SSR_INCLUDED == TRUE
memset(&bta_dm_di_cb, 0, sizeof(tBTA_DM_DI_CB));
memcpy(dev_class, p_bta_dm_cfg->dev_class, sizeof(dev_class));
bta_dm_search_cb.conn_id = BTA_GATT_INVALID_CONN_ID;
#endif
#endif
-
+#if (SMP_INCLUDED == TRUE)
BTM_SecRegister((tBTM_APPL_INFO *)&bta_security);
+#endif ///SMP_INCLUDED == TRUE
BTM_SetDefaultLinkSuperTout(p_bta_dm_cfg->link_timeout);
BTM_WritePageTimeout(p_bta_dm_cfg->page_timeout);
bta_dm_cb.cur_policy = p_bta_dm_cfg->policy_settings;
BTM_ReadLocalDeviceNameFromController((tBTM_CMPL_CB *)bta_dm_local_name_cback);
bta_sys_rm_register((tBTA_SYS_CONN_CBACK *)bta_dm_rm_cback);
-
+#if (BTM_SSR_INCLUDED == TRUE)
/* initialize bluetooth low power manager */
bta_dm_init_pm();
-
+#endif ///BTM_SSR_INCLUDED == TRUE
bta_sys_policy_register((tBTA_SYS_CONN_CBACK *)bta_dm_policy_cback);
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE)
BTM_SetDiscoverability(BTM_NON_DISCOVERABLE, 0, 0);
BTM_SetConnectability(BTM_NON_CONNECTABLE, 0, 0);
-
+#if (BTM_SSR_INCLUDED == TRUE)
bta_dm_disable_pm();
+#endif ///BTM_SSR_INCLUDED == TRUE
bta_dm_disable_search_and_disc();
bta_dm_cb.disabling = TRUE;
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void bta_dm_bond (tBTA_DM_MSG *p_data)
{
tBTM_STATUS status;
}
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
if (policy & (HCI_ENABLE_SNIFF_MODE | HCI_ENABLE_PARK_MODE)) {
/* if clearing sniff/park, wake the link */
+#if (BTM_SSR_INCLUDED == TRUE)
bta_dm_pm_active(p_dev->peer_bdaddr);
+#endif ///BTM_SSR_INCLUDED == TRUE
}
break;
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void bta_dm_confirm(tBTA_DM_MSG *p_data)
{
tBTM_STATUS res = BTM_NOT_AUTHORIZED;
}
BTM_ConfirmReqReply(res, p_data->confirm.bd_addr);
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
-#if (BTM_OOB_INCLUDED == TRUE)
+#if (BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
void bta_dm_loc_oob(tBTA_DM_MSG *p_data)
{
UNUSED(p_data);
BTM_RemoteOobDataReply(res, p_data->ci_rmt_oob.bd_addr,
p_data->ci_rmt_oob.c, p_data->ci_rmt_oob.r );
}
-#endif /* BTM_OOB_INCLUDED */
+#endif /* BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE */
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SDP_INCLUDED == TRUE)
void bta_dm_free_sdp_db (tBTA_DM_MSG *p_data)
{
-#if (SDP_INCLUDED == TRUE)
UNUSED(p_data);
if (bta_dm_search_cb.p_sdp_db) {
GKI_freebuf(bta_dm_search_cb.p_sdp_db);
bta_dm_search_cb.p_sdp_db = NULL;
}
-#endif ///SDP_INCLUDED == TRUE
}
+#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name,
UINT8 *service_name, UINT8 service_id, BOOLEAN is_originator)
{
return BTM_NOT_AUTHORIZED;
}
}
-
-
+
** Returns void
**
*******************************************************************************/
-static void bta_dm_pinname_cback (void *p_data)
+ static void bta_dm_pinname_cback (void *p_data)
{
tBTM_REMOTE_DEV_NAME *p_result = (tBTM_REMOTE_DEV_NAME *)p_data;
tBTA_DM_SEC sec_event;
}
#endif /* (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE) */
+#endif ///SMP_INCLUDED == TRUE
+
+
/*******************************************************************************
**
** Function bta_dm_local_name_cback
{
UNUSED(p_tle);
tBTA_SYS_HW_MSG *sys_enable_event;
-
+#if (BTM_SSR_INCLUDED == TRUE)
/* disable the power managment module */
bta_dm_disable_pm();
-
+#endif ///BTM_SSR_INCLUDED == TRUE
/* register our callback to SYS HW manager */
bta_sys_hw_register( BTA_SYS_HW_BLUETOOTH, bta_dm_sys_hw_cback );
}
/* AV calls bta_sys_conn_open with the A2DP stream count as app_id */
if (BTA_ID_AV == id) {
+#if (BTM_SSR_INCLUDED == TRUE)
bta_dm_cb.cur_av_count = bta_dm_get_av_count();
+#endif ///BTM_SSR_INCLUDED == TRUE
}
} else if ( status == BTA_SYS_CONN_IDLE) {
if (p_dev) {
/* get cur_av_count from connected services */
if (BTA_ID_AV == id) {
+#if (BTM_SSR_INCLUDED == TRUE)
bta_dm_cb.cur_av_count = bta_dm_get_av_count();
+#endif ///BTM_SSR_INCLUDED == TRUE
}
}
APPL_TRACE_WARNING("bta_dm_rm_cback:%d, status:%d", bta_dm_cb.cur_av_count, status);
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr)
{
UINT16 index = 0;
#endif
}
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static void bta_dm_bond_cancel_complete_cback(tBTM_STATUS result)
{
bta_dm_cb.p_sec_cback(BTA_DM_BOND_CANCEL_CMPL_EVT, &sec_event);
}
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns None
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void bta_dm_set_encryption (tBTA_DM_MSG *p_data)
{
UINT8 i ;
}
}
}
+#endif ///SMP_INCLUDED == TRUE
#if (BLE_INCLUDED == TRUE)
/*******************************************************************************
}
return status;
}
-#endif /* SMP_INCLUDED == TRUE */
/*******************************************************************************
**
{
BTM_SecurityGrant(p_data->ble_sec_grant.bd_addr, p_data->ble_sec_grant.res);
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void BTA_DmBond(BD_ADDR bd_addr)
{
tBTA_DM_API_BOND *p_msg;
}
-#if (BTM_OOB_INCLUDED == TRUE)
+#if (BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function BTA_DmLocalOob
return BTA_SUCCESS;
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** BTA_FAIL if operation failed.
**
*******************************************************************************/
+#if BLE_INCLUDED == TRUE
+#if SMP_INCLUDED == TRUE
void BTA_DmAddBleKey (BD_ADDR bd_addr, tBTA_LE_KEY_VALUE *p_le_key, tBTA_LE_KEY_TYPE key_type)
{
-#if BLE_INCLUDED == TRUE
-
tBTA_DM_API_ADD_BLEKEY *p_msg;
if ((p_msg = (tBTA_DM_API_ADD_BLEKEY *) GKI_getbuf(sizeof(tBTA_DM_API_ADD_BLEKEY))) != NULL) {
bta_sys_sendmsg(p_msg);
}
-#endif
}
/*******************************************************************************
*******************************************************************************/
void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, tBT_DEVICE_TYPE dev_type)
{
-#if BLE_INCLUDED == TRUE
tBTA_DM_API_ADD_BLE_DEVICE *p_msg;
if ((p_msg = (tBTA_DM_API_ADD_BLE_DEVICE *) GKI_getbuf(sizeof(tBTA_DM_API_ADD_BLE_DEVICE))) != NULL) {
bta_sys_sendmsg(p_msg);
}
-#endif
}
/*******************************************************************************
**
*******************************************************************************/
void BTA_DmBlePasskeyReply(BD_ADDR bd_addr, BOOLEAN accept, UINT32 passkey)
{
-#if BLE_INCLUDED == TRUE
tBTA_DM_API_PASSKEY_REPLY *p_msg;
if ((p_msg = (tBTA_DM_API_PASSKEY_REPLY *) GKI_getbuf(sizeof(tBTA_DM_API_PASSKEY_REPLY))) != NULL) {
}
bta_sys_sendmsg(p_msg);
}
-#endif
}
/*******************************************************************************
**
*******************************************************************************/
void BTA_DmBleConfirmReply(BD_ADDR bd_addr, BOOLEAN accept)
{
-#if BLE_INCLUDED == TRUE
tBTA_DM_API_CONFIRM *p_msg = (tBTA_DM_API_CONFIRM *)GKI_getbuf(sizeof(tBTA_DM_API_CONFIRM));
if (p_msg != NULL) {
memset(p_msg, 0, sizeof(tBTA_DM_API_CONFIRM));
p_msg->accept = accept;
bta_sys_sendmsg(p_msg);
}
-#endif
}
/*******************************************************************************
*******************************************************************************/
void BTA_DmBleSecurityGrant(BD_ADDR bd_addr, tBTA_DM_BLE_SEC_GRANT res)
{
-#if BLE_INCLUDED == TRUE
tBTA_DM_API_BLE_SEC_GRANT *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_SEC_GRANT *) GKI_getbuf(sizeof(tBTA_DM_API_BLE_SEC_GRANT))) != NULL) {
bta_sys_sendmsg(p_msg);
}
-#endif
}
+#endif ///SMP_INCLUDED == TRUE
+#endif ///BLE_INCLUDED == TRUE
/*******************************************************************************
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_DM_ENCRYPT_CBACK *p_callback,
tBTA_DM_BLE_SEC_ACT sec_act)
{
bta_sys_sendmsg(p_msg);
}
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
#include "bta_dm_ci.h"
-#if (BTM_OOB_INCLUDED == TRUE)
+#if (BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_dm_ci_io_req
BTA_DM_ACL_CHANGE_EVT,
BTA_DM_API_ADD_DEVICE_EVT,
BTA_DM_API_REMOVE_ACL_EVT,
-
+#if (SMP_INCLUDED == TRUE)
/* security API events */
BTA_DM_API_BOND_EVT,
BTA_DM_API_BOND_CANCEL_EVT,
BTA_DM_API_PIN_REPLY_EVT,
-
+#endif ///SMP_INCLUDED == TRUE
+#if (BTM_SSR_INCLUDED == TRUE)
/* power manger events */
BTA_DM_PM_BTM_STATUS_EVT,
BTA_DM_PM_TIMER_EVT,
-
+#endif ///BTM_SSR_INCLUDED == TRUE
+#if (SMP_INCLUDED == TRUE)
/* simple pairing events */
BTA_DM_API_CONFIRM_EVT,
BTA_DM_API_SET_ENCRYPTION_EVT,
-
-#if (BTM_OOB_INCLUDED == TRUE)
+#endif ///SMP_INCLUDED == TRUE
+#if (BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
BTA_DM_API_LOC_OOB_EVT,
BTA_DM_CI_IO_REQ_EVT,
BTA_DM_CI_RMT_OOB_EVT,
#if BLE_INCLUDED == TRUE
+#if SMP_INCLUDED == TRUE
BTA_DM_API_ADD_BLEKEY_EVT,
BTA_DM_API_ADD_BLEDEVICE_EVT,
BTA_DM_API_BLE_PASSKEY_REPLY_EVT,
BTA_DM_API_BLE_CONFIRM_REPLY_EVT,
BTA_DM_API_BLE_SEC_GRANT_EVT,
+#endif ///SMP_INCLUDED == TRUE
BTA_DM_API_BLE_SET_BG_CONN_TYPE,
BTA_DM_API_BLE_CONN_PARAM_EVT,
BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT,
UINT32 wbt_sdp_handle; /* WIDCOMM Extensions SDP record handle */
UINT8 wbt_scn; /* WIDCOMM Extensions SCN */
UINT8 num_master_only;
+#if BTM_SSR_INCLUDED == TRUE
UINT8 pm_id;
tBTA_PM_TIMER pm_timer[BTA_DM_NUM_PM_TIMER];
+#endif ///BTM_SSR_INCLUDED == TRUE
UINT32 role_policy_mask; /* the bits set indicates the modules that wants to remove role switch from the default link policy */
UINT16 cur_policy; /* current default link policy */
UINT16 rs_event; /* the event waiting for role switch */
bta_dm_acl_change, /* 8 BTA_DM_ACL_CHANGE_EVT */
bta_dm_add_device, /* 9 BTA_DM_API_ADD_DEVICE_EVT */
bta_dm_close_acl, /* 10 BTA_DM_API_ADD_DEVICE_EVT */
-
+#if (SMP_INCLUDED == TRUE)
/* security API events */
bta_dm_bond, /* 11 BTA_DM_API_BOND_EVT */
bta_dm_bond_cancel, /* 12 BTA_DM_API_BOND_CANCEL_EVT */
bta_dm_pin_reply, /* 13 BTA_DM_API_PIN_REPLY_EVT */
-
+#endif ///SMP_INCLUDED == TRUE
+#if (BTM_SSR_INCLUDED == TRUE)
/* power manger events */
bta_dm_pm_btm_status, /* 16 BTA_DM_PM_BTM_STATUS_EVT */
bta_dm_pm_timer, /* 17 BTA_DM_PM_TIMER_EVT*/
-
+#endif ///BTM_SSR_INCLUDED == TRUE
/* simple pairing events */
+#if (SMP_INCLUDED == TRUE)
bta_dm_confirm, /* 18 BTA_DM_API_CONFIRM_EVT */
-
bta_dm_set_encryption, /* BTA_DM_API_SET_ENCRYPTION_EVT */
-
-#if (BTM_OOB_INCLUDED == TRUE)
+#endif ///SMP_INCLUDED == TRUE
+#if (BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
bta_dm_loc_oob, /* 20 BTA_DM_API_LOC_OOB_EVT */
bta_dm_ci_io_req_act, /* 21 BTA_DM_CI_IO_REQ_EVT */
bta_dm_ci_rmt_oob_act, /* 22 BTA_DM_CI_RMT_OOB_EVT */
#if BLE_INCLUDED == TRUE
+#if SMP_INCLUDED == TRUE
bta_dm_add_blekey, /* BTA_DM_API_ADD_BLEKEY_EVT */
bta_dm_add_ble_device, /* BTA_DM_API_ADD_BLEDEVICE_EVT */
bta_dm_ble_passkey_reply, /* BTA_DM_API_BLE_PASSKEY_REPLY_EVT */
bta_dm_ble_confirm_reply, /* BTA_DM_API_BLE_CONFIRM_REPLY_EVT */
bta_dm_security_grant,
+#endif ///SMP_INCLUDED == TRUE
bta_dm_ble_set_bg_conn_type,
bta_dm_ble_set_conn_params, /* BTA_DM_API_BLE_CONN_PARAM_EVT */
bta_dm_ble_set_conn_scan_params, /* BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT */
BTA_DM_SDP_RESULT, /* 5 bta_dm_sdp_result */
#endif ///SDP_INCLUDED == TRUE
BTA_DM_SEARCH_CMPL, /* 6 bta_dm_search_cmpl*/
+#if (SDP_INCLUDED == TRUE)
BTA_DM_FREE_SDP_DB, /* 7 bta_dm_free_sdp_db */
+#endif ///SDP_INCLUDED == TRUE
BTA_DM_DISC_RESULT, /* 8 bta_dm_disc_result */
BTA_DM_SEARCH_RESULT, /* 9 bta_dm_search_result */
BTA_DM_QUEUE_SEARCH, /* 10 bta_dm_queue_search */
bta_dm_sdp_result, /* 5 BTA_DM_SDP_RESULT */
#endif ///SDP_INCLUDED == TRUE
bta_dm_search_cmpl, /* 6 BTA_DM_SEARCH_CMPL */
+#if (SDP_INCLUDED == TRUE)
bta_dm_free_sdp_db, /* 7 BTA_DM_FREE_SDP_DB */
+#endif ///SDP_INCLUDED == TRUE
bta_dm_disc_result, /* 8 BTA_DM_DISC_RESULT */
bta_dm_search_result, /* 9 BTA_DM_SEARCH_RESULT */
bta_dm_queue_search, /* 10 BTA_DM_QUEUE_SEARCH */
#endif ///SDP_INCLUDED == TRUE
/* INQUIRY_CMPL */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
/* REMT_NAME_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
+#if (SDP_INCLUDED == TRUE)
/* SDP_RESULT_EVT */ {BTA_DM_FREE_SDP_DB, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
+#endif ///SDP_INCLUDED == TRUE
/* SEARCH_CMPL_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
/* DISCV_RES_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#if (SDP_INCLUDED == TRUE)
#include "bta_dm_int.h"
#include "btm_api.h"
+#if (BTM_SSR_INCLUDED == TRUE)
static void bta_dm_pm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
static void bta_dm_pm_set_mode(BD_ADDR peer_addr, tBTA_DM_PM_ACTION pm_mode,
static void bta_dm_pm_set_sniff_policy(tBTA_DM_PEER_DEVICE *p_dev, BOOLEAN bDisable);
static void bta_dm_pm_stop_timer_by_index(tBTA_PM_TIMER *p_timer,
UINT8 timer_idx);
+#endif///BTM_SSR_INCLUDED == TRUE
#if (BTM_SSR_INCLUDED == TRUE)
#if (defined BTA_HH_INCLUDED && BTA_HH_INCLUDED == TRUE)
#define BTA_DM_PM_SSR_HH BTA_DM_PM_SSR1
#endif
static void bta_dm_pm_ssr(BD_ADDR peer_addr);
-#endif
tBTA_DM_CONNECTED_SRVCS bta_dm_conn_srvcs;
APPL_TRACE_EVENT("%s", __func__);
bta_dm_pm_set_mode(p_data->pm_timer.bd_addr, p_data->pm_timer.pm_request, BTA_DM_PM_EXECUTE);
}
+#endif ///BTM_SSR_INCLUDED == TRUE
+
/*******************************************************************************
**
return p_dev;
}
+#if (BTM_SSR_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_dm_is_sco_active
return cur_state;
}
#endif
+
+#endif ///BTM_SSR_INCLUDED == TRUE
+
uint2devclass((UINT32)cod, dev_class);
}
btc_config_get_int(name, "PinLength", &pin_length);
+#if (SMP_INCLUDED == TRUE)
BTA_DmAddDevice(bd_addr.address, dev_class, link_key, 0, 0,
(UINT8)linkkey_type, 0, pin_length);
+#endif ///SMP_INCLUDED == TRUE
}
bt_linkkey_file_found = TRUE;
} else {
}
}
+#if (SMP_INCLUDED == TRUE)
static void btc_set_encryption_callback(BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_STATUS enc_status)
{
UNUSED(bd_addr);
LOG_DEBUG("enc_status = %x\n", enc_status);
return;
}
-
+#endif ///SMP_INCLUDED == TRUE
static void btc_ble_start_scanning(uint8_t duration,
tBTA_DM_SEARCH_CBACK *results_cb,
btc_scan_rsp_data_raw_callback);
break;
case BTC_GAP_BLE_SET_ENCRYPTION_EVT: {
+#if (SMP_INCLUDED == TRUE)
BD_ADDR bd_addr;
memcpy(bd_addr, arg->set_encryption.bd_addr, sizeof(BD_ADDR));
BTA_DmSetEncryption(bd_addr, BT_TRANSPORT_LE, btc_set_encryption_callback,
(tBTA_DM_BLE_SEC_ACT)arg->set_encryption.sec_act);
+#endif ///SMP_INCLUDED == TRUE
break;
}
#endif
#ifndef BT_USE_TRACES
-#define BT_USE_TRACES TRUE
+#define BT_USE_TRACES FALSE
#endif
#ifndef BT_TRACE_BTIF
/* The number of SCO links. */
#ifndef BTM_MAX_SCO_LINKS
+#if (CLASSIC_BT_INCLUDED == TRUE)
#define BTM_MAX_SCO_LINKS 1 //3
+#else ///CLASSIC_BT_INCLUDED == TRUE
+#define BTM_MAX_SCO_LINKS 0
+#endif ///CLASSIC_BT_INCLUDED == TRUE
#endif
/* The preferred type of SCO links (2-eSCO, 0-SCO). */
/* TRUE to include Sniff Subrating */
#ifndef BTM_SSR_INCLUDED
-#define BTM_SSR_INCLUDED TRUE
+#define BTM_SSR_INCLUDED FALSE
#endif
/*************************
const UINT8 req_pend = (p_dev_rec->sm4 & BTM_SM4_REQ_PEND);
#endif ///CLASSIC_BT_INCLUDED == TRUE
/* Store the Peer Security Capabilites (in SM4 and rmt_sec_caps) */
+#if (SMP_INCLUDED == TRUE)
btm_sec_set_peer_sec_caps(p, p_dev_rec);
+#endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
BTM_TRACE_API("%s: pend:%d\n", __FUNCTION__, req_pend);
if (req_pend) {
}
const UINT8 req_pend = (p_dev_rec->sm4 & BTM_SM4_REQ_PEND);
-
+#if (SMP_INCLUDED == TRUE)
/* Store the Peer Security Capabilites (in SM4 and rmt_sec_caps) */
btm_sec_set_peer_sec_caps(p_acl_cb, p_dev_rec);
-
+#endif ///SMP_INCLUDED == TRUE
BTM_TRACE_API("%s: pend:%d\n", __FUNCTION__, req_pend);
if (req_pend) {
/* Request for remaining Security Features (if any) */
** Returns Allocated SCN number or 0 if none.
**
*******************************************************************************/
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 BTM_AllocateSCN(void)
{
-#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 x;
BTM_TRACE_DEBUG ("BTM_AllocateSCN\n");
// stack reserves scn 1 for HFP, HSP we still do the correct way
return (x + 1);
}
}
-#endif ///CLASSIC_BT_INCLUDED == TRUE
return (0); /* No free ports */
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
**
** Returns Returns TRUE if server channel was available
**
*******************************************************************************/
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
BOOLEAN BTM_TryAllocateSCN(UINT8 scn)
{
-#if (CLASSIC_BT_INCLUDED == TRUE)
/* Make sure we don't exceed max port range.
* Stack reserves scn 1 for HFP, HSP we still do the correct way.
*/
btm_cb.btm_scn[scn - 1] = TRUE;
return TRUE;
}
-#endif ///CLASSIC_BT_INCLUDED == TRUE
return (FALSE); /* Port was busy */
}
+
/*******************************************************************************
**
** Function BTM_FreeSCN
*******************************************************************************/
BOOLEAN BTM_FreeSCN(UINT8 scn)
{
-
-#if (CLASSIC_BT_INCLUDED == TRUE)
BTM_TRACE_DEBUG ("BTM_FreeSCN \n");
if (scn <= BTM_MAX_SCN) {
btm_cb.btm_scn[scn - 1] = FALSE;
} else {
return (FALSE); /* Illegal SCN passed in */
}
-#else
return (FALSE);
-#endif ///CLASSIC_BT_INCLUDED == TRUE
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
**
** Description send a paging command or queue it in btm_cb
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE && CLASSIC_BT_INCLUDED == TRUE)
void btm_acl_paging (BT_HDR *p, BD_ADDR bda)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
BTM_TRACE_DEBUG ("btm_acl_paging discing:%d, paging:%d BDA: %06x%06x\n",
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
}
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns TRUE if added OK, else FALSE
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE dev_type,
tBLE_ADDR_TYPE addr_type)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
UINT8 i = 0;
tBTM_INQ_INFO *p_info = NULL;
BTM_TRACE_DEBUG ("InqDb device_type =0x%x addr_type=0x%x",
p_info->results.device_type, p_info->results.ble_addr_type);
}
-#endif ///SMP_INCLUDED == TRUE
return (TRUE);
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
** Returns TRUE if added OK, else FALSE
**
*******************************************************************************/
+#if SMP_INCLUDED == TRUE
BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key, tBTM_LE_KEY_TYPE key_type)
{
-#if SMP_INCLUDED == TRUE
tBTM_SEC_DEV_REC *p_dev_rec;
BTM_TRACE_DEBUG ("BTM_SecAddBleKey");
p_dev_rec = btm_find_dev (bd_addr);
}
#endif
-#endif
return (TRUE);
}
+#endif
+
/*******************************************************************************
**
** res - comparison result BTM_SUCCESS if success
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void BTM_BleConfirmReply (BD_ADDR bd_addr, UINT8 res)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
tSMP_STATUS res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_PASSKEY_ENTRY_FAIL;
p_dev_rec->sec_flags |= BTM_SEC_LE_AUTHENTICATED;
BTM_TRACE_DEBUG ("%s\n", __func__);
SMP_ConfirmReply(bd_addr, res_smp);
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_ble_rand_enc_complete (UINT8 *p, UINT16 op_code, tBTM_RAND_ENC_CB *p_enc_cplt_cback)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_RAND_ENC params;
UINT8 *p_dest = params.param_buf;
(*p_enc_cplt_cback)(¶ms); /* Call the Encryption complete callback function */
}
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
** Returns None
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local )
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
BTM_TRACE_DEBUG ("btm_ble_increment_sign_ctr is_local=%d", is_local);
p_dev_rec->ble.keys.local_counter,
p_dev_rec->ble.keys.counter);
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns p_key_type: output parameter to carry the key type value.
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
BOOLEAN btm_ble_get_enc_key_type(BD_ADDR bd_addr, UINT8 *p_key_types)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
BTM_TRACE_DEBUG ("btm_ble_get_enc_key_type");
return TRUE;
}
-#endif ///SMP_INCLUDED == TRUE
return FALSE;
}
*******************************************************************************/
BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_div)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
BOOLEAN status = FALSE;
BTM_TRACE_DEBUG ("btm_get_local_div");
}
BTM_TRACE_DEBUG ("btm_get_local_div status=%d (1-OK) DIV=0x%x", status, *p_div);
return status;
-#else
- return FALSE;
-#endif ///SMP_INCLUDED == TRUE
}
+
/*******************************************************************************
**
** Function btm_sec_save_le_key
void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY_VALUE *p_keys,
BOOLEAN pass_to_application)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_rec;
tBTM_LE_EVT_DATA cb_data;
UINT8 i;
if (p_rec) {
BTM_TRACE_DEBUG ("sec_flags=0x%x", p_rec->sec_flags);
}
-#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void btm_ble_update_sec_key_size(BD_ADDR bd_addr, UINT8 enc_key_size)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_rec;
BTM_TRACE_DEBUG("btm_ble_update_sec_key_size enc_key_size = %d", enc_key_size);
if ((p_rec = btm_find_dev (bd_addr)) != NULL ) {
p_rec->enc_key_size = enc_key_size;
}
-#endif ///SMP_INCLUDED == TRUE
}
+
/*******************************************************************************
**
** Function btm_ble_read_sec_key_size
*******************************************************************************/
UINT8 btm_ble_read_sec_key_size(BD_ADDR bd_addr)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_rec;
if ((p_rec = btm_find_dev (bd_addr)) != NULL ) {
} else {
return 0;
}
-#else
return 0;
-#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE_SEC_REQ_ACT *p_sec_req_act)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
UINT8 req_sec_level = BTM_LE_SEC_NONE, cur_sec_level = BTM_LE_SEC_NONE;
req_sec_level,
*p_sec_req_act);
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_CB *p_cb = &btm_cb;
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
BT_OCTET8 dummy_stk = {0};
btm_ble_ltk_request_reply(p_dev_rec->bd_addr, FALSE, dummy_stk);
}
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
BOOLEAN enc_cback;
}
/* to notify GATT to send data if any request is pending */
gatt_notify_enc_cmpl(p_dev_rec->ble.pseudo_addr);
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_ble_ltk_request_reply(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bda);
tBTM_CB *p_cb = &btm_cb;
btsnd_hcic_ble_ltk_req_neg_reply(btm_cb.enc_handle);
}
}
-#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
UINT8 btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p_data)
{
UINT8 callback_rc = BTM_SUCCESS;
-#if (SMP_INCLUDED == TRUE)
BTM_TRACE_DEBUG ("btm_ble_io_capabilities_req");
if (btm_cb.api.p_le_callback) {
/* the callback function implementation may change the IO capability... */
BTM_TRACE_DEBUG ("btm_ble_io_capabilities_req 6: IO_CAP:%d oob_data:%d auth_req:0x%02x\n",
p_data->io_cap, p_data->oob_data, p_data->auth_req);
}
-#endif ///SMP_INCLUDED == TRUE
return callback_rc;
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
UINT8 btm_ble_br_keys_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p_data)
{
UINT8 callback_rc = BTM_SUCCESS;
-#if (SMP_INCLUDED)
BTM_TRACE_DEBUG ("%s\n", __func__);
if (btm_cb.api.p_le_callback) {
/* the callback function implementation may change the IO capability... */
callback_rc = (*btm_cb.api.p_le_callback) (BTM_LE_IO_REQ_EVT, p_dev_rec->bd_addr,
(tBTM_LE_EVT_DATA *)p_data);
}
-#endif ///SMP_INCLUDED
return callback_rc;
}
+#endif ///SMP_INCLUDED
+
#if (BLE_PRIVACY_SPT == TRUE )
/*******************************************************************************
** Description This function is the SMP callback handler.
**
******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
UINT8 res = 0;
} else {
BTM_TRACE_ERROR("btm_proc_smp_cback received for unknown device");
}
-#endif ///SMP_INCLUDED == TRUE
return 0;
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
** Returns TRUE if signing sucessul, otherwise FALSE.
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
BLE_SIGNATURE signature)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bd_addr);
BTM_TRACE_DEBUG ("%s", __func__);
GKI_freebuf(p_buf);
}
}
-#endif ///SMP_INCLUDED == TRUE
return ret;
}
UINT8 *p_comp)
{
BOOLEAN verified = FALSE;
-#if SMP_INCLUDED == TRUE
tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bd_addr);
UINT8 p_mac[BTM_CMAC_TLEN_SIZE];
}
}
}
-#endif /* SMP_INCLUDED */
return verified;
}
+#endif /* SMP_INCLUDED */
+
/*******************************************************************************
**
memset(&btm_cb.devcb.id_keys, 0, sizeof(tBTM_BLE_LOCAL_ID_KEYS));
}
}
-#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
*******************************************************************************/
static void btm_ble_process_ir2(tBTM_RAND_ENC *p)
{
-#if SMP_INCLUDED == TRUE
UINT8 btm_ble_dhk_pt = 0x03;
tSMP_ENC output;
} else {
memset(&btm_cb.devcb.id_keys, 0, sizeof(tBTM_BLE_LOCAL_ID_KEYS));
}
-#endif
}
/*******************************************************************************
BTM_TRACE_DEBUG("Generating IR failed.");
}
}
+#endif ///SMP_INCLUDED == TRUE
#if BTM_BLE_CONFORMANCE_TESTING == TRUE
/*******************************************************************************
static tBTM_SEC_SERV_REC *btm_sec_find_mx_serv (UINT8 is_originator, UINT16 psm,
UINT32 mx_proto_id,
UINT32 mx_chan_id);
-#endif ///SMP_INCLUDED == TRUE
static tBTM_STATUS btm_sec_execute_procedure (tBTM_SEC_DEV_REC *p_dev_rec);
static BOOLEAN btm_sec_start_get_name (tBTM_SEC_DEV_REC *p_dev_rec);
static BOOLEAN btm_sec_start_authentication (tBTM_SEC_DEV_REC *p_dev_rec);
static BOOLEAN btm_sec_start_encryption (tBTM_SEC_DEV_REC *p_dev_rec);
-#if (SMP_INCLUDED == TRUE)
static void btm_sec_collision_timeout (TIMER_LIST_ENT *p_tle);
static void btm_restore_mode(void);
static void btm_sec_pairing_timeout (TIMER_LIST_ENT *p_tle);
static tBTM_STATUS btm_sec_dd_create_conn (tBTM_SEC_DEV_REC *p_dev_rec);
-#endif ///SMP_INCLUDED == TRUE
static void btm_sec_change_pairing_state (tBTM_PAIRING_STATE new_state);
-
+#endif ///SMP_INCLUDED == TRUE
#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
static char *btm_pair_state_descr (tBTM_PAIRING_STATE state);
#endif
-
-static void btm_sec_check_pending_reqs(void);
#if (SMP_INCLUDED == TRUE)
+static void btm_sec_check_pending_reqs(void);
static BOOLEAN btm_sec_queue_mx_request (BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_orig,
UINT32 mx_proto_id, UINT32 mx_chan_id,
tBTM_SEC_CALLBACK *p_callback, void *p_ref_data);
#if (SMP_INCLUDED == TRUE)
static void btm_send_link_key_notif (tBTM_SEC_DEV_REC *p_dev_rec);
static BOOLEAN btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC *p_dev_rec);
-#endif ///SMP_INCLUDED == TRUE
static UINT8 btm_sec_start_authorization (tBTM_SEC_DEV_REC *p_dev_rec);
+#endif ///SMP_INCLUDED == TRUE
BOOLEAN btm_sec_are_all_trusted(UINT32 p_mask[]);
#if (SMP_INCLUDED == TRUE)
static tBTM_STATUS btm_sec_send_hci_disconnect (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 reason, UINT16 conn_handle);
static BOOLEAN btm_serv_trusted(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_SEC_SERV_REC *p_serv_rec);
static BOOLEAN btm_sec_is_serv_level0 (UINT16 psm);
static UINT16 btm_sec_set_serv_level4_flags (UINT16 cur_security, BOOLEAN is_originator);
-#endif ///SMP_INCLUDED == TRUE
static BOOLEAN btm_sec_queue_encrypt_request (BD_ADDR bd_addr, tBT_TRANSPORT transport,
tBTM_SEC_CALLBACK *p_callback, void *p_ref_data);
-#if (SMP_INCLUDED == TRUE)
static void btm_sec_check_pending_enc_req (tBTM_SEC_DEV_REC *p_dev_rec, tBT_TRANSPORT transport,
UINT8 encr_enable);
static BOOLEAN btm_sec_use_smp_br_chnl(tBTM_SEC_DEV_REC *p_dev_rec);
#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
LOG_DEBUG("%s p_cb_info->p_le_callback == 0x%p\n", __func__, p_cb_info->p_le_callback);
if (p_cb_info->p_le_callback) {
-#if SMP_INCLUDED == TRUE
BTM_TRACE_EVENT("%s SMP_Register( btm_proc_smp_cback )\n", __func__);
SMP_Register(btm_proc_smp_cback);
-#endif
/* if no IR is loaded, need to regenerate all the keys */
if (memcmp(btm_cb.devcb.id_keys.ir, &temp_value, sizeof(BT_OCTET16)) == 0) {
btm_ble_reset_id();
** Returns TRUE if registered OK, else FALSE
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
BOOLEAN BTM_SecAddRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback)
{
-#if (SMP_INCLUDED == TRUE)
int i;
for (i = 0; i < BTM_SEC_MAX_RMT_NAME_CALLBACKS; i++) {
return (TRUE);
}
}
-#endif ///SMP_INCLUDED == TRUE
return (FALSE);
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
** Returns TRUE if OK, else FALSE
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
BOOLEAN BTM_SecDeleteRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback)
{
-#if (SMP_INCLUDED == TRUE)
int i;
for (i = 0; i < BTM_SEC_MAX_RMT_NAME_CALLBACKS; i++) {
return (TRUE);
}
}
-#endif ///SMP_INCLUDED == TRUE
return (FALSE);
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns Number of records that were freed.
**
*******************************************************************************/
+#if (SDP_INCLUDED == TRUE)
UINT8 BTM_SecClrService (UINT8 service_id)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_SERV_REC *p_srec = &btm_cb.sec_serv_rec[0];
UINT8 num_freed = 0;
int i;
}
return (num_freed);
-#else
- return 0;
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns Number of records that were freed.
**
*******************************************************************************/
+#if (SDP_INCLUDED== TRUE)
UINT8 btm_sec_clr_service_by_psm (UINT16 psm)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_SERV_REC *p_srec = &btm_cb.sec_serv_rec[0];
UINT8 num_freed = 0;
int i;
BTM_TRACE_API("btm_sec_clr_service_by_psm psm:0x%x num_freed:%d\n", psm, num_freed);
return (num_freed);
-#else
- return 0;
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SDP_INCLUDED== TRUE
/*******************************************************************************
**
** trusted_mask - bitwise OR of trusted services (array of UINT32)
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin, UINT32 trusted_mask[])
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
BTM_TRACE_API ("BTM_PINCodeReply(): PairState: %s PairFlags: 0x%02x PinLen:%d Result:%d\n",
btm_cb.pin_code_len_saved = pin_len;
#endif
btsnd_hcic_pin_code_req_reply (bd_addr, pin_len, p_pin);
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
**
** Note: After 2.1 parameters are not used and preserved here not to change API
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
tBTM_STATUS BTM_SecBond (BD_ADDR bd_addr, UINT8 pin_len, UINT8 *p_pin, UINT32 trusted_mask[])
{
tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
-#if BLE_INCLUDED == TRUE
if (BTM_UseLeLink(bd_addr)) {
transport = BT_TRANSPORT_LE;
}
-#endif
return btm_sec_bond_by_transport(bd_addr, transport, pin_len, p_pin, trusted_mask);
}
/*******************************************************************************
*******************************************************************************/
tBTM_STATUS BTM_SecBondCancel (BD_ADDR bd_addr)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
BTM_TRACE_API ("BTM_SecBondCancel() State: %s flags:0x%x\n",
return BTM_NOT_AUTHORIZED;
}
}
-#endif ///SMP_INCLUDED == TRUE
return BTM_WRONG_MODE;
}
+
/*******************************************************************************
**
** Function BTM_SecGetDeviceLinkKey
}
return (BTM_UNKNOWN_ADDR);
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** BTM_MODE_UNSUPPORTED - if security manager not linked in.
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
tBTM_STATUS BTM_SetEncryption (BD_ADDR bd_addr, tBT_TRANSPORT transport, tBTM_SEC_CBACK *p_callback,
void *p_ref_data)
{
/*******************************************************************************
* disconnect the ACL link, if it's not done yet.
*******************************************************************************/
-#if (SMP_INCLUDED == TRUE)
static tBTM_STATUS btm_sec_send_hci_disconnect (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 reason, UINT16 conn_handle)
{
UINT8 old_state = p_dev_rec->sec_state;
** BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
**
*******************************************************************************/
-#if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE)
+#if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE && SMP_INCLUDED == TRUE)
void BTM_PasskeyReqReply(tBTM_STATUS res, BD_ADDR bd_addr, UINT32 passkey)
{
-#if (SMP_INCLUDED == TRUE)
BTM_TRACE_API ("BTM_PasskeyReqReply: State: %s res:%d\n",
btm_pair_state_descr(btm_cb.pairing_state), res);
btm_cb.acl_disc_reason = HCI_SUCCESS;
btsnd_hcic_user_passkey_reply (bd_addr, passkey);
}
-#endif ///SMP_INCLUDED == TRUE
}
-#endif
+#endif ///BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE && SMP_INCLUDED == TRUE
/*******************************************************************************
**
** type - notification type
**
*******************************************************************************/
-#if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE)
+#if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE && SMP_INCLUDED == TRUE)
void BTM_SendKeypressNotif(BD_ADDR bd_addr, tBTM_SP_KEY_TYPE type)
{
-#if (SMP_INCLUDED == TRUE)
/* This API only make sense between PASSKEY_REQ and SP complete */
if (btm_cb.pairing_state == BTM_PAIR_STATE_KEY_ENTRY) {
btsnd_hcic_send_keypress_notif (bd_addr, type);
}
-#endif ///SMP_INCLUDED == TRUE
}
-#endif
+#endif ///BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE && SMP_INCLUDED == TRUE
-#if BTM_OOB_INCLUDED == TRUE
+#if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Function BTM_IoCapRsp
*******************************************************************************/
void BTM_IoCapRsp(BD_ADDR bd_addr, tBTM_IO_CAP io_cap, tBTM_OOB_DATA oob, tBTM_AUTH_REQ auth_req)
{
-#if (SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("BTM_IoCapRsp: state: %s oob: %d io_cap: %d\n",
btm_pair_state_descr(btm_cb.pairing_state), oob, io_cap);
btsnd_hcic_io_cap_req_reply (bd_addr, io_cap, oob, auth_req);
}
-#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void BTM_RemoteOobDataReply(tBTM_STATUS res, BD_ADDR bd_addr, BT_OCTET16 c, BT_OCTET16 r)
{
-#if (SMP_INCLUDED == TRUE)
BTM_TRACE_EVENT ("%s() - State: %s res: %d\n", __func__,
btm_pair_state_descr(btm_cb.pairing_state), res);
btm_cb.acl_disc_reason = HCI_SUCCESS;
btsnd_hcic_rem_oob_reply (bd_addr, c, r);
}
-#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
return p_ret;
}
-#endif
+#endif ///BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (CLASSIC_BT_INCLUDED == TRUE)
void BTM_SetOutService(BD_ADDR bd_addr, UINT8 service_id, UINT32 mx_chan_id)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
tBTM_SEC_SERV_REC *p_serv_rec = &btm_cb.sec_serv_rec[0];
break;
}
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
/************************************************************************
** I N T E R N A L F U N C T I O N S
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_sec_check_pending_reqs (void)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_QUEUE_ENTRY *p_e;
BUFFER_Q bq;
GKI_freebuf (p_e);
}
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_io_capabilities_req (UINT8 *p)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SP_IO_REQ evt_data;
UINT8 err_code = 0;
tBTM_SEC_DEV_REC *p_dev_rec;
btsnd_hcic_io_cap_req_reply(evt_data.bd_addr, evt_data.io_cap,
evt_data.oob_data, evt_data.auth_req);
}
-#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void btm_io_capabilities_rsp (UINT8 *p)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
tBTM_SP_IO_RSP evt_data;
if (btm_cb.api.p_sp_callback) {
(*btm_cb.api.p_sp_callback) (BTM_SP_IO_RSP_EVT, (tBTM_SP_EVT_DATA *)&evt_data);
}
-#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
**
** Returns void
**
-*******************************************************************************/
+*******************************************************************************/\r
void btm_proc_sp_req_evt (tBTM_SP_EVT event, UINT8 *p)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_STATUS status = BTM_ERR_PROCESSING;
tBTM_SP_EVT_DATA evt_data;
UINT8 *p_bda = evt_data.cfm_req.bd_addr;
btsnd_hcic_user_passkey_neg_reply(p_bda);
}
#endif
-#endif ///SMP_INCLUDED == TRUE
}
+
/*******************************************************************************
**
** Function btm_keypress_notif_evt
*******************************************************************************/
void btm_simple_pair_complete (UINT8 *p)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SP_COMPLT evt_data;
tBTM_SEC_DEV_REC *p_dev_rec;
UINT8 status;
btm_sec_send_hci_disconnect (p_dev_rec, HCI_ERR_AUTH_FAILURE, p_dev_rec->hci_handle);
}
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
-#if BTM_OOB_INCLUDED == TRUE
+
+#if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Function btm_rem_oob_req
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_sec_auth_complete (UINT16 handle, UINT8 status)
{
-#if (SMP_INCLUDED == TRUE)
UINT8 old_sm4;
tBTM_PAIRING_STATE old_state = btm_cb.pairing_state;
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
if (status != BTM_CMD_STARTED) {
btm_sec_dev_rec_cback_event (p_dev_rec, status, FALSE);
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void btm_sec_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
tACL_CONN *p_acl = NULL;
if (status != BTM_CMD_STARTED) {
btm_sec_dev_rec_cback_event (p_dev_rec, status, FALSE);
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** BTM_NO_RESOURCES - permission declined
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static tBTM_STATUS btm_sec_execute_procedure (tBTM_SEC_DEV_REC *p_dev_rec)
{
BTM_TRACE_EVENT ("btm_sec_execute_procedure: Required:0x%x Flags:0x%x State:%d\n",
return (BTM_SUCCESS);
}
-
/*******************************************************************************
**
** Function btm_sec_start_get_name
btm_sec_start_get_name (p_dev_rec);
return (BTM_CMD_STARTED);
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Description This function is called to change pairing state
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static void btm_sec_change_pairing_state (tBTM_PAIRING_STATE new_state)
{
-#if (SMP_INCLUDED == TRUE)
tBTM_PAIRING_STATE old_state = btm_cb.pairing_state;
BTM_TRACE_EVENT ("%s() Old: %s\n", __func__, btm_pair_state_descr(btm_cb.pairing_state));
btu_start_timer (&btm_cb.pairing_tle, BTU_TTYPE_USER_FUNC, BTM_SEC_TIMEOUT_VALUE);
}
-#endif ///SMP_INCLUDED == TRUE
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
#endif
(*p_callback) (p_dev_rec->bd_addr, BT_TRANSPORT_BR_EDR, p_dev_rec->p_ref_data, res);
}
-
+#if (SMP_INCLUDED == TRUE)
btm_sec_check_pending_reqs();
+#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
return rv;
}
-#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns TRUE if the service is security mode 4 level 0 service
**
*******************************************************************************/
-#if (SMP_INCLUDED == TRUE)
static BOOLEAN btm_sec_is_serv_level0(UINT16 psm)
{
if (psm == BT_PSM_SDP) {
static void btu_hcif_connection_comp_evt (UINT8 *p);
static void btu_hcif_connection_request_evt (UINT8 *p);
static void btu_hcif_disconnection_comp_evt (UINT8 *p);
+#if (SMP_INCLUDED == TRUE)
static void btu_hcif_authentication_comp_evt (UINT8 *p);
+#endif ///SMP_INCLUDED == TRUE
static void btu_hcif_rmt_name_request_comp_evt (UINT8 *p, UINT16 evt_len);
+#if (SMP_INCLUDED == TRUE)
static void btu_hcif_encryption_change_evt (UINT8 *p);
+#endif ///SMP_INCLUDED == TRUE
static void btu_hcif_read_rmt_features_comp_evt (UINT8 *p);
static void btu_hcif_read_rmt_ext_features_comp_evt (UINT8 *p);
static void btu_hcif_read_rmt_version_comp_evt (UINT8 *p);
/* Simple Pairing Events */
static void btu_hcif_host_support_evt (UINT8 *p);
+#if (SMP_INCLUDED == TRUE)
static void btu_hcif_io_cap_request_evt (UINT8 *p);
static void btu_hcif_io_cap_response_evt (UINT8 *p);
static void btu_hcif_user_conf_request_evt (UINT8 *p);
static void btu_hcif_user_passkey_request_evt (UINT8 *p);
static void btu_hcif_user_passkey_notif_evt (UINT8 *p);
static void btu_hcif_keypress_notif_evt (UINT8 *p);
-
-#if BTM_OOB_INCLUDED == TRUE
+#endif ///SMP_INCLUDED == TRUE
+#if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
static void btu_hcif_rem_oob_request_evt (UINT8 *p);
#endif
-
+#if (SMP_INCLUDED == TRUE)
static void btu_hcif_simple_pair_complete_evt (UINT8 *p);
+#endif ///SMP_INCLUDED == TRUE
#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
static void btu_hcif_enhanced_flush_complete_evt (void);
#endif
static void btu_ble_process_adv_pkt (UINT8 *p);
static void btu_ble_read_remote_feat_evt (UINT8 *p);
static void btu_ble_ll_conn_param_upd_evt (UINT8 *p, UINT16 evt_len);
+#if (SMP_INCLUDED == TRUE)
static void btu_ble_proc_ltk_req (UINT8 *p);
static void btu_hcif_encryption_key_refresh_cmpl_evt (UINT8 *p);
+#endif ///SMP_INCLUDED == TRUE
static void btu_ble_data_length_change_evt (UINT8 *p, UINT16 evt_len);
#if (BLE_LLT_INCLUDED == TRUE)
static void btu_ble_rc_param_req_evt(UINT8 *p);
btu_hcif_disconnection_comp_evt (p);
break;
case HCI_AUTHENTICATION_COMP_EVT:
+#if (SMP_INCLUDED == TRUE)
btu_hcif_authentication_comp_evt (p);
+#endif ///SMP_INCLUDED == TRUE
break;
case HCI_RMT_NAME_REQUEST_COMP_EVT:
btu_hcif_rmt_name_request_comp_evt (p, hci_evt_len);
break;
case HCI_ENCRYPTION_CHANGE_EVT:
+#if (SMP_INCLUDED == TRUE)
btu_hcif_encryption_change_evt (p);
+#endif ///SMP_INCLUDED == TRUE
break;
#if BLE_INCLUDED == TRUE
case HCI_ENCRYPTION_KEY_REFRESH_COMP_EVT:
+#if (SMP_INCLUDED == TRUE)
btu_hcif_encryption_key_refresh_cmpl_evt(p);
+#endif ///SMP_INCLUDED == TRUE
break;
#endif
case HCI_READ_RMT_FEATURES_COMP_EVT:
case HCI_RMT_HOST_SUP_FEAT_NOTIFY_EVT:
btu_hcif_host_support_evt (p);
break;
+#if (SMP_INCLUDED == TRUE)
case HCI_IO_CAPABILITY_REQUEST_EVT:
btu_hcif_io_cap_request_evt (p);
break;
case HCI_USER_PASSKEY_REQUEST_EVT:
btu_hcif_user_passkey_request_evt (p);
break;
-#if BTM_OOB_INCLUDED == TRUE
+#endif ///SMP_INCLUDED == TRUE
+#if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
case HCI_REMOTE_OOB_DATA_REQUEST_EVT:
btu_hcif_rem_oob_request_evt (p);
break;
#endif
+#if (SMP_INCLUDED == TRUE)
case HCI_SIMPLE_PAIRING_COMPLETE_EVT:
btu_hcif_simple_pair_complete_evt (p);
break;
case HCI_KEYPRESS_NOTIFY_EVT:
btu_hcif_keypress_notif_evt (p);
break;
+#endif ///SMP_INCLUDED == TRUE
#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
case HCI_ENHANCED_FLUSH_COMPLETE_EVT:
btu_hcif_enhanced_flush_complete_evt ();
btu_ble_read_remote_feat_evt(p);
break;
case HCI_BLE_LTK_REQ_EVT: /* received only at slave device */
+#if (SMP_INCLUDED == TRUE)
btu_ble_proc_ltk_req(p);
+#endif ///SMP_INCLUDED == TRUE
break;
//#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
case HCI_BLE_ENHANCED_CONN_COMPLETE_EVT:
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static void btu_hcif_authentication_comp_evt (UINT8 *p)
{
UINT8 status;
btm_sec_auth_complete (handle, status);
}
-
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static void btu_hcif_encryption_change_evt (UINT8 *p)
{
UINT8 status;
btm_acl_encrypt_change (handle, status, encr_enable);
btm_sec_encrypt_change (handle, status, encr_enable);
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
break;
case HCI_READ_LOCAL_OOB_DATA:
-#if BTM_OOB_INCLUDED == TRUE
+#if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
btm_read_local_oob_complete(p);
#endif
break;
case HCI_BLE_RAND:
case HCI_BLE_ENCRYPT:
+#if (SMP_INCLUDED == TRUE)
btm_ble_rand_enc_complete (p, opcode, (tBTM_RAND_ENC_CB *)p_cplt_cback);
+#endif ///SMP_INCLUDED == TRUE
break;
case HCI_BLE_READ_ADV_CHNL_TX_POWER:
break;
case HCI_AUTHENTICATION_REQUESTED:
+#if (SMP_INCLUDED == TRUE)
/* Device refused to start authentication. That should be treated as authentication failure. */
btm_sec_auth_complete (BTM_INVALID_HCI_HANDLE, status);
+#endif ///SMP_INCLUDED == TRUE
break;
case HCI_SET_CONN_ENCRYPTION:
+#if (SMP_INCLUDED == TRUE)
/* Device refused to start encryption. That should be treated as encryption failure. */
btm_sec_encrypt_change (BTM_INVALID_HCI_HANDLE, status, FALSE);
+#endif ///SMP_INCLUDED == TRUE
break;
#if BLE_INCLUDED == TRUE
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static void btu_hcif_io_cap_request_evt (UINT8 *p)
{
btm_io_capabilities_req(p);
btm_proc_sp_req_evt(BTM_SP_CFM_REQ_EVT, p);
}
-
/*******************************************************************************
**
** Function btu_hcif_user_passkey_request_evt
{
btm_keypress_notif_evt(p);
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
** Returns void
**
*******************************************************************************/
-#if BTM_OOB_INCLUDED == TRUE
+#if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
static void btu_hcif_rem_oob_request_evt (UINT8 *p)
{
btm_rem_oob_req(p);
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static void btu_hcif_simple_pair_complete_evt (UINT8 *p)
{
btm_simple_pair_complete(p);
}
-
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Function btu_hcif_enhanced_flush_complete_evt
** BLE Events
***********************************************/
#if (defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE)
+#if (SMP_INCLUDED == TRUE)
static void btu_hcif_encryption_key_refresh_cmpl_evt (UINT8 *p)
{
UINT8 status;
btm_sec_encrypt_change (handle, status, enc_enable);
}
+#endif ///SMP_INCLUDED == TRUE
static void btu_ble_process_adv_pkt (UINT8 *p)
{
btm_ble_read_remote_features_complete(p);
}
+#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
static void btu_ble_proc_ltk_req (UINT8 *p)
{
-#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+
UINT16 ediv, handle;
UINT8 *pp;
STREAM_TO_UINT16(ediv, pp);
btm_ble_ltk_request(handle, p, ediv);
-#endif
/* This is empty until an upper layer cares about returning event */
}
+#endif ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+
static void btu_ble_data_length_change_evt(UINT8 *p, UINT16 evt_len)
{
return;
}
}
-
+#if (SDP_INCLUDED == TRUE)
/* Free the security record for this PSM */
BTM_SecClrService(service_id);
+#endif ///SDP_INCLUDED == TRUE
L2CA_DEREGISTER (psm);
}
** Returns TRUE if encrypted, otherwise FALSE.
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static BOOLEAN gatt_sign_data (tGATT_CLCB *p_clcb)
{
tGATT_VALUE *p_attr = (tGATT_VALUE *)p_clcb->p_attr_buf;
return status;
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Returns
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
void gatt_verify_signature(tGATT_TCB *p_tcb, BT_HDR *p_buf)
{
UINT16 cmd_len;
return;
}
+#endif ///SMP_INCLUDED == TRUE
+
/*******************************************************************************
**
** Function gatt_sec_check_complete
gatt_act_write(p_clcb, sec_act);
} else if (p_clcb->operation == GATTC_OPTYPE_READ) {
gatt_act_read(p_clcb, p_clcb->counter);
- }\r
+ }
#endif ///GATTC_INCLUDED == TRUE
}
/*******************************************************************************
BOOLEAN is_link_encrypted = FALSE;
BOOLEAN is_link_key_known = FALSE;
BOOLEAN is_key_mitm = FALSE;
- UINT8 key_type;
#if (SMP_INCLUDED == TRUE)
+ UINT8 key_type;
tBTM_BLE_SEC_REQ_ACT sec_act = BTM_LE_SEC_NONE;
#endif ///SMP_INCLUDED == TRUE
if (auth_req == GATT_AUTH_REQ_NONE ) {
/* this is a write command request
check data signing required or not */
if (!is_link_encrypted) {
+#if (SMP_INCLUDED == TRUE)
btm_ble_get_enc_key_type(p_tcb->peer_bda, &key_type);
-
+#endif ///SMP_INCLUDED == TRUE
if (
#if (SMP_INCLUDED == TRUE)
(key_type & BTM_LE_KEY_LCSRK) &&
tGATT_SEC_ACTION gatt_sec_act;
tBTM_BLE_SEC_ACT btm_ble_sec_act;
BOOLEAN status = TRUE;
+#if (SMP_INCLUDED == TRUE)
tBTM_STATUS btm_status;
+#endif ///SMP_INCLUDED == TRUE
tGATT_SEC_ACTION sec_act_old = gatt_get_sec_act(p_tcb);
gatt_sec_act = gatt_determine_sec_act(p_clcb);
switch (gatt_sec_act ) {
case GATT_SEC_SIGN_DATA:
+#if (SMP_INCLUDED == TRUE)
GATT_TRACE_DEBUG("gatt_security_check_start: Do data signing");
gatt_sign_data(p_clcb);
+#endif ///SMP_INCLUDED == TRUE
break;
case GATT_SEC_ENCRYPT:
case GATT_SEC_ENCRYPT_NO_MITM:
if (sec_act_old < GATT_SEC_ENCRYPT) {
GATT_TRACE_DEBUG("gatt_security_check_start: Encrypt now or key upgreade first");
gatt_convert_sec_action(gatt_sec_act, &btm_ble_sec_act);
+#if (SMP_INCLUDED == TRUE)
btm_status = BTM_SetEncryption(p_tcb->peer_bda, p_tcb->transport , gatt_enc_cmpl_cback, &btm_ble_sec_act);
if ( (btm_status != BTM_SUCCESS) && (btm_status != BTM_CMD_STARTED)) {
GATT_TRACE_ERROR("gatt_security_check_start BTM_SetEncryption failed btm_status=%d", btm_status);
status = FALSE;
}
+#endif ///SMP_INCLUDED == TRUE
}
if (status) {
gatt_add_pending_enc_channel_clcb (p_tcb, p_clcb);
if (pseudo_op_code < GATT_OP_CODE_MAX) {
if (op_code == GATT_SIGN_CMD_WRITE) {
+#if (SMP_INCLUDED == TRUE)
gatt_verify_signature(p_tcb, p_buf);
+#endif ///SMP_INCLUDED == TRUE
} else {
/* message from client */
if ((op_code % 2) == 0) {
BTM_GetSecurityFlagsByTransport(rem_bda, &sec_flag, transport);
sec_flag &= (GATT_SEC_FLAG_LKEY_UNAUTHED | GATT_SEC_FLAG_LKEY_AUTHED | GATT_SEC_FLAG_ENCRYPTED);
-
+#if (SMP_INCLUDED == TRUE)
*p_key_size = btm_ble_read_sec_key_size(rem_bda);
+#endif ///SMP_INCLUDED == TRUE
*p_sec_flag = sec_flag;
}
/*******************************************************************************
#if !defined (BT_10A)
UINT8_TO_STREAM (pp, allow_switch);
#endif
+#if (SMP_INCLUDED == TRUE && CLASSIC_BT_INCLUDED == TRUE)
btm_acl_paging (p, dest);
+#endif ///SMP_INCLUDED == TRUE && CLASSIC_BT_INCLUDED == TRUE
return (TRUE);
}
UINT8_TO_STREAM (pp, page_scan_rep_mode);
UINT8_TO_STREAM (pp, page_scan_mode);
UINT16_TO_STREAM (pp, clock_offset);
-
+#if (SMP_INCLUDED == TRUE && CLASSIC_BT_INCLUDED == TRUE)
btm_acl_paging (p, bd_addr);
+#endif ///SMP_INCLUDED == TRUE && CLASSIC_BT_INCLUDED == TRUE
return (TRUE);
}
**
*******************************************************************************/
//extern
+#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 BTM_AllocateSCN(void);
// btla-specific ++
*******************************************************************************/
//extern
BOOLEAN BTM_FreeSCN(UINT8 scn);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
TIMER_LIST_ENT pairing_tle; /* Timer for pairing process */
UINT16 disc_handle; /* for legacy devices */
UINT8 disc_reason; /* for legacy devices */
-#endif ///SMP_INCLUDED == TRUE
tBTM_SEC_SERV_REC sec_serv_rec[BTM_SEC_MAX_SERVICE_RECORDS];
+#endif ///SMP_INCLUDED == TRUE
tBTM_SEC_DEV_REC sec_dev_rec[BTM_SEC_MAX_DEVICE_RECORDS];
tBTM_SEC_SERV_REC *p_out_serv;
tBTM_MKEY_CALLBACK *mkey_cback;
if (!p_ccb->in_use) {
return;
}
-
+#if (SDP_INCLUDED == TRUE)
if (p_rcb && (p_rcb->psm != p_rcb->real_psm)) {
btm_sec_clr_service_by_psm(p_rcb->psm);
}
-
+#endif ///SMP_INCLUDED == TRUE
if (p_ccb->should_free_rcb) {
osi_free(p_rcb);
p_ccb->p_rcb = NULL;