Merge branch 'feature/btdm_ble_bt_separa' into 'master'

Feature/btdm ble bt separa

@Jack @snake @igrokhotkov @angus @island please help to review the code.
Separate the bt/ble code. After the separate, can save 15k~25k ram & 240k~460k code size(depending on the menuconfig).

See merge request !684
This commit is contained in:
Jiang Jiang Jian 2017-04-27 21:12:44 +08:00
commit a21d524ca0
121 changed files with 1446 additions and 431 deletions

View File

@ -38,6 +38,42 @@ config BT_DRAM_RELEASE
Enabling this option will release about 30K DRAM from Classic BT.
The released DRAM will be used as system heap memory.
config GATTS_ENABLE
bool "Include GATT server module(GATTS)"
depends on BLUEDROID_ENABLED
default y
help
This option can be disabled when the app work only on gatt client mode
config GATTC_ENABLE
bool "Include GATT client module(GATTC)"
depends on BLUEDROID_ENABLED
default y
help
This option can be close when the app work only on gatt server mode
config SMP_ENABLE
bool "Include BT security module(SMP)"
depends on BLUEDROID_ENABLED
default y
help
This option can be close when the app not used the ble security connect.
config BT_STACK_NO_LOG
bool "Close the bluedroid bt stack log print"
depends on BLUEDROID_ENABLED
default n
help
This select can save the rodata code size
config BT_ACL_CONNECTIONS
int "BT/BLE MAX ACL CONNECTIONS(1~7)"
depends on BLUEDROID_ENABLED
range 1 7
default 4
help
Maximum BT/BLE connection count
#disable now for app cpu due to a known issue
config BTDM_CONTROLLER_RUN_APP_CPU
bool "Run controller on APP CPU"

View File

