mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components/bt: Separation of BT and BLE
This commit is contained in:
parent
485c896740
commit
07fef85a23
@ -1,6 +1,5 @@
|
||||
menu Bluetooth
|
||||
|
||||
|
||||
config BT_ENABLED
|
||||
bool "Bluetooth"
|
||||
help
|
||||
@ -475,9 +474,16 @@ menu Bluetooth
|
||||
help
|
||||
This enables the Secure Simple Pairing. If disable this option, Bluedroid will only support Legacy Pairing
|
||||
|
||||
config BT_BLE_ENABLED
|
||||
bool "Bluetooth Low Energy"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
default y
|
||||
help
|
||||
This enables Bluetooth Low Energy
|
||||
|
||||
config BT_GATTS_ENABLE
|
||||
bool "Include GATT server module(GATTS)"
|
||||
depends on BT_BLUEDROID_ENABLED && (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
|
||||
depends on BT_BLE_ENABLED
|
||||
default y
|
||||
help
|
||||
This option can be disabled when the app work only on gatt client mode
|
||||
@ -510,21 +516,21 @@ menu Bluetooth
|
||||
|
||||
config BT_GATTC_ENABLE
|
||||
bool "Include GATT client module(GATTC)"
|
||||
depends on BT_BLUEDROID_ENABLED && (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
|
||||
depends on BT_BLE_ENABLED
|
||||
default y
|
||||
help
|
||||
This option can be close when the app work only on gatt server mode
|
||||
|
||||
config BT_GATTC_CACHE_NVS_FLASH
|
||||
bool "Save gattc cache data to nvs flash"
|
||||
depends on BT_GATTC_ENABLE && (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
|
||||
depends on BT_GATTC_ENABLE
|
||||
default n
|
||||
help
|
||||
This select can save gattc cache data to nvs flash
|
||||
|
||||
config BT_BLE_SMP_ENABLE
|
||||
bool "Include BLE security module(SMP)"
|
||||
depends on BT_BLUEDROID_ENABLED && (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
|
||||
depends on BT_BLE_ENABLED
|
||||
default y
|
||||
help
|
||||
This option can be close when the app not used the ble security connect.
|
||||
|
@ -60,7 +60,9 @@ 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);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
static UINT8 bta_dm_pin_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, BOOLEAN min_16_digit);
|
||||
#endif /// CLASSIC_BT_INCLUDED == TRUE
|
||||
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
|
||||
@ -125,9 +127,12 @@ static void bta_dm_ctrl_features_rd_cmpl_cback(tBTM_STATUS result);
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr);
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#if (BLE_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_observe_discard_cb (uint32_t num_dis);
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
static void bta_dm_delay_role_switch_cback(TIMER_LIST_ENT *p_tle);
|
||||
extern void sdpu_uuid16_to_uuid128(UINT16 uuid16, UINT8 *p_uuid128);
|
||||
static void bta_dm_disable_timer_cback(TIMER_LIST_ENT *p_tle);
|
||||
@ -215,7 +220,11 @@ const UINT32 bta_service_id_to_btm_srv_id_lkup_tbl [BTA_MAX_SERVICE_ID] = {
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
const tBTM_APPL_INFO bta_security = {
|
||||
&bta_dm_authorize_cback,
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
&bta_dm_pin_cback,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
&bta_dm_new_link_key_cback,
|
||||
&bta_dm_authentication_complete_cback,
|
||||
&bta_dm_bond_cancel_complete_cback,
|
||||
@ -581,7 +590,7 @@ void bta_dm_disable (tBTA_DM_MSG *p_data)
|
||||
bta_sys_start_timer(&bta_dm_cb.disable_timer, 0, 5000);
|
||||
}
|
||||
|
||||
#if BLE_PRIVACY_SPT == TRUE
|
||||
#if BLE_INCLUDED == TRUE && BLE_PRIVACY_SPT == TRUE
|
||||
btm_ble_resolving_list_cleanup (); //by TH, because cmn_ble_vsc_cb.max_filter has something mistake as btm_ble_adv_filter_cleanup
|
||||
#endif
|
||||
|
||||
@ -698,25 +707,31 @@ void bta_dm_config_eir (tBTA_DM_MSG *p_data)
|
||||
|
||||
void bta_dm_update_white_list(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
BTM_BleUpdateAdvWhitelist(p_data->white_list.add_remove, p_data->white_list.remote_addr, p_data->white_list.addr_type, p_data->white_list.add_wl_cb);
|
||||
#endif ///BLE_INCLUDED == 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
|
||||
}
|
||||
|
||||
void bta_dm_ble_read_rssi(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
if (p_data->rssi.read_rssi_cb != NULL) {
|
||||
BTM_ReadRSSI(p_data->rssi.remote_addr, p_data->rssi.transport, p_data->rssi.read_rssi_cb);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s(), the callback function can't be NULL.", __func__);
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -732,42 +747,52 @@ void bta_dm_ble_read_rssi(tBTA_DM_MSG *p_data)
|
||||
void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
UINT16 window, interval;
|
||||
UINT16 le_disc_mode = BTM_BleReadDiscoverability();
|
||||
UINT16 disc_mode = BTM_ReadDiscoverability(&window, &interval);
|
||||
UINT16 le_conn_mode = BTM_BleReadConnectability();
|
||||
UINT16 conn_mode = BTM_ReadConnectability(&window, &interval);
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
UINT16 le_disc_mode = BTM_BleReadDiscoverability();
|
||||
UINT16 le_conn_mode = BTM_BleReadConnectability();
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/* set modes for Discoverability and connectability if not ignore */
|
||||
if (p_data->set_visibility.disc_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE)) {
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
if ((p_data->set_visibility.disc_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE) {
|
||||
p_data->set_visibility.disc_mode =
|
||||
((p_data->set_visibility.disc_mode & ~BTA_DM_LE_IGNORE) | le_disc_mode);
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
if ((p_data->set_visibility.disc_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE) {
|
||||
p_data->set_visibility.disc_mode =
|
||||
((p_data->set_visibility.disc_mode & ~BTA_DM_IGNORE) | disc_mode);
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
BTM_SetDiscoverability(p_data->set_visibility.disc_mode,
|
||||
bta_dm_cb.inquiry_scan_window,
|
||||
bta_dm_cb.inquiry_scan_interval);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (p_data->set_visibility.conn_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE)) {
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
if ((p_data->set_visibility.conn_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE) {
|
||||
p_data->set_visibility.conn_mode =
|
||||
((p_data->set_visibility.conn_mode & ~BTA_DM_LE_IGNORE) | le_conn_mode);
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
if ((p_data->set_visibility.conn_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE) {
|
||||
p_data->set_visibility.conn_mode =
|
||||
((p_data->set_visibility.conn_mode & ~BTA_DM_IGNORE) | conn_mode);
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
BTM_SetConnectability(p_data->set_visibility.conn_mode,
|
||||
bta_dm_cb.page_scan_window,
|
||||
bta_dm_cb.page_scan_interval);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Send False or True if not ignore */
|
||||
@ -1096,7 +1121,9 @@ void bta_dm_bond_cancel (tBTA_DM_MSG *p_data)
|
||||
*******************************************************************************/
|
||||
void bta_dm_set_pin_type (tBTA_DM_MSG *p_data)
|
||||
{
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
BTM_SetPinType (p_data->set_pin_type.pin_type, p_data->set_pin_type.p_pin, p_data->set_pin_type.pin_len);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -1111,6 +1138,7 @@ void bta_dm_set_pin_type (tBTA_DM_MSG *p_data)
|
||||
*******************************************************************************/
|
||||
void bta_dm_pin_reply (tBTA_DM_MSG *p_data)
|
||||
{
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
UINT32 trusted_mask[BTM_SEC_SERVICE_ARRAY_SIZE];
|
||||
UINT32 *current_trusted_mask;
|
||||
|
||||
@ -1128,7 +1156,7 @@ void bta_dm_pin_reply (tBTA_DM_MSG *p_data)
|
||||
} else {
|
||||
BTM_PINCodeReply(p_data->pin_reply.bd_addr, BTM_NOT_AUTHORIZED, 0, NULL, trusted_mask );
|
||||
}
|
||||
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
@ -2792,6 +2820,8 @@ static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NA
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (BT_SSP_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -2878,6 +2908,7 @@ static UINT8 bta_dm_pin_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_
|
||||
bta_dm_cb.p_sec_cback(BTA_DM_PIN_REQ_EVT, &sec_event);
|
||||
return BTM_CMD_STARTED;
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -5797,6 +5828,7 @@ static void bta_dm_gattc_register(void)
|
||||
}
|
||||
}
|
||||
#endif /* GATTC_INCLUDED == TRUE */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_dm_start_disc_gatt_services
|
||||
@ -5806,6 +5838,7 @@ static void bta_dm_gattc_register(void)
|
||||
** Parameters:
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (GATTC_INCLUDED == TRUE)
|
||||
static void btm_dm_start_disc_gatt_services (UINT16 conn_id)
|
||||
{
|
||||
tBT_UUID *p_uuid = bta_dm_search_cb.p_srvc_uuid +
|
||||
@ -5817,6 +5850,7 @@ static void btm_dm_start_disc_gatt_services (UINT16 conn_id)
|
||||
/* always search for all services */
|
||||
BTA_GATTC_ServiceSearchRequest(conn_id, p_uuid);
|
||||
}
|
||||
#endif /* GATTC_INCLUDED == TRUE */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -5877,6 +5911,7 @@ static void bta_dm_gatt_disc_result(tBTA_GATT_ID service_id)
|
||||
** Parameters:
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (GATTC_INCLUDED == TRUE)
|
||||
static void bta_dm_gatt_disc_complete(UINT16 conn_id, tBTA_GATT_STATUS status)
|
||||
{
|
||||
tBTA_DM_MSG *p_msg;
|
||||
@ -5934,6 +5969,7 @@ static void bta_dm_gatt_disc_complete(UINT16 conn_id, tBTA_GATT_STATUS status)
|
||||
bta_dm_search_cb.gatt_disc_active = FALSE;
|
||||
}
|
||||
}
|
||||
#endif /* #if (GATTC_INCLUDED == TRUE) */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -6003,6 +6039,7 @@ static void bta_dm_cancel_gatt_discovery(BD_ADDR bd_addr)
|
||||
bta_dm_gatt_disc_complete(bta_dm_search_cb.conn_id, (tBTA_GATT_STATUS) BTA_GATT_ERROR);
|
||||
}
|
||||
#endif /* #if (GATTC_INCLUDED == TRUE) */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_proc_open_evt
|
||||
@ -6012,6 +6049,7 @@ static void bta_dm_cancel_gatt_discovery(BD_ADDR bd_addr)
|
||||
** Parameters:
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (GATTC_INCLUDED == TRUE)
|
||||
void bta_dm_proc_open_evt(tBTA_GATTC_OPEN *p_data)
|
||||
{
|
||||
UINT8 *p1;
|
||||
@ -6042,6 +6080,7 @@ void bta_dm_proc_open_evt(tBTA_GATTC_OPEN *p_data)
|
||||
bta_dm_gatt_disc_complete(BTA_GATT_INVALID_CONN_ID, p_data->status);
|
||||
}
|
||||
}
|
||||
#endif /* #if (GATTC_INCLUDED == TRUE) */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -225,6 +225,7 @@ void BTA_DmConfigEir(tBTA_DM_EIR_CONF *eir_config)
|
||||
}
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBLE_ADDR_TYPE addr_type, tBTA_ADD_WHITELIST_CBACK *add_wl_cb)
|
||||
{
|
||||
tBTA_DM_API_UPDATE_WHITE_LIST *p_msg;
|
||||
@ -248,6 +249,7 @@ void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb)
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb)
|
||||
{
|
||||
@ -475,10 +477,10 @@ void BTA_DmBondCancel(BD_ADDR bd_addr)
|
||||
bdcpy(p_msg->bd_addr, bd_addr);
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DMSetPinType
|
||||
@ -529,6 +531,7 @@ void BTA_DmPinReply(BD_ADDR bd_addr, BOOLEAN accept, UINT8 pin_len, UINT8 *p_pin
|
||||
}
|
||||
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
#if (BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
@ -594,6 +597,7 @@ void BTA_DmOobReply(BD_ADDR bd_addr, UINT8 len, UINT8 *p_value)
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
void BTA_DmConfirm(BD_ADDR bd_addr, BOOLEAN accept)
|
||||
{
|
||||
tBTA_DM_API_CONFIRM *p_msg;
|
||||
@ -629,6 +633,7 @@ void BTA_DmPasskeyReqReply(BOOLEAN accept, BD_ADDR bd_addr, UINT32 passkey)
|
||||
}
|
||||
}
|
||||
#endif ///BT_SSP_INCLUDED == TRUE
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmAddDevice
|
||||
@ -705,7 +710,7 @@ tBTA_STATUS BTA_DmRemoveDevice(BD_ADDR bd_addr, tBT_TRANSPORT transport)
|
||||
|
||||
return BTA_SUCCESS;
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
// #endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -989,7 +994,6 @@ void BTA_DmBleSecurityGrant(BD_ADDR bd_addr, tBTA_DM_BLE_SEC_GRANT res)
|
||||
}
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -1207,7 +1211,7 @@ void BTA_DmSetBleAdvParamsAll (UINT16 adv_int_min, UINT16 adv_int_max,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -1796,6 +1800,8 @@ void BTA_DmBleUpdateConnectionParam(BD_ADDR bd_addr, UINT16 min_int,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleConfigLocalPrivacy
|
||||
@ -1826,7 +1832,6 @@ void BTA_DmBleConfigLocalPrivacy(BOOLEAN privacy_enable, tBTA_SET_LOCAL_PRIVACY_
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleConfigLocalIcon
|
||||
|
@ -203,6 +203,7 @@ typedef struct {
|
||||
UINT8 data[];
|
||||
}tBTA_DM_API_CONFIG_EIR;
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BOOLEAN add_remove;
|
||||
@ -223,6 +224,7 @@ typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_CMPL_CB *read_tx_power_cb;
|
||||
}tBTA_DM_API_READ_ADV_TX_POWER;
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
@ -402,8 +404,8 @@ typedef struct {
|
||||
UINT8 hci_status;
|
||||
#if BLE_INCLUDED == TRUE
|
||||
UINT16 handle;
|
||||
tBT_TRANSPORT transport;
|
||||
#endif
|
||||
tBT_TRANSPORT transport;
|
||||
} tBTA_DM_ACL_CHANGE;
|
||||
|
||||
#if (BTA_DM_PM_INCLUDED == TRUE)
|
||||
@ -801,9 +803,12 @@ typedef union {
|
||||
tBTA_DM_API_SET_NAME set_name;
|
||||
tBTA_DM_API_CONFIG_EIR config_eir;
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
tBTA_DM_API_UPDATE_WHITE_LIST white_list;
|
||||
tBTA_DM_API_READ_ADV_TX_POWER read_tx_power;
|
||||
tBTA_DM_API_READ_RSSI rssi;
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
tBTA_DM_API_SET_VISIBILITY set_visibility;
|
||||
|
||||
tBTA_DM_API_ADD_DEVICE add_dev;
|
||||
@ -939,8 +944,8 @@ typedef struct {
|
||||
BOOLEAN remove_dev_pending;
|
||||
#if BLE_INCLUDED == TRUE
|
||||
UINT16 conn_handle;
|
||||
tBT_TRANSPORT transport;
|
||||
#endif
|
||||
tBT_TRANSPORT transport;
|
||||
} tBTA_DM_PEER_DEVICE;
|
||||
|
||||
|
||||
@ -1031,6 +1036,8 @@ typedef struct {
|
||||
BOOLEAN disable_pair_mode; /* disable pair mode or not */
|
||||
BOOLEAN conn_paired_only; /* allow connectable to paired device only or not */
|
||||
tBTA_DM_API_SEARCH search_msg;
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
UINT16 page_scan_interval;
|
||||
UINT16 page_scan_window;
|
||||
UINT16 inquiry_scan_interval;
|
||||
@ -1040,8 +1047,10 @@ typedef struct {
|
||||
BD_ADDR pin_bd_addr;
|
||||
DEV_CLASS pin_dev_class;
|
||||
tBTA_DM_SEC_EVT pin_evt;
|
||||
UINT32 num_val; /* the numeric value for comparison. If just_works, do not show this number to UI */
|
||||
BOOLEAN just_works; /* TRUE, if "Just Works" association model */
|
||||
UINT32 num_val; /* the numeric value for comparison. If just_works, do not show this number to UI */
|
||||
BOOLEAN just_works; /* TRUE, if "Just Works" association model */
|
||||
#endif
|
||||
|
||||
#if ( BTA_EIR_CANNED_UUID_LIST != TRUE )
|
||||
/* store UUID list for EIR */
|
||||
TIMER_LIST_ENT app_ready_timer;
|
||||
|
@ -31,9 +31,9 @@
|
||||
// #include "uipc_msg.h"
|
||||
#include "stack/sdp_api.h"
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
// #if BLE_INCLUDED == TRUE
|
||||
#include "stack/btm_ble_api.h"
|
||||
#endif
|
||||
// #endif
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants and data types
|
||||
@ -323,7 +323,7 @@ typedef struct {
|
||||
tBTA_DM_CONFIG_EIR_CBACK *config_eir_callback; /* callback */
|
||||
} tBTA_DM_EIR_CONF;
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
// #if BLE_INCLUDED == TRUE
|
||||
/* ADV data flag bit definition used for BTM_BLE_AD_TYPE_FLAG */
|
||||
#define BTA_BLE_LIMIT_DISC_FLAG BTM_BLE_LIMIT_DISC_FLAG
|
||||
#define BTA_BLE_GEN_DISC_FLAG BTM_BLE_GEN_DISC_FLAG
|
||||
@ -510,7 +510,7 @@ enum {
|
||||
typedef tBTM_BLE_BATCH_SCAN_EVT tBTA_BLE_BATCH_SCAN_EVT;
|
||||
|
||||
typedef tBTM_BLE_TRACK_ADV_ACTION tBTA_BLE_TRACK_ADV_ACTION;
|
||||
#endif
|
||||
// #endif
|
||||
|
||||
/* BLE customer specific feature function type definitions */
|
||||
/* data type used on customer specific feature for RSSI monitoring */
|
||||
@ -1473,9 +1473,11 @@ extern void BTA_DmSetDeviceName(const char *p_name);
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmConfigEir(tBTA_DM_EIR_CONF *eir_config);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
extern void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBLE_ADDR_TYPE addr_type, tBTA_ADD_WHITELIST_CBACK *add_wl_cb);
|
||||
|
||||
extern void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb);
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
extern void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb);
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#define BTA_DM_CO_H
|
||||
|
||||
#include "bta/bta_sys.h"
|
||||
#include "esp_err.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Function Declarations
|
||||
|
@ -96,6 +96,7 @@ void btc_storage_save(void)
|
||||
btc_config_unlock();
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
static bt_status_t _btc_storage_add_ble_bonding_key(bt_bdaddr_t *remote_bd_addr,
|
||||
char *key,
|
||||
uint8_t key_type,
|
||||
@ -552,6 +553,7 @@ bt_status_t btc_storage_remove_ble_dev_type(bt_bdaddr_t *remote_bd_addr, bool fl
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
static bt_status_t _btc_storage_set_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, uint8_t auth_mode, bool flush)
|
||||
{
|
||||
@ -725,6 +727,7 @@ bt_status_t btc_storage_get_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
static void _btc_read_le_key(const uint8_t key_type, const size_t key_len, bt_bdaddr_t bd_addr,
|
||||
const uint8_t addr_type, const bool add_key, bool *device_added, bool *key_found)
|
||||
{
|
||||
@ -926,5 +929,6 @@ int btc_storage_get_num_ble_bond_devices(void)
|
||||
|
||||
return num_dev;
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
|
@ -129,6 +129,7 @@ static void btc_disable_bluetooth_evt(void)
|
||||
}
|
||||
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
void btc_dm_load_ble_local_keys(void)
|
||||
{
|
||||
memset(&btc_dm_cb.ble_local_key_cb, 0, sizeof(btc_dm_local_key_cb_t));
|
||||
@ -296,6 +297,7 @@ static void btc_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
|
||||
return;
|
||||
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
|
||||
@ -569,8 +571,10 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
||||
btc_clear_services_mask();
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
btc_storage_load_bonded_devices();
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
//load the bonding device to the btm layer
|
||||
btc_storage_load_bonded_ble_devices();
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
/* Set initial device name, it can be overwritten later */
|
||||
@ -633,6 +637,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
||||
#endif /* #if (SMP_INCLUDED == TRUE) */
|
||||
break;
|
||||
}
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
case BTA_DM_BLE_DEV_UNPAIRED_EVT: {
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
bt_bdaddr_t bd_addr;
|
||||
@ -654,6 +659,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
||||
#endif /* #if (SMP_INCLUDED == TRUE) */
|
||||
break;
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
case BTA_DM_BUSY_LEVEL_EVT:
|
||||
#if (BTC_GAP_BT_INCLUDED == TRUE)
|
||||
{
|
||||
@ -668,7 +674,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
||||
case BTA_DM_HW_ERROR_EVT:
|
||||
BTC_TRACE_DEBUG( "btc_dm_sec_cback : unhandled event (%d)\n", msg->act );
|
||||
break;
|
||||
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE) && (SMP_INCLUDED == TRUE))
|
||||
#if ((BLE_INCLUDED == TRUE) && (SMP_INCLUDED == TRUE))
|
||||
case BTA_DM_BLE_AUTH_CMPL_EVT: {
|
||||
rsp_app = true;
|
||||
ble_msg.act = ESP_GAP_BLE_AUTH_CMPL_EVT;
|
||||
|
@ -64,15 +64,20 @@ static void btc_init_bluetooth(void)
|
||||
bte_main_boot_entry(btc_init_callback);
|
||||
#if (SMP_INCLUDED)
|
||||
btc_config_init();
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
//load the ble local key which has been stored in the flash
|
||||
btc_dm_load_ble_local_keys();
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
#endif /* #if (SMP_INCLUDED) */
|
||||
}
|
||||
|
||||
|
||||
static void btc_deinit_bluetooth(void)
|
||||
{
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
btc_gap_ble_deinit();
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
bta_dm_sm_deinit();
|
||||
#if (GATTC_INCLUDED)
|
||||
bta_gattc_deinit();
|
||||
|
@ -69,7 +69,11 @@ static const btc_func_t profile_tab[BTC_PID_NUM] = {
|
||||
#if (GATTS_INCLUDED == TRUE || GATTC_INCLUDED == TRUE)
|
||||
[BTC_PID_GATT_COMMON] = {btc_gatt_com_call_handler, NULL },
|
||||
#endif //GATTC_INCLUDED == TRUE || GATTS_INCLUDED == TRUE
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
[BTC_PID_GAP_BLE] = {btc_gap_ble_call_handler, btc_gap_ble_cb_handler },
|
||||
#else
|
||||
[BTC_PID_GAP_BLE] = {NULL, NULL},
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
[BTC_PID_BLE_HID] = {NULL, NULL},
|
||||
[BTC_PID_SPPLIKE] = {NULL, NULL},
|
||||
#if (GATTS_INCLUDED == TRUE)
|
||||
@ -183,6 +187,7 @@ static bt_status_t btc_init_mem(void) {
|
||||
}
|
||||
memset((void *)btc_profile_cb_tab, 0, sizeof(void *) * BTC_PID_NUM);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
if ((gl_bta_adv_data_ptr = (tBTA_BLE_ADV_DATA *)osi_malloc(sizeof(tBTA_BLE_ADV_DATA))) == NULL) {
|
||||
return BT_STATUS_NOMEM;
|
||||
}
|
||||
@ -192,6 +197,7 @@ static bt_status_t btc_init_mem(void) {
|
||||
return BT_STATUS_NOMEM;
|
||||
}
|
||||
memset((void *)gl_bta_scan_rsp_data_ptr, 0, sizeof(tBTA_BLE_ADV_DATA));
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
#if GATTS_INCLUDED == TRUE && GATT_DYNAMIC_MEMORY == TRUE
|
||||
if ((btc_creat_tab_env_ptr = (esp_btc_creat_tab_t *)osi_malloc(sizeof(esp_btc_creat_tab_t))) == NULL) {
|
||||
@ -273,7 +279,10 @@ int btc_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
btc_gap_callback_init();
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
btc_adv_list_init();
|
||||
#endif
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "osi/mutex.h"
|
||||
#include "esp_bt.h"
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
#if BTC_DYNAMIC_MENDRY == FALSE
|
||||
static tBTA_BLE_ADV_DATA gl_bta_adv_data;
|
||||
static tBTA_BLE_ADV_DATA gl_bta_scan_rsp_data;
|
||||
@ -1372,3 +1373,4 @@ void btc_adv_list_unlock(void)
|
||||
osi_mutex_unlock(&adv_list_lock);
|
||||
}
|
||||
#endif
|
||||
#endif ///BLE_INCLUDED == TRUE
|
@ -119,6 +119,12 @@
|
||||
** BLE features
|
||||
**
|
||||
******************************************************************************/
|
||||
#if (UC_BT_BLE_ENABLED ==TRUE)
|
||||
#define BLE_INCLUDED TRUE
|
||||
#else
|
||||
#define BLE_INCLUDED FALSE
|
||||
#endif /* UC_BT_BLE_ENABLED */
|
||||
|
||||
#if (UC_BT_GATTS_ENABLE)
|
||||
#define GATTS_INCLUDED TRUE
|
||||
#else
|
||||
@ -139,8 +145,12 @@
|
||||
|
||||
#if (UC_BT_SMP_ENABLE)
|
||||
#define SMP_INCLUDED TRUE
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
#define BLE_PRIVACY_SPT TRUE
|
||||
#else
|
||||
#define BLE_PRIVACY_SPT FALSE
|
||||
#endif /*BLE_INCLUDED*/
|
||||
#else
|
||||
#define SMP_INCLUDED FALSE
|
||||
#define BLE_PRIVACY_SPT FALSE
|
||||
#endif /* UC_BT_SMP_ENABLE */
|
||||
@ -1024,7 +1034,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BLE_INCLUDED
|
||||
#define BLE_INCLUDED TRUE
|
||||
#define BLE_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BLE_ANDROID_CONTROLLER_SCAN_FILTER
|
||||
@ -1181,12 +1191,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if SMP_INCLUDED == TRUE && BLE_INCLUDED == FALSE
|
||||
#error "can't have SMP without BLE"
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** SMP
|
||||
@ -1200,10 +1204,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if SMP_INCLUDED == TRUE && BLE_INCLUDED == FALSE
|
||||
#error "can't have SMP without BLE"
|
||||
#endif
|
||||
|
||||
#ifndef SMP_DEBUG
|
||||
#define SMP_DEBUG FALSE
|
||||
#endif
|
||||
|
@ -86,6 +86,12 @@
|
||||
#define UC_BT_SSP_ENABLED CONFIG_BT_SSP_ENABLED
|
||||
#else
|
||||
#define UC_BT_SSP_ENABLED FALSE
|
||||
|
||||
//BLE
|
||||
#ifdef CONFIG_BT_BLE_ENABLED
|
||||
#define UC_BT_BLE_ENABLED CONFIG_BT_BLE_ENABLED
|
||||
#else
|
||||
#define UC_BT_BLE_ENABLED FALSE
|
||||
#endif
|
||||
|
||||
//GATTS
|
||||
|
@ -2038,6 +2038,8 @@ tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_C
|
||||
/* If here, no BD Addr found */
|
||||
return (BTM_UNKNOWN_ADDR);
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
tBTM_STATUS BTM_BleReadAdvTxPower(tBTM_CMPL_CB *p_cb)
|
||||
{
|
||||
BOOLEAN ret;
|
||||
@ -2074,6 +2076,7 @@ void BTM_BleGetWhiteListSize(uint16_t *length)
|
||||
*length = p_cb->white_list_avail_size;
|
||||
return;
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -24,8 +24,6 @@
|
||||
******************************************************************************/
|
||||
#include "common/bt_target.h"
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "stack/bt_types.h"
|
||||
@ -41,7 +39,7 @@
|
||||
|
||||
//#define LOG_TAG "bt_btm_ble"
|
||||
//#include "osi/include/log.h"
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
#if SMP_INCLUDED == TRUE
|
||||
// The temp variable to pass parameter between functions when in the connected event callback.
|
||||
static BOOLEAN temp_enhanced = FALSE;
|
||||
@ -667,7 +665,7 @@ void BTM_ReadDevInfo (BD_ADDR remote_bda, tBT_DEVICE_TYPE *p_dev_type, tBLE_ADDR
|
||||
|
||||
BTM_TRACE_DEBUG ("btm_find_dev_type - device_type = %d addr_type = %d", *p_dev_type , *p_addr_type);
|
||||
}
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -703,7 +701,7 @@ BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda, tBT_TRANSPORT tran
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
if (transport == BT_TRANSPORT_LE) {
|
||||
memcpy(remote_bda, p_dev_rec->ble.pseudo_addr, BD_ADDR_LEN);
|
||||
if (btm_bda_to_acl(p_dev_rec->ble.pseudo_addr, transport) != NULL) {
|
||||
@ -712,10 +710,11 @@ BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda, tBT_TRANSPORT tran
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleReceiverTest
|
||||
@ -1104,6 +1103,7 @@ void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local )
|
||||
}
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -1116,6 +1116,7 @@ void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local )
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
BOOLEAN btm_ble_get_enc_key_type(BD_ADDR bd_addr, UINT8 *p_key_types)
|
||||
{
|
||||
tBTM_SEC_DEV_REC *p_dev_rec;
|
||||
@ -1160,7 +1161,6 @@ BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_div)
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_sec_save_le_key
|
||||
@ -1420,9 +1420,10 @@ void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE
|
||||
|
||||
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_set_encryption
|
||||
@ -2113,10 +2114,9 @@ UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
|
||||
}
|
||||
#endif
|
||||
|
||||
BTM_TRACE_DEBUG ("btm_cb pairing_state=%x pairing_flags=%x pin_code_len=%x",
|
||||
BTM_TRACE_DEBUG ("btm_cb pairing_state=%x pairing_flags=%x",
|
||||
btm_cb.pairing_state,
|
||||
btm_cb.pairing_flags,
|
||||
btm_cb.pin_code_len );
|
||||
btm_cb.pairing_flags);
|
||||
BTM_TRACE_DEBUG ("btm_cb.pairing_bda %02x:%02x:%02x:%02x:%02x:%02x",
|
||||
btm_cb.pairing_bda[0], btm_cb.pairing_bda[1], btm_cb.pairing_bda[2],
|
||||
btm_cb.pairing_bda[3], btm_cb.pairing_bda[4], btm_cb.pairing_bda[5]);
|
||||
@ -2737,7 +2737,7 @@ void btm_ble_set_keep_rfu_in_auth_req(BOOLEAN keep_rfu)
|
||||
** Function btm_get_current_conn_params
|
||||
**
|
||||
** Description This function is called to get current connection parameters
|
||||
** information of the device
|
||||
** information of the device
|
||||
**
|
||||
** Returns TRUE if the information is geted, else FALSE
|
||||
**
|
||||
@ -2758,7 +2758,7 @@ BOOLEAN btm_get_current_conn_params(BD_ADDR bda, UINT16 *interval, UINT16 *laten
|
||||
return TRUE;
|
||||
}
|
||||
BTM_TRACE_WARNING("%s Device is not connected", __func__);
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -190,9 +190,9 @@ static void reset_complete(void)
|
||||
l2c_link_processs_ble_num_bufs(controller->get_acl_buffer_count_ble());
|
||||
}
|
||||
#endif
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
#if (SMP_INCLUDED == TRUE && CLASSIC_BT_INCLUDED == TRUE)
|
||||
BTM_SetPinType (btm_cb.cfg.pin_type, btm_cb.cfg.pin_code, btm_cb.cfg.pin_code_len);
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#endif ///SMP_INCLUDED == TRUE && CLASSIC_BT_INCLUDED == TRUE
|
||||
for (int i = 0; i <= controller->get_last_features_classic_index(); i++) {
|
||||
btm_decode_ext_features_page(i, controller->get_features_classic(i)->as_array);
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "l2c_int.h"
|
||||
#include "osi/fixed_queue.h"
|
||||
#include "osi/alarm.h"
|
||||
#include "stack/btm_ble_api.h"
|
||||
|
||||
#if (BT_USE_TRACES == TRUE && BT_TRACE_VERBOSE == FALSE)
|
||||
/* needed for sprintf() */
|
||||
@ -368,6 +369,7 @@ BOOLEAN BTM_GetSecurityFlagsByTransport (BD_ADDR bd_addr, UINT8 *p_sec_flags,
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_SetPinType
|
||||
@ -392,6 +394,7 @@ void BTM_SetPinType (UINT8 pin_type, PIN_CODE pin_code, UINT8 pin_code_len)
|
||||
btm_cb.cfg.pin_code_len = pin_code_len;
|
||||
memcpy (btm_cb.cfg.pin_code, pin_code, pin_code_len);
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -824,6 +827,7 @@ void btm_sec_clr_temp_auth_service (BD_ADDR bda)
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin, UINT32 trusted_mask[])
|
||||
{
|
||||
tBTM_SEC_DEV_REC *p_dev_rec;
|
||||
@ -930,6 +934,7 @@ void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin,
|
||||
#endif
|
||||
btsnd_hcic_pin_code_req_reply (bd_addr, pin_len, p_pin);
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
|
||||
@ -995,12 +1000,14 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
return (BTM_NO_RESOURCES);
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* Save the PIN code if we got a valid one */
|
||||
if (p_pin && (pin_len <= PIN_CODE_LEN) && (pin_len != 0)) {
|
||||
btm_cb.pin_code_len = pin_len;
|
||||
p_dev_rec->pin_code_length = pin_len;
|
||||
memcpy (btm_cb.pin_code, p_pin, PIN_CODE_LEN);
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
memcpy (btm_cb.pairing_bda, bd_addr, BD_ADDR_LEN);
|
||||
|
||||
@ -1034,6 +1041,8 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
|
||||
|
||||
BTM_TRACE_DEBUG ("after update sec_flags=0x%x\n", p_dev_rec->sec_flags);
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (!controller_get_interface()->supports_simple_pairing()) {
|
||||
/* The special case when we authenticate keyboard. Set pin type to fixed */
|
||||
/* It would be probably better to do it from the application, but it is */
|
||||
@ -1045,6 +1054,7 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
btsnd_hcic_write_pin_type (HCI_PIN_TYPE_FIXED);
|
||||
}
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
for (ii = 0; ii <= HCI_EXT_FEATURES_PAGE_MAX; ii++) {
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
@ -1133,6 +1143,7 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
tBTM_STATUS BTM_SecBondByTransport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
UINT8 pin_len, UINT8 *p_pin, UINT32 trusted_mask[])
|
||||
{
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
tBT_DEVICE_TYPE dev_type;
|
||||
tBLE_ADDR_TYPE addr_type;
|
||||
|
||||
@ -1142,6 +1153,8 @@ tBTM_STATUS BTM_SecBondByTransport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
(transport == BT_TRANSPORT_BR_EDR && (dev_type & BT_DEVICE_TYPE_BREDR) == 0)) {
|
||||
return BTM_ILLEGAL_ACTION;
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
return btm_sec_bond_by_transport(bd_addr, transport, pin_len, p_pin, trusted_mask);
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
@ -1165,9 +1178,11 @@ tBTM_STATUS BTM_SecBondByTransport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
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 ///BLE_INCLUDED == TRUE
|
||||
return btm_sec_bond_by_transport(bd_addr, transport, pin_len, p_pin, trusted_mask);
|
||||
}
|
||||
/*******************************************************************************
|
||||
@ -4117,8 +4132,10 @@ void btm_sec_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable)
|
||||
if (p_dev_rec->no_smp_on_br) {
|
||||
BTM_TRACE_DEBUG ("%s NO SM over BR/EDR\n", __func__);
|
||||
} else {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
BTM_TRACE_DEBUG ("%s start SM over BR/EDR\n", __func__);
|
||||
SMP_BR_PairWith(p_dev_rec->bd_addr);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -4924,6 +4941,7 @@ static void btm_sec_pairing_timeout (TIMER_LIST_ENT *p_tle)
|
||||
}
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_sec_pin_code_request
|
||||
@ -5061,6 +5079,7 @@ void btm_sec_pin_code_request (UINT8 *p_bda)
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
|
||||
@ -5589,10 +5608,12 @@ static void btm_restore_mode(void)
|
||||
btsnd_hcic_write_auth_enable ((UINT8)(btm_cb.security_mode == BTM_SEC_MODE_LINK));
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (btm_cb.pin_type_changed) {
|
||||
btm_cb.pin_type_changed = FALSE;
|
||||
btsnd_hcic_write_pin_type (btm_cb.cfg.pin_type);
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
@ -5644,7 +5665,9 @@ static void btm_sec_change_pairing_state (tBTM_PAIRING_STATE new_state)
|
||||
btu_stop_timer (&btm_cb.pairing_tle);
|
||||
|
||||
btm_cb.pairing_flags = 0;
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
btm_cb.pin_code_len = 0;
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
/* Make sure the the lcb shows we are not bonding */
|
||||
l2cu_update_lcb_4_bonding (btm_cb.pairing_bda, FALSE);
|
||||
@ -5770,9 +5793,11 @@ static BOOLEAN btm_sec_queue_mx_request (BD_ADDR bd_addr, UINT16 psm, BOOLEAN
|
||||
}
|
||||
static BOOLEAN btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
{
|
||||
BOOLEAN rv = FALSE;
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
UINT8 major = (UINT8)(p_dev_rec->dev_class[1] & BTM_COD_MAJOR_CLASS_MASK);
|
||||
UINT8 minor = (UINT8)(p_dev_rec->dev_class[2] & BTM_COD_MINOR_CLASS_MASK);
|
||||
BOOLEAN rv = FALSE;
|
||||
rv = TRUE;
|
||||
|
||||
if ((major == BTM_COD_MAJOR_AUDIO)
|
||||
&& ((minor == BTM_COD_MINOR_CONFM_HANDSFREE) || (minor == BTM_COD_MINOR_CAR_AUDIO)) ) {
|
||||
@ -5810,7 +5835,8 @@ static BOOLEAN btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
|
||||
rv = TRUE;
|
||||
}
|
||||
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -5993,6 +6019,7 @@ static UINT16 btm_sec_set_serv_level4_flags(UINT16 cur_security, BOOLEAN is_orig
|
||||
return cur_security | sec_level4_flags;
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_sec_clear_ble_keys
|
||||
@ -6004,6 +6031,7 @@ static UINT16 btm_sec_set_serv_level4_flags(UINT16 cur_security, BOOLEAN is_orig
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
void btm_sec_clear_ble_keys (tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
{
|
||||
|
||||
@ -6017,7 +6045,7 @@ void btm_sec_clear_ble_keys (tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_sec_is_a_bonded_dev
|
||||
@ -6034,7 +6062,7 @@ BOOLEAN btm_sec_is_a_bonded_dev (BD_ADDR bda)
|
||||
BOOLEAN is_bonded = FALSE;
|
||||
|
||||
if (p_dev_rec &&
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
#if (SMP_INCLUDED == TRUE && BLE_INCLUDED == TRUE)
|
||||
((p_dev_rec->ble.key_type && (p_dev_rec->sec_flags & BTM_SEC_LE_LINK_KEY_KNOWN)) ||
|
||||
#else
|
||||
(
|
||||
@ -6057,10 +6085,10 @@ BOOLEAN btm_sec_is_a_bonded_dev (BD_ADDR bda)
|
||||
*******************************************************************************/
|
||||
BOOLEAN btm_sec_is_le_capable_dev (BD_ADDR bda)
|
||||
{
|
||||
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bda);
|
||||
BOOLEAN le_capable = FALSE;
|
||||
|
||||
#if (BLE_INCLUDED== TRUE)
|
||||
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bda);
|
||||
if (p_dev_rec && (p_dev_rec->device_type & BT_DEVICE_TYPE_BLE) == BT_DEVICE_TYPE_BLE) {
|
||||
le_capable = TRUE;
|
||||
}
|
||||
@ -6077,6 +6105,7 @@ BOOLEAN btm_sec_is_le_capable_dev (BD_ADDR bda)
|
||||
** Returns TRUE - found a bonded device
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
BOOLEAN btm_sec_find_bonded_dev (UINT8 start_idx, UINT8 *p_found_idx, tBTM_SEC_DEV_REC **p_rec)
|
||||
{
|
||||
BOOLEAN found = FALSE;
|
||||
@ -6101,7 +6130,7 @@ BOOLEAN btm_sec_find_bonded_dev (UINT8 start_idx, UINT8 *p_found_idx, tBTM_SEC_D
|
||||
#endif
|
||||
return (found);
|
||||
}
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_sec_use_smp_br_chnl
|
||||
|
@ -32,13 +32,14 @@
|
||||
#include "stack/rfcdefs.h"
|
||||
|
||||
#include "stack/btm_api.h"
|
||||
#include "osi/fixed_queue.h"
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
#include "btm_ble_int.h"
|
||||
#endif
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
#include "stack/smp_api.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
typedef char tBTM_LOC_BD_NAME[BTM_MAX_LOC_BD_NAME_LEN + 1];
|
||||
@ -855,9 +856,12 @@ typedef struct {
|
||||
BOOLEAN pairing_disabled;
|
||||
BOOLEAN connect_only_paired;
|
||||
BOOLEAN security_mode_changed; /* mode changed during bonding */
|
||||
BOOLEAN pin_type_changed; /* pin type changed during bonding */
|
||||
BOOLEAN sec_req_pending; /* TRUE if a request is pending */
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
BOOLEAN pin_type_changed; /* pin type changed during bonding */
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
// btla-specific ++
|
||||
#ifdef PORCHE_PAIRING_CONFLICT
|
||||
UINT8 pin_code_len_saved; /* for legacy devices */
|
||||
@ -866,12 +870,14 @@ typedef struct {
|
||||
|
||||
UINT8 pin_code_len; /* for legacy devices */
|
||||
PIN_CODE pin_code; /* for legacy devices */
|
||||
UINT8 disc_reason; /* for legacy devices */
|
||||
UINT16 disc_handle; /* for legacy devices */
|
||||
#endif ///CLASSIC_BT_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 */
|
||||
UINT16 disc_handle; /* for legacy devices */
|
||||
UINT8 disc_reason; /* for legacy devices */
|
||||
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#if SMP_INCLUDED == TRUE || CLASSIC_BT_INCLUDED == TRUE
|
||||
tBTM_SEC_SERV_REC sec_serv_rec[BTM_SEC_MAX_SERVICE_RECORDS];
|
||||
@ -1122,10 +1128,10 @@ BOOLEAN btm_sec_is_le_capable_dev (BD_ADDR bda);
|
||||
BOOLEAN btm_ble_init_pseudo_addr (tBTM_SEC_DEV_REC *p_dev_rec, BD_ADDR new_pseudo_addr);
|
||||
extern BOOLEAN btm_ble_start_sec_check(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originator,
|
||||
tBTM_SEC_CALLBACK *p_callback, void *p_ref_data);
|
||||
extern tBTM_SEC_SERV_REC *btm_sec_find_first_serv (CONNECTION_TYPE conn_type, UINT16 psm);
|
||||
|
||||
#endif /* BLE_INCLUDED */
|
||||
|
||||
extern tBTM_SEC_SERV_REC *btm_sec_find_first_serv (CONNECTION_TYPE conn_type, UINT16 psm);
|
||||
|
||||
tINQ_DB_ENT *btm_inq_db_new (BD_ADDR p_bda);
|
||||
|
||||
#if BTM_OOB_INCLUDED == TRUE
|
||||
|
@ -1436,6 +1436,7 @@ static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len)
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
static void btu_hcif_pin_code_request_evt (UINT8 *p)
|
||||
{
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
BD_ADDR bda;
|
||||
|
||||
STREAM_TO_BDADDR (bda, p);
|
||||
@ -1445,6 +1446,7 @@ static void btu_hcif_pin_code_request_evt (UINT8 *p)
|
||||
l2c_pin_code_request (bda);
|
||||
|
||||
btm_sec_pin_code_request (bda);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
|
||||
|
@ -645,8 +645,8 @@ typedef struct {
|
||||
INT8 rssi; /* Set to BTM_INQ_RES_IGNORE_RSSI if not valid */
|
||||
UINT32 eir_uuid[BTM_EIR_SERVICE_ARRAY_SIZE];
|
||||
BOOLEAN eir_complete_list;
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
tBT_DEVICE_TYPE device_type;
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
UINT8 inq_result_type;
|
||||
UINT8 ble_addr_type;
|
||||
tBTM_BLE_EVT_TYPE ble_evt_type;
|
||||
@ -1394,12 +1394,12 @@ typedef UINT8 tBTM_SP_EVT;
|
||||
#define BTM_IO_CAP_IO 1 /* DisplayYesNo */
|
||||
#define BTM_IO_CAP_IN 2 /* KeyboardOnly */
|
||||
#define BTM_IO_CAP_NONE 3 /* NoInputNoOutput */
|
||||
#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
|
||||
// #if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
|
||||
#define BTM_IO_CAP_KBDISP 4 /* Keyboard display */
|
||||
#define BTM_IO_CAP_MAX 5
|
||||
#else
|
||||
#define BTM_IO_CAP_MAX 4
|
||||
#endif
|
||||
// #else
|
||||
// #define BTM_IO_CAP_MAX 4
|
||||
// #endif
|
||||
|
||||
typedef UINT8 tBTM_IO_CAP;
|
||||
|
||||
|
@ -1210,6 +1210,7 @@ extern BOOLEAN L2CA_EnableUpdateBleConnParams (BD_ADDR rem_bda, BOOLEAN enable);
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT8 L2CA_GetBleConnRole (BD_ADDR bd_addr);
|
||||
#endif /* (BLE_INCLUDED == TRUE) */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -1228,7 +1229,6 @@ extern UINT16 L2CA_GetDisconnectReason (BD_ADDR remote_bda, tBT_TRANSPORT transp
|
||||
extern BOOLEAN L2CA_CheckIsCongest(UINT16 fixed_cid, UINT16 handle);
|
||||
|
||||
|
||||
#endif /* (BLE_INCLUDED == TRUE) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
#define SMP_PIN_CODE_LEN_MAX PIN_CODE_LEN
|
||||
#define SMP_PIN_CODE_LEN_MIN 6
|
||||
|
||||
#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
|
||||
// #if SMP_INCLUDED == TRUE
|
||||
/* SMP command code */
|
||||
#define SMP_OPCODE_PAIRING_REQ 0x01
|
||||
#define SMP_OPCODE_PAIRING_RSP 0x02
|
||||
@ -48,7 +48,7 @@
|
||||
#define SMP_OPCODE_MAX SMP_OPCODE_PAIR_KEYPR_NOTIF
|
||||
#define SMP_OPCODE_MIN SMP_OPCODE_PAIRING_REQ
|
||||
#define SMP_OPCODE_PAIR_COMMITM 0x0F
|
||||
#endif
|
||||
// #endif
|
||||
|
||||
/* SMP event type */
|
||||
#define SMP_IO_CAP_REQ_EVT 1 /* IO capability request event */
|
||||
|
@ -1301,6 +1301,7 @@ UINT8 L2CA_GetChnlFcrMode (UINT16 lcid)
|
||||
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function L2CA_RegisterLECoc
|
||||
@ -1610,8 +1611,7 @@ BOOLEAN L2CA_GetPeerLECocConfig (UINT16 lcid, tL2CAP_LE_CFG_INFO* peer_cfg)
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
#if (L2CAP_NUM_FIXED_CHNLS > 0)
|
||||
/*******************************************************************************
|
||||
|
@ -223,28 +223,6 @@ UINT8 L2CA_GetBleConnRole (BD_ADDR bd_addr)
|
||||
|
||||
return role;
|
||||
}
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function L2CA_GetDisconnectReason
|
||||
**
|
||||
** Description This function returns the disconnect reason code.
|
||||
**
|
||||
** Returns disconnect reason
|
||||
**
|
||||
*******************************************************************************/
|
||||
UINT16 L2CA_GetDisconnectReason (BD_ADDR remote_bda, tBT_TRANSPORT transport)
|
||||
{
|
||||
tL2C_LCB *p_lcb;
|
||||
UINT16 reason = 0;
|
||||
|
||||
if ((p_lcb = l2cu_find_lcb_by_bd_addr (remote_bda, transport)) != NULL) {
|
||||
reason = p_lcb->disc_reason;
|
||||
}
|
||||
|
||||
L2CAP_TRACE_DEBUG ("L2CA_GetDisconnectReason=%d ", reason);
|
||||
|
||||
return reason;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -1491,3 +1469,25 @@ BOOLEAN l2ble_sec_access_req(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originator,
|
||||
}
|
||||
#endif /* #if (SMP_INCLUDED == TRUE) */
|
||||
#endif /* (BLE_INCLUDED == TRUE) */
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function L2CA_GetDisconnectReason
|
||||
**
|
||||
** Description This function returns the disconnect reason code.
|
||||
**
|
||||
** Returns disconnect reason
|
||||
**
|
||||
*******************************************************************************/
|
||||
UINT16 L2CA_GetDisconnectReason (BD_ADDR remote_bda, tBT_TRANSPORT transport)
|
||||
{
|
||||
tL2C_LCB *p_lcb;
|
||||
UINT16 reason = 0;
|
||||
|
||||
if ((p_lcb = l2cu_find_lcb_by_bd_addr (remote_bda, transport)) != NULL) {
|
||||
reason = p_lcb->disc_reason;
|
||||
}
|
||||
|
||||
L2CAP_TRACE_DEBUG ("L2CA_GetDisconnectReason=%d ", reason);
|
||||
|
||||
return reason;
|
||||
}
|
@ -357,7 +357,9 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
|
||||
p_lcb = l2cu_find_lcb_by_handle (handle);
|
||||
/* If we don't have one, maybe an SCO link. Send to MM */
|
||||
if (!p_lcb) {
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
BTM_Recovery_Pre_State();
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
status = FALSE;
|
||||
} else {
|
||||
/* There can be a case when we rejected PIN code authentication */
|
||||
@ -1026,8 +1028,10 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf)
|
||||
|
||||
/* Loop through, starting at the next */
|
||||
for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++) {
|
||||
/* If controller window is full, nothing to do */
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
L2CAP_TRACE_DEBUG("window = %d,robin_unacked = %d,robin_quota=%d",l2cb.controller_le_xmit_window,l2cb.ble_round_robin_unacked,l2cb.ble_round_robin_quota);
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
/* If controller window is full, nothing to do */
|
||||
if (((l2cb.controller_xmit_window == 0 ||
|
||||
(l2cb.round_robin_unacked >= l2cb.round_robin_quota))
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
@ -1038,7 +1042,7 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf)
|
||||
l2cb.controller_le_xmit_window == 0 )))
|
||||
#else
|
||||
))
|
||||
#endif
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
break;
|
||||
|
||||
|
||||
|
@ -295,7 +295,9 @@ void l2c_rcv_acl_data (BT_HDR *p_msg)
|
||||
/* we have received credits more than max coc credits,
|
||||
* so disconnecting the Le Coc Channel
|
||||
*/
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
l2cble_send_peer_disc_req (p_ccb);
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
} else {
|
||||
p_ccb->peer_conn_cfg.credits += credit;
|
||||
l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, NULL);
|
||||
@ -926,6 +928,7 @@ void l2c_process_timeout (TIMER_LIST_ENT *p_tle)
|
||||
l2c_info_timeout((tL2C_LCB *)p_tle->param);
|
||||
break;
|
||||
case BTU_TTYPE_L2CAP_UPDA_CONN_PARAMS: {
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
UINT8 status = HCI_ERR_HOST_TIMEOUT;
|
||||
tL2C_LCB *p_lcb = (tL2C_LCB *)p_tle->param;
|
||||
if (p_lcb){
|
||||
@ -933,6 +936,7 @@ void l2c_process_timeout (TIMER_LIST_ENT *p_tle)
|
||||
p_lcb->conn_update_mask &= ~L2C_BLE_UPDATE_PARAM_FULL;
|
||||
}
|
||||
l2c_send_update_conn_params_cb(p_lcb, status);
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -243,6 +243,7 @@ void l2cu_release_lcb (tL2C_LCB *p_lcb)
|
||||
(*p_cb) (L2CAP_PING_RESULT_NO_LINK);
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/* Check and release all the LE COC connections waiting for security */
|
||||
if (p_lcb->le_sec_pending_q)
|
||||
{
|
||||
@ -257,6 +258,7 @@ void l2cu_release_lcb (tL2C_LCB *p_lcb)
|
||||
fixed_queue_free(p_lcb->le_sec_pending_q, NULL);
|
||||
p_lcb->le_sec_pending_q = NULL;
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
#if (C2H_FLOW_CONTROL_INCLUDED == TRUE)
|
||||
p_lcb->completed_packets = 0;
|
||||
@ -1765,6 +1767,7 @@ tL2C_RCB *l2cu_allocate_rcb (UINT16 psm)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function l2cu_allocate_ble_rcb
|
||||
@ -1796,6 +1799,7 @@ tL2C_RCB *l2cu_allocate_ble_rcb (UINT16 psm)
|
||||
/* If here, no free RCB found */
|
||||
return (NULL);
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -1867,6 +1871,7 @@ tL2C_RCB *l2cu_find_rcb_by_psm (UINT16 psm)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function l2cu_find_ble_rcb_by_psm
|
||||
@ -1892,7 +1897,7 @@ tL2C_RCB *l2cu_find_ble_rcb_by_psm (UINT16 psm)
|
||||
/* If here, no match found */
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -24,7 +24,7 @@
|
||||
#ifndef SMP_INT_H
|
||||
#define SMP_INT_H
|
||||
|
||||
#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
|
||||
// #if (SMP_INCLUDED == TRUE)
|
||||
|
||||
#include "stack/btu.h"
|
||||
#include "stack/btm_ble_api.h"
|
||||
@ -537,6 +537,6 @@ extern BOOLEAN aes_cipher_msg_auth_code(BT_OCTET16 key, UINT8 *input, UINT16 len
|
||||
UINT16 tlen, UINT8 *p_signature);
|
||||
extern void print128(BT_OCTET16 x, const UINT8 *key_name);
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
|
||||
// #endif ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
|
||||
|
||||
#endif /* SMP_INT_H */
|
||||
|
@ -46,10 +46,17 @@ const UINT8 smp_association_table[2][SMP_IO_CAP_MAX][SMP_IO_CAP_MAX] = {
|
||||
|
||||
#define SMP_KEY_DIST_TYPE_MAX 4
|
||||
const tSMP_ACT smp_distribute_act [] = {
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
smp_generate_ltk,
|
||||
smp_send_id_info,
|
||||
smp_generate_csrk,
|
||||
smp_set_derive_link_key
|
||||
#else
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
};
|
||||
|
||||
extern UINT8 bta_dm_co_ble_get_accept_auth_enable(void);
|
||||
@ -191,7 +198,7 @@ void smp_send_app_cback(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
|
||||
smp_sm_event(p_cb, SMP_IO_RSP_EVT, NULL);
|
||||
break;
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case SMP_BR_KEYS_REQ_EVT:
|
||||
p_cb->loc_enc_size = cb_data.io_req.max_key_size;
|
||||
p_cb->local_i_key = cb_data.io_req.init_keys;
|
||||
@ -206,6 +213,7 @@ void smp_send_app_cback(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
|
||||
smp_br_state_machine_event(p_cb, SMP_BR_KEYS_RSP_EVT, NULL);
|
||||
break;
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -241,13 +249,15 @@ void smp_send_pair_fail(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
*******************************************************************************/
|
||||
void smp_send_pair_req(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
{
|
||||
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (p_cb->pairing_bda);
|
||||
SMP_TRACE_DEBUG("%s\n", __func__);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (p_cb->pairing_bda);
|
||||
/* erase all keys when master sends pairing req*/
|
||||
if (p_dev_rec) {
|
||||
btm_sec_clear_ble_keys(p_dev_rec);
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
/* do not manipulate the key, let app decide,
|
||||
leave out to BTM to mandate key distribution for bonding case */
|
||||
smp_send_cmd(SMP_OPCODE_PAIRING_REQ, p_cb);
|
||||
@ -261,6 +271,7 @@ void smp_send_pair_rsp(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
{
|
||||
SMP_TRACE_DEBUG("%s\n", __func__);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
p_cb->local_i_key &= p_cb->peer_i_key;
|
||||
p_cb->local_r_key &= p_cb->peer_r_key;
|
||||
|
||||
@ -271,6 +282,7 @@ void smp_send_pair_rsp(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
smp_decide_association_model(p_cb, NULL);
|
||||
}
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -365,6 +377,7 @@ void smp_send_enc_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
le_key.key_size = p_cb->loc_enc_size;
|
||||
le_key.sec_level = p_cb->sec_level;
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND)) {
|
||||
btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LENC,
|
||||
(tBTM_LE_KEY_VALUE *)&le_key, TRUE);
|
||||
@ -373,6 +386,7 @@ void smp_send_enc_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
SMP_TRACE_DEBUG ("%s\n", __func__);
|
||||
|
||||
smp_key_distribution(p_cb, NULL);
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -381,21 +395,24 @@ void smp_send_enc_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
*******************************************************************************/
|
||||
void smp_send_id_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
{
|
||||
tBTM_LE_KEY_VALUE le_key;
|
||||
SMP_TRACE_DEBUG("%s\n", __func__);
|
||||
smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ID, FALSE);
|
||||
|
||||
smp_send_cmd(SMP_OPCODE_IDENTITY_INFO, p_cb);
|
||||
smp_send_cmd(SMP_OPCODE_ID_ADDR, p_cb);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
tBTM_LE_KEY_VALUE le_key;
|
||||
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND)) {
|
||||
btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LID,
|
||||
&le_key, TRUE);
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
smp_key_distribution_by_transport(p_cb, NULL);
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
** Function smp_send_csrk_info
|
||||
** Description send CSRK command.
|
||||
@ -441,7 +458,6 @@ void smp_proc_sec_req(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
SMP_TRACE_DEBUG("%s auth_req=0x%x", __func__, auth_req);
|
||||
|
||||
p_cb->cb_evt = 0;
|
||||
|
||||
btm_ble_link_sec_check(p_cb->pairing_bda, auth_req, &sec_req_act);
|
||||
|
||||
SMP_TRACE_DEBUG("%s sec_req_act=0x%x", __func__, sec_req_act);
|
||||
@ -478,6 +494,7 @@ void smp_proc_sec_req(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
** Function smp_proc_sec_grant
|
||||
@ -532,6 +549,7 @@ uint16_t smp_get_auth_mode (tSMP_ASSO_MODEL model)
|
||||
return auth;
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
** Function smp_proc_pair_cmd
|
||||
** Description Process the SMP pairing request/response from peer device
|
||||
@ -652,6 +670,7 @@ void smp_proc_pair_cmd(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
** Function smp_proc_confirm
|
||||
@ -823,6 +842,7 @@ void smp_process_keypress_notification(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
p_cb->cb_evt = SMP_PEER_KEYPR_NOT_EVT;
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
** Function smp_br_process_pairing_command
|
||||
** Description Process the SMP pairing request/response from peer device via
|
||||
@ -842,10 +862,12 @@ void smp_br_process_pairing_command(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
return;
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/* erase all keys if it is slave proc pairing req*/
|
||||
if (p_dev_rec && (p_cb->role == HCI_ROLE_SLAVE)) {
|
||||
btm_sec_clear_ble_keys(p_dev_rec);
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
p_cb->flags |= SMP_PAIR_FLAG_ENC_AFTER_PAIR;
|
||||
|
||||
@ -966,7 +988,9 @@ void smp_br_select_next_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
** Function smp_proc_enc_info
|
||||
** Description process encryption information from peer device
|
||||
@ -980,6 +1004,8 @@ void smp_proc_enc_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
|
||||
smp_key_distribution(p_cb, NULL);
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
** Function smp_proc_master_id
|
||||
** Description process master ID from slave device
|
||||
@ -1001,6 +1027,7 @@ void smp_proc_master_id(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
le_key.sec_level = p_cb->sec_level;
|
||||
le_key.key_size = p_cb->loc_enc_size;
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND)) {
|
||||
btm_sec_save_le_key(p_cb->pairing_bda,
|
||||
BTM_LE_KEY_PENC,
|
||||
@ -1008,6 +1035,7 @@ void smp_proc_master_id(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
}
|
||||
|
||||
smp_key_distribution(p_cb, NULL);
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -1044,11 +1072,14 @@ void smp_proc_id_addr(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
p_cb->id_addr_type = pid_key.addr_type;
|
||||
memcpy(p_cb->id_addr, pid_key.static_addr, BD_ADDR_LEN);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/* store the ID key from peer device */
|
||||
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND)) {
|
||||
btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_PID,
|
||||
(tBTM_LE_KEY_VALUE *)&pid_key, TRUE);
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
smp_key_distribution_by_transport(p_cb, NULL);
|
||||
}
|
||||
|
||||
@ -1058,6 +1089,7 @@ void smp_proc_id_addr(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
*******************************************************************************/
|
||||
void smp_proc_srk_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
{
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
tBTM_LE_PCSRK_KEYS le_key;
|
||||
|
||||
SMP_TRACE_DEBUG("%s", __func__);
|
||||
@ -1073,6 +1105,8 @@ void smp_proc_srk_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
BTM_LE_KEY_PCSRK,
|
||||
(tBTM_LE_KEY_VALUE *)&le_key, TRUE);
|
||||
}
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
smp_key_distribution_by_transport(p_cb, NULL);
|
||||
}
|
||||
|
||||
@ -1107,6 +1141,7 @@ void smp_proc_compare(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
}
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
** Function smp_proc_sl_key
|
||||
** Description process key ready events.
|
||||
@ -1147,6 +1182,7 @@ void smp_start_enc(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
|
||||
}
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
** Function smp_proc_discard
|
||||
@ -1246,7 +1282,7 @@ void smp_key_pick_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
while (i < SMP_KEY_DIST_TYPE_MAX) {
|
||||
SMP_TRACE_DEBUG("key to send = %02x, i = %d\n", key_to_dist, i);
|
||||
|
||||
if (key_to_dist & (1 << i)) {
|
||||
if (key_to_dist & (1 << i) && smp_distribute_act[i] != NULL) {
|
||||
SMP_TRACE_DEBUG("smp_distribute_act[%d]\n", i);
|
||||
(* smp_distribute_act[i])(p_cb, p_data);
|
||||
break;
|
||||
@ -1254,6 +1290,8 @@ void smp_key_pick_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
i ++;
|
||||
}
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
** Function smp_key_distribution
|
||||
** Description start key distribution if required.
|
||||
@ -1417,6 +1455,7 @@ void smp_process_io_response(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
smp_send_pair_rsp(p_cb, NULL);
|
||||
}
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
** Function smp_br_process_slave_keys_response
|
||||
@ -1481,6 +1520,7 @@ void smp_idle_terminate(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
}
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
** Function smp_fast_conn_param
|
||||
** Description apply default connection parameter for pairing process
|
||||
@ -1706,6 +1746,7 @@ void smp_process_peer_nonce(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
|
||||
SMP_TRACE_DEBUG("%s end\n ", __FUNCTION__);
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
** Function smp_match_dhkey_checks
|
||||
@ -1793,6 +1834,7 @@ void smp_wait_for_both_public_keys(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
}
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
** Function smp_start_passkey_verification
|
||||
** Description Starts SC passkey entry verification.
|
||||
@ -2059,7 +2101,9 @@ void smp_derive_link_key_from_long_term_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function smp_br_process_link_key
|
||||
@ -2087,6 +2131,7 @@ void smp_br_process_link_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, FALSE);
|
||||
smp_br_select_next_key(p_cb, NULL);
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
** Function smp_key_distribution_by_transport
|
||||
@ -2097,9 +2142,13 @@ void smp_key_distribution_by_transport(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
{
|
||||
SMP_TRACE_DEBUG("%s\n", __func__);
|
||||
if (p_cb->smp_over_br) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
smp_br_select_next_key(p_cb, NULL);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
} else {
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
smp_key_distribution(p_cb, NULL);
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,6 +183,7 @@ tSMP_STATUS SMP_Pair (BD_ADDR bd_addr)
|
||||
** Returns SMP_STARTED if pairing started, otherwise reason for failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
tSMP_STATUS SMP_BR_PairWith (BD_ADDR bd_addr)
|
||||
{
|
||||
tSMP_CB *p_cb = &smp_cb;
|
||||
@ -212,6 +213,7 @@ tSMP_STATUS SMP_BR_PairWith (BD_ADDR bd_addr)
|
||||
|
||||
return SMP_STARTED;
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -258,6 +260,7 @@ void SMP_SecurityGrant(BD_ADDR bd_addr, UINT8 res)
|
||||
{
|
||||
SMP_TRACE_EVENT ("SMP_SecurityGrant ");
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (smp_cb.smp_over_br) {
|
||||
if (smp_cb.br_state != SMP_BR_STATE_WAIT_APP_RSP ||
|
||||
smp_cb.cb_evt != SMP_SEC_REQUEST_EVT ||
|
||||
@ -271,6 +274,7 @@ void SMP_SecurityGrant(BD_ADDR bd_addr, UINT8 res)
|
||||
smp_br_state_machine_event(&smp_cb, SMP_BR_API_SEC_GRANT_EVT, &res);
|
||||
return;
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
if (smp_cb.state != SMP_STATE_WAIT_APP_RSP ||
|
||||
smp_cb.cb_evt != SMP_SEC_REQUEST_EVT ||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <string.h>
|
||||
#include "smp_int.h"
|
||||
|
||||
#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
|
||||
#if ( CLASSIC_BT_INCLUDED== TRUE && SMP_INCLUDED == TRUE)
|
||||
|
||||
const char *const smp_br_state_name [SMP_BR_STATE_MAX + 1] = {
|
||||
"SMP_BR_STATE_IDLE",
|
||||
|
@ -23,7 +23,7 @@
|
||||
******************************************************************************/
|
||||
#include "common/bt_target.h"
|
||||
|
||||
#if SMP_INCLUDED == TRUE
|
||||
#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
|
||||
#if SMP_DEBUG == TRUE
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
@ -380,10 +380,13 @@ void smp_generate_ltk(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
|
||||
BOOLEAN div_status;
|
||||
SMP_TRACE_DEBUG ("%s\n", __FUNCTION__);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (smp_get_br_state() == SMP_BR_STATE_BOND_PENDING) {
|
||||
smp_br_process_link_key(p_cb, NULL);
|
||||
return;
|
||||
} else if (p_cb->le_secure_connections_mode_is_used) {
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
if (p_cb->le_secure_connections_mode_is_used) {
|
||||
smp_process_secure_connection_long_term_key();
|
||||
return;
|
||||
}
|
||||
@ -432,7 +435,9 @@ void smp_compute_csrk(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
if (!SMP_Encrypt(er, BT_OCTET16_LEN, buffer, 4, &output)) {
|
||||
SMP_TRACE_ERROR("smp_generate_csrk failed\n");
|
||||
if (p_cb->smp_over_br) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &status);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
} else {
|
||||
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status);
|
||||
}
|
||||
|
@ -35,10 +35,12 @@
|
||||
|
||||
|
||||
static void smp_tx_complete_callback(UINT16 cid, UINT16 num_pkt);
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
|
||||
static void smp_connect_callback(UINT16 channel, BD_ADDR bd_addr, BOOLEAN connected, UINT16 reason,
|
||||
tBT_TRANSPORT transport);
|
||||
static void smp_data_received(UINT16 channel, BD_ADDR bd_addr, BT_HDR *p_buf);
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
static void smp_br_connect_callback(UINT16 channel, BD_ADDR bd_addr, BOOLEAN connected, UINT16 reason,
|
||||
tBT_TRANSPORT transport);
|
||||
@ -64,8 +66,6 @@ void smp_l2cap_if_init (void)
|
||||
fixed_reg.fixed_chnl_opts.mps = 0;
|
||||
fixed_reg.fixed_chnl_opts.tx_win_sz = 0;
|
||||
|
||||
fixed_reg.pL2CA_FixedConn_Cb = smp_connect_callback;
|
||||
fixed_reg.pL2CA_FixedData_Cb = smp_data_received;
|
||||
fixed_reg.pL2CA_FixedTxComplete_Cb = smp_tx_complete_callback;
|
||||
|
||||
fixed_reg.pL2CA_FixedCong_Cb = NULL; /* do not handle congestion on this channel */
|
||||
@ -75,7 +75,12 @@ void smp_l2cap_if_init (void)
|
||||
will cause the disconnect event to go back up for a long time.
|
||||
Set to 0 will be disconnected directly, and it will come up
|
||||
pairing failure, so it will not cause adverse effects. */
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
fixed_reg.pL2CA_FixedConn_Cb = smp_connect_callback;
|
||||
fixed_reg.pL2CA_FixedData_Cb = smp_data_received;
|
||||
L2CA_RegisterFixedChannel (L2CAP_SMP_CID, &fixed_reg);
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
fixed_reg.pL2CA_FixedConn_Cb = smp_br_connect_callback;
|
||||
fixed_reg.pL2CA_FixedData_Cb = smp_br_data_received;
|
||||
@ -84,6 +89,7 @@ void smp_l2cap_if_init (void)
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function smp_connect_callback
|
||||
@ -107,7 +113,7 @@ static void smp_connect_callback (UINT16 channel, BD_ADDR bd_addr, BOOLEAN conne
|
||||
}
|
||||
if(!connected && &p_cb->rsp_timer_ent) {
|
||||
//free timer
|
||||
btu_free_timer(&p_cb->rsp_timer_ent);
|
||||
btu_free_timer(&p_cb->rsp_timer_ent);
|
||||
}
|
||||
if (memcmp(bd_addr, p_cb->pairing_bda, BD_ADDR_LEN) == 0) {
|
||||
SMP_TRACE_EVENT ("%s() for pairing BDA: %08x%04x Event: %s\n",
|
||||
@ -200,6 +206,7 @@ static void smp_data_received(UINT16 channel, BD_ADDR bd_addr, BT_HDR *p_buf)
|
||||
|
||||
osi_free (p_buf);
|
||||
}
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -223,7 +230,9 @@ static void smp_tx_complete_callback (UINT16 cid, UINT16 num_pkt)
|
||||
if (cid == L2CAP_SMP_CID) {
|
||||
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
|
||||
} else {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &reason);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,8 @@ enum {
|
||||
SMP_SM_NO_ACTION
|
||||
};
|
||||
|
||||
static const tSMP_ACT smp_sm_action[] = {
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
static const tSMP_ACT smp_sm_action[SMP_SM_NO_ACTION] = {
|
||||
smp_proc_sec_req,
|
||||
smp_send_pair_req,
|
||||
smp_send_pair_rsp,
|
||||
@ -226,6 +227,9 @@ static const tSMP_ACT smp_sm_action[] = {
|
||||
smp_idle_terminate,
|
||||
smp_fast_conn_param
|
||||
};
|
||||
#else
|
||||
static const tSMP_ACT smp_sm_action[SMP_SM_NO_ACTION] = {NULL};
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
/************ SMP Master FSM State/Event Indirection Table **************/
|
||||
static const UINT8 smp_master_entry_map[][SMP_STATE_MAX] = {
|
||||
@ -766,7 +770,7 @@ void smp_sm_event(tSMP_CB *p_cb, tSMP_EVENT event, void *p_data)
|
||||
/* execute action */
|
||||
/* execute action functions */
|
||||
for (i = 0; i < SMP_NUM_ACTIONS; i++) {
|
||||
if ((action = state_table[entry - 1][i]) != SMP_SM_NO_ACTION) {
|
||||
if ((action = state_table[entry - 1][i]) != SMP_SM_NO_ACTION && smp_sm_action[action] != NULL) {
|
||||
(*smp_sm_action[action])(p_cb, (tSMP_INT_DATA *)p_data);
|
||||
} else {
|
||||
break;
|
||||
|
@ -367,7 +367,9 @@ BOOLEAN smp_send_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
|
||||
|
||||
if (!sent) {
|
||||
if (p_cb->smp_over_br) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &failure);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
} else {
|
||||
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &failure);
|
||||
}
|
||||
@ -393,7 +395,9 @@ void smp_rsp_timeout(TIMER_LIST_ENT *p_tle)
|
||||
SMP_TRACE_EVENT("%s state:%d br_state:%d", __FUNCTION__, p_cb->state, p_cb->br_state);
|
||||
|
||||
if (p_cb->smp_over_br) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &failure);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
} else {
|
||||
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &failure);
|
||||
}
|
||||
@ -550,6 +554,7 @@ static BT_HDR *smp_build_master_id_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
|
||||
static BT_HDR *smp_build_identity_info_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
|
||||
{
|
||||
BT_HDR *p_buf = NULL ;
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
UINT8 *p;
|
||||
BT_OCTET16 irk;
|
||||
UNUSED(cmd_code);
|
||||
@ -568,6 +573,7 @@ static BT_HDR *smp_build_identity_info_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
|
||||
p_buf->len = SMP_ID_INFO_SIZE;
|
||||
}
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
return p_buf;
|
||||
}
|
||||
|
||||
@ -590,13 +596,16 @@ static BT_HDR *smp_build_id_addr_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
|
||||
p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
|
||||
|
||||
UINT8_TO_STREAM (p, SMP_OPCODE_ID_ADDR);
|
||||
/* Identity Address Information is used in the Transport Specific Key Distribution phase to distribute
|
||||
/* Identity Address Information is used in the Transport Specific Key Distribution phase to distribute
|
||||
its public device address or static random address. if slave using static random address is encrypted,
|
||||
it should distribute its static random address */
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
if(btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type == BLE_ADDR_RANDOM && memcmp(btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr,6) == 0) {
|
||||
UINT8_TO_STREAM (p, 0x01);
|
||||
BDADDR_TO_STREAM (p, btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr);
|
||||
} else {
|
||||
} else
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
{
|
||||
UINT8_TO_STREAM (p, 0);
|
||||
BDADDR_TO_STREAM (p, controller_get_interface()->get_address()->address);
|
||||
}
|
||||
@ -997,6 +1006,7 @@ void smp_proc_pairing_cmpl(tSMP_CB *p_cb)
|
||||
|
||||
memcpy (pairing_bda, p_cb->pairing_bda, BD_ADDR_LEN);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
#if (SMP_SLAVE_CON_PARAMS_UPD_ENABLE == TRUE)
|
||||
if (p_cb->role == HCI_ROLE_SLAVE) {
|
||||
if(p_rec && p_rec->ble.skip_update_conn_param) {
|
||||
@ -1006,7 +1016,10 @@ void smp_proc_pairing_cmpl(tSMP_CB *p_cb)
|
||||
L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
smp_reset_control_value(p_cb);
|
||||
|
||||
if (p_callback) {
|
||||
@ -1405,7 +1418,7 @@ void smp_collect_peer_io_capabilities(UINT8 *iocap, tSMP_CB *p_cb)
|
||||
iocap[1] = p_cb->peer_oob_flag;
|
||||
iocap[2] = p_cb->peer_auth_req;
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
** Function smp_collect_local_ble_address
|
||||
**
|
||||
@ -1558,7 +1571,7 @@ BOOLEAN smp_calculate_f5_mackey_and_long_term_key(tSMP_CB *p_cb)
|
||||
SMP_TRACE_EVENT ("%s is completed\n", __func__);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function smp_request_oob_data
|
||||
|
@ -8,6 +8,4 @@ CONFIG_BT_BLUEDROID_ENABLED=y
|
||||
CONFIG_BT_CLASSIC_ENABLED=y
|
||||
CONFIG_BT_A2DP_ENABLE=y
|
||||
CONFIG_BT_SPP_ENABLED=n
|
||||
CONFIG_BT_GATTS_ENABLE=n
|
||||
CONFIG_BT_GATTC_ENABLE=n
|
||||
CONFIG_BT_BLE_SMP_ENABLE=n
|
||||
CONFIG_BT_BLE_ENABLED=n
|
||||
|
@ -8,6 +8,4 @@ CONFIG_BT_BLUEDROID_ENABLED=y
|
||||
CONFIG_BT_CLASSIC_ENABLED=y
|
||||
CONFIG_BT_A2DP_ENABLE=y
|
||||
CONFIG_BT_SPP_ENABLED=n
|
||||
CONFIG_BT_GATTS_ENABLE=n
|
||||
CONFIG_BT_GATTC_ENABLE=n
|
||||
CONFIG_BT_BLE_SMP_ENABLE=n
|
||||
CONFIG_BT_BLE_ENABLED=n
|
||||
|
@ -6,6 +6,4 @@ CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=y
|
||||
CONFIG_BTDM_CTRL_MODE_BTDM=
|
||||
CONFIG_BT_CLASSIC_ENABLED=y
|
||||
CONFIG_BT_A2DP_ENABLE=n
|
||||
CONFIG_BT_GATTS_ENABLE=n
|
||||
CONFIG_BT_GATTC_ENABLE=n
|
||||
CONFIG_BT_BLE_SMP_ENABLE=n
|
||||
CONFIG_BT_BLE_ENABLED=n
|
||||
|
@ -7,3 +7,4 @@ CONFIG_BTDM_CTRL_MODE_BTDM=
|
||||
CONFIG_BT_CLASSIC_ENABLED=y
|
||||
CONFIG_WIFI_ENABLED=n
|
||||
CONFIG_BT_SPP_ENABLED=y
|
||||
CONFIG_BT_BLE_ENABLED=n
|
||||
|
@ -7,3 +7,4 @@ CONFIG_BTDM_CTRL_MODE_BTDM=
|
||||
CONFIG_BT_CLASSIC_ENABLED=y
|
||||
CONFIG_WIFI_ENABLED=n
|
||||
CONFIG_BT_SPP_ENABLED=y
|
||||
CONFIG_BT_BLE_ENABLED=n
|
||||
|
@ -7,3 +7,4 @@ CONFIG_BTDM_CTRL_MODE_BTDM=
|
||||
CONFIG_BT_CLASSIC_ENABLED=y
|
||||
CONFIG_WIFI_ENABLED=n
|
||||
CONFIG_BT_SPP_ENABLED=y
|
||||
CONFIG_BT_BLE_ENABLED=n
|
||||
|
@ -7,3 +7,4 @@ CONFIG_BTDM_CTRL_MODE_BTDM=
|
||||
CONFIG_BT_CLASSIC_ENABLED=y
|
||||
CONFIG_WIFI_ENABLED=n
|
||||
CONFIG_BT_SPP_ENABLED=y
|
||||
CONFIG_BT_BLE_ENABLED=n
|
||||
|
Loading…
x
Reference in New Issue
Block a user