@ -20,6 +20,7 @@
#include "btc_gattc.h"
#include "btc_gatt_util.h"
#if (GATTC_INCLUDED == TRUE)
esp_err_t esp_ble_gattc_register_callback(esp_gattc_cb_t callback)
{
if (esp_bluedroid_get_status() == ESP_BLUEDROID_STATUS_UNINITIALIZED) {
@ -450,3 +451,5 @@ esp_gatt_status_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if,
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif ///GATTC_INCLUDED == TRUE

View File

@ -19,7 +19,8 @@
#include "btc_manage.h"
#include "btc_gatts.h"
#include "btc_gatt_util.h"
#include "bt_target.h"
#if (GATTS_INCLUDED == TRUE)
#define COPY_TO_GATTS_ARGS(_gatt_args, _arg, _arg_type) memcpy(_gatt_args, _arg, sizeof(_arg_type))
@ -399,3 +400,5 @@ esp_err_t esp_ble_gatts_close(esp_gatt_if_t gatts_if, uint16_t conn_id)
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif ///GATTS_INCLUDED

View File

@ -27,6 +27,7 @@
#include "bta_av_api.h"
#if (BTA_AR_INCLUDED == TRUE)
#ifndef BTA_AR_DEBUG
#define BTA_AR_DEBUG FALSE
@ -60,4 +61,6 @@ extern tBTA_AR_CB *bta_ar_cb_ptr;
#define bta_ar_cb (*bta_ar_cb_ptr)
#endif
#endif ///BTA_AR_INCLUDED == TRUE
#endif /* BTA_AR_INT_H */

View File

@ -31,6 +31,8 @@
#include "bta_av_co.h"
#include "list.h"
#if (BTA_AV_INCLUDED == TRUE)
#define BTA_AV_DEBUG TRUE
/*****************************************************************************
** Constants
@ -701,4 +703,6 @@ extern void bta_av_do_disc_vdp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_vdp_str_opened (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_reg_vdp (tAVDT_CS *p_cs, char *p_service_name, void *p_data);
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_INT_H */

View File

@ -50,13 +50,19 @@ static void bta_dm_inq_results_cb (tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
static void bta_dm_inq_cmpl_cb (void *p_result);
static void bta_dm_service_search_remname_cback (BD_ADDR bd_addr, DEV_CLASS dc, BD_NAME bd_name);
static void bta_dm_remname_cback (tBTM_REMOTE_DEV_NAME *p_remote_name);
#if (SDP_INCLUDED == TRUE)
static void bta_dm_find_services ( BD_ADDR bd_addr);
#endif ///SDP_INCLUDED == TRUE
static void bta_dm_discover_next_device(void);
#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);
@ -65,35 +71,39 @@ 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) */
static void bta_dm_set_eir (char *local_name);
#if (SDP_INCLUDED == TRUE)
static void bta_dm_eir_search_services( tBTM_INQ_RESULTS *p_result,
tBTA_SERVICE_MASK *p_services_to_search,
tBTA_SERVICE_MASK *p_services_found);
#endif ///SDP_INCLUDED == TRUE
static void bta_dm_search_timer_cback (TIMER_LIST_ENT *p_tle);
static void bta_dm_disable_conn_down_timer_cback (TIMER_LIST_ENT *p_tle);
static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
static void bta_dm_adjust_roles(BOOLEAN delay_role_switch);
#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);
#endif ///SDP_INCLUDED == TRUE
static void bta_dm_sys_hw_cback( tBTA_SYS_HW_EVT status );
static void bta_dm_disable_search_and_disc(void);
#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);
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
#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);
static void bta_dm_cancel_gatt_discovery(BD_ADDR bd_addr);
@ -109,8 +119,9 @@ static void bta_dm_ctrl_features_rd_cmpl_cback(tBTM_STATUS result);
#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);
@ -197,6 +208,7 @@ const UINT32 bta_service_id_to_btm_srv_id_lkup_tbl [BTA_MAX_SERVICE_ID] = {
};
/* bta security callback */
#if (SMP_INCLUDED == TRUE)
const tBTM_APPL_INFO bta_security = {
&bta_dm_authorize_cback,
&bta_dm_pin_cback,
@ -204,22 +216,22 @@ const tBTM_APPL_INFO bta_security = {
&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
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;
/*******************************************************************************
@ -325,7 +337,9 @@ static void bta_dm_sys_hw_cback( tBTA_SYS_HW_EVT status )
/* 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));
@ -341,12 +355,13 @@ static void bta_dm_sys_hw_cback( tBTA_SYS_HW_EVT status )
if (key_mask & BTA_BLE_LOCAL_KEY_TYPE_ID) {
BTM_BleLoadLocalKeys(BTA_BLE_LOCAL_KEY_TYPE_ID, (tBTM_BLE_LOCAL_KEYS *)&id_key);
}
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE)
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;
@ -365,13 +380,13 @@ static void bta_dm_sys_hw_cback( tBTA_SYS_HW_EVT status )
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)
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE)
bta_dm_gattc_register();
#endif
@ -405,8 +420,9 @@ void bta_dm_disable (tBTA_DM_MSG *p_data)
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;
@ -590,14 +606,14 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
*******************************************************************************/
void bta_dm_process_remove_device(BD_ADDR bd_addr)
{
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE)
/* need to remove all pending background connection before unpair */
BTA_GATTC_CancelOpen(0, bd_addr, FALSE);
#endif
BTM_SecDeleteDevice(bd_addr);
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE)
/* remove all cached GATT information */
BTA_GATTC_Refresh(bd_addr);
#endif
@ -780,7 +796,7 @@ void bta_dm_close_acl(tBTA_DM_MSG *p_data)
if (!BTM_SecDeleteDevice(p_remove_acl->bd_addr)) {
APPL_TRACE_ERROR("delete device from security database failed.");
}
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE)
/* need to remove all pending background connection if any */
BTA_GATTC_CancelOpen(0, p_remove_acl->bd_addr, FALSE);
/* remove all cached GATT information */
@ -831,6 +847,7 @@ void bta_dm_remove_all_acl(tBTA_DM_MSG *p_data)
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
void bta_dm_bond (tBTA_DM_MSG *p_data)
{
tBTM_STATUS status;
@ -927,6 +944,7 @@ void bta_dm_pin_reply (tBTA_DM_MSG *p_data)
}
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -969,7 +987,9 @@ static void bta_dm_policy_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app
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;
@ -1002,6 +1022,7 @@ static void bta_dm_policy_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
void bta_dm_confirm(tBTA_DM_MSG *p_data)
{
tBTM_STATUS res = BTM_NOT_AUTHORIZED;
@ -1011,6 +1032,7 @@ void bta_dm_confirm(tBTA_DM_MSG *p_data)
}
BTM_ConfirmReqReply(res, p_data->confirm.bd_addr);
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -1021,7 +1043,7 @@ void bta_dm_confirm(tBTA_DM_MSG *p_data)
** 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);
@ -1067,7 +1089,7 @@ void bta_dm_ci_rmt_oob_act(tBTA_DM_MSG *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 */
/*******************************************************************************
**
@ -1083,7 +1105,7 @@ void bta_dm_search_start (tBTA_DM_MSG *p_data)
{
tBTM_INQUIRY_CMPL result;
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE)
UINT16 len = (UINT16)(sizeof(tBT_UUID) * p_data->search.num_uuid);
bta_dm_gattc_register();
#endif
@ -1101,7 +1123,7 @@ void bta_dm_search_start (tBTA_DM_MSG *p_data)
bta_dm_search_cb.p_search_cback = p_data->search.p_cback;
bta_dm_search_cb.services = p_data->search.services;
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE)
utl_freebuf((void **)&bta_dm_search_cb.p_srvc_uuid);
if ((bta_dm_search_cb.num_uuid = p_data->search.num_uuid) != 0 &&
@ -1176,7 +1198,7 @@ void bta_dm_search_cancel (tBTA_DM_MSG *p_data)
}
}
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE
if (bta_dm_search_cb.gatt_disc_active) {
bta_dm_cancel_gatt_discovery(bta_dm_search_cb.peer_bdaddr);
}
@ -1193,9 +1215,10 @@ void bta_dm_search_cancel (tBTA_DM_MSG *p_data)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_dm_discover (tBTA_DM_MSG *p_data)
{
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
UINT16 len = (UINT16)(sizeof(tBT_UUID) * p_data->discover.num_uuid);
#endif
APPL_TRACE_EVENT("%s services_to_search=0x%04X, sdp_search=%d", __func__,
@ -1281,7 +1304,7 @@ static void bta_dm_di_disc_callback(UINT16 result)
bta_sys_sendmsg(p_msg);
}
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Function bta_dm_disable_search_and_disc
@ -1295,12 +1318,13 @@ static void bta_dm_di_disc_callback(UINT16 result)
*******************************************************************************/
static void bta_dm_disable_search_and_disc (void)
{
#if (SDP_INCLUDED == TRUE)
tBTA_DM_DI_DISC_CMPL di_disc;
#endif ///SDP_INCLUDED == TRUE
if (bta_dm_search_cb.state != BTA_DM_SEARCH_IDLE) {
bta_dm_search_cancel(NULL);
}
#if (SDP_INCLUDED == TRUE)
if (bta_dm_di_cb.p_di_db != NULL) {
memset(&di_disc, 0, sizeof(tBTA_DM_DI_DISC_CMPL));
bdcpy(di_disc.bd_addr, bta_dm_search_cb.peer_bdaddr);
@ -1309,6 +1333,7 @@ static void bta_dm_disable_search_and_disc (void)
bta_dm_di_cb.p_di_db = NULL;
bta_dm_search_cb.p_search_cback(BTA_DM_DI_DISC_CMPL_EVT, NULL);
}
#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
@ -1321,6 +1346,7 @@ static void bta_dm_disable_search_and_disc (void)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_dm_di_disc (tBTA_DM_MSG *p_data)
{
UINT16 result = BTA_FAILURE;
@ -1347,6 +1373,7 @@ void bta_dm_di_disc (tBTA_DM_MSG *p_data)
bta_sys_sendmsg(p_msg);
}
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
@ -1357,6 +1384,7 @@ void bta_dm_di_disc (tBTA_DM_MSG *p_data)
** Returns TRUE if started to get remote name
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
static BOOLEAN bta_dm_read_remote_device_name (BD_ADDR bd_addr, tBT_TRANSPORT transport)
{
tBTM_STATUS btm_status;
@ -1388,6 +1416,7 @@ static BOOLEAN bta_dm_read_remote_device_name (BD_ADDR bd_addr, tBT_TRANSPORT tr
return (FALSE);
}
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
@ -1412,7 +1441,9 @@ void bta_dm_inq_cmpl (tBTA_DM_MSG *p_data)
/* start name and service discovery from the first device on inquiry result */
bta_dm_search_cb.name_discover_done = FALSE;
bta_dm_search_cb.peer_name[0] = 0;
#if (SDP_INCLUDED == TRUE)
bta_dm_discover_device(bta_dm_search_cb.p_btm_inq_info->results.remote_bd_addr);
#endif ///SDP_INCLUDED == TRUE
} else {
/* no devices, search complete */
bta_dm_search_cb.services = 0;
@ -1441,8 +1472,9 @@ void bta_dm_rmt_name (tBTA_DM_MSG *p_data)
if ( p_data->rem_name.result.disc_res.bd_name[0] && bta_dm_search_cb.p_btm_inq_info) {
bta_dm_search_cb.p_btm_inq_info->appl_knows_rem_name = TRUE;
}
#if (SDP_INCLUDED == TRUE)
bta_dm_discover_device(bta_dm_search_cb.peer_bdaddr);
#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
@ -1467,8 +1499,9 @@ void bta_dm_disc_rmt_name (tBTA_DM_MSG *p_data)
p_btm_inq_info->appl_knows_rem_name = TRUE;
}
}
#if (SDP_INCLUDED == TRUE)
bta_dm_discover_device(p_data->rem_name.result.disc_res.bd_addr);
#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
@ -1480,9 +1513,9 @@ void bta_dm_disc_rmt_name (tBTA_DM_MSG *p_data)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
{
tSDP_DISC_REC *p_sdp_rec = NULL;
tBTA_DM_MSG *p_msg;
BOOLEAN scn_found = FALSE;
@ -1715,6 +1748,7 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
}
}
}
#endif ///SDP_INCLUDE == TRUE
/*******************************************************************************
**
@ -1729,12 +1763,14 @@ void bta_dm_search_cmpl (tBTA_DM_MSG *p_data)
{
APPL_TRACE_EVENT("%s", __func__);
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE)
utl_freebuf((void **)&bta_dm_search_cb.p_srvc_uuid);
#endif
if (p_data->hdr.layer_specific == BTA_DM_API_DI_DISCOVER_EVT) {
#if (SDP_INCLUDED == TRUE)
bta_dm_di_disc_cmpl(p_data);
#endif ///SDP_INCLUDED == TRUE
} else {
bta_dm_search_cb.p_search_cback(BTA_DM_DISC_CMPL_EVT, NULL);
}
@ -1837,6 +1873,7 @@ static void bta_dm_search_timer_cback (TIMER_LIST_ENT *p_tle)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_dm_free_sdp_db (tBTA_DM_MSG *p_data)
{
UNUSED(p_data);
@ -1844,8 +1881,8 @@ void bta_dm_free_sdp_db (tBTA_DM_MSG *p_data)
GKI_freebuf(bta_dm_search_cb.p_sdp_db);
bta_dm_search_cb.p_sdp_db = NULL;
}
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
@ -1876,6 +1913,7 @@ void bta_dm_queue_search (tBTA_DM_MSG *p_data)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_dm_queue_disc (tBTA_DM_MSG *p_data)
{
if (bta_dm_search_cb.p_search_queue) {
@ -1884,8 +1922,8 @@ void bta_dm_queue_disc (tBTA_DM_MSG *p_data)
bta_dm_search_cb.p_search_queue = (tBTA_DM_MSG *)GKI_getbuf(sizeof(tBTA_DM_API_DISCOVER));
memcpy(bta_dm_search_cb.p_search_queue, p_data, sizeof(tBTA_DM_API_DISCOVER));
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
@ -1934,6 +1972,7 @@ void bta_dm_search_cancel_cmpl (tBTA_DM_MSG *p_data)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_dm_search_cancel_transac_cmpl(tBTA_DM_MSG *p_data)
{
UNUSED(p_data);
@ -1944,6 +1983,7 @@ void bta_dm_search_cancel_transac_cmpl(tBTA_DM_MSG *p_data)
bta_dm_search_cancel_notify(NULL);
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
@ -1964,7 +2004,7 @@ void bta_dm_search_cancel_notify (tBTA_DM_MSG *p_data)
if (!bta_dm_search_cb.name_discover_done) {
BTM_CancelRemoteDeviceName();
}
#if (BLE_INCLUDED == TRUE) && (BTA_GATT_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE) && (BTA_GATT_INCLUDED == TRUE) && (SDP_INCLUDED == TRUE)
if (bta_dm_search_cb.gatt_disc_active) {
bta_dm_cancel_gatt_discovery(bta_dm_search_cb.peer_bdaddr);
}
@ -1981,9 +2021,9 @@ void bta_dm_search_cancel_notify (tBTA_DM_MSG *p_data)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
static void bta_dm_find_services ( BD_ADDR bd_addr)
{
tSDP_UUID uuid;
tBTA_DM_MSG *p_msg;
@ -2090,6 +2130,7 @@ static void bta_dm_find_services ( BD_ADDR bd_addr)
}
}
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
@ -2111,7 +2152,9 @@ static void bta_dm_discover_next_device(void)
if ((bta_dm_search_cb.p_btm_inq_info = BTM_InqDbNext(bta_dm_search_cb.p_btm_inq_info)) != NULL) {
bta_dm_search_cb.name_discover_done = FALSE;
bta_dm_search_cb.peer_name[0] = 0;
#if (SDP_INCLUDED == TRUE)
bta_dm_discover_device(bta_dm_search_cb.p_btm_inq_info->results.remote_bd_addr);
#endif ///SDP_INCLUDED == TRUE
} else {
/* no devices, search complete */
bta_dm_search_cb.services = 0;
@ -2133,6 +2176,7 @@ static void bta_dm_discover_next_device(void)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
{
tBTA_DM_MSG *p_msg;
@ -2199,7 +2243,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
bta_dm_search_cb.service_index = 0;
bta_dm_search_cb.services_found = 0;
bta_dm_search_cb.services_to_search = bta_dm_search_cb.services;
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE
bta_dm_search_cb.uuid_to_search = bta_dm_search_cb.num_uuid;
#endif
if ((bta_dm_search_cb.p_btm_inq_info != NULL) &&
@ -2222,7 +2266,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
bta_dm_search_cb.wait_disc = TRUE;
}
#if (BLE_INCLUDED == TRUE && (defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
#if (BLE_INCLUDED == TRUE && (defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE)
if ( bta_dm_search_cb.p_btm_inq_info ) {
APPL_TRACE_DEBUG("%s p_btm_inq_info %p results.device_type 0x%x services_to_search 0x%x",
__func__,
@ -2293,7 +2337,7 @@ static void bta_dm_sdp_callback (UINT16 sdp_status)
}
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Function bta_dm_inq_results_cb
@ -2455,7 +2499,7 @@ static void bta_dm_remname_cback (tBTM_REMOTE_DEV_NAME *p_remote_name)
BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback);
#if BLE_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE
if (bta_dm_search_cb.transport == BT_TRANSPORT_LE ) {
GAP_BleReadPeerPrefConnParams (bta_dm_search_cb.peer_bdaddr);
}
@ -2483,6 +2527,7 @@ static void bta_dm_remname_cback (tBTM_REMOTE_DEV_NAME *p_remote_name)
** 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)
{
@ -2526,8 +2571,7 @@ static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NA
return BTM_NOT_AUTHORIZED;
}
}
@ -2540,7 +2584,7 @@ static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NA
** 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;
@ -2873,6 +2917,9 @@ 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) */
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Function bta_dm_local_name_cback
@ -3204,7 +3251,7 @@ void bta_dm_acl_change(tBTA_DM_MSG *p_data)
}
if (conn.link_down.is_removed) {
BTM_SecDeleteDevice(p_bda);
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE)
/* need to remove all pending background connection */
BTA_GATTC_CancelOpen(0, p_bda, FALSE);
/* remove all cached GATT information */
@ -3239,10 +3286,10 @@ static void bta_dm_disable_conn_down_timer_cback (TIMER_LIST_ENT *p_tle)
{
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 );
@ -3305,7 +3352,9 @@ static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id,
}
/* 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) {
@ -3314,7 +3363,9 @@ static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id,
/* 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);
@ -3355,6 +3406,7 @@ static void bta_dm_delay_role_switch_cback(TIMER_LIST_ENT *p_tle)
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr)
{
UINT16 index = 0;
@ -3374,7 +3426,7 @@ static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr)
}
} else {
BTM_SecDeleteDevice (remote_bd_addr);
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE)
/* need to remove all pending background connection */
BTA_GATTC_CancelOpen(0, remote_bd_addr, FALSE);
/* remove all cached GATT information */
@ -3382,6 +3434,7 @@ static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr)
#endif
}
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
@ -3474,6 +3527,7 @@ static void bta_dm_adjust_roles(BOOLEAN delay_role_switch)
**
** Returns char * - Pointer to the remote device name
*******************************************************************************/
#if (SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE)
static char *bta_dm_get_remname(void)
{
char *p_name = (char *)bta_dm_search_cb.peer_name;
@ -3487,6 +3541,7 @@ static char *bta_dm_get_remname(void)
return p_name;
}
#endif ///SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -3497,6 +3552,7 @@ static char *bta_dm_get_remname(void)
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
static void bta_dm_bond_cancel_complete_cback(tBTM_STATUS result)
{
@ -3512,6 +3568,7 @@ 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
/*******************************************************************************
**
@ -3781,6 +3838,7 @@ static void bta_dm_set_eir (char *local_name)
** Returns None
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
static void bta_dm_eir_search_services( tBTM_INQ_RESULTS *p_result,
tBTA_SERVICE_MASK *p_services_to_search,
tBTA_SERVICE_MASK *p_services_found)
@ -3839,6 +3897,7 @@ static void bta_dm_eir_search_services( tBTM_INQ_RESULTS *p_result,
APPL_TRACE_ERROR("BTA EIR search result, services_to_search=0x%08X, services_found=0x%08X",
*p_services_to_search, *p_services_found);
}
#endif ///SDP_INCLUDED == TRUE
#if (BTA_EIR_CANNED_UUID_LIST != TRUE)
/*******************************************************************************
@ -3987,6 +4046,7 @@ void bta_dm_encrypt_cback(BD_ADDR bd_addr, tBT_TRANSPORT transport, void *p_ref_
** Returns None
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
void bta_dm_set_encryption (tBTA_DM_MSG *p_data)
{
UINT8 i ;
@ -4018,6 +4078,7 @@ void bta_dm_set_encryption (tBTA_DM_MSG *p_data)
}
}
}
#endif ///SMP_INCLUDED == TRUE
#if (BLE_INCLUDED == TRUE)
/*******************************************************************************
@ -4217,7 +4278,6 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
}
return status;
}
#endif /* SMP_INCLUDED == TRUE */
/*******************************************************************************
**
@ -4354,6 +4414,7 @@ void bta_dm_security_grant (tBTA_DM_MSG *p_data)
{
BTM_SecurityGrant(p_data->ble_sec_grant.bd_addr, p_data->ble_sec_grant.res);
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -5187,11 +5248,11 @@ static void bta_ble_energy_info_cmpl(tBTM_BLE_TX_TIME_MS tx_time,
{
tBTA_STATUS st = (status == BTM_SUCCESS) ? BTA_SUCCESS : BTA_FAILURE;
tBTA_DM_CONTRL_STATE ctrl_state = 0;
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE)
if (BTA_SUCCESS == st) {
ctrl_state = bta_dm_pm_obtain_controller_state();
}
#endif
if (bta_dm_cb.p_energy_info_cback) {
bta_dm_cb.p_energy_info_cback(tx_time, rx_time, idle_time, energy_used, ctrl_state, st);
}
@ -5217,7 +5278,7 @@ void bta_dm_ble_get_energy_info(tBTA_DM_MSG *p_data)
}
}
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE)
#ifndef BTA_DM_GATT_CLOSE_DELAY_TOUT
#define BTA_DM_GATT_CLOSE_DELAY_TOUT 1000
#endif

View File

@ -276,6 +276,7 @@ void BTA_DmSearchCancel(void)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search)
{
@ -291,7 +292,6 @@ void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
p_msg->sdp_search = sdp_search;
bta_sys_sendmsg(p_msg);
}
}
/*******************************************************************************
@ -324,8 +324,8 @@ void BTA_DmDiscoverUUID(BD_ADDR bd_addr, tSDP_UUID *uuid,
memcpy( &p_msg->uuid, uuid, sizeof(tSDP_UUID) );
bta_sys_sendmsg(p_msg);
}
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
@ -338,6 +338,7 @@ void BTA_DmDiscoverUUID(BD_ADDR bd_addr, tSDP_UUID *uuid,
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
void BTA_DmBond(BD_ADDR bd_addr)
{
tBTA_DM_API_BOND *p_msg;
@ -429,7 +430,7 @@ void BTA_DmPinReply(BD_ADDR bd_addr, BOOLEAN accept, UINT8 pin_len, UINT8 *p_pin
}
#if (BTM_OOB_INCLUDED == TRUE)
#if (BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function BTA_DmLocalOob
@ -550,6 +551,7 @@ tBTA_STATUS BTA_DmRemoveDevice(BD_ADDR bd_addr)
return BTA_SUCCESS;
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -613,7 +615,7 @@ UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr )
return (p_dev && p_dev->conn_state == BTA_DM_CONNECTED);
}
#if (SDP_INCLUDED == TRUE)
/*******************************************************************************
** Device Identification (DI) Server Functions
*******************************************************************************/
@ -645,7 +647,7 @@ tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
return status;
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Function bta_dmexecutecallback
@ -685,10 +687,10 @@ void bta_dmexecutecallback (tBTA_DM_EXEC_CBACK *p_callback, void *p_param)
** 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) {
@ -702,7 +704,6 @@ void BTA_DmAddBleKey (BD_ADDR bd_addr, tBTA_LE_KEY_VALUE *p_le_key, tBTA_LE_KEY_
bta_sys_sendmsg(p_msg);
}
#endif
}
/*******************************************************************************
@ -722,7 +723,6 @@ void BTA_DmAddBleKey (BD_ADDR bd_addr, tBTA_LE_KEY_VALUE *p_le_key, tBTA_LE_KEY_
*******************************************************************************/
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) {
@ -735,7 +735,6 @@ void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, tBT_DEVICE_TY
bta_sys_sendmsg(p_msg);
}
#endif
}
/*******************************************************************************
**
@ -753,7 +752,6 @@ void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, tBT_DEVICE_TY
*******************************************************************************/
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) {
@ -768,7 +766,6 @@ void BTA_DmBlePasskeyReply(BD_ADDR bd_addr, BOOLEAN accept, UINT32 passkey)
}
bta_sys_sendmsg(p_msg);
}
#endif
}
/*******************************************************************************
**
@ -784,7 +781,6 @@ void BTA_DmBlePasskeyReply(BD_ADDR bd_addr, BOOLEAN accept, UINT32 passkey)
*******************************************************************************/
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));
@ -793,7 +789,6 @@ void BTA_DmBleConfirmReply(BD_ADDR bd_addr, BOOLEAN accept)
p_msg->accept = accept;
bta_sys_sendmsg(p_msg);
}
#endif
}
/*******************************************************************************
@ -810,7 +805,6 @@ void BTA_DmBleConfirmReply(BD_ADDR bd_addr, BOOLEAN accept)
*******************************************************************************/
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) {
@ -822,8 +816,9 @@ void BTA_DmBleSecurityGrant(BD_ADDR bd_addr, tBTA_DM_BLE_SEC_GRANT res)
bta_sys_sendmsg(p_msg);
}
#endif
}
#endif ///SMP_INCLUDED == TRUE
#endif ///BLE_INCLUDED == TRUE
/*******************************************************************************
@ -1393,7 +1388,7 @@ void BTA_DmBleSetBgConnType(tBTA_DM_BLE_CONN_TYPE bg_conn_type, tBTA_DM_BLE_SEL_
** Returns void
**
*******************************************************************************/
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE
static void bta_dm_discover_send_msg(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services,
tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search,
tBTA_TRANSPORT transport)
@ -1447,7 +1442,7 @@ void BTA_DmDiscoverByTransport(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_service
tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search,
tBTA_TRANSPORT transport)
{
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE
bta_dm_discover_send_msg(bd_addr, p_services, p_cback, sdp_search, transport);
#endif
}
@ -1471,7 +1466,7 @@ void BTA_DmDiscoverByTransport(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_service
void BTA_DmDiscoverExt(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services,
tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search)
{
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE
bta_dm_discover_send_msg(bd_addr, p_services, p_cback, sdp_search, BTA_TRANSPORT_UNKNOWN);
#endif
@ -2062,6 +2057,7 @@ void BTA_DmBleSetDataLength(BD_ADDR remote_device, UINT16 tx_data_length)
** 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)
{
@ -2081,6 +2077,7 @@ void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_DM_ENCR
bta_sys_sendmsg(p_msg);
}
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**

View File

@ -30,7 +30,7 @@
#include "bta_dm_ci.h"
#if (BTM_OOB_INCLUDED == TRUE)
#if (BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_dm_ci_io_req

View File

@ -57,22 +57,24 @@ enum {
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,
@ -80,11 +82,13 @@ enum {
#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,
@ -201,6 +205,7 @@ typedef struct {
#endif
} tBTA_DM_API_SEARCH;
#if (SDP_INCLUDED == TRUE)
/* data type for BTA_DM_API_DISCOVER_EVT */
typedef struct {
BT_HDR hdr;
@ -215,12 +220,15 @@ typedef struct {
#endif
tSDP_UUID uuid;
} tBTA_DM_API_DISCOVER;
#endif ///SDP_INCLUDED == TRUE
/* data type for BTA_DM_API_DI_DISC_EVT */
typedef struct {
BT_HDR hdr;
BD_ADDR bd_addr;
#if (SDP_INCLUDED == TRUE)
tBTA_DISCOVERY_DB *p_sdp_db;
#endif ///SDP_INCLUDED == TRUE
UINT32 len;
tBTA_DM_SEARCH_CBACK *p_cback;
} tBTA_DM_API_DI_DISC;
@ -675,9 +683,9 @@ typedef union {
tBTA_DM_API_REMOVE_DEVICE remove_dev;
tBTA_DM_API_SEARCH search;
#if (SDP_INCLUDED == TRUE)
tBTA_DM_API_DISCOVER discover;
#endif ///SDP_INCLUDED == TRUE
tBTA_DM_API_BOND bond;
tBTA_DM_API_BOND_CANCEL bond_cancel;
@ -870,8 +878,10 @@ typedef struct {
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 */
@ -918,7 +928,9 @@ typedef struct {
tBTA_SERVICE_MASK services;
tBTA_SERVICE_MASK services_to_search;
tBTA_SERVICE_MASK services_found;
#if (SDP_INCLUDED == TRUE)
tSDP_DISCOVERY_DB *p_sdp_db;
#endif ///SDP_INCLUDED == TRUE
UINT16 state;
BD_ADDR peer_bdaddr;
BOOLEAN name_discover_done;
@ -928,14 +940,16 @@ typedef struct {
tBTA_DM_MSG *p_search_queue; /* search or discover commands during search cancel stored here */
BOOLEAN wait_disc;
BOOLEAN sdp_results;
#if (SDP_INCLUDED == TRUE)
tSDP_UUID uuid;
#endif ///SDP_INCLUDED == TRUE
UINT8 peer_scn;
BOOLEAN sdp_search;
BOOLEAN cancel_pending; /* inquiry cancel is pending */
tBTA_TRANSPORT transport;
#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
tBTA_DM_SEARCH_CBACK *p_scan_cback;
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE)
tBTA_GATTC_IF client_if;
UINT8 num_uuid;
tBT_UUID *p_srvc_uuid;
@ -955,7 +969,9 @@ typedef struct {
/* DI control block */
typedef struct {
#if (SDP_INCLUDED == TRUE)
tSDP_DISCOVERY_DB *p_di_db; /* pointer to the DI discovery database */
#endif ///SDP_INCLUDED == TRUE
UINT8 di_num; /* total local DI record number */
UINT32 di_handle[BTA_DI_NUM_MAX]; /* local DI record handle, the first one is primary record */
} tBTA_DM_DI_CB;
@ -1152,10 +1168,14 @@ extern UINT8 bta_dm_get_av_count(void);
extern void bta_dm_search_start (tBTA_DM_MSG *p_data);
extern void bta_dm_search_cancel (tBTA_DM_MSG *p_data);
extern void bta_dm_discover (tBTA_DM_MSG *p_data);
#if (SDP_INCLUDED == TRUE)
extern void bta_dm_di_disc (tBTA_DM_MSG *p_data);
#endif ///SDP_INCLUDED == TRUE
extern void bta_dm_inq_cmpl (tBTA_DM_MSG *p_data);
extern void bta_dm_rmt_name (tBTA_DM_MSG *p_data);
#if (SDP_INCLUDED == TRUE)
extern void bta_dm_sdp_result (tBTA_DM_MSG *p_data);
#endif ///SDP_INCLUDED == TRUE
extern void bta_dm_search_cmpl (tBTA_DM_MSG *p_data);
extern void bta_dm_free_sdp_db (tBTA_DM_MSG *p_data);
extern void bta_dm_disc_result (tBTA_DM_MSG *p_data);

View File

@ -54,22 +54,23 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
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 */
@ -77,11 +78,13 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_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 */
@ -144,22 +147,34 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
enum {
BTA_DM_API_SEARCH, /* 0 bta_dm_search_start */
BTA_DM_API_SEARCH_CANCEL, /* 1 bta_dm_search_cancel */
#if (SDP_INCLUDED == TRUE)
BTA_DM_API_DISCOVER, /* 2 bta_dm_discover */
#endif ///SDP_INCLUDED == TRUE
BTA_DM_INQUIRY_CMPL, /* 3 bta_dm_inq_cmpl */
BTA_DM_REMT_NAME, /* 4 bta_dm_rmt_name */
#if (SDP_INCLUDED == TRUE)
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 */
#if (SDP_INCLUDED == TRUE)
BTA_DM_QUEUE_DISC, /* 11 bta_dm_queue_disc */
#endif ///SDP_INCLUDED == TRUE
BTA_DM_SEARCH_CLEAR_QUEUE, /* 12 bta_dm_search_clear_queue */
BTA_DM_SEARCH_CANCEL_CMPL, /* 13 bta_dm_search_cancel_cmpl */
BTA_DM_SEARCH_CANCEL_NOTIFY, /* 14 bta_dm_search_cancel_notify */
#if (SDP_INCLUDED == TRUE)
BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, /* 15 bta_dm_search_cancel_transac_cmpl */
#endif ///SDP_INCLUDED == TRUE
BTA_DM_DISC_RMT_NAME, /* 16 bta_dm_disc_rmt_name */
#if (SDP_INCLUDED == TRUE)
BTA_DM_API_DI_DISCOVER, /* 17 bta_dm_di_disc */
#endif ///SDP_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE
BTA_DM_CLOSE_GATT_CONN, /* 18 bta_dm_close_gatt_conn */
#endif
@ -172,23 +187,35 @@ const tBTA_DM_ACTION bta_dm_search_action[] = {
bta_dm_search_start, /* 0 BTA_DM_API_SEARCH */
bta_dm_search_cancel, /* 1 BTA_DM_API_SEARCH_CANCEL */
#if (SDP_INCLUDED == TRUE)
bta_dm_discover, /* 2 BTA_DM_API_DISCOVER */
#endif ///SDP_INCLUDED == TRUE
bta_dm_inq_cmpl, /* 3 BTA_DM_INQUIRY_CMPL */
bta_dm_rmt_name, /* 4 BTA_DM_REMT_NAME */
#if (SDP_INCLUDED == TRUE)
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 */
#if (SDP_INCLUDED == TRUE)
bta_dm_queue_disc, /* 11 BTA_DM_QUEUE_DISC */
#endif ///SDP_INCLUDED == TRUE
bta_dm_search_clear_queue, /* 12 BTA_DM_SEARCH_CLEAR_QUEUE */
bta_dm_search_cancel_cmpl, /* 13 BTA_DM_SEARCH_CANCEL_CMPL */
bta_dm_search_cancel_notify, /* 14 BTA_DM_SEARCH_CANCEL_NOTIFY */
#if (SDP_INCLUDED == TRUE)
bta_dm_search_cancel_transac_cmpl, /* 15 BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL */
#endif ///SDP_INCLUDED == TRUE
bta_dm_disc_rmt_name, /* 16 BTA_DM_DISC_RMT_NAME */
#if (SDP_INCLUDED == TRUE)
bta_dm_di_disc /* 17 BTA_DM_API_DI_DISCOVER */
#if BLE_INCLUDED == TRUE
#endif ///SDP_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && SDP_INCLUDED == TRUE
, bta_dm_close_gatt_conn
#endif
};
@ -207,15 +234,21 @@ const UINT8 bta_dm_search_idle_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
/* Event Action 1 Action 2 Next State */
/* API_SEARCH */ {BTA_DM_API_SEARCH, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
/* API_SEARCH_CANCEL */ {BTA_DM_SEARCH_CANCEL_NOTIFY, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#if (SDP_INCLUDED == TRUE)
/* API_SEARCH_DISC */ {BTA_DM_API_DISCOVER, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
#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},
/* API_DI_DISCOVER_EVT */ {BTA_DM_API_DI_DISCOVER, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE}
#if (SDP_INCLUDED == TRUE)
/* API_DI_DISCOVER_EVT */ {BTA_DM_API_DI_DISCOVER, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
#endif ///SDP_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE
/* DISC_CLOSE_TOUT_EVT */ , {BTA_DM_CLOSE_GATT_CONN, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE}
/* DISC_CLOSE_TOUT_EVT */ {BTA_DM_CLOSE_GATT_CONN, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#endif
};
const UINT8 bta_dm_search_search_active_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
@ -226,7 +259,9 @@ const UINT8 bta_dm_search_search_active_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
/* API_SEARCH_DISC */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
/* INQUIRY_CMPL */ {BTA_DM_INQUIRY_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
/* REMT_NAME_EVT */ {BTA_DM_REMT_NAME, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
#if (SDP_INCLUDED == TRUE)
/* SDP_RESULT_EVT */ {BTA_DM_SDP_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
#endif ///SDP_INCLUDED == TRUE
/* SEARCH_CMPL_EVT */ {BTA_DM_SEARCH_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
/* DISCV_RES_EVT */ {BTA_DM_SEARCH_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
/* API_DI_DISCOVER_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE}
@ -241,12 +276,16 @@ const UINT8 bta_dm_search_search_cancelling_st_table[][BTA_DM_SEARCH_NUM_COLS] =
/* Event Action 1 Action 2 Next State */
/* API_SEARCH */ {BTA_DM_QUEUE_SEARCH, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING},
/* API_SEARCH_CANCEL */ {BTA_DM_SEARCH_CLEAR_QUEUE, BTA_DM_SEARCH_CANCEL_NOTIFY, BTA_DM_SEARCH_CANCELLING},
#if (SDP_INCLUDED == TRUE)
/* API_SEARCH_DISC */ {BTA_DM_QUEUE_DISC, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING},
#endif ///SDP_INCLUDED == TRUE
/* INQUIRY_CMPL */ {BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#if (SDP_INCLUDED == TRUE)
/* REMT_NAME_EVT */ {BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IDLE},
/* SDP_RESULT_EVT */ {BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IDLE},
/* SEARCH_CMPL_EVT */ {BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IDLE},
/* DISCV_RES_EVT */ {BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IDLE},
#endif ///SDP_INCLUDED == TRUE
/* API_DI_DISCOVER_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING}
#if BLE_INCLUDED == TRUE
/* DISC_CLOSE_TOUT_EVT */ , {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING}
@ -262,7 +301,9 @@ const UINT8 bta_dm_search_disc_active_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
/* API_SEARCH_DISC */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
/* INQUIRY_CMPL */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
/* REMT_NAME_EVT */ {BTA_DM_DISC_RMT_NAME, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
#if (SDP_INCLUDED == TRUE)
/* SDP_RESULT_EVT */ {BTA_DM_SDP_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
#endif ///SDP_INCLUDED == TRUE
/* SEARCH_CMPL_EVT */ {BTA_DM_SEARCH_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
/* DISCV_RES_EVT */ {BTA_DM_DISC_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
/* API_DI_DISCOVER_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE}

View File

@ -32,6 +32,7 @@
#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,
@ -45,6 +46,7 @@ static void bta_dm_pm_hid_check(BOOLEAN bScoActive);
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)
@ -53,7 +55,6 @@ static void bta_dm_pm_stop_timer_by_index(tBTA_PM_TIMER *p_timer,
#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;
@ -700,7 +701,9 @@ static BOOLEAN bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE *p_peer_dev, UINT8 index)
#endif
BTM_ReadPowerMode(p_peer_dev->peer_bdaddr, &mode);
#if (BTM_SSR_INCLUDED == TRUE)
p_rem_feat = BTM_ReadRemoteFeatures (p_peer_dev->peer_bdaddr);
#endif ///BTM_SSR_INCLUDED == TRUE
#if (BTM_SSR_INCLUDED == TRUE)
APPL_TRACE_DEBUG("bta_dm_pm_sniff cur:%d, idx:%d, info:x%x", mode, index, p_peer_dev->info);
if (mode != BTM_PM_MD_SNIFF ||
@ -1013,6 +1016,8 @@ void bta_dm_pm_timer(tBTA_DM_MSG *p_data)
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
/*******************************************************************************
**
@ -1037,6 +1042,7 @@ tBTA_DM_PEER_DEVICE *bta_dm_find_peer_device(BD_ADDR peer_addr)
return p_dev;
}
#if (BTM_SSR_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_dm_is_sco_active
@ -1133,8 +1139,9 @@ static void bta_dm_pm_set_sniff_policy(tBTA_DM_PEER_DEVICE *p_dev, BOOLEAN bDisa
BTM_SetLinkPolicy(p_dev->peer_bdaddr, &policy_setting);
}
#endif ///BTM_SSR_INCLUDED == TRUE
#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE) && SDP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_dm_pm_obtain_controller_state
@ -1156,3 +1163,4 @@ tBTA_DM_CONTRL_STATE bta_dm_pm_obtain_controller_state(void)
return cur_state;
}
#endif

View File

@ -43,7 +43,7 @@
// #include "osi/include/log.h"
#if BTA_GATT_INCLUDED && BLE_INCLUDED == TRUE
#if GATTC_INCLUDED == TRUE && BLE_INCLUDED == TRUE
/*****************************************************************************
** Constants
@ -2199,4 +2199,4 @@ void bta_gattc_broadcast(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg)
}
}
#endif
#endif
#endif ///GATTC_INCLUDED == TRUE && BLE_INCLUDED == TRUE

View File

@ -24,7 +24,7 @@
#include "bt_target.h"
#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
#if defined(GATTC_INCLUDED) && (GATTC_INCLUDED == TRUE)
#include <string.h>
#include "gki.h"

View File

@ -25,7 +25,7 @@
#include "bt_target.h"
#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
#if defined(GATTC_INCLUDED) && (GATTC_INCLUDED == TRUE)
#include <string.h>
#include "utl.h"
@ -41,9 +41,10 @@
// #include "osi/include/log.h"
static void bta_gattc_char_dscpt_disc_cmpl(UINT16 conn_id, tBTA_GATTC_SERV *p_srvc_cb);
#if (SDP_INCLUDED == TRUE)
static tBTA_GATT_STATUS bta_gattc_sdp_service_disc(UINT16 conn_id, tBTA_GATTC_SERV *p_server_cb);
#define BTA_GATT_SDP_DB_SIZE 4096
#endif ///SDP_INCLUDED == TRUE
/*****************************************************************************
** Constants
@ -457,7 +458,9 @@ tBTA_GATT_STATUS bta_gattc_discover_pri_service(UINT16 conn_id, tBTA_GATTC_SERV
if (p_clcb->transport == BTA_TRANSPORT_LE) {
status = bta_gattc_discover_procedure(conn_id, p_server_cb, disc_type);
} else {
#if (SDP_INCLUDED == TRUE)
status = bta_gattc_sdp_service_disc(conn_id, p_server_cb);
#endif ///SDP_INCLUDED == TRUE
}
}
@ -786,6 +789,7 @@ static tBTA_GATT_STATUS bta_gattc_add_char_to_list(tBTA_GATTC_SERV *p_srvc_cb,
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_gattc_sdp_callback (UINT16 sdp_status)
{
tSDP_DISC_REC *p_sdp_rec = NULL;
@ -843,6 +847,8 @@ void bta_gattc_sdp_callback (UINT16 sdp_status)
bta_gattc_cb.p_sdp_db = NULL;
bta_gattc_cb.sdp_conn_id = 0;
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Function bta_gattc_sdp_service_disc
@ -852,6 +858,7 @@ void bta_gattc_sdp_callback (UINT16 sdp_status)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
static tBTA_GATT_STATUS bta_gattc_sdp_service_disc(UINT16 conn_id, tBTA_GATTC_SERV *p_server_cb)
{
tSDP_UUID uuid;
@ -882,6 +889,8 @@ static tBTA_GATT_STATUS bta_gattc_sdp_service_disc(UINT16 conn_id, tBTA_GATTC_SE
}
return status;
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Function bta_gattc_disc_res_cback
@ -1504,5 +1513,5 @@ BOOLEAN bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
return FALSE;
}
}
#endif /* BTA_GATT_INCLUDED */
#endif /* GATTC_INCLUDED */

View File

@ -24,7 +24,7 @@
#include "bt_target.h"
#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
#if defined(GATTC_INCLUDED) && (GATTC_INCLUDED == TRUE)
#include <string.h>
@ -133,4 +133,4 @@ void bta_gattc_ci_cache_save(BD_ADDR server_bda, UINT16 evt, tBTA_GATT_STATUS st
bta_sys_sendmsg(p_evt);
}
}
#endif /* BTA_GATT_INCLUDED */
#endif /* GATTC_INCLUDED */

View File

@ -24,7 +24,7 @@
#include "bt_target.h"
#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
#if (GATTC_INCLUDED == TRUE && BLE_INCLUDED == TRUE)
#include <string.h>
@ -522,4 +522,4 @@ static char *gattc_state_code(tBTA_GATTC_STATE state_code)
}
#endif /* Debug Functions */
#endif /* BTA_GATT_INCLUDED */
#endif /* GATTC_INCLUDED == TRUE && BLE_INCLUDED == TRUE */

View File

@ -24,7 +24,7 @@
#include "bt_target.h"
#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
#if defined(GATTC_INCLUDED) && (GATTC_INCLUDED == TRUE)
#include <string.h>

View File

@ -26,7 +26,7 @@
#include "bt_target.h"
#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
#if defined(GATTS_INCLUDED) && (GATTS_INCLUDED == TRUE)
#include "utl.h"
#include "gki.h"
@ -963,4 +963,4 @@ static void bta_gatts_cong_cback (UINT16 conn_id, BOOLEAN congested)
}
}
}
#endif /* BTA_GATT_INCLUDED */
#endif /* GATTS_INCLUDED */

View File

@ -24,7 +24,7 @@
#include "bt_target.h"
#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
#if defined(GATTS_INCLUDED) && (GATTS_INCLUDED == TRUE)
#include <string.h>
#include "gki.h"

View File

@ -24,7 +24,7 @@
#include "bt_target.h"
#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
#if defined(GATTS_INCLUDED) && (GATTS_INCLUDED == TRUE)
#include <string.h>
@ -136,4 +136,4 @@ BOOLEAN bta_gatts_hdl_event(BT_HDR *p_msg)
return (TRUE);
}
#endif /* BTA_GATT_INCLUDED */
#endif /* GATTS_INCLUDED */

View File

@ -24,7 +24,7 @@
#include "bt_target.h"
#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
#if defined(GATTS_INCLUDED) && (GATTS_INCLUDED == TRUE)
#include <string.h>
#include "utl.h"
@ -222,4 +222,4 @@ BOOLEAN bta_gatts_uuid_compare(tBT_UUID tar, tBT_UUID src)
#endif
#endif /* GATTS_INCLUDED */

View File

@ -26,6 +26,9 @@
#include "bt_target.h"
#include "bta_hh_api.h"
#if defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
/* max number of device types supported by BTA */
#define BTA_HH_MAX_DEVT_SPT 9
@ -58,3 +61,4 @@ const tBTA_HH_CFG bta_hh_cfg = {
tBTA_HH_CFG *p_bta_hh_cfg = (tBTA_HH_CFG *) &bta_hh_cfg;
#endif ///defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)

View File

@ -32,6 +32,7 @@
//#if BTA_HH_LE_INCLUDED == TRUE
#include "bta_gatt_api.h"
//#endif
#if defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
/* can be moved to bta_api.h */
#define BTA_HH_MAX_RPT_CHARS 8
@ -395,5 +396,6 @@ extern void bta_hh_ci_load_rpt (tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_trace_dev_db(void);
#endif
#endif ///defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
#endif

View File

@ -635,7 +635,7 @@ typedef struct {
} tBTA_DM_PIN_REQ;
/* BLE related definition */
#if (SMP_INCLUDED == TRUE)
#define BTA_DM_AUTH_FAIL_BASE (HCI_ERR_MAX_ERR + 10)
#define BTA_DM_AUTH_CONVERT_SMP_CODE(x) (BTA_DM_AUTH_FAIL_BASE + (x))
#define BTA_DM_AUTH_SMP_PASSKEY_FAIL BTA_DM_AUTH_CONVERT_SMP_CODE (SMP_PASSKEY_ENTRY_FAIL)
@ -655,7 +655,7 @@ typedef struct {
#define BTA_DM_AUTH_SMP_BUSY (BTA_DM_AUTH_FAIL_BASE + SMP_BUSY)
#define BTA_DM_AUTH_SMP_ENC_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_FAIL)
#define BTA_DM_AUTH_SMP_RSP_TIMEOUT (BTA_DM_AUTH_FAIL_BASE + SMP_RSP_TIMEOUT)
#endif ///SMP_INCLUDED == TRUE
/* connection parameter boundary value and dummy value */
#define BTA_DM_BLE_SCAN_INT_MIN BTM_BLE_SCAN_INT_MIN
#define BTA_DM_BLE_SCAN_INT_MAX BTM_BLE_SCAN_INT_MAX
@ -668,13 +668,14 @@ typedef struct {
#define BTA_DM_BLE_CONN_SUP_TOUT_MAX BTM_BLE_CONN_SUP_TOUT_MAX
#define BTA_DM_BLE_CONN_PARAM_UNDEF BTM_BLE_CONN_PARAM_UNDEF /* use this value when a specific value not to be overwritten */
#if (SMP_INCLUDED == TRUE)
#define BTA_LE_KEY_PENC BTM_LE_KEY_PENC /* encryption information of peer device */
#define BTA_LE_KEY_PID BTM_LE_KEY_PID /* identity key of the peer device */
#define BTA_LE_KEY_PCSRK BTM_LE_KEY_PCSRK /* peer SRK */
#define BTA_LE_KEY_LENC BTM_LE_KEY_LENC /* master role security information:div */
#define BTA_LE_KEY_LID BTM_LE_KEY_LID /* master device ID key */
#define BTA_LE_KEY_LCSRK BTM_LE_KEY_LCSRK /* local CSRK has been deliver to peer */
#endif ///SMP_INCLUDED == TRUE
typedef UINT8 tBTA_LE_KEY_TYPE; /* can be used as a bit mask */
@ -702,10 +703,11 @@ typedef struct {
BT_OCTET16 irk;
BT_OCTET16 dhk;
} tBTA_BLE_LOCAL_ID_KEYS;
#if (SMP_INCLUDED == TRUE)
#define BTA_DM_SEC_GRANTED BTA_SUCCESS
#define BTA_DM_SEC_PAIR_NOT_SPT BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT
#define BTA_DM_SEC_REP_ATTEMPTS BTA_DM_AUTH_SMP_REPEATED_ATTEMPT
#endif ///SMP_INCLUDED == TRUE
typedef UINT8 tBTA_DM_BLE_SEC_GRANT;
@ -810,6 +812,7 @@ typedef tBTM_AUTH_REQ tBTA_AUTH_REQ;
#define BTA_AUTH_GEN_BOND BTM_AUTH_SPGB_NO /* 4 this bit is set for general bonding */
#define BTA_AUTH_BONDS BTM_AUTH_BONDS /* 6 the general/dedicated bonding bits */
#if (SMP_INCLUDED == TRUE)
#define BTA_LE_AUTH_NO_BOND BTM_LE_AUTH_REQ_NO_BOND /* 0*/
#define BTA_LE_AUTH_BOND BTM_LE_AUTH_REQ_BOND /* 1 << 0 */
#define BTA_LE_AUTH_REQ_MITM BTM_LE_AUTH_REQ_MITM /* 1 << 2 */
@ -818,6 +821,7 @@ typedef tBTM_AUTH_REQ tBTA_AUTH_REQ;
#define BTA_LE_AUTH_REQ_SC_BOND BTM_LE_AUTH_REQ_SC_BOND /* 1001 */
#define BTA_LE_AUTH_REQ_SC_MITM BTM_LE_AUTH_REQ_SC_MITM /* 1100 */
#define BTA_LE_AUTH_REQ_SC_MITM_BOND BTM_LE_AUTH_REQ_SC_MITM_BOND /* 1101 */
#endif ///SMP_INCLUDED == TRUE
typedef tBTM_LE_AUTH_REQ tBTA_LE_AUTH_REQ; /* combination of the above bit pattern */
#define BTA_OOB_NONE BTM_OOB_NONE
@ -1285,7 +1289,7 @@ typedef void (tBTA_DM_SWITCH_CBACK)(tBTA_DM_SWITCH_EVT event, tBTA_STATUS status
typedef UINT8 tBTA_DM_ROUTE_PATH;
#if (SDP_INCLUDED == TRUE)
/* Device Identification (DI) data structure
*/
/* Used to set the DI record */
@ -1294,6 +1298,7 @@ typedef tSDP_DI_RECORD tBTA_DI_RECORD;
typedef tSDP_DI_GET_RECORD tBTA_DI_GET_RECORD;
/* SDP discovery database */
typedef tSDP_DISCOVERY_DB tBTA_DISCOVERY_DB;
#endif ///SDP_INCLUDED == TRUE
#ifndef BTA_DI_NUM_MAX
#define BTA_DI_NUM_MAX 3
@ -1446,9 +1451,9 @@ extern void BTA_DmSearchCancel(void);
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
extern void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
// btla-specific ++
/*******************************************************************************
**
@ -1463,7 +1468,7 @@ extern void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
*******************************************************************************/
extern void BTA_DmDiscoverUUID(BD_ADDR bd_addr, tSDP_UUID *uuid,
tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Function BTA_DmGetCachedRemoteName
@ -1619,7 +1624,7 @@ extern void BTA_GetEirService( UINT8 *p_eir, tBTA_SERVICE_MASK *p_services );
*******************************************************************************/
extern UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr );
#if (SDP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function BTA_DmSetLocalDiRecord
@ -1631,7 +1636,7 @@ extern UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr );
*******************************************************************************/
extern tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
UINT32 *p_handle );
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
**

View File

@ -33,6 +33,8 @@
#include "bta_av_api.h"
#include "bta_sys.h"
#if (BTA_AR_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
@ -137,4 +139,6 @@ extern void bta_ar_dereg_avrc(UINT16 service_uuid, tBTA_SYS_ID sys_id);
}
#endif
#endif ///BTA_AR_INCLUDED == TRUE
#endif /* BTA_AR_API_H */

View File

@ -31,6 +31,8 @@
#include "a2d_api.h"
#include "bta_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
@ -805,4 +807,6 @@ void BTA_AvMetaCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_CMD cmd_code, BT_HDR *p
}
#endif
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_API_H */

View File

@ -26,6 +26,8 @@
#include "bta_av_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*****************************************************************************
** Function Declarations
*****************************************************************************/
@ -70,4 +72,6 @@ extern void bta_av_ci_setconfig(tBTA_AV_HNDL hndl, UINT8 err_code,
}
#endif
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_CI_H */

View File

@ -27,6 +27,8 @@
#include "l2c_api.h"
#include "bta_av_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
@ -386,4 +388,6 @@ extern void bta_av_co_audio_delay(tBTA_AV_HNDL hndl, UINT16 delay);
*******************************************************************************/
extern void bta_av_co_video_delay(tBTA_AV_HNDL hndl, UINT16 delay);
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_CO_H */

View File

@ -25,6 +25,8 @@
#ifndef BTA_AV_SBC_H
#define BTA_AV_SBC_H
#if (BTA_AV_INCLUDED == TRUE)
/*****************************************************************************
** constants
*****************************************************************************/
@ -215,5 +217,7 @@ extern UINT8 bta_av_sbc_cfg_matches_cap(UINT8 *p_cfg, tA2D_SBC_CIE *p_cap);
*******************************************************************************/
extern void bta_av_sbc_bld_hdr(BT_HDR *p_buf, UINT16 fr_per_pkt);
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_SBC_H */

View File

@ -320,7 +320,7 @@ typedef struct {
} tBTA_GATTC_SERV;
#ifndef BTA_GATTC_NOTIF_REG_MAX
#define BTA_GATTC_NOTIF_REG_MAX 15
#define BTA_GATTC_NOTIF_REG_MAX 7//15
#endif
typedef struct {
@ -398,8 +398,9 @@ typedef struct {
tBTA_GATTC_CLCB clcb[BTA_GATTC_CLCB_MAX];
tBTA_GATTC_SERV known_server[BTA_GATTC_KNOWN_SR_MAX];
#if (SDP_INCLUDED == TRUE)
tSDP_DISCOVERY_DB *p_sdp_db;
#endif ///SDP_INCLUDED == TRUE
UINT16 sdp_conn_id;
} tBTA_GATTC_CB;

View File

@ -20,6 +20,7 @@
#include "bta_api.h"
#include "hidh_api.h"
#if defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
#include "gatt_api.h"
@ -538,4 +539,7 @@ extern void bta_hh_le_hid_read_rpt_clt_cfg(BD_ADDR bd_addr, UINT8 rpt_id);
}
#endif
#endif ///defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
#endif /* BTA_HH_API_H */

View File

@ -30,6 +30,7 @@
#include "bta_api.h"
#include "btm_api.h"
#if (SDP_INCLUDED == TRUE)
/* status values */
#define BTA_SDP_SUCCESS 0 /* Successful operation. */
#define BTA_SDP_FAILURE 1 /* Generic failure. */
@ -70,7 +71,9 @@ typedef void (tBTA_SDP_DM_CBACK)(tBTA_SDP_EVT event, tBTA_SDP *p_data, void *use
/* MCE configuration structure */
typedef struct {
UINT16 sdp_db_size; /* The size of p_sdp_db */
#if (SDP_INCLUDED == TRUE)
tSDP_DISCOVERY_DB *p_sdp_db; /* The data buffer to keep SDP database */
#endif ///SDP_INCLUDED == TRUE
} tBTA_SDP_CFG;
#ifdef __cplusplus
@ -139,4 +142,6 @@ extern tBTA_SDP_STATUS BTA_SdpRemoveRecordByUser(void *user_data);
}
#endif
#endif ///SDP_INCLUDED == TRUE
#endif /* BTA_SDP_API_H */

View File

@ -39,7 +39,8 @@
#include "btm_int.h"
#include "sdp_api.h"
#if defined(BTA_SDP_INCLUDED) && (BTA_SDP_INCLUDED == TRUE)
#if (SDP_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
@ -545,4 +546,4 @@ void bta_sdp_remove_record(tBTA_SDP_MSG *p_data)
}
}
#endif /* #if defined(BTA_SDP_INCLUDED) && (BTA_SDP_INCLUDED == TRUE) */
#endif ///SDP_INCLUDED == TRUE

View File

@ -31,6 +31,7 @@
#include "bta_api.h"
#include "bta_sdp_api.h"
#if (SDP_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
@ -105,4 +106,7 @@ extern void bta_sdp_search (tBTA_SDP_MSG *p_data);
extern void bta_sdp_create_record(tBTA_SDP_MSG *p_data);
extern void bta_sdp_remove_record(tBTA_SDP_MSG *p_data);
#endif ///SDP_INCLUDED == TRUE
#endif /* BTA_SDP_INT_H */

View File

@ -20,6 +20,8 @@
#include "btc_ble_storage.h"
#include "bta_gatts_co.h"
#if (SMP_INCLUDED == TRUE)
btc_dm_pairing_cb_t pairing_cb;
btc_dm_local_key_cb_t ble_local_key_cb;
@ -485,4 +487,6 @@ void btc_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET1
}
LOG_DEBUG("%s *p_key_mask=0x%02x",__func__, *p_key_mask);
}
#endif ///SMP_INCLUDED == TRUE

View File

@ -113,6 +113,7 @@ static void btc_disable_bluetooth_evt(void)
future_ready(*btc_main_get_future_p(BTC_MAIN_DISABLE_FUTURE), FUTURE_SUCCESS);
}
#if (SMP_INCLUDED == TRUE)
static void btc_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
{
/* Save link key, if not temporary */
@ -147,7 +148,9 @@ static void btc_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
LOG_DEBUG("%s, authentication status = %x", __func__, status);
return;
}
#endif ///SMP_INCLUDED == TRUE
static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
{
@ -303,8 +306,10 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
case BTA_DM_ENABLE_EVT: {
btc_clear_services_mask();
btc_storage_load_bonded_devices();
#if (SMP_INCLUDED == TRUE)
//load the ble local key whitch has been store in the flash
btc_dm_load_ble_local_keys();
#endif ///SMP_INCLUDED == TRUE
btc_enable_bluetooth_evt(p_data->enable.status);
break;
}
@ -334,7 +339,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
case BTA_DM_LINK_DOWN_EVT:
case BTA_DM_HW_ERROR_EVT:
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
#if (defined(BLE_INCLUDED) && (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;

View File

@ -90,8 +90,10 @@ static bt_status_t btc_in_fetch_bonded_devices(int add)
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 {

View File

@ -42,12 +42,18 @@ static xQueueHandle xBtcQueue = 0;
static btc_func_t profile_tab[BTC_PID_NUM] = {
[BTC_PID_MAIN_INIT] = {btc_main_call_handler, NULL },
[BTC_PID_DEV] = {btc_dev_call_handler, NULL },
#if (GATTS_INCLUDED == TRUE)
[BTC_PID_GATTS] = {btc_gatts_call_handler, btc_gatts_cb_handler },
#endif ///GATTS_INCLUDED == TRUE
#if (GATTC_INCLUDED == TRUE)
[BTC_PID_GATTC] = {btc_gattc_call_handler, btc_gattc_cb_handler },
#endif ///GATTC_INCLUDED == TRUE
[BTC_PID_GAP_BLE] = {btc_gap_ble_call_handler, btc_gap_ble_cb_handler },
[BTC_PID_BLE_HID] = {NULL, NULL},
[BTC_PID_SPPLIKE] = {NULL, NULL},
#if (GATTS_INCLUDED == TRUE)
[BTC_PID_BLUFI] = {btc_blufi_call_handler, btc_blufi_cb_handler },
#endif ///GATTS_INCLUDED == TRUE
[BTC_PID_DM_SEC] = {NULL, btc_dm_sec_cb_handler },
[BTC_PID_ALARM] = {btc_alarm_handler, NULL },
#if CONFIG_CLASSIC_BT_ENABLED

View File

@ -15,7 +15,7 @@
#include "bt_types.h"
#include "bt_target.h"
#if (SMP_INCLUDED == TRUE)
#define BTC_LE_LOCAL_KEY_IR (1<<0)
#define BTC_LE_LOCAL_KEY_IRK (1<<1)
#define BTC_LE_LOCAL_KEY_DHK (1<<2)
@ -120,4 +120,5 @@ bt_status_t btc_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
void btc_dm_load_ble_local_keys(void);
void btc_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET16 er,
tBTA_BLE_LOCAL_ID_KEYS *p_id_keys);
tBTA_BLE_LOCAL_ID_KEYS *p_id_keys);
#endif ///SMP_INCLUDED == TRUE

View File

@ -38,7 +38,9 @@ typedef enum {
BTC_PID_MAIN_INIT = 0,
BTC_PID_DEV,
BTC_PID_GATTS,
#if (GATTC_INCLUDED == TRUE)
BTC_PID_GATTC,
#endif ///GATTC_INCLUDED == TRUE
BTC_PID_GAP_BLE,
BTC_PID_BLE_HID,
BTC_PID_SPPLIKE,

View File

@ -35,6 +35,8 @@
#include "esp_blufi_api.h"
#if (GATTS_INCLUDED == TRUE)
#define BT_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x"
#define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
@ -917,3 +919,5 @@ uint16_t btc_blufi_get_version(void)
{
return BTC_BLUFI_VERSION;
}
#endif ///GATTS_INCLUDED == TRUE

View File

@ -35,6 +35,7 @@
#include "esp_wifi.h"
#if (GATTS_INCLUDED == TRUE)
extern tBLUFI_ENV blufi_env;
void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len)
@ -247,3 +248,5 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len)
break;
}
}
#endif ///(GATTS_INCLUDED == TRUE)

View File

@ -17,6 +17,7 @@
#include "btc_media.h"
#if (BTA_AV_INCLUDED == TRUE)
/*******************************************************************************
** Constants & Macros
********************************************************************************/
@ -166,4 +167,6 @@ BOOLEAN bta_av_co_peer_cp_supported(tBTA_AV_HNDL hndl);
*******************************************************************************/
BOOLEAN bta_av_co_get_remote_bitpool_pref(UINT8 *min, UINT8 *max);
#endif ///BTA_AV_INCLUDED == TRUE
#endif

View File

@ -568,6 +568,7 @@ static void btc_stop_scan_callback(tBTA_STATUS status)
}
}
#if (SMP_INCLUDED == TRUE)
static void btc_set_encryption_callback(BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_STATUS enc_status)
{
UNUSED(bd_addr);
@ -575,7 +576,7 @@ static void btc_set_encryption_callback(BD_ADDR bd_addr, tBTA_TRANSPORT transpor
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,
@ -881,10 +882,12 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
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;
}
@ -928,11 +931,13 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
break;
}
case BTC_GAP_BLE_SECURITY_RSP_EVT: {
#if (SMP_INCLUDED == TRUE)
BD_ADDR bd_addr;
tBTA_DM_BLE_SEC_GRANT res = arg->sec_rsp.accept ? BTA_DM_SEC_GRANTED : BTA_DM_SEC_PAIR_NOT_SPT;
memcpy(bd_addr, arg->sec_rsp.bd_addr, sizeof(BD_ADDR));
BTA_DmBleSecurityGrant(bd_addr, res);
break;
#endif ///SMP_INCLUDED == TRUE
}
default:
break;

View File

@ -22,6 +22,7 @@
#include "bt_trace.h"
#include "esp_gattc_api.h"
#if (GATTC_INCLUDED == TRUE)
static inline void btc_gattc_cb_to_app(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param)
{
esp_gattc_cb_t btc_gattc_cb = (esp_gattc_cb_t )btc_profile_cb_get(BTC_PID_GATTC);
@ -699,3 +700,5 @@ void btc_gattc_cb_handler(btc_msg_t *msg)
// free the deep-copied data
btc_gattc_free_req_data(msg);
}
#endif ///GATTC_INCLUDED == TRUE

View File

@ -24,6 +24,8 @@
#include "btc_main.h"
#include "esp_gatts_api.h"
#if (GATTS_INCLUDED == TRUE)
#define A2C_GATTS_EVT(_bta_event) (_bta_event) //BTA TO BTC EVT
#define C2A_GATTS_EVT(_btc_event) (_btc_event) //BTC TO BTA EVT
@ -779,3 +781,5 @@ void btc_gatts_cb_handler(btc_msg_t *msg)
btc_gatts_cb_param_copy_free(msg, p_data);
}
#endif ///GATTS_INCLUDED

View File

@ -25,7 +25,7 @@
#ifndef HID_CONN_H
#define HID_CONN_H
#if (HID_HOST_INCLUDED == TRUE)
/* Define the HID Connection Block
*/
typedef struct hid_conn {
@ -65,4 +65,5 @@ typedef struct hid_conn {
#define HIDD_SEC_CHN 3
#define HIDD_NOSEC_CHN 4
#endif ///HID_HOST_INCLUDED == TRUE
#endif

View File

@ -29,6 +29,8 @@
#include "hid_conn.h"
#include "l2c_api.h"
#if (HID_HOST_INCLUDED == TRUE)
enum {
HID_DEV_NO_CONN,
HID_DEV_CONNECTED
@ -88,4 +90,6 @@ extern tHID_HOST_CTB *hidh_cb_ptr;
}
#endif
#endif ///HID_HOST_INCLUDED == TRUE
#endif

View File

@ -31,7 +31,7 @@
#include "btc_sm.h"
#include "bta_av_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*******************************************************************************
** Type definitions for callback functions
********************************************************************************/
@ -171,4 +171,6 @@ BOOLEAN btc_av_is_peer_edr(void);
********************************************************************************/
void btc_av_clear_remote_suspend_flag(void);
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* __BTC_AV_H__ */

View File

@ -32,7 +32,7 @@
#include "a2d_api.h"
#include "a2d_sbc.h"
#if (BTC_AV_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
@ -198,4 +198,6 @@ typedef struct {
}
#endif
#endif ///BTC_AV_INCLUDED == TRUE
#endif /* __BTC_AV_API_H__ */

View File

@ -23,6 +23,7 @@
#include "bt_types.h"
#include "bta_av_api.h"
#if (BTC_AV_INCLUDED == TRUE)
#ifndef BTC_AVRC_TGT_INCLUDED
#define BTC_AVRC_TGT_INCLUDED FALSE
#endif
@ -71,4 +72,6 @@ BOOLEAN btc_rc_get_connected_peer(BD_ADDR peer_addr);
********************************************************************************/
void btc_avrc_call_handler(btc_msg_t *msg);
#endif ///BTC_AV_INCLUDED == TRUE
#endif /* __BTC_AVRC_H__ */

View File

@ -28,6 +28,7 @@
#include "gki.h"
#include "btc_av_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*******************************************************************************
** Constants
@ -263,5 +264,5 @@ void btc_reset_decoder(UINT8 *p_av);
int btc_a2dp_get_track_frequency(UINT8 frequency);
int btc_a2dp_get_track_channel_count(UINT8 channeltype);
void btc_a2dp_set_peer_sep(UINT8 sep);
#endif ///BTA_AV_INCLUDED == TRUE
#endif

View File

@ -22,15 +22,15 @@
#include "bta_sys.h"
#include "bta_dm_co.h"
#include "bta_dm_ci.h"
#include "btc_ble_storage.h"
#if (defined(BTIF_INCLUDED) && BTIF_INCLUDED == TRUE)
#include "bt_utils.h"
#if (BTM_OOB_INCLUDED == TRUE)
#include "btif_dm.h"
#endif
#endif /* #if (defined(BTIF_INCLUDED) && BTIF_INCLUDED == TRUE) */
#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
#include "bte_appl.h"
#include "btc_ble_storage.h"
tBTE_APPL_CFG bte_appl_cfg = {
#if SMP_INCLUDED == TRUE
BTA_LE_AUTH_REQ_SC_MITM_BOND, // Authentication requirements
@ -369,12 +369,14 @@ void bta_dm_co_le_io_key_req(BD_ADDR bd_addr, UINT8 *p_max_key_size,
tBTA_LE_KEY_TYPE *p_resp_key )
{
UNUSED(bd_addr);
#if (SMP_INCLUDED == TRUE)
BTIF_TRACE_ERROR("##################################");
BTIF_TRACE_ERROR("bta_dm_co_le_io_key_req: only setting max size to 16");
BTIF_TRACE_ERROR("##################################");
*p_max_key_size = 16;
*p_init_key = *p_resp_key =
(BTA_LE_KEY_PENC | BTA_LE_KEY_PID | BTA_LE_KEY_PCSRK | BTA_LE_KEY_LENC | BTA_LE_KEY_LID | BTA_LE_KEY_LCSRK);
#endif ///SMP_INCLUDED == TRUE
}
@ -398,10 +400,11 @@ void bta_dm_co_ble_load_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OC
BTIF_TRACE_DEBUG("bta_dm_co_ble_load_local_keys: Load local keys if any are persisted");
BTIF_TRACE_DEBUG("##################################");
btif_dm_get_ble_local_keys( p_key_mask, er, p_id_keys);
#else
#endif ///defined(BTIF_INCLUDED) && BTIF_INCLUDED == TRUE
#if (SMP_INCLUDED == TRUE)
btc_dm_get_ble_local_keys( p_key_mask, er, p_id_keys);
LOG_WARN("bta_dm_co_ble_load_local_keys: func not ported\n");
#endif
#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
@ -429,6 +432,7 @@ void bta_dm_co_ble_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap,
tBTA_LE_KEY_TYPE *p_init_key,
tBTA_LE_KEY_TYPE *p_resp_key )
{
#if (SMP_INCLUDED == TRUE)
UNUSED(bd_addr);
/* if OOB is not supported, this call-out function does not need to do anything
* otherwise, look for the OOB data associated with the address and set *p_oob_data accordingly
@ -458,41 +462,52 @@ void bta_dm_co_ble_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap,
if (bte_appl_cfg.ble_max_key_size > 7 && bte_appl_cfg.ble_max_key_size <= 16) {
*p_max_key_size = bte_appl_cfg.ble_max_key_size;
}
#endif ///SMP_INCLUDED == TRUE
}
void bta_dm_co_ble_set_io_cap(UINT8 ble_io_cap)
{
#if (SMP_INCLUDED == TRUE)
if(ble_io_cap < BTM_IO_CAP_MAX ) {
bte_appl_cfg.ble_io_cap = ble_io_cap;
} else {
APPL_TRACE_ERROR("%s error:Invalid io cap value.",__func__);
}
#endif ///SMP_INCLUDED == TRUE
}
void bta_dm_co_ble_set_auth_req(UINT8 ble_auth_req)
{
#if (SMP_INCLUDED == TRUE)
bte_appl_cfg.ble_auth_req = ble_auth_req;
#endif ///SMP_INCLUDED == TRUE
}
void bta_dm_co_ble_set_init_key_req(UINT8 init_key)
{
#if (SMP_INCLUDED == TRUE)
init_key &= 0x0f; // 4~7bit reservd, only used the 0~3bit
bte_appl_cfg.ble_init_key &= init_key;
#endif ///SMP_INCLUDED == TRUE
}
void bta_dm_co_ble_set_rsp_key_req(UINT8 rsp_key)
{
#if (SMP_INCLUDED == TRUE)
rsp_key &= 0x0f; // 4~7bit reservd, only used the 0~3bit
bte_appl_cfg.ble_init_key &= rsp_key;
#endif ///SMP_INCLUDED == TRUE
}
void bta_dm_co_ble_set_max_key_size(UINT8 ble_key_size)
{
#if (SMP_INCLUDED == TRUE)
if(ble_key_size > 7 && ble_key_size >= 16) {
bte_appl_cfg.ble_max_key_size = ble_key_size;
} else {
APPL_TRACE_ERROR("%s error:Invalid key size value, key_size =%d",__func__, ble_key_size);
}
#endif ///SMP_INCLUDED == TRUE
}
#endif

View File

@ -27,7 +27,7 @@
#include "btm_int.h"
#if( defined BLE_INCLUDED ) && (BLE_INCLUDED == TRUE)
#if( defined BTA_GATT_INCLUDED ) && (BTA_GATT_INCLUDED == TRUE)
#if( defined BTA_GATT_INCLUDED ) && (GATTC_INCLUDED == TRUE)
#define GATT_CACHE_PREFIX "/data/misc/bluedroid/gatt_cache_"

View File

@ -19,7 +19,7 @@
#include "bta_api.h"
#if( defined BLE_INCLUDED ) && (BLE_INCLUDED == TRUE)
#if( defined BTA_GATT_INCLUDED ) && (BTA_GATT_INCLUDED == TRUE)
#if( defined GATTS_INCLUDED ) && (GATTS_INCLUDED == TRUE)
#include <stdlib.h>
#include <string.h>

View File

@ -21,6 +21,7 @@
#include <stdbool.h>
#include "bt_defs.h"
#include "bt_target.h"
typedef enum {
// Disable secure connections

View File

@ -26,6 +26,7 @@
#define CASE_RETURN_STR(const) case const: return #const;
#if (SMP_INCLUDED == TRUE)
static const char *interop_feature_string(const interop_feature_t feature)
{
switch (feature) {
@ -37,7 +38,6 @@ static const char *interop_feature_string(const interop_feature_t feature)
}
// Interface functions
bool interop_match(const interop_feature_t feature, const bt_bdaddr_t *addr)
{
assert(addr);
@ -56,3 +56,4 @@ bool interop_match(const interop_feature_t feature, const bt_bdaddr_t *addr)
return false;
}
#endif ///SMP_INCLUDED == TRUE

View File

@ -195,7 +195,7 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
packet->offset++;
packet->len--;
if (type == HCI_BLE_EVENT) {
uint8_t len;
uint8_t len = 0;
STREAM_TO_UINT8(len, stream);
LOG_ERROR("Workround stream corrupted during LE SCAN: pkt_len=%d ble_event_len=%d\n",
packet->len, len);

View File

@ -42,7 +42,7 @@
#include "dyn_mem.h" /* defines static and/or dynamic memory for components */
#if CONFIG_CLASSIC_BT_ENABLED
#define CLASSIC_BT_INCLUDED TRUE
#define BTA_SDP_INCLUDED TRUE
#define BTA_PAN_INCLUDED FALSE
#define BTA_HH_INCLUDED FALSE
@ -66,7 +66,7 @@
#define BTC_AV_INCLUDED TRUE
#else /* #if CONFIG_CLASSIC_BT_ENABLED */
#define CLASSIC_BT_INCLUDED FALSE
#define BTA_SDP_INCLUDED FALSE
#define BTA_PAN_INCLUDED FALSE
#define BTA_HH_INCLUDED FALSE
@ -91,6 +91,31 @@
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
#if (CONFIG_GATTS_ENABLE)
#define GATTS_INCLUDED TRUE
#else
#define GATTS_INCLUDED FALSE
#endif /* CONFIG_GATTS_ENABLE */
#if (CONFIG_GATTC_ENABLE)
#define GATTC_INCLUDED TRUE
#else
#define GATTC_INCLUDED FALSE
#endif /* CONFIG_GATTC_ENABLE */
#if (CONFIG_SMP_ENABLE)
#define SMP_INCLUDED TRUE
#define BLE_PRIVACY_SPT TRUE
#else
#define SMP_INCLUDED FALSE
#define BLE_PRIVACY_SPT FALSE
#endif /* CONFIG_GATTC_ENABLE */
#if (CONFIG_BT_ACL_CONNECTIONS)
#define MAX_ACL_CONNECTIONS CONFIG_BT_ACL_CONNECTIONS
#define GATT_MAX_PHY_CHANNEL CONFIG_BT_ACL_CONNECTIONS
#endif /* CONFIG_BT_ACL_CONNECTIONS */
//------------------Added from bdroid_buildcfg.h---------------------
#ifndef L2CAP_EXTFEA_SUPPORTED_MASK
#define L2CAP_EXTFEA_SUPPORTED_MASK (L2CAP_EXTFEA_ENH_RETRANS | L2CAP_EXTFEA_STREAM_MODE | L2CAP_EXTFEA_NO_CRC | L2CAP_EXTFEA_FIXED_CHNLS)
@ -203,7 +228,7 @@
#endif
#ifndef BT_USE_TRACES
#define BT_USE_TRACES TRUE
#define BT_USE_TRACES FALSE
#endif
#ifndef BT_TRACE_BTIF
@ -477,9 +502,9 @@
#define BTM_SCO_DATA_SIZE_MAX 240
#endif
/* The size in bytes of the BTM inquiry database. 40 As Default */
/* The size in bytes of the BTM inquiry database. 5 As Default */
#ifndef BTM_INQ_DB_SIZE
#define BTM_INQ_DB_SIZE 32
#define BTM_INQ_DB_SIZE 5
#endif
/* The default scan mode */
@ -538,7 +563,11 @@
/* 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). */
@ -635,7 +664,11 @@
#endif
#ifndef BTM_LOCAL_IO_CAPS_BLE
#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
#define BTM_LOCAL_IO_CAPS_BLE BTM_IO_CAP_KBDISP
#else
#define BTM_LOCAL_IO_CAPS_BLE 4
#endif ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
#endif
/* The default MITM Protection Requirement (for Simple Pairing)
@ -657,7 +690,7 @@
/* TRUE to include Sniff Subrating */
#ifndef BTM_SSR_INCLUDED
#define BTM_SSR_INCLUDED TRUE
#define BTM_SSR_INCLUDED FALSE
#endif
/*************************
@ -684,7 +717,6 @@
#define L2CAP_CLIENT_INCLUDED FALSE
#endif
/* The maximum number of simultaneous links that L2CAP can support. Up to 7*/
#ifndef MAX_ACL_CONNECTIONS
#define MAX_L2CAP_LINKS 3
@ -694,12 +726,20 @@
/* The maximum number of simultaneous channels that L2CAP can support. Up to 16*/
#ifndef MAX_L2CAP_CHANNELS
#if (CLASSIC_BT_INCLUDED == TRUE)
#define MAX_L2CAP_CHANNELS 8
#else
#define MAX_L2CAP_CHANNELS 2 //Not support to create l2cap channels in the BLE only mode in this bluedroid version(6.0)
#endif ///CLASSIC_BT_INCLUDED == TRUE
#endif
/* The maximum number of simultaneous applications that can register with L2CAP. */
#ifndef MAX_L2CAP_CLIENTS
#if (CLASSIC_BT_INCLUDED == TRUE)
#define MAX_L2CAP_CLIENTS 8
#else
#define MAX_L2CAP_CLIENTS 1 //Not support to allocate a channel control block in BLE only mode
#endif ///CLASSIC_BT_INCLUDED == TRUE
#endif
/* The number of seconds of link inactivity before a link is disconnected. */
@ -785,7 +825,11 @@
/* Used for features using fixed channels; set to zero if no fixed channels supported (BLE, etc.) */
/* Excluding L2CAP signaling channel and UCD */
#ifndef L2CAP_NUM_FIXED_CHNLS
#if (CLASSIC_BT_INCLUDED == TRUE)
#define L2CAP_NUM_FIXED_CHNLS 32
#else
#define L2CAP_NUM_FIXED_CHNLS 3 //There are just three fix channel in the BLE only mode(gatt,signal,smp)
#endif ///CLASSIC_BT_INCLUDED == TRUE
#endif
/* First fixed channel supported */
@ -853,7 +897,7 @@
* resolution, local address rotation etc.
*/
#ifndef BLE_PRIVACY_SPT
#define BLE_PRIVACY_SPT TRUE
#define BLE_PRIVACY_SPT FALSE
#endif
/*
@ -965,7 +1009,7 @@
******************************************************************************/
#ifndef GATTC_INCLUDED
#if BLE_INCLUDED == TRUE
#define GATTC_INCLUDED TRUE
#define GATTC_INCLUDED FALSE
#else
#define GATTC_INCLUDED FALSE
#endif
@ -992,7 +1036,7 @@
******************************************************************************/
#ifndef SMP_INCLUDED
#if BLE_INCLUDED == TRUE
#define SMP_INCLUDED TRUE
#define SMP_INCLUDED FALSE
#else
#define SMP_INCLUDED FALSE
#endif
@ -1036,7 +1080,7 @@
******************************************************************************/
#ifndef SDP_INCLUDED
#define SDP_INCLUDED TRUE
#define SDP_INCLUDED FALSE //TRUE
#endif
/* This is set to enable SDP server functionality. */
@ -1535,7 +1579,7 @@ Range: 2 octets
/* This is set to enable use of GAP L2CAP connections. */
#ifndef GAP_CONN_INCLUDED
#if GAP_INCLUDED == TRUE
#if (GAP_INCLUDED == TRUE && CLASSIC_BT_INCLUDED == TRUE)
#define GAP_CONN_INCLUDED TRUE
#else
#define GAP_CONN_INCLUDED FALSE

View File

@ -18,6 +18,7 @@
#ifndef _BT_TRACE_H_
#define _BT_TRACE_H_
#include "sdkconfig.h"
#include <stdio.h>
#include "bt_types.h"
@ -170,7 +171,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
/* Enables or disables all trace messages. */
#ifndef BT_USE_TRACES
#define BT_USE_TRACES TRUE
#define BT_USE_TRACES FALSE
#endif
/******************************************************************************
@ -270,11 +271,13 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
#ifndef LOG_LEVEL
#define LOG_LEVEL LOG_LEVEL_INFO
#endif
#define LOG_ERROR(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_ERROR) BT_PRINTF(fmt,## args);} while(0)
#define LOG_WARN(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_WARN) BT_PRINTF(fmt,## args);} while(0)
#define LOG_INFO(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_INFO) BT_PRINTF(fmt,## args);} while(0)
#define LOG_DEBUG(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_DEBUG) BT_PRINTF(fmt,## args);} while(0)
#define LOG_VERBOSE(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_VERBOSE) BT_PRINTF(fmt,## args);} while(0)
#if !CONFIG_BT_STACK_NO_LOG
#define LOG_ERROR(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_ERROR) BT_PRINTF(fmt,## args);} while(0)
#define LOG_WARN(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_WARN) BT_PRINTF(fmt,## args);} while(0)
#define LOG_INFO(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_INFO) BT_PRINTF(fmt,## args);} while(0)
#define LOG_DEBUG(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_DEBUG) BT_PRINTF(fmt,## args);} while(0)
#define LOG_VERBOSE(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_VERBOSE) BT_PRINTF(fmt,## args);} while(0)
/* Define tracing for the HCI unit
*/
@ -287,7 +290,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
*/
#define BTM_TRACE_ERROR(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_ERROR) BT_PRINTF(fmt, ## args);}
#define BTM_TRACE_WARNING(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
#define BTM_TRACE_API(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define BTM_TRACE_API(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define BTM_TRACE_EVENT(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define BTM_TRACE_DEBUG(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
@ -303,7 +306,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
*/
#define SDP_TRACE_ERROR(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_ERROR) BT_PRINTF(fmt, ## args);}
#define SDP_TRACE_WARNING(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
#define SDP_TRACE_API(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define SDP_TRACE_API(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define SDP_TRACE_EVENT(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define SDP_TRACE_DEBUG(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
@ -318,7 +321,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
/* Generic Access Profile traces */
#define GAP_TRACE_ERROR(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_ERROR) BT_PRINTF(fmt, ## args);}
#define GAP_TRACE_EVENT(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define GAP_TRACE_API(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define GAP_TRACE_API(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define GAP_TRACE_WARNING(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
/* define traces for HID Host */
@ -340,7 +343,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
#define PAN_TRACE_ERROR(fmt, args...) {if (pan_cb.trace_level >= BT_TRACE_LEVEL_ERROR) BT_PRINTF(fmt, ## args);}
#define PAN_TRACE_WARNING(fmt, args...) {if (pan_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
#define PAN_TRACE_API(fmt, args...) {if (pan_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define PAN_TRACE_API(fmt, args...) {if (pan_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define PAN_TRACE_EVENT(fmt, args...) {if (pan_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define PAN_TRACE_DEBUG(fmt, args...) {if (pan_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
@ -350,7 +353,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
#define A2D_TRACE_WARNING(fmt, args...) {if (a2d_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
#define A2D_TRACE_EVENT(fmt, args...) {if (a2d_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define A2D_TRACE_DEBUG(fmt, args...) {if (a2d_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
#define A2D_TRACE_API(fmt, args...) {if (a2d_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define A2D_TRACE_API(fmt, args...) {if (a2d_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
/* AVDTP
*/
@ -382,7 +385,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
#define MCA_TRACE_WARNING(fmt, args...) {if (mca_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
#define MCA_TRACE_EVENT(fmt, args...) {if (mca_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define MCA_TRACE_DEBUG(fmt, args...) {if (mca_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
#define MCA_TRACE_API(fmt, args...) {if (mca_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define MCA_TRACE_API(fmt, args...) {if (mca_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
/* Define tracing for the ATT/GATT unit
*/
@ -396,7 +399,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
*/
#define SMP_TRACE_ERROR(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_ERROR) BT_PRINTF(fmt, ## args);}
#define SMP_TRACE_WARNING(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
#define SMP_TRACE_API(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define SMP_TRACE_API(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define SMP_TRACE_EVENT(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define SMP_TRACE_DEBUG(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
@ -419,6 +422,158 @@ extern UINT8 btif_trace_level;
#define APPL_TRACE_DEBUG(fmt, args...) {if (appl_trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
#define APPL_TRACE_VERBOSE(fmt, args...) {if (appl_trace_level >= BT_TRACE_LEVEL_VERBOSE) BT_PRINTF(fmt, ## args);}
#else
#define LOG_ERROR(fmt, args...)
#define LOG_WARN(fmt, args...)
#define LOG_INFO(fmt, args...)
#define LOG_DEBUG(fmt, args...)
#define LOG_VERBOSE(fmt, args...)
/* Define tracing for the HCI unit
*/
#define HCI_TRACE_ERROR(fmt, args...)
#define HCI_TRACE_WARNING(fmt, args...)
#define HCI_TRACE_EVENT(fmt, args...)
#define HCI_TRACE_DEBUG(fmt, args...)
/* Define tracing for BTM
*/
#define BTM_TRACE_ERROR(fmt, args...)
#define BTM_TRACE_WARNING(fmt, args...)
#define BTM_TRACE_API(fmt, args...)
#define BTM_TRACE_EVENT(fmt, args...)
#define BTM_TRACE_DEBUG(fmt, args...)
/* Define tracing for the L2CAP unit
*/
#define L2CAP_TRACE_ERROR(fmt, args...)
#define L2CAP_TRACE_WARNING(fmt, args...)
#define L2CAP_TRACE_API(fmt, args...)
#define L2CAP_TRACE_EVENT(fmt, args...)
#define L2CAP_TRACE_DEBUG(fmt, args...)
/* Define tracing for the SDP unit
*/
#define SDP_TRACE_ERROR(fmt, args...)
#define SDP_TRACE_WARNING(fmt, args...)
#define SDP_TRACE_API(fmt, args...)
#define SDP_TRACE_EVENT(fmt, args...)
#define SDP_TRACE_DEBUG(fmt, args...)
/* Define tracing for the RFCOMM unit
*/
#define RFCOMM_TRACE_ERROR(fmt, args...)
#define RFCOMM_TRACE_WARNING(fmt, args...)
#define RFCOMM_TRACE_API(fmt, args...)
#define RFCOMM_TRACE_EVENT(fmt, args...)
#define RFCOMM_TRACE_DEBUG(fmt, args...)
/* Generic Access Profile traces */
#define GAP_TRACE_ERROR(fmt, args...)
#define GAP_TRACE_EVENT(fmt, args...)
#define GAP_TRACE_API(fmt, args...)
#define GAP_TRACE_WARNING(fmt, args...)
/* define traces for HID Host */
#define HIDH_TRACE_ERROR(fmt, args...)
#define HIDH_TRACE_WARNING(fmt, args...)
#define HIDH_TRACE_API(fmt, args...)
#define HIDH_TRACE_EVENT(fmt, args...)
#define HIDH_TRACE_DEBUG(fmt, args...)
/* define traces for BNEP */
#define BNEP_TRACE_ERROR(fmt, args...)
#define BNEP_TRACE_WARNING(fmt, args...)
#define BNEP_TRACE_API(fmt, args...)
#define BNEP_TRACE_EVENT(fmt, args...)
#define BNEP_TRACE_DEBUG(fmt, args...)
/* define traces for PAN */
#define PAN_TRACE_ERROR(fmt, args...)
#define PAN_TRACE_WARNING(fmt, args...)
#define PAN_TRACE_API(fmt, args...)
#define PAN_TRACE_EVENT(fmt, args...)
#define PAN_TRACE_DEBUG(fmt, args...)
/* Define tracing for the A2DP profile
*/
#define A2D_TRACE_ERROR(fmt, args...)
#define A2D_TRACE_WARNING(fmt, args...)
#define A2D_TRACE_EVENT(fmt, args...)
#define A2D_TRACE_DEBUG(fmt, args...)
#define A2D_TRACE_API(fmt, args...)
/* AVDTP
*/
#define AVDT_TRACE_ERROR(fmt, args...)
#define AVDT_TRACE_WARNING(fmt, args...)
#define AVDT_TRACE_EVENT(fmt, args...)
#define AVDT_TRACE_DEBUG(fmt, args...)
#define AVDT_TRACE_API(fmt, args...)
/* Define tracing for the AVCTP protocol
*/
#define AVCT_TRACE_ERROR(fmt, args...)
#define AVCT_TRACE_WARNING(fmt, args...)
#define AVCT_TRACE_EVENT(fmt, args...)
#define AVCT_TRACE_DEBUG(fmt, args...)
#define AVCT_TRACE_API(fmt, args...)
/* Define tracing for the AVRCP profile
*/
#define AVRC_TRACE_ERROR(fmt, args...)
#define AVRC_TRACE_WARNING(fmt, args...)
#define AVRC_TRACE_EVENT(fmt, args...)
#define AVRC_TRACE_DEBUG(fmt, args...)
#define AVRC_TRACE_API(fmt, args...)
/* MCAP
*/
#define MCA_TRACE_ERROR(fmt, args...)
#define MCA_TRACE_WARNING(fmt, args...)
#define MCA_TRACE_EVENT(fmt, args...)
#define MCA_TRACE_DEBUG(fmt, args...)
#define MCA_TRACE_API(fmt, args...)
/* Define tracing for the ATT/GATT unit
*/
#define GATT_TRACE_ERROR(fmt, args...)
#define GATT_TRACE_WARNING(fmt, args...)
#define GATT_TRACE_API(fmt, args...)
#define GATT_TRACE_EVENT(fmt, args...)
#define GATT_TRACE_DEBUG(fmt, args...)
/* Define tracing for the SMP unit
*/
#define SMP_TRACE_ERROR(fmt, args...)
#define SMP_TRACE_WARNING(fmt, args...)
#define SMP_TRACE_API(fmt, args...)
#define SMP_TRACE_EVENT(fmt, args...)
#define SMP_TRACE_DEBUG(fmt, args...)
extern UINT8 btif_trace_level;
// define traces for application
#define BTIF_TRACE_ERROR(fmt, args...)
#define BTIF_TRACE_WARNING(fmt, args...)
#define BTIF_TRACE_API(fmt, args...)
#define BTIF_TRACE_EVENT(fmt, args...)
#define BTIF_TRACE_DEBUG(fmt, args...)
#define BTIF_TRACE_VERBOSE(fmt, args...)
/* define traces for application */
#define APPL_TRACE_ERROR(fmt, args...)
#define APPL_TRACE_WARNING(fmt, args...)
#define APPL_TRACE_API(fmt, args...)
#define APPL_TRACE_EVENT(fmt, args...)
#define APPL_TRACE_DEBUG(fmt, args...)
#define APPL_TRACE_VERBOSE(fmt, args...)
#endif ///CONFIG_BT_STACK_NO_LOG
/* Simplified Trace Helper Macro
*/
#define bdld(fmt, args...) \

View File

@ -25,7 +25,7 @@
#define A2D_INT_H
#include "a2d_api.h"
#if (A2D_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
@ -77,5 +77,5 @@ extern void a2d_set_avdt_sdp_ver (UINT16 avdt_sdp_ver);
#ifdef __cplusplus
}
#endif
#endif ///A2D_INCLUDED == TRUE
#endif /* A2D_INT_H */

View File

@ -24,6 +24,9 @@
******************************************************************************/
#ifndef AVDT_DEFS_H
#define AVDT_DEFS_H
#include "bt_target.h"
#if (AVDT_INCLUDED == TRUE)
/*****************************************************************************
** constants
@ -199,5 +202,7 @@
#define AVDT_MSG_BLD_NOSP(p, nosp) \
*(p)++ = (UINT8) (nosp);
#endif ///AVRC_INCLUDED == TRUE
#endif /* AVDT_DEFS_H */

View File

@ -31,6 +31,8 @@
#include "l2c_api.h"
#include "btm_api.h"
#if (AVRC_INCLUDED == TRUE)
#ifndef AVDT_DEBUG
#define AVDT_DEBUG FALSE
#endif
@ -741,4 +743,6 @@ extern const UINT8 avdt_msg_rej_2_evt[];
}
#endif
#endif ///AVRC_INCLUDED == TRUE
#endif /* AVDT_INT_H */

View File

@ -29,6 +29,7 @@
#include "avct_defs.h"
#include "avrc_api.h"
#if (AVRC_INCLUDED == TRUE)
/* DEBUG FLAGS
*
* #define META_DEBUG_ENABLED
@ -152,4 +153,6 @@ extern BOOLEAN avrc_is_valid_opcode(UINT8 opcode);
}
#endif
#endif ///AVRC_INCLUDED == TRUE
#endif /* AVRC_INT_H */

View File

@ -240,7 +240,8 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
#else
p->conn_addr_type = BLE_ADDR_PUBLIC;
memcpy(p->conn_addr, &controller_get_interface()->get_address()->address, BD_ADDR_LEN);
BTM_TRACE_DEBUG ("conn_addr: RemBdAddr: %02x%02x%02x%02x%02x%02x\n",
p->conn_addr[0], p->conn_addr[1], p->conn_addr[2], p->conn_addr[3], p->conn_addr[4], p->conn_addr[5]);
#endif
#endif
p->switch_role_state = BTM_ACL_SWKEY_STATE_IDLE;
@ -276,17 +277,20 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
memcpy (p->peer_lmp_features, p_dev_rec->features,
(HCI_FEATURE_BYTES_PER_PAGE * p_dev_rec->num_read_pages));
p->num_read_pages = p_dev_rec->num_read_pages;
#if (CLASSIC_BT_INCLUDED == TRUE)
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) {
/* Request for remaining Security Features (if any) */
l2cu_resubmit_pending_sec_req (p_dev_rec->bd_addr);
}
#endif ///CLASSIC_BT_INCLUDED == TRUE
btm_establish_continue (p);
return;
}
@ -924,14 +928,16 @@ void btm_process_remote_ext_features (tACL_CONN *p_acl_cb, UINT8 num_read_pages)
}
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) {
#if (CLASSIC_BT_INCLUDED == TRUE)
/* Request for remaining Security Features (if any) */
l2cu_resubmit_pending_sec_req (p_dev_rec->bd_addr);
#endif ///CLASSIC_BT_INCLUDED == TRUE
}
}
@ -1476,12 +1482,11 @@ void btm_acl_role_changed (UINT8 hci_status, BD_ADDR bd_addr, UINT8 new_role)
** Returns Allocated SCN number or 0 if none.
**
*******************************************************************************/
#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 BTM_AllocateSCN(void)
{
UINT8 x;
BTM_TRACE_DEBUG ("BTM_AllocateSCN\n");
// stack reserves scn 1 for HFP, HSP we still do the correct way
for (x = 1; x < BTM_MAX_SCN; x++) {
if (!btm_cb.btm_scn[x]) {
@ -1489,9 +1494,9 @@ UINT8 BTM_AllocateSCN(void)
return (x + 1);
}
}
return (0); /* No free ports */
}
#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
**
@ -1502,7 +1507,7 @@ UINT8 BTM_AllocateSCN(void)
** Returns Returns TRUE if server channel was available
**
*******************************************************************************/
#if (CLASSIC_BT_INCLUDED == TRUE)
BOOLEAN BTM_TryAllocateSCN(UINT8 scn)
{
/* Make sure we don't exceed max port range.
@ -1521,6 +1526,7 @@ BOOLEAN BTM_TryAllocateSCN(UINT8 scn)
return (FALSE); /* Port was busy */
}
/*******************************************************************************
**
** Function BTM_FreeSCN
@ -1539,7 +1545,9 @@ BOOLEAN BTM_FreeSCN(UINT8 scn)
} else {
return (FALSE); /* Illegal SCN passed in */
}
return (FALSE);
}
#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
**
@ -2284,6 +2292,7 @@ void btm_cont_rswitch (tACL_CONN *p, tBTM_SEC_DEV_REC *p_dev_rec,
*******************************************************************************/
void btm_acl_resubmit_page (void)
{
#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
BT_HDR *p_buf;
UINT8 *pp;
@ -2306,6 +2315,7 @@ void btm_acl_resubmit_page (void)
} else {
btm_cb.paging = FALSE;
}
#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
@ -2334,6 +2344,7 @@ void btm_acl_reset_paging (void)
** 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)
{
tBTM_SEC_DEV_REC *p_dev_rec;
@ -2368,6 +2379,7 @@ void btm_acl_paging (BT_HDR *p, BD_ADDR bda)
}
}
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**

View File

@ -68,6 +68,7 @@ extern void gatt_notify_enc_cmpl(BD_ADDR bd_addr);
** 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)
{
@ -132,9 +133,10 @@ BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE d
BTM_TRACE_DEBUG ("InqDb device_type =0x%x addr_type=0x%x",
p_info->results.device_type, p_info->results.ble_addr_type);
}
return (TRUE);
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -151,9 +153,9 @@ BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE d
** 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);
@ -180,10 +182,11 @@ BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key, tBTM_LE_
}
#endif
#endif
return (TRUE);
}
#endif
/*******************************************************************************
**
@ -430,6 +433,7 @@ void BTM_BlePasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey)
** res - comparison result BTM_SUCCESS if success
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
void BTM_BleConfirmReply (BD_ADDR bd_addr, UINT8 res)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
@ -444,6 +448,7 @@ void BTM_BleConfirmReply (BD_ADDR bd_addr, UINT8 res)
BTM_TRACE_DEBUG ("%s\n", __func__);
SMP_ConfirmReply(bd_addr, res_smp);
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -834,6 +839,7 @@ tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length)
** 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)
{
tBTM_RAND_ENC params;
@ -864,10 +870,9 @@ void btm_ble_rand_enc_complete (UINT8 *p, UINT16 op_code, tBTM_RAND_ENC_CB *p_en
}
}
}
#endif ///SMP_INCLUDED == TRUE
#if (SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btm_ble_get_enc_key_type
@ -876,6 +881,7 @@ void btm_ble_rand_enc_complete (UINT8 *p, UINT16 op_code, tBTM_RAND_ENC_CB *p_en
** Returns None
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local )
{
tBTM_SEC_DEV_REC *p_dev_rec;
@ -894,6 +900,7 @@ void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local )
p_dev_rec->ble.keys.counter);
}
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -905,6 +912,7 @@ void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local )
** 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)
{
tBTM_SEC_DEV_REC *p_dev_rec;
@ -915,6 +923,7 @@ BOOLEAN btm_ble_get_enc_key_type(BD_ADDR bd_addr, UINT8 *p_key_types)
*p_key_types = p_dev_rec->ble.key_type;
return TRUE;
}
return FALSE;
}
@ -948,6 +957,7 @@ BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_div)
return status;
}
/*******************************************************************************
**
** Function btm_sec_save_le_key
@ -1113,6 +1123,7 @@ void btm_ble_update_sec_key_size(BD_ADDR bd_addr, UINT8 enc_key_size)
}
}
/*******************************************************************************
**
** Function btm_ble_read_sec_key_size
@ -1131,6 +1142,7 @@ UINT8 btm_ble_read_sec_key_size(BD_ADDR bd_addr)
} else {
return 0;
}
return 0;
}
/*******************************************************************************
@ -1195,7 +1207,10 @@ void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE
req_sec_level,
*p_sec_req_act);
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -1213,6 +1228,7 @@ void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE
tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, void *p_ref_data, UINT8 link_role)
{
tBTM_STATUS cmd = BTM_NO_RESOURCES;
#if (SMP_INCLUDED == TRUE)
tBTM_BLE_SEC_ACT sec_act = *(tBTM_BLE_SEC_ACT *)p_ref_data ;
tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bd_addr);
tBTM_BLE_SEC_REQ_ACT sec_req_act;
@ -1261,6 +1277,7 @@ tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, void *p_ref_data, UINT8 lin
cmd = BTM_WRONG_MODE;
break;
}
#endif ///SMP_INCLUDED == TRUE
return cmd;
}
@ -1275,6 +1292,7 @@ tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, void *p_ref_data, UINT8 lin
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv)
{
tBTM_CB *p_cb = &btm_cb;
@ -1294,6 +1312,8 @@ void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv)
}
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -1307,11 +1327,14 @@ void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv)
*******************************************************************************/
tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk)
{
#if (SMP_INCLUDED == TRUE)
tBTM_CB *p_cb = &btm_cb;
tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bda);
BT_OCTET8 dummy_rand = {0};
tBTM_STATUS rt = BTM_NO_RESOURCES;
#endif ///SMP_INCLUDED == TRUE
tBTM_STATUS rt = BTM_NO_RESOURCES;
#if (SMP_INCLUDED == TRUE)
BTM_TRACE_DEBUG ("btm_ble_start_encrypt");
if (!p_rec ) {
@ -1343,7 +1366,7 @@ tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk)
p_rec->sec_state = BTM_SEC_STATE_ENCRYPTING;
}
}
#endif ///SMP_INCLUDED == TRUE
return rt;
}
@ -1356,6 +1379,7 @@ tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk)
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
@ -1390,6 +1414,8 @@ void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable)
/* 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
/*******************************************************************************
**
@ -1401,6 +1427,7 @@ void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable)
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
void btm_ble_ltk_request_reply(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk)
{
tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bda);
@ -1510,6 +1537,8 @@ UINT8 btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p
}
return callback_rc;
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -1521,6 +1550,7 @@ UINT8 btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p
** 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;
@ -1530,9 +1560,10 @@ UINT8 btm_ble_br_keys_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p_data)
callback_rc = (*btm_cb.api.p_le_callback) (BTM_LE_IO_REQ_EVT, p_dev_rec->bd_addr,
(tBTM_LE_EVT_DATA *)p_data);
}
return callback_rc;
}
#endif ///SMP_INCLUDED
#if (BLE_PRIVACY_SPT == TRUE )
/*******************************************************************************
@ -1673,10 +1704,13 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced)
{
#if (BLE_PRIVACY_SPT == TRUE )
UINT8 *p_data = p, peer_addr_type;
#endif
#endif ///BLE_PRIVACY_SPT == TRUE
UINT8 role, status, bda_type;
UINT16 handle;
BD_ADDR bda, local_rpa, peer_rpa;
BD_ADDR bda;
#if (BLE_PRIVACY_SPT == TRUE)
BD_ADDR local_rpa, peer_rpa;
#endif ///BLE_PRIVACY_SPT == TRUE
UINT16 conn_interval, conn_latency, conn_timeout;
BOOLEAN match = FALSE;
UNUSED(evt_len);
@ -1686,7 +1720,7 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced)
STREAM_TO_UINT8 (role, p);
STREAM_TO_UINT8 (bda_type, p);
STREAM_TO_BDADDR (bda, p);
BTM_TRACE_ERROR("status = %d, handle = %d, role = %d, bda_type = %d",status,handle,role,bda_type);
if (status == 0) {
#if (BLE_PRIVACY_SPT == TRUE )
peer_addr_type = bda_type;
@ -1763,6 +1797,7 @@ void btm_ble_create_ll_conn_complete (UINT8 status)
** 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)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
@ -1870,11 +1905,10 @@ UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
} else {
BTM_TRACE_ERROR("btm_proc_smp_cback received for unknown device");
}
return 0;
}
#endif ///SMP_INCLUDED == TRUE
#endif /* SMP_INCLUDED */
/*******************************************************************************
**
@ -1892,13 +1926,16 @@ UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
** 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)
{
tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bd_addr);
BTM_TRACE_DEBUG ("%s", __func__);
#endif ///SMP_INCLUDED == TRUE
BOOLEAN ret = FALSE;
#if (SMP_INCLUDED == TRUE)
if (p_rec == NULL) {
BTM_TRACE_ERROR("%s-data signing can not be done from unknown device", __func__);
} else {
@ -1951,7 +1988,6 @@ BOOLEAN BTM_BleVerifySignature (BD_ADDR bd_addr, UINT8 *p_orig, UINT16 len, UINT
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];
@ -1972,9 +2008,10 @@ BOOLEAN BTM_BleVerifySignature (BD_ADDR bd_addr, UINT8 *p_orig, UINT16 len, UINT
}
}
}
#endif /* SMP_INCLUDED */
return verified;
}
#endif /* SMP_INCLUDED */
/*******************************************************************************
**
@ -1988,7 +2025,7 @@ BOOLEAN BTM_BleVerifySignature (BD_ADDR bd_addr, UINT8 *p_orig, UINT16 len, UINT
*******************************************************************************/
BOOLEAN BTM_GetLeSecurityState (BD_ADDR bd_addr, UINT8 *p_le_dev_sec_flags, UINT8 *p_le_key_size)
{
#if (BLE_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
UINT16 dev_rec_sec_flags;
#endif
@ -2125,6 +2162,7 @@ extern UINT8 BTM_BleGetSupportedKeySize (BD_ADDR bd_addr)
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
static void btm_notify_new_key(UINT8 key_type)
{
tBTM_BLE_LOCAL_KEYS *p_locak_keys = NULL;
@ -2235,6 +2273,7 @@ static void btm_ble_process_irk(tSMP_ENC *p)
}
}
/*******************************************************************************
**
** Function btm_ble_process_dhk
@ -2248,7 +2287,6 @@ static void btm_ble_process_irk(tSMP_ENC *p)
*******************************************************************************/
static void btm_ble_process_dhk(tSMP_ENC *p)
{
#if SMP_INCLUDED == TRUE
UINT8 btm_ble_irk_pt = 0x01;
tSMP_ENC output;
@ -2270,7 +2308,6 @@ static void btm_ble_process_dhk(tSMP_ENC *p)
/* reset all identity root related key */
memset(&btm_cb.devcb.id_keys, 0, sizeof(tBTM_BLE_LOCAL_ID_KEYS));
}
#endif
}
/*******************************************************************************
@ -2286,7 +2323,6 @@ static void btm_ble_process_dhk(tSMP_ENC *p)
*******************************************************************************/
static void btm_ble_process_ir2(tBTM_RAND_ENC *p)
{
#if SMP_INCLUDED == TRUE
UINT8 btm_ble_dhk_pt = 0x03;
tSMP_ENC output;
@ -2306,7 +2342,6 @@ static void btm_ble_process_ir2(tBTM_RAND_ENC *p)
} else {
memset(&btm_cb.devcb.id_keys, 0, sizeof(tBTM_BLE_LOCAL_ID_KEYS));
}
#endif
}
/*******************************************************************************
@ -2353,6 +2388,7 @@ void btm_ble_reset_id( void )
BTM_TRACE_DEBUG("Generating IR failed.");
}
}
#endif ///SMP_INCLUDED == TRUE
#if BTM_BLE_CONFORMANCE_TESTING == TRUE
/*******************************************************************************

View File

@ -193,7 +193,6 @@ void btm_gen_non_resolvable_private_addr (tBTM_BLE_ADDR_CBACK *p_cback, void *p)
}
#if SMP_INCLUDED == TRUE
/*******************************************************************************
** Utility functions for Random address resolving
*******************************************************************************/
@ -207,6 +206,7 @@ void btm_gen_non_resolvable_private_addr (tBTM_BLE_ADDR_CBACK *p_cback, void *p)
** Returns None.
**
*******************************************************************************/
#if SMP_INCLUDED == TRUE
static void btm_ble_resolve_address_cmpl(void)
{
tBTM_LE_RANDOM_CB *p_mgnt_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
@ -250,8 +250,10 @@ static BOOLEAN btm_ble_proc_resolve_x(tSMP_ENC *p)
return TRUE;
}
}
return FALSE;
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -265,13 +267,14 @@ static BOOLEAN btm_ble_proc_resolve_x(tSMP_ENC *p)
*******************************************************************************/
BOOLEAN btm_ble_init_pseudo_addr (tBTM_SEC_DEV_REC *p_dev_rec, BD_ADDR new_pseudo_addr)
{
#if (SMP_INCLUDED == TRUE)
BD_ADDR dummy_bda = {0};
if (memcmp(p_dev_rec->ble.pseudo_addr, dummy_bda, BD_ADDR_LEN) == 0) {
memcpy(p_dev_rec->ble.pseudo_addr, new_pseudo_addr, BD_ADDR_LEN);
return TRUE;
}
#endif ///SMP_INCLUDED == TRUE
return FALSE;
}
@ -287,7 +290,7 @@ BOOLEAN btm_ble_init_pseudo_addr (tBTM_SEC_DEV_REC *p_dev_rec, BD_ADDR new_pseud
BOOLEAN btm_ble_addr_resolvable (BD_ADDR rpa, tBTM_SEC_DEV_REC *p_dev_rec)
{
BOOLEAN rt = FALSE;
#if (SMP_INCLUDED == TRUE)
if (!BTM_BLE_IS_RESOLVE_BDA(rpa)) {
return rt;
}
@ -315,9 +318,11 @@ BOOLEAN btm_ble_addr_resolvable (BD_ADDR rpa, tBTM_SEC_DEV_REC *p_dev_rec)
rt = TRUE;
}
}
#endif ///SMP_INCLUDED == TRUE
return rt;
}
#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btm_ble_match_random_bda
@ -331,7 +336,6 @@ BOOLEAN btm_ble_addr_resolvable (BD_ADDR rpa, tBTM_SEC_DEV_REC *p_dev_rec)
*******************************************************************************/
static BOOLEAN btm_ble_match_random_bda(UINT16 rec_index)
{
#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
/* use the 3 MSB of bd address as prand */
tBTM_LE_RANDOM_CB *p_mgnt_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
@ -364,8 +368,8 @@ static BOOLEAN btm_ble_match_random_bda(UINT16 rec_index)
btm_ble_resolve_address_cmpl();
return TRUE;
}
#endif
}
#endif ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -379,6 +383,7 @@ static BOOLEAN btm_ble_match_random_bda(UINT16 rec_index)
*******************************************************************************/
void btm_ble_resolve_random_addr(BD_ADDR random_bda, tBTM_BLE_RESOLVE_CBACK *p_cback, void *p)
{
#if (SMP_INCLUDED == TRUE)
tBTM_LE_RANDOM_CB *p_mgnt_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
BTM_TRACE_EVENT ("btm_ble_resolve_random_addr");
@ -400,9 +405,11 @@ void btm_ble_resolve_random_addr(BD_ADDR random_bda, tBTM_BLE_RESOLVE_CBACK *p_c
} else {
(*p_cback)(NULL, p);
}
}
#endif
}
/*******************************************************************************
** address mapping between pseudo address and real connection address
*******************************************************************************/

View File

@ -903,9 +903,11 @@ static UINT8 btm_set_conn_mode_adv_init_addr(tBTM_BLE_INQ_CB *p_cb,
tBLE_ADDR_TYPE *p_peer_addr_type,
tBLE_ADDR_TYPE *p_own_addr_type)
{
UINT8 evt_type, i = BTM_SEC_MAX_DEVICE_RECORDS;
UINT8 evt_type;
#if BLE_PRIVACY_SPT == TRUE
UINT8 i = BTM_SEC_MAX_DEVICE_RECORDS;
tBTM_SEC_DEV_REC *p_dev_rec;
#endif ///BLE_PRIVACY_SPT == TRUE
evt_type = (p_cb->connectable_mode == BTM_BLE_NON_CONNECTABLE) ? \
((p_cb->scan_rsp) ? BTM_BLE_DISCOVER_EVT : BTM_BLE_NON_CONNECT_EVT )\
: BTM_BLE_CONNECT_EVT;
@ -2128,7 +2130,9 @@ void btm_ble_read_remote_name_cmpl(BOOLEAN status, BD_ADDR bda, UINT16 length, c
}
btm_process_remote_name(bda, bd_name, length + 1, hci_status);
#if (SMP_INCLUDED == TRUE)
btm_sec_rmt_name_request_complete (bda, (UINT8 *)p_name, hci_status);
#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
@ -2163,7 +2167,7 @@ tBTM_STATUS btm_ble_read_remote_name(BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur, t
return BTM_BUSY;
}
#if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE)
#if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
if (!GAP_BleReadPeerDevName(remote_bda, btm_ble_read_remote_name_cmpl)) {
return BTM_BUSY;
}
@ -2197,7 +2201,7 @@ BOOLEAN btm_ble_cancel_remote_name(BD_ADDR remote_bda)
tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
BOOLEAN status = TRUE;
#if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE)
#if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
status = GAP_BleCancelReadPeerDevName(remote_bda);
#endif

View File

@ -733,6 +733,7 @@ BOOLEAN btm_ble_disable_resolving_list(UINT8 rl_mask, BOOLEAN to_resume )
BOOLEAN btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC *p_dev_rec)
{
BOOLEAN rt = FALSE;
#if (SMP_INCLUDED == TRUE)
UINT8 rl_mask = btm_cb.ble_ctr_cb.rl_state;
BTM_TRACE_DEBUG("%s btm_cb.ble_ctr_cb.privacy_mode = %d\n", __func__,
@ -812,6 +813,7 @@ BOOLEAN btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC *p_dev_rec)
} else {
BTM_TRACE_DEBUG("Device not a RPA enabled device\n");
}
#endif ///SMP_INCLUDED == TRUE
return rt;
}

View File

@ -63,6 +63,7 @@ BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name,
LINK_KEY link_key, UINT8 key_type, tBTM_IO_CAP io_cap,
UINT8 pin_length)
{
#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
int i, j;
BOOLEAN found = FALSE;
@ -160,7 +161,7 @@ BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name,
p_dev_rec->rmt_io_caps = io_cap;
p_dev_rec->device_type |= BT_DEVICE_TYPE_BREDR;
#endif ///SMP_INCLUDED == TRUE
return (TRUE);
}
@ -459,7 +460,7 @@ tBTM_SEC_DEV_REC *btm_find_dev(BD_ADDR bd_addr)
*******************************************************************************/
void btm_consolidate_dev(tBTM_SEC_DEV_REC *p_target_rec)
{
#if BLE_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
tBTM_SEC_DEV_REC *p_dev_rec = &btm_cb.sec_dev_rec[0];
tBTM_SEC_DEV_REC temp_rec = *p_target_rec;

View File

@ -143,12 +143,12 @@ static void reset_complete(void)
/* Tell L2CAP that all connections are gone */
l2cu_device_reset ();
#if (SMP_INCLUDED == TRUE)
/* Clear current security state */
for (int devinx = 0; devinx < BTM_SEC_MAX_DEVICE_RECORDS; devinx++) {
btm_cb.sec_dev_rec[devinx].sec_state = BTM_SEC_STATE_IDLE;
}
#endif ///SMP_INCLUDED == TRUE
/* After the reset controller should restore all parameters to defaults. */
btm_cb.btm_inq_vars.inq_counter = 1;
btm_cb.btm_inq_vars.inq_scan_window = HCI_DEF_INQUIRYSCAN_WINDOW;
@ -187,9 +187,9 @@ static void reset_complete(void)
l2c_link_processs_ble_num_bufs(controller->get_acl_buffer_count_ble());
}
#endif
#if (SMP_INCLUDED == TRUE)
BTM_SetPinType (btm_cb.cfg.pin_type, btm_cb.cfg.pin_code, btm_cb.cfg.pin_code_len);
#endif ///SMP_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);
}

View File

@ -2353,8 +2353,9 @@ void btm_inq_rmt_name_failed (void)
} else {
btm_process_remote_name (NULL, NULL, 0, HCI_ERR_UNSPECIFIED);
}
#if (SMP_INCLUDED == TRUE)
btm_sec_rmt_name_request_complete (NULL, NULL, HCI_ERR_UNSPECIFIED);
#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
**

View File

@ -59,7 +59,9 @@ void btm_init (void)
/* Initialize BTM component structures */
btm_inq_db_init(); /* Inquiry Database and Structures */
btm_acl_init(); /* ACL Database and Structures */
#if (SMP_INCLUDED == TRUE)
btm_sec_init(BTM_SEC_MODE_SP); /* Security Manager Database and Structures */
#endif ///SMP_INCLUDED == TRUE
#if BTM_SCO_INCLUDED == TRUE
btm_sco_init(); /* SCO Database and Structures (If included) */
#endif

File diff suppressed because it is too large Load Diff

View File

@ -63,9 +63,13 @@ static void btu_hcif_extended_inquiry_result_evt (UINT8 *p);
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);
@ -77,9 +81,11 @@ static void btu_hcif_flush_occured_evt (void);
static void btu_hcif_role_change_evt (UINT8 *p);
static void btu_hcif_num_compl_data_pkts_evt (UINT8 *p);
static void btu_hcif_mode_change_evt (UINT8 *p);
#if (SMP_INCLUDED == TRUE)
static void btu_hcif_pin_code_request_evt (UINT8 *p);
static void btu_hcif_link_key_request_evt (UINT8 *p);
static void btu_hcif_link_key_notification_evt (UINT8 *p);
#endif ///SMP_INCLUDED == TRUE
static void btu_hcif_loopback_command_evt (void);
static void btu_hcif_data_buf_overflow_evt (void);
static void btu_hcif_max_slots_changed_evt (void);
@ -93,18 +99,20 @@ static void btu_hcif_esco_connection_chg_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
@ -118,15 +126,17 @@ static void btu_ble_ll_conn_complete_evt (UINT8 *p, UINT16 evt_len);
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);
#endif
#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
//#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
static void btu_ble_proc_enhanced_conn_cmpl (UINT8 *p, UINT16 evt_len);
#endif
//#endif
#endif
@ -173,17 +183,23 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
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:
@ -221,6 +237,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_MODE_CHANGE_EVT:
btu_hcif_mode_change_evt (p);
break;
#if (SMP_INCLUDED == TRUE)
case HCI_PIN_CODE_REQUEST_EVT:
btu_hcif_pin_code_request_evt (p);
break;
@ -230,6 +247,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_LINK_KEY_NOTIFICATION_EVT:
btu_hcif_link_key_notification_evt (p);
break;
#endif ///SMP_INCLUDED == TRUE
case HCI_LOOPBACK_COMMAND_EVT:
btu_hcif_loopback_command_evt ();
break;
@ -268,6 +286,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
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;
@ -280,11 +299,13 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
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;
@ -294,6 +315,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
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 ();
@ -304,7 +326,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_BLE_EVENT:
STREAM_TO_UINT8 (ble_sub_code, p);
HCI_TRACE_DEBUG("BLE HCI(id=%d) event = 0x%02x)", hci_evt_code, ble_sub_code);
HCI_TRACE_ERROR("BLE HCI(id=%d) event = 0x%02x)", hci_evt_code, ble_sub_code);
switch (ble_sub_code) {
case HCI_BLE_ADV_PKT_RPT_EVT: /* result of inquiry */
@ -320,13 +342,15 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
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)
//#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
case HCI_BLE_ENHANCED_CONN_COMPLETE_EVT:
btu_ble_proc_enhanced_conn_cmpl(p, hci_evt_len);
break;
#endif
//#endif
#if (BLE_LLT_INCLUDED == TRUE)
case HCI_BLE_RC_PARAM_REQ_EVT:
btu_ble_rc_param_req_evt(p);
@ -497,7 +521,9 @@ static void btu_hcif_connection_comp_evt (UINT8 *p)
UINT16 handle;
BD_ADDR bda;
UINT8 link_type;
#if SMP_INCLUDED == TRUE
UINT8 enc_mode;
#endif ///SMP_INCLUDED == TRUE
#if BTM_SCO_INCLUDED == TRUE
tBTM_ESCO_DATA esco_data;
#endif
@ -506,13 +532,15 @@ static void btu_hcif_connection_comp_evt (UINT8 *p)
STREAM_TO_UINT16 (handle, p);
STREAM_TO_BDADDR (bda, p);
STREAM_TO_UINT8 (link_type, p);
#if (SMP_INCLUDED == TRUE)
STREAM_TO_UINT8 (enc_mode, p);
#endif ///SMP_INCLUDED == TRUE
handle = HCID_GET_HANDLE (handle);
if (link_type == HCI_LINK_TYPE_ACL) {
#if (SMP_INCLUDED == TRUE)
btm_sec_connected (bda, handle, status, enc_mode);
#endif ///SMP_INCLUDED == TRUE
l2c_link_hci_conn_comp (status, handle, bda);
}
#if BTM_SCO_INCLUDED == TRUE
@ -544,11 +572,12 @@ static void btu_hcif_connection_request_evt (UINT8 *p)
STREAM_TO_BDADDR (bda, p);
STREAM_TO_DEVCLASS (dc, p);
STREAM_TO_UINT8 (link_type, p);
/* Pass request to security manager to check connect filters before */
/* passing request to l2cap */
if (link_type == HCI_LINK_TYPE_ACL) {
#if (SMP_INCLUDED == TRUE)
btm_sec_conn_req (bda, dc);
#endif ///SMP_INCLUDED == TRUE
}
#if BTM_SCO_INCLUDED == TRUE
else {
@ -586,9 +615,10 @@ static void btu_hcif_disconnection_comp_evt (UINT8 *p)
#else
l2c_link_hci_disc_comp (handle, reason);
#endif /* BTM_SCO_INCLUDED */
#if (SMP_INCLUDED == TRUE)
/* Notify security manager */
btm_sec_disconnected (handle, reason);
#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
@ -600,6 +630,7 @@ static void btu_hcif_disconnection_comp_evt (UINT8 *p)
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
static void btu_hcif_authentication_comp_evt (UINT8 *p)
{
UINT8 status;
@ -610,7 +641,7 @@ static void btu_hcif_authentication_comp_evt (UINT8 *p)
btm_sec_auth_complete (handle, status);
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -632,8 +663,9 @@ static void btu_hcif_rmt_name_request_comp_evt (UINT8 *p, UINT16 evt_len)
evt_len -= (1 + BD_ADDR_LEN);
btm_process_remote_name (bd_addr, p, evt_len, status);
#if (SMP_INCLUDED == TRUE)
btm_sec_rmt_name_request_complete (bd_addr, p, status);
#endif ///SMP_INCLUDED == TRUE
}
@ -646,6 +678,7 @@ static void btu_hcif_rmt_name_request_comp_evt (UINT8 *p, UINT16 evt_len)
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
static void btu_hcif_encryption_change_evt (UINT8 *p)
{
UINT8 status;
@ -659,6 +692,7 @@ static void btu_hcif_encryption_change_evt (UINT8 *p)
btm_acl_encrypt_change (handle, status, encr_enable);
btm_sec_encrypt_change (handle, status, encr_enable);
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -854,7 +888,7 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
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;
@ -880,7 +914,9 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
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:
@ -1030,8 +1066,9 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
case HCI_RMT_NAME_REQUEST:
/* Tell inquiry processing that we are done */
btm_process_remote_name (NULL, NULL, 0, status);
#if (SMP_INCLUDED == TRUE)
btm_sec_rmt_name_request_complete (NULL, NULL, status);
#endif ///SMP_INCLUDED == TRUE
break;
case HCI_QOS_SETUP_COMP_EVT:
@ -1057,7 +1094,9 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
if (p_cmd != NULL) {
p_cmd++;
STREAM_TO_BDADDR (bd_addr, p_cmd);
#if (SMP_INCLUDED == TRUE)
btm_sec_connected (bd_addr, HCI_INVALID_HANDLE, status, 0);
#endif ///SMP_INCLUDED == TRUE
l2c_link_hci_conn_comp (status, HCI_INVALID_HANDLE, bd_addr);
}
break;
@ -1074,13 +1113,17 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
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
@ -1308,6 +1351,7 @@ static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len)
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
static void btu_hcif_pin_code_request_evt (UINT8 *p)
{
BD_ADDR bda;
@ -1339,7 +1383,6 @@ static void btu_hcif_link_key_request_evt (UINT8 *p)
btm_sec_link_key_request (bda);
}
/*******************************************************************************
**
** Function btu_hcif_link_key_notification_evt
@ -1361,6 +1404,7 @@ static void btu_hcif_link_key_notification_evt (UINT8 *p)
btm_sec_link_key_notification (bda, key, key_type);
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
@ -1527,6 +1571,7 @@ static void btu_hcif_host_support_evt (UINT8 *p)
** Returns void
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
static void btu_hcif_io_cap_request_evt (UINT8 *p)
{
btm_io_capabilities_req(p);
@ -1562,7 +1607,6 @@ static void btu_hcif_user_conf_request_evt (UINT8 *p)
btm_proc_sp_req_evt(BTM_SP_CFM_REQ_EVT, p);
}
/*******************************************************************************
**
** Function btu_hcif_user_passkey_request_evt
@ -1604,6 +1648,8 @@ static void btu_hcif_keypress_notif_evt (UINT8 *p)
{
btm_keypress_notif_evt(p);
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -1614,7 +1660,7 @@ static void btu_hcif_keypress_notif_evt (UINT8 *p)
** 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);
@ -1630,11 +1676,12 @@ static void btu_hcif_rem_oob_request_evt (UINT8 *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
@ -1659,6 +1706,7 @@ static void btu_hcif_enhanced_flush_complete_evt (void)
** 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;
@ -1674,6 +1722,7 @@ static void btu_hcif_encryption_key_refresh_cmpl_evt (UINT8 *p)
btm_sec_encrypt_change (handle, status, enc_enable);
}
#endif ///SMP_INCLUDED == TRUE
static void btu_ble_process_adv_pkt (UINT8 *p)
{
@ -1686,12 +1735,12 @@ static void btu_ble_ll_conn_complete_evt ( UINT8 *p, UINT16 evt_len)
{
btm_ble_conn_complete(p, evt_len, FALSE);
}
#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
//#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
static void btu_ble_proc_enhanced_conn_cmpl( UINT8 *p, UINT16 evt_len)
{
btm_ble_conn_complete(p, evt_len, TRUE);
}
#endif
//#endif
static void btu_ble_ll_conn_param_upd_evt (UINT8 *p, UINT16 evt_len)
{
/* LE connection update has completed successfully as a master. */
@ -1710,19 +1759,22 @@ static void btu_ble_read_remote_feat_evt (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)
{
UINT16 ediv, handle;
UINT8 *pp;
STREAM_TO_UINT16(handle, p);
pp = p + 8;
STREAM_TO_UINT16(ediv, pp);
#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
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)
{

View File

@ -133,7 +133,7 @@ void btu_free_core(void)
l2c_free();
#if BLE_INCLUDED == TRUE
#if (defined(GATT_INCLUDED) && GATT_INCLUDED == true)
#if (defined(GATTS_INCLUDED) && GATTS_INCLUDED == true)
gatt_free();
#endif
#endif

View File

@ -69,7 +69,7 @@ void GAP_Init(void)
gap_conn_init();
#endif
#if BLE_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE
gap_attr_db_init();
#endif
}

View File

@ -17,7 +17,7 @@
******************************************************************************/
#include "bt_target.h"
#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
#include "bt_defs.h"
#include <string.h>
@ -513,11 +513,12 @@ BOOLEAN gap_ble_send_cl_read_request(tGAP_CLCB *p_clcb)
param.service.s_handle = 1;
param.service.e_handle = 0xFFFF;
param.service.auth_req = 0;
#if (GATTC_INCLUDED == TRUE)
if (GATTC_Read(p_clcb->conn_id, GATT_READ_BY_TYPE, &param) == GATT_SUCCESS) {
p_clcb->cl_op_uuid = uuid;
started = TRUE;
}
#endif ///GATTC_INCLUDED == TRUE
}
return started;
@ -784,7 +785,7 @@ BOOLEAN GAP_BleCancelReadPeerDevName (BD_ADDR peer_bda)
return (TRUE);
}
#endif /* BLE_INCLUDED */
#endif /* BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE*/

View File

@ -1165,9 +1165,10 @@ static void gap_release_ccb (tGAP_CCB *p_ccb)
return;
}
}
#if (SDP_INCLUDED == TRUE)
/* Free the security record for this PSM */
BTM_SecClrService(service_id);
#endif ///SDP_INCLUDED == TRUE
L2CA_DEREGISTER (psm);
}

View File

@ -21,6 +21,7 @@
//#include "bt_utils.h"
#include "gap_int.h"
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function gap_allocate_cb
@ -136,3 +137,5 @@ UINT16 gap_convert_btm_status (tBTM_STATUS btm_status)
return (GAP_ERR_PROCESSING);
}
}
#endif ///CLASSIC_BT_INCLUDED == TRUE

View File

@ -127,15 +127,15 @@ typedef struct {
tGAP_INFO blk[GAP_MAX_BLOCKS];
tBTM_CMPL_CB *btm_cback[GAP_MAX_BLOCKS];
UINT8 trace_level;
tGAP_FINDADDR_CB findaddr_cb; /* Contains the control block for finding a device addr */
tBTM_INQ_INFO *cur_inqptr;
//tGAP_FINDADDR_CB findaddr_cb; /* Contains the control block for finding a device addr */
//tBTM_INQ_INFO *cur_inqptr;
#if GAP_CONN_INCLUDED == TRUE
tGAP_CONN conn;
#endif
/* LE GAP attribute database */
#if BLE_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE
tGAP_ATTR gatt_attr[GAP_MAX_CHAR_NUM];
tGAP_CLCB clcb[GAP_MAX_CL]; /* connection link*/
tGATT_IF gatt_if;
@ -147,7 +147,7 @@ extern tGAP_CB gap_cb;
#if (GAP_CONN_INCLUDED == TRUE)
extern void gap_conn_init(void);
#endif
#if (BLE_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
extern void gap_attr_db_init(void);
#endif

View File

@ -345,7 +345,11 @@ tGATT_STATUS attp_send_msg_to_l2cap(tGATT_TCB *p_tcb, BT_HDR *p_toL2CAP)
if (p_tcb->att_lcid == L2CAP_ATT_CID) {
l2cap_ret = L2CA_SendFixedChnlData (L2CAP_ATT_CID, p_tcb->peer_bda, p_toL2CAP);
} else {
#if (CLASSIC_BT_INCLUDED == TRUE)
l2cap_ret = (UINT16) L2CA_DataWrite (p_tcb->att_lcid, p_toL2CAP);
#else
l2cap_ret = L2CAP_DW_FAILED;
#endif ///CLASSIC_BT_INCLUDED == TRUE
}
if (l2cap_ret == L2CAP_DW_FAILED) {

View File

@ -65,6 +65,8 @@ UINT8 GATT_SetTraceLevel (UINT8 new_level)
return (gatt_cb.trace_level);
}
#if (GATTS_INCLUDED == TRUE)
/*****************************************************************************
**
** GATT SERVER API
@ -440,7 +442,9 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
tGATT_SR_REG *p_sreg;
tGATT_HDL_LIST_ELEM *p_list = NULL;
UINT8 i_sreg;
#if (SDP_INCLUDED == TRUE)
tBT_UUID *p_uuid;
#endif ///SDP_INCLUDED == TRUE
tGATT_REG *p_reg = gatt_get_regcb(gatt_if);
tGATTS_PENDING_NEW_SRV_START *p_buf;
@ -479,9 +483,10 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
case GATT_TRANSPORT_BR_EDR:
case GATT_TRANSPORT_LE_BR_EDR:
if (p_sreg->type == GATT_UUID_PRI_SERVICE) {
#if (SDP_INCLUDED == TRUE)
p_uuid = gatts_get_service_uuid (p_sreg->p_db);
p_sreg->sdp_handle = gatt_add_sdp_record(p_uuid, p_sreg->s_hdl, p_sreg->e_hdl);
#endif ///SDP_INCLUDED == TRUE
}
break;
default:
@ -531,9 +536,11 @@ void GATTS_StopService (UINT16 service_handle)
/* Index 0 is reserved for GATT, and is never stopped */
if ( (ii > 0) && (ii < GATT_MAX_SR_PROFILES) && (gatt_cb.sr_reg[ii].in_use) ) {
#if(SDP_INCLUDED == TRUE)
if (gatt_cb.sr_reg[ii].sdp_handle) {
SDP_DeleteRecord(gatt_cb.sr_reg[ii].sdp_handle);
}
#endif ///SDP_INCLUDED == TRUE
gatt_remove_a_srv_from_list(&gatt_cb.srv_list_info, &gatt_cb.srv_list[ii]);
gatt_cb.srv_list[ii].in_use = FALSE;
memset (&gatt_cb.sr_reg[ii], 0, sizeof(tGATT_SR_REG));
@ -758,7 +765,10 @@ tGATT_STATUS GATTS_GetAttributeValue(UINT16 attr_handle, UINT16 *length, UINT8 *
status = gatts_get_attribute_value(&p_decl->svc_db, attr_handle, length, value);
return status;
}
#endif ///GATTS_INCLUDED == TRUE
#if (GATTC_INCLUDED == TRUE)
/*******************************************************************************/
/* GATT Profile Srvr Functions */
/*******************************************************************************/
@ -1112,6 +1122,7 @@ tGATT_STATUS GATTC_SendHandleValueConfirm (UINT16 conn_id, UINT16 handle)
return ret;
}
#endif ///GATTC_INCLUDED == TRUE
/*******************************************************************************/
/* */
@ -1215,10 +1226,12 @@ void GATT_Deregister (tGATT_IF gatt_if)
{
tGATT_REG *p_reg = gatt_get_regcb(gatt_if);
tGATT_TCB *p_tcb;
tGATT_CLCB *p_clcb;
UINT8 i, ii, j;
tGATT_CLCB *p_clcb;
UINT8 i, j;
#if (GATTS_INCLUDED == TRUE)
UINT8 ii;
tGATT_SR_REG *p_sreg;
#endif ///GATTS_INCLUDED == TRUE
GATT_TRACE_API ("GATT_Deregister gatt_if=%d", gatt_if);
/* Index 0 is GAP and is never deregistered */
if ( (gatt_if == 0) || (p_reg == NULL) ) {
@ -1230,16 +1243,15 @@ void GATT_Deregister (tGATT_IF gatt_if)
/* todo an applcaiton can not be deregistered if its services is also used by other application
deregisteration need to bed performed in an orderly fashion
no check for now */
#if (GATTS_INCLUDED == TRUE)
for (ii = 0, p_sreg = gatt_cb.sr_reg; ii < GATT_MAX_SR_PROFILES; ii++, p_sreg++) {
if (p_sreg->in_use && (p_sreg->gatt_if == gatt_if)) {
GATTS_StopService(p_sreg->s_hdl);
}
}
/* free all services db buffers if owned by this application */
gatt_free_srvc_db_buffer_app_id(&p_reg->app_uuid128);
#endif ///GATTS_INCLUDED == TRUE
/* When an application deregisters, check remove the link associated with the app */
for (i = 0, p_tcb = gatt_cb.tcb; i < GATT_MAX_PHY_CHANNEL; i++, p_tcb++) {

View File

@ -30,7 +30,7 @@
#include "gatt_int.h"
#include "sdpdefs.h"
#if BLE_INCLUDED == TRUE
#if (BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
#define GATTP_MAX_NUM_INC_SVR 0
#define GATTP_MAX_CHAR_NUM 2
@ -71,13 +71,14 @@ static tGATT_CBACK gatt_profile_cback = {
** Returns Connection ID
**
*******************************************************************************/
#if (GATTS_INCLUDED == TRUE)
UINT16 gatt_profile_find_conn_id_by_bd_addr(BD_ADDR remote_bda)
{
UINT16 conn_id = GATT_INVALID_CONN_ID;
GATT_GetConnIdIfConnected (gatt_cb.gatt_if, remote_bda, &conn_id, BT_TRANSPORT_LE);
return conn_id;
}
#endif ///GATTS_INCLUDED == TRUE
/*******************************************************************************
**
** Function gatt_profile_find_clcb_by_conn_id
@ -431,10 +432,12 @@ static void gatt_cl_start_config_ccc(tGATT_PROFILE_CLCB *p_clcb)
srvc_disc_param.e_handle = 0xffff;
srvc_disc_param.service.len = 2;
srvc_disc_param.service.uu.uuid16 = UUID_SERVCLASS_GATT_SERVER;
#if (GATTC_INCLUDED == TRUE)
if (GATTC_Discover (p_clcb->conn_id, GATT_DISC_SRVC_BY_UUID, &srvc_disc_param) != GATT_SUCCESS) {
GATT_TRACE_ERROR("%s() - ccc service error", __FUNCTION__);
gatt_config_ccc_complete(p_clcb);
}
#endif ///GATTC_INCLUDED == TRUE
break;
case GATT_SVC_CHANGED_CHARACTERISTIC: /* discover service change char */
@ -442,29 +445,35 @@ static void gatt_cl_start_config_ccc(tGATT_PROFILE_CLCB *p_clcb)
srvc_disc_param.e_handle = p_clcb->e_handle;
srvc_disc_param.service.len = 2;
srvc_disc_param.service.uu.uuid16 = GATT_UUID_GATT_SRV_CHGD;
#if (GATTC_INCLUDED == TRUE)
if (GATTC_Discover (p_clcb->conn_id, GATT_DISC_CHAR, &srvc_disc_param) != GATT_SUCCESS) {
GATT_TRACE_ERROR("%s() - ccc char error", __FUNCTION__);
gatt_config_ccc_complete(p_clcb);
}
#endif ///GATTC_INCLUDED == TRUE
break;
case GATT_SVC_CHANGED_DESCRIPTOR: /* discover service change ccc */
srvc_disc_param.s_handle = p_clcb->s_handle;
srvc_disc_param.e_handle = p_clcb->e_handle;
#if (GATTC_INCLUDED == TRUE)
if (GATTC_Discover (p_clcb->conn_id, GATT_DISC_CHAR_DSCPT, &srvc_disc_param) != GATT_SUCCESS) {
GATT_TRACE_ERROR("%s() - ccc char descriptor error", __FUNCTION__);
gatt_config_ccc_complete(p_clcb);
}
#endif ///GATTC_INCLUDED == TRUE
break;
case GATT_SVC_CHANGED_CONFIGURE_CCCD: /* write ccc */
ccc_value.handle = p_clcb->s_handle;
ccc_value.len = 2;
ccc_value.value[0] = GATT_CLT_CONFIG_INDICATION;
#if (GATTC_INCLUDED == TRUE)
if (GATTC_Write (p_clcb->conn_id, GATT_WRITE, &ccc_value) != GATT_SUCCESS) {
GATT_TRACE_ERROR("%s() - write ccc error", __FUNCTION__);
gatt_config_ccc_complete(p_clcb);
}
#endif ///GATTC_INCLUDED == TRUE
break;
}
}
@ -506,4 +515,4 @@ void GATT_ConfigServiceChangeCCC (BD_ADDR remote_bda, BOOLEAN enable, tBT_TRANSP
gatt_cl_start_config_ccc(p_clcb);
}
#endif /* BLE_INCLUDED */
#endif /* BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE */

View File

@ -41,6 +41,7 @@
** 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;
@ -72,7 +73,9 @@ static BOOLEAN gatt_sign_data (tGATT_CLCB *p_clcb)
p_signature)) {
p_attr->len += BTM_BLE_AUTH_SIGN_LEN;
gatt_set_ch_state(p_clcb->p_tcb, GATT_CH_OPEN);
#if (GATTC_INCLUDED == TRUE)
gatt_act_write(p_clcb, GATT_SEC_SIGN_DATA);
#endif ///GATTC_INCLUDED == TRUE
} else {
gatt_end_operation(p_clcb, GATT_INTERNAL_ERROR, NULL);
}
@ -82,6 +85,7 @@ static BOOLEAN gatt_sign_data (tGATT_CLCB *p_clcb)
return status;
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -93,10 +97,13 @@ static BOOLEAN gatt_sign_data (tGATT_CLCB *p_clcb)
** Returns
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
void gatt_verify_signature(tGATT_TCB *p_tcb, BT_HDR *p_buf)
{
UINT16 cmd_len;
#if (GATTS_INCLUDED == TRUE)
UINT8 op_code;
#endif ///GATTS_INCLUDED == TRUE
UINT8 *p, *p_orig = (UINT8 *)(p_buf + 1) + p_buf->offset;
UINT32 counter;
@ -110,8 +117,10 @@ void gatt_verify_signature(tGATT_TCB *p_tcb, BT_HDR *p_buf)
STREAM_TO_UINT32(counter, p);
if (BTM_BleVerifySignature(p_tcb->peer_bda, p_orig, cmd_len, counter, p)) {
#if (GATTS_INCLUDED == TRUE)
STREAM_TO_UINT8(op_code, p_orig);
gatt_server_handle_client_req (p_tcb, op_code, (UINT16)(p_buf->len - 1), p_orig);
#endif ///GATTS_INCLUDED == TRUE
} else {
/* if this is a bad signature, assume from attacker, ignore it */
GATT_TRACE_ERROR("Signature Verification Failed, data ignored");
@ -119,6 +128,8 @@ void gatt_verify_signature(tGATT_TCB *p_tcb, BT_HDR *p_buf)
return;
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Function gatt_sec_check_complete
@ -133,7 +144,7 @@ void gatt_sec_check_complete(BOOLEAN sec_check_ok, tGATT_CLCB *p_clcb, UINT8 s
if (p_clcb && p_clcb->p_tcb && GKI_queue_is_empty(&p_clcb->p_tcb->pending_enc_clcb)) {
gatt_set_sec_act(p_clcb->p_tcb, GATT_SEC_NONE);
}
#if (GATTC_INCLUDED == TRUE)
if (!sec_check_ok) {
gatt_end_operation(p_clcb, GATT_AUTH_FAIL, NULL);
} else if (p_clcb->operation == GATTC_OPTYPE_WRITE) {
@ -141,6 +152,7 @@ void gatt_sec_check_complete(BOOLEAN sec_check_ok, tGATT_CLCB *p_clcb, UINT8 s
} else if (p_clcb->operation == GATTC_OPTYPE_READ) {
gatt_act_read(p_clcb, p_clcb->counter);
}
#endif ///GATTC_INCLUDED == TRUE
}
/*******************************************************************************
**
@ -292,19 +304,23 @@ tGATT_SEC_ACTION gatt_determine_sec_act(tGATT_CLCB *p_clcb )
BOOLEAN is_link_encrypted = FALSE;
BOOLEAN is_link_key_known = FALSE;
BOOLEAN is_key_mitm = FALSE;
#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 ) {
return act;
}
BTM_GetSecurityFlagsByTransport(p_tcb->peer_bda, &sec_flag, p_clcb->p_tcb->transport);
#if (SMP_INCLUDED == TRUE)
btm_ble_link_sec_check(p_tcb->peer_bda, auth_req, &sec_act);
#endif ///SMP_INCLUDED == TRUE
/* if a encryption is pending, need to wait */
if (sec_act == BTM_BLE_SEC_REQ_ACT_DISCARD &&
if (
#if (SMP_INCLUDED == TRUE)
sec_act == BTM_BLE_SEC_REQ_ACT_DISCARD &&
#endif ///SMP_INCLUDED == TRUE
auth_req != GATT_AUTH_REQ_NONE) {
return GATT_SEC_ENC_PENDING;
}
@ -348,9 +364,13 @@ tGATT_SEC_ACTION gatt_determine_sec_act(tGATT_CLCB *p_clcb )
/* 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);
if ( (key_type & BTM_LE_KEY_LCSRK) &&
#endif ///SMP_INCLUDED == TRUE
if (
#if (SMP_INCLUDED == TRUE)
(key_type & BTM_LE_KEY_LCSRK) &&
#endif ///SMP_INCLUDED == TRUE
((auth_req == GATT_AUTH_REQ_SIGNED_NO_MITM) ||
(auth_req == GATT_AUTH_REQ_SIGNED_MITM))) {
act = GATT_SEC_SIGN_DATA;
@ -445,7 +465,9 @@ BOOLEAN gatt_security_check_start(tGATT_CLCB *p_clcb)
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);
@ -456,8 +478,10 @@ BOOLEAN gatt_security_check_start(tGATT_CLCB *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:
@ -465,11 +489,13 @@ BOOLEAN gatt_security_check_start(tGATT_CLCB *p_clcb)
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);

View File

@ -24,7 +24,7 @@
#include "bt_target.h"
#if BLE_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
#include <string.h>
//#include "bt_utils.h"
@ -1162,4 +1162,4 @@ void gatt_client_handle_server_rsp (tGATT_TCB *p_tcb, UINT8 op_code,
return;
}
#endif /* BLE_INCLUDED */
#endif /* BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE */

View File

@ -24,7 +24,7 @@
#include "bt_target.h"
#if BLE_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE
#include "bt_trace.h"
//#include "bt_utils.h"
@ -1465,4 +1465,4 @@ static BOOLEAN gatts_db_add_service_declaration(tGATT_SVC_DB *p_db, tBT_UUID *p_
return rt;
}
#endif /* BLE_INCLUDED */
#endif /* BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE */

View File

@ -48,7 +48,7 @@ static void gatt_le_connect_cback (UINT16 chan, BD_ADDR bd_addr, BOOLEAN connect
UINT16 reason, tBT_TRANSPORT transport);
static void gatt_le_data_ind (UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf);
static void gatt_le_cong_cback(BD_ADDR remote_bda, BOOLEAN congest);
#if (CLASSIC_BT_INCLUDED == TRUE)
static void gatt_l2cif_connect_ind_cback (BD_ADDR bd_addr, UINT16 l2cap_cid,
UINT16 psm, UINT8 l2cap_id);
static void gatt_l2cif_connect_cfm_cback (UINT16 l2cap_cid, UINT16 result);
@ -57,9 +57,10 @@ static void gatt_l2cif_config_cfm_cback (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cf
static void gatt_l2cif_disconnect_ind_cback (UINT16 l2cap_cid, BOOLEAN ack_needed);
static void gatt_l2cif_disconnect_cfm_cback (UINT16 l2cap_cid, UINT16 result);
static void gatt_l2cif_data_ind_cback (UINT16 l2cap_cid, BT_HDR *p_msg);
#endif ///CLASSIC_BT_INCLUDED == TRUE
static void gatt_send_conn_cback (tGATT_TCB *p_tcb);
#if (CLASSIC_BT_INCLUDED == TRUE)
static void gatt_l2cif_congest_cback (UINT16 cid, BOOLEAN congested);
static const tL2CAP_APPL_INFO dyn_info = {
gatt_l2cif_connect_ind_cback,
gatt_l2cif_connect_cfm_cback,
@ -73,6 +74,7 @@ static const tL2CAP_APPL_INFO dyn_info = {
gatt_l2cif_congest_cback,
NULL
} ;
#endif ///SMP_INCLUDED == TRUE
#if GATT_DYNAMIC_MEMORY == FALSE
tGATT_CB gatt_cb;
@ -120,19 +122,21 @@ void gatt_init (void)
fixed_reg.default_idle_tout = 0xffff; /* 0xffff default idle timeout */
L2CA_RegisterFixedChannel (L2CAP_ATT_CID, &fixed_reg);
#if (CLASSIC_BT_INCLUDED == TRUE)
/* Now, register with L2CAP for ATT PSM over BR/EDR */
if (!L2CA_Register (BT_PSM_ATT, (tL2CAP_APPL_INFO *) &dyn_info)) {
GATT_TRACE_ERROR ("ATT Dynamic Registration failed");
}
#endif ///CLASSIC_BT_INCLUDED == TRUE
BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_ATT, BTM_SEC_NONE, BT_PSM_ATT, 0, 0);
BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_ATT, BTM_SEC_NONE, BT_PSM_ATT, 0, 0);
gatt_cb.hdl_cfg.gatt_start_hdl = GATT_GATT_START_HANDLE;
gatt_cb.hdl_cfg.gap_start_hdl = GATT_GAP_START_HANDLE;
gatt_cb.hdl_cfg.app_start_hdl = GATT_APP_START_HANDLE;
#if (GATTS_INCLUDED == TRUE)
gatt_profile_db_init();
#endif ///GATTS_INCLUDED == TRUE
}
@ -146,6 +150,7 @@ void gatt_init (void)
** Returns void
**
*******************************************************************************/
#if (GATTS_INCLUDED == TRUE)
void gatt_free(void)
{
int i;
@ -154,6 +159,7 @@ void gatt_free(void)
gatt_free_hdl_buffer(&gatt_cb.hdl_list[i]);
}
}
#endif ///GATTS_INCLUDED == TRUE
/*******************************************************************************
**
@ -177,10 +183,13 @@ BOOLEAN gatt_connect (BD_ADDR rem_bda, tGATT_TCB *p_tcb, tBT_TRANSPORT transport
if (transport == BT_TRANSPORT_LE) {
p_tcb->att_lcid = L2CAP_ATT_CID;
gatt_ret = L2CA_ConnectFixedChnl (L2CAP_ATT_CID, rem_bda);
#if (CLASSIC_BT_INCLUDED == TRUE)
} else {
if ((p_tcb->att_lcid = L2CA_ConnectReq(BT_PSM_ATT, rem_bda)) != 0) {
gatt_ret = TRUE;
}
#endif ///CLASSIC_BT_INCLUDED == TRUE
}
return gatt_ret;
@ -215,8 +224,10 @@ BOOLEAN gatt_disconnect (tGATT_TCB *p_tcb)
gatt_set_ch_state(p_tcb, GATT_CH_CLOSING);
ret = L2CA_CancelBleConnectReq (p_tcb->peer_bda);
}
#if (CLASSIC_BT_INCLUDED == TRUE)
} else {
ret = L2CA_DisconnectReq(p_tcb->att_lcid);
#endif ///CLASSIC_BT_INCLUDED == TRUE
}
} else {
GATT_TRACE_DEBUG ("gatt_disconnect already in closing state");
@ -403,7 +414,9 @@ static void gatt_le_connect_cback (UINT16 chan, BD_ADDR bd_addr, BOOLEAN connect
gatt_send_conn_cback(p_tcb);
}
if (check_srv_chg) {
#if (GATTS_INCLUDED == TRUE)
gatt_chk_srv_chg (p_srv_chg_clt);
#endif ///GATTS_INCLUDED == TRUE
}
}
/* this is incoming connection or background connection callback */
@ -418,7 +431,9 @@ static void gatt_le_connect_cback (UINT16 chan, BD_ADDR bd_addr, BOOLEAN connect
gatt_send_conn_cback (p_tcb);
if (check_srv_chg) {
#if (GATTS_INCLUDED == TRUE)
gatt_chk_srv_chg (p_srv_chg_clt);
#endif ///GATTS_INCLUDED == TRUE
}
} else {
GATT_TRACE_ERROR("CCB max out, no rsources");
@ -445,11 +460,12 @@ static void gatt_channel_congestion(tGATT_TCB *p_tcb, BOOLEAN congested)
UINT8 i = 0;
tGATT_REG *p_reg = NULL;
UINT16 conn_id;
#if (GATTC_INCLUDED == TRUE)
/* if uncongested, check to see if there is any more pending data */
if (p_tcb != NULL && congested == FALSE) {
gatt_cl_send_next_cmd_inq(p_tcb);
}
#endif ///GATTC_INCLUDED == TRUE
/* notifying all applications for the connection up event */
for (i = 0, p_reg = gatt_cb.cl_rcb ; i < GATT_MAX_APPS; i++, p_reg++) {
if (p_reg->in_use) {
@ -525,6 +541,7 @@ static void gatt_le_data_ind (UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf)
** Returns void
**
*******************************************************************************/
#if (CLASSIC_BT_INCLUDED == TRUE)
static void gatt_l2cif_connect_ind_cback (BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
{
/* do we already have a control channel for this peer? */
@ -563,6 +580,7 @@ static void gatt_l2cif_connect_ind_cback (BD_ADDR bd_addr, UINT16 lcid, UINT16
L2CA_ConfigReq(lcid, &cfg);
}
}
/*******************************************************************************
@ -639,7 +657,9 @@ void gatt_l2cif_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
gatt_set_ch_state(p_tcb, GATT_CH_OPEN);
if ((p_srv_chg_clt = gatt_is_bda_in_the_srv_chg_clt_list(p_tcb->peer_bda)) != NULL) {
#if (GATTS_INCLUDED == TRUE)
gatt_chk_srv_chg(p_srv_chg_clt);
#endif ///GATTS_INCLUDED == TRUE
} else {
if (btm_sec_is_a_bonded_dev(p_tcb->peer_bda)) {
gatt_add_a_bonded_dev_for_srv_chg(p_tcb->peer_bda);
@ -697,7 +717,9 @@ void gatt_l2cif_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
if (p_tcb->ch_flags & GATT_L2C_CFG_CFM_DONE) {
gatt_set_ch_state(p_tcb, GATT_CH_OPEN);
if ((p_srv_chg_clt = gatt_is_bda_in_the_srv_chg_clt_list(p_tcb->peer_bda)) != NULL) {
#if (GATTS_INCLUDED == TRUE)
gatt_chk_srv_chg(p_srv_chg_clt);
#endif ///GATTS_INCLUDED == TRUE
} else {
if (btm_sec_is_a_bonded_dev(p_tcb->peer_bda)) {
gatt_add_a_bonded_dev_for_srv_chg(p_tcb->peer_bda);
@ -804,6 +826,7 @@ static void gatt_l2cif_data_ind_cback(UINT16 lcid, BT_HDR *p_buf)
} else { /* prevent buffer leak */
GKI_freebuf(p_buf);
}
}
/*******************************************************************************
@ -822,7 +845,9 @@ static void gatt_l2cif_congest_cback (UINT16 lcid, BOOLEAN congested)
if (p_tcb != NULL) {
gatt_channel_congestion(p_tcb, congested);
}
}
#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
**
@ -896,13 +921,19 @@ void gatt_data_process (tGATT_TCB *p_tcb, BT_HDR *p_buf)
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) {
#if (GATTS_INCLUDED == TRUE)
gatt_server_handle_client_req (p_tcb, op_code, msg_len, p);
#endif ///GATTS_INCLUDED == TRUE
} else {
#if (GATTC_INCLUDED == TRUE)
gatt_client_handle_server_rsp (p_tcb, op_code, msg_len, p);
#endif ///GATTC_INCLUDED == TRUE
}
}
} else {
@ -950,6 +981,7 @@ void gatt_add_a_bonded_dev_for_srv_chg (BD_ADDR bda)
** Returns void
**
*******************************************************************************/
#if (GATTS_INCLUDED == TRUE)
void gatt_send_srv_chg_ind (BD_ADDR peer_bda)
{
UINT8 handle_range[GATT_SIZE_OF_SRV_CHG_HNDL_RANGE];
@ -974,6 +1006,7 @@ void gatt_send_srv_chg_ind (BD_ADDR peer_bda)
}
}
/*******************************************************************************
**
** Function gatt_chk_srv_chg
@ -992,6 +1025,8 @@ void gatt_chk_srv_chg(tGATTS_SRV_CHG *p_srv_chg_clt)
gatt_send_srv_chg_ind(p_srv_chg_clt->bda);
}
}
#endif ///GATTS_INCLUDED == TRUE
/*******************************************************************************
**
@ -1045,6 +1080,7 @@ void gatt_init_srv_chg (void)
** Returns void
**
*******************************************************************************/
#if (GATTS_INCLUDED == TRUE)
void gatt_proc_srv_chg (void)
{
UINT8 start_idx, found_idx;
@ -1071,6 +1107,7 @@ void gatt_proc_srv_chg (void)
}
}
}
#endif ///GATTS_INCLUDED == TRUE
/*******************************************************************************
**

View File

@ -25,7 +25,7 @@
#include "bt_target.h"
//#include "bt_utils.h"
#if BLE_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE
#include <string.h>
#include "gatt_int.h"
#include "l2c_api.h"
@ -1491,6 +1491,7 @@ static void gatts_proc_srv_chg_ind_ack(tGATT_TCB *p_tcb )
*******************************************************************************/
static void gatts_chk_pending_ind(tGATT_TCB *p_tcb )
{
#if (GATTS_INCLUDED == TRUE)
tGATT_VALUE *p_buf = (tGATT_VALUE *)GKI_getfirst(&p_tcb->pending_ind_q);
GATT_TRACE_DEBUG("gatts_chk_pending_ind");
@ -1501,6 +1502,7 @@ static void gatts_chk_pending_ind(tGATT_TCB *p_tcb )
p_buf->value);
GKI_freebuf(GKI_remove_from_queue (&p_tcb->pending_ind_q, p_buf));
}
#endif ///GATTS_INCLUDED == TRUE
}
/*******************************************************************************
@ -1645,4 +1647,4 @@ void gatt_server_handle_client_req (tGATT_TCB *p_tcb, UINT8 op_code,
}
}
#endif /* BLE_INCLUDED */
#endif /* BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE */

View File

@ -297,6 +297,7 @@ tGATTS_SRV_CHG *gatt_add_srv_chg_clt(tGATTS_SRV_CHG *p_srv_chg)
** Returns Pointer to the allocated buffer, NULL no buffer available
**
*******************************************************************************/
#if (GATTS_INCLUDED == TRUE)
tGATT_HDL_LIST_ELEM *gatt_alloc_hdl_buffer(void)
{
UINT8 i;
@ -395,6 +396,8 @@ tGATT_HDL_LIST_ELEM *gatt_find_hdl_buffer_by_app_id (tBT_UUID *p_app_uuid128,
}
return NULL;
}
#endif ///GATTS_INCLUDED == TRUE
/*******************************************************************************
**
** Function gatt_free_attr_value_buffer
@ -451,6 +454,7 @@ void gatt_free_hdl_buffer(tGATT_HDL_LIST_ELEM *p)
** Returns None
**
*******************************************************************************/
#if (GATTS_INCLUDED == TRUE)
void gatt_free_srvc_db_buffer_app_id(tBT_UUID *p_app_id)
{
tGATT_HDL_LIST_ELEM *p_elem = &gatt_cb.hdl_list[0];
@ -501,7 +505,6 @@ BOOLEAN gatt_is_last_attribute(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM
return is_last_attribute;
}
/*******************************************************************************
**
** Function gatt_update_last_pri_srv_info
@ -545,6 +548,8 @@ void gatts_update_srv_list_elem(UINT8 i_sreg, UINT16 handle, BOOLEAN is_primary)
return;
}
#endif ///GATTS_INCLUDED == TRUE
/*******************************************************************************
**
** Function gatt_add_a_srv_to_list
@ -1234,7 +1239,9 @@ void gatt_rsp_timeout(TIMER_LIST_ENT *p_tle)
GATT_TRACE_ERROR("gatt_rsp_timeout command queue out of sync, disconnect");
} else {
p_clcb->retry_count++;
#if (GATTC_INCLUDED == TRUE)
gatt_act_discovery(p_clcb);
#endif ///GATTC_INCLUDED == TRUE
return;
}
}
@ -1296,6 +1303,7 @@ UINT8 gatt_sr_find_i_rcb_by_handle(UINT16 handle)
** Returns 0 if not found. Otherwise index of th eservice.
**
*******************************************************************************/
#if (GATTS_INCLUDED == TRUE)
UINT8 gatt_sr_find_i_rcb_by_app_id(tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid, UINT16 svc_inst)
{
UINT8 i_rcb = 0;
@ -1319,6 +1327,7 @@ UINT8 gatt_sr_find_i_rcb_by_app_id(tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid
}
return i_rcb;
}
#endif ///GATTS_INCLUDED == TRUE
/*******************************************************************************
**
** Function gatt_sr_find_i_rcb_by_handle
@ -1371,8 +1380,9 @@ void gatt_sr_get_sec_info(BD_ADDR rem_bda, tBT_TRANSPORT transport, UINT8 *p_sec
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;
}
/*******************************************************************************
@ -1431,15 +1441,15 @@ tGATT_STATUS gatt_send_error_rsp (tGATT_TCB *p_tcb, UINT8 err_code, UINT8 op_cod
} else {
status = GATT_INSUF_RESOURCE;
}
#if (GATTS_INCLUDED == TRUE)
if (deq) {
gatt_dequeue_sr_cmd(p_tcb);
}
#endif ///GATTS_INCLUDED == TRUE
return status;
}
#if (SDP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function gatt_add_sdp_record
@ -1505,7 +1515,7 @@ UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl)
return (sdp_handle);
}
#endif ///SDP_INCLUDED == TRUE
#if GATT_CONFORMANCE_TESTING == TRUE
/*******************************************************************************
@ -1716,6 +1726,7 @@ UINT8 gatt_num_clcb_by_bd_addr(BD_ADDR bda)
*******************************************************************************/
void gatt_sr_copy_prep_cnt_to_cback_cnt(tGATT_TCB *p_tcb )
{
#if (GATTS_INCLUDED == TRUE)
UINT8 i;
if (p_tcb) {
@ -1725,7 +1736,7 @@ void gatt_sr_copy_prep_cnt_to_cback_cnt(tGATT_TCB *p_tcb )
}
}
}
#endif ///GATTS_INCLUDED == TRUE
}
/*******************************************************************************
@ -1740,6 +1751,7 @@ void gatt_sr_copy_prep_cnt_to_cback_cnt(tGATT_TCB *p_tcb )
BOOLEAN gatt_sr_is_cback_cnt_zero(tGATT_TCB *p_tcb )
{
BOOLEAN status = TRUE;
#if (GATTS_INCLUDED == TRUE)
UINT8 i;
if (p_tcb) {
@ -1752,6 +1764,7 @@ BOOLEAN gatt_sr_is_cback_cnt_zero(tGATT_TCB *p_tcb )
} else {
status = FALSE;
}
#endif ///GATTS_INCLUDED == TRUE
return status;
}
@ -1794,6 +1807,7 @@ BOOLEAN gatt_sr_is_prep_cnt_zero(tGATT_TCB *p_tcb)
*******************************************************************************/
void gatt_sr_reset_cback_cnt(tGATT_TCB *p_tcb )
{
#if (GATTS_INCLUDED == TRUE)
UINT8 i;
if (p_tcb) {
@ -1801,6 +1815,7 @@ void gatt_sr_reset_cback_cnt(tGATT_TCB *p_tcb )
p_tcb->sr_cmd.cback_cnt[i] = 0;
}
}
#endif ///GATTS_INCLUDED == TRUE
}
/*******************************************************************************
@ -1834,7 +1849,7 @@ void gatt_sr_reset_prep_cnt(tGATT_TCB *p_tcb )
*******************************************************************************/
void gatt_sr_update_cback_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc, BOOLEAN is_reset_first)
{
#if (GATTS_INCLUDED == TRUE)
UINT8 idx = ((UINT8) gatt_if) - 1 ;
if (p_tcb) {
@ -1849,6 +1864,7 @@ void gatt_sr_update_cback_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc
}
}
}
#endif ///GATTS_INCLUDED == TRUE
}

View File

@ -385,7 +385,9 @@ typedef struct {
/* server needs */
/* server response data */
#if (GATTS_INCLUDED == TRUE)
tGATT_SR_CMD sr_cmd;
#endif ///GATTS_INCLUDED == TRUE
UINT16 indicate_handle;
BUFFER_Q pending_ind_q;
@ -502,11 +504,12 @@ typedef struct {
UINT16 next_handle; /* next available handle */
tGATT_SVC_CHG gattp_attr; /* GATT profile attribute service change */
tGATT_IF gatt_if;
#if (GATTS_INCLUDED == TRUE)
tGATT_HDL_LIST_INFO hdl_list_info;
tGATT_HDL_LIST_ELEM hdl_list[GATT_MAX_SR_PROFILES];
tGATT_SRV_LIST_INFO srv_list_info;
tGATT_SRV_LIST_ELEM srv_list[GATT_MAX_SR_PROFILES];
#endif ///GATTS_INCLUDED == TRUE
BUFFER_Q srv_chg_clt_q; /* service change clients queue */
BUFFER_Q pending_new_srv_start_q; /* pending new service start queue */
tGATT_REG cl_rcb[GATT_MAX_APPS];
@ -521,8 +524,9 @@ typedef struct {
UINT8 err_status;
UINT16 handle;
#endif
#if (GATTS_INCLUDED == TRUE)
tGATT_PROFILE_CLCB profile_clcb[GATT_MAX_APPS];
#endif ///GATTS_INCLUDED == TRUE
UINT16 handle_of_h_r; /* Handle of the handles reused characteristic value */
tGATT_APPL_INFO cb_info;
@ -589,7 +593,9 @@ extern tGATT_STATUS attp_send_msg_to_l2cap(tGATT_TCB *p_tcb, BT_HDR *p_toL2CAP);
/* utility functions */
extern UINT8 *gatt_dbg_op_name(UINT8 op_code);
#if (SDP_INCLUDED == TRUE)
extern UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl);
#endif ///SDP_INCLUDED == TRUE
extern BOOLEAN gatt_parse_uuid_from_cmd(tBT_UUID *p_uuid, UINT16 len, UINT8 **p_data);
extern UINT8 gatt_build_uuid_to_stream(UINT8 **p_dst, tBT_UUID uuid);
extern BOOLEAN gatt_uuid_compare(tBT_UUID src, tBT_UUID tar);

View File

@ -86,7 +86,7 @@ BOOLEAN btsnd_hcic_ble_write_adv_params (UINT16 adv_int_min, UINT16 adv_int_max,
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_ERROR("####################adv_type = %d",adv_type);
if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_BLE_WRITE_ADV_PARAMS)) == NULL) {
return (FALSE);
}

View File

@ -164,7 +164,9 @@ BOOLEAN btsnd_hcic_create_conn(BD_ADDR dest, UINT16 packet_types,
#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);
}
@ -489,8 +491,9 @@ BOOLEAN btsnd_hcic_rmt_name_req (BD_ADDR bd_addr, UINT8 page_scan_rep_mode,
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);
}

View File

@ -24,7 +24,7 @@
#ifndef A2D_API_H
#define A2D_API_H
#include "sdp_api.h"
#if (A2D_INCLUDED == TRUE)
/*****************************************************************************
** constants
*****************************************************************************/
@ -251,5 +251,5 @@ extern UINT8 A2D_BitsSet(UINT8 num);
**
*******************************************************************************/
extern void A2D_Init(void);
#endif ///A2D_INCLUDED
#endif /* A2D_API_H */

View File

@ -23,7 +23,7 @@
******************************************************************************/
#ifndef A2D_SBC_H
#define A2D_SBC_H
#if (A2D_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
@ -208,4 +208,6 @@ extern void A2D_ParsSbcMplHdr(UINT8 *p_src, BOOLEAN *p_frag,
}
#endif
#endif ///A2D_INCLUDED == TRUE
#endif /* A2D_SBC_H */

View File

@ -27,7 +27,7 @@
#include "avct_api.h"
#include "sdp_api.h"
#include "avrc_defs.h"
#if (AVRC_INCLUDED == TRUE)
/*****************************************************************************
** constants
*****************************************************************************/
@ -634,4 +634,7 @@ extern BOOLEAN AVRC_IsValidPlayerAttr(UINT8 attr);
}
#endif
#endif ///AVRC_INCLUDED == TRUE
#endif /* AVRC_API_H */

View File

@ -23,7 +23,9 @@
******************************************************************************/
#ifndef _AVRC_DEFS_H
#define _AVRC_DEFS_H
#include "bt_target.h"
#if (AVRC_INCLUDED == TRUE)
/*****************************************************************************
** constants
*****************************************************************************/
@ -1356,5 +1358,5 @@ typedef union {
tAVRC_RSP add_to_play; /* AddToNowPlaying */
} tAVRC_RESPONSE;
#endif ///AVRC_INCLUDED == TRUE
#endif

View File

@ -1531,6 +1531,7 @@ typedef void (tBTM_BOND_CANCEL_CMPL_CALLBACK) (tBTM_STATUS result);
/* LE related event and data structure
*/
#if (SMP_INCLUDED == TRUE)
#define BTM_LE_IO_REQ_EVT SMP_IO_CAP_REQ_EVT /* received IO_CAPABILITY_REQUEST event */
#define BTM_LE_SEC_REQUEST_EVT SMP_SEC_REQUEST_EVT /* security request event */
#define BTM_LE_KEY_NOTIF_EVT SMP_PASSKEY_NOTIF_EVT /* received USER_PASSKEY_NOTIFY event */
@ -1546,8 +1547,10 @@ typedef void (tBTM_BOND_CANCEL_CMPL_CALLBACK) (tBTM_STATUS result);
#define BTM_LE_COMPLT_EVT SMP_COMPLT_EVT /* SMP complete event */
#define BTM_LE_LAST_FROM_SMP BTM_LE_BR_KEYS_REQ_EVT
#define BTM_LE_KEY_EVT BTM_LE_LAST_FROM_SMP + 1 /* KEY update event */
#endif ///SMP_INCLUDED == TRUE
typedef UINT8 tBTM_LE_EVT;
#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
#define BTM_LE_KEY_NONE 0
#define BTM_LE_KEY_PENC SMP_SEC_KEY_TYPE_ENC /* encryption information of peer device */
#define BTM_LE_KEY_PID SMP_SEC_KEY_TYPE_ID /* identity key of the peer device */
@ -1557,12 +1560,15 @@ typedef UINT8 tBTM_LE_EVT;
#define BTM_LE_KEY_LENC (SMP_SEC_KEY_TYPE_ENC << 4) /* master role security information:div */
#define BTM_LE_KEY_LID (SMP_SEC_KEY_TYPE_ID << 4) /* master device ID key */
#define BTM_LE_KEY_LCSRK (SMP_SEC_KEY_TYPE_CSRK << 4) /* local CSRK has been deliver to peer */
#endif ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
typedef UINT8 tBTM_LE_KEY_TYPE;
#if (SMP_INCLUDED == TRUE)
#define BTM_LE_AUTH_REQ_NO_BOND SMP_AUTH_NO_BOND /* 0 */
#define BTM_LE_AUTH_REQ_BOND SMP_AUTH_GEN_BOND /* 1 << 0 */
#define BTM_LE_AUTH_REQ_MITM SMP_AUTH_YN_BIT /* 1 << 2 */
#endif ///SMP_INCLUDED == TRUE
typedef UINT8 tBTM_LE_AUTH_REQ;
#if (SMP_INCLUDED == TRUE)
#define BTM_LE_SC_SUPPORT_BIT SMP_SC_SUPPORT_BIT /* (1 << 3) */
#define BTM_LE_KP_SUPPORT_BIT SMP_KP_SUPPORT_BIT /* (1 << 4) */
@ -1576,6 +1582,7 @@ typedef UINT8 tBTM_LE_AUTH_REQ;
#define BTM_LE_SEC_NONE SMP_SEC_NONE
#define BTM_LE_SEC_UNAUTHENTICATE SMP_SEC_UNAUTHENTICATE /* 1 */
#define BTM_LE_SEC_AUTHENTICATED SMP_SEC_AUTHENTICATED /* 4 */
#endif ///SMP_INCLUDED == TRUE
typedef UINT8 tBTM_LE_SEC;
@ -2025,6 +2032,7 @@ tBTM_STATUS BTM_VendorSpecificCommand(UINT16 opcode,
**
*******************************************************************************/
//extern
#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 BTM_AllocateSCN(void);
// btla-specific ++
@ -2053,6 +2061,7 @@ BOOLEAN BTM_TryAllocateSCN(UINT8 scn);
*******************************************************************************/
//extern
BOOLEAN BTM_FreeSCN(UINT8 scn);
#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************

View File

@ -759,7 +759,9 @@ typedef struct {
** ACL Management
****************************************************/
tACL_CONN acl_db[MAX_L2CAP_LINKS];
#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 btm_scn[BTM_MAX_SCN]; /* current SCNs: TRUE if SCN is in use */
#endif ///CLASSIC_BT_INCLUDED == TRUE
UINT16 btm_def_link_policy;
UINT16 btm_def_link_super_tout;
@ -815,9 +817,11 @@ typedef struct {
tBTM_APPL_INFO api;
#define BTM_SEC_MAX_RMT_NAME_CALLBACKS 2
tBTM_RMT_NAME_CALLBACK *p_rmt_name_callback[BTM_SEC_MAX_RMT_NAME_CALLBACKS];
tBTM_RMT_NAME_CALLBACK *p_rmt_name_callback[BTM_SEC_MAX_RMT_NAME_CALLBACKS];
#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_collided_dev_rec;
#endif ///SMP_INCLUDED == TRUE
TIMER_LIST_ENT sec_collision_tle;
UINT32 collision_start_time;
UINT32 max_collision_delay;
@ -828,6 +832,7 @@ typedef struct {
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 (SMP_INCLUDED == TRUE)
// btla-specific ++
#ifdef PORCHE_PAIRING_CONFLICT
UINT8 pin_code_len_saved; /* for legacy devices */
@ -843,6 +848,7 @@ typedef struct {
UINT16 disc_handle; /* for legacy devices */
UINT8 disc_reason; /* for legacy devices */
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;
@ -859,7 +865,6 @@ typedef struct {
BOOLEAN paging;
BOOLEAN discing;
BUFFER_Q sec_pending_q; /* pending sequrity requests in tBTM_SEC_QUEUE_ENTRY format */
#if (!defined(BT_TRACE_VERBOSE) || (BT_TRACE_VERBOSE == FALSE))
char state_temp_buffer[BTM_STATE_BUFFER_SIZE];
#endif

View File

@ -24,8 +24,12 @@
#ifndef HIDDEFS_H
#define HIDDEFS_H
#include "bt_target.h"
#if (HID_HOST_INCLUDED == TRUE)
#if (SDP_INCLUDED == TRUE)
#include "sdp_api.h"
#endif ///SDP_INCLUDED == TRUE
/*
** tHID_STATUS: HID result codes, returned by HID and device and host functions.
*/
@ -149,8 +153,11 @@ typedef struct sdp_info {
tHID_DEV_DSCP_INFO dscp_info; /* Descriptor list and Report list to be set in the SDP record.
This parameter is used if HID_DEV_USE_GLB_SDP_REC is set to FALSE.*/
#if(SDP_INCLUDED == TRUE)
tSDP_DISC_REC *p_sdp_layer_rec;
#endif ///SDP_INCLUDED == TRUE
} tHID_DEV_SDP_INFO;
#endif ///HID_HOST_INCLUDED == TRUE
#endif

Some files were not shown because too many files have changed in this diff Show More