#include "bta_av_api.h"
+#if (BTA_AR_INCLUDED == TRUE)
#ifndef BTA_AR_DEBUG
#define BTA_AR_DEBUG FALSE
#define bta_ar_cb (*bta_ar_cb_ptr)
#endif
+#endif ///BTA_AR_INCLUDED == TRUE
+
#endif /* BTA_AR_INT_H */
#include "bta_av_co.h"
#include "list.h"
+#if (BTA_AV_INCLUDED == TRUE)
+
#define BTA_AV_DEBUG TRUE
/*****************************************************************************
** Constants
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 */
static void bta_dm_remname_cback (tBTM_REMOTE_DEV_NAME *p_remote_name);
static void bta_dm_find_services ( BD_ADDR bd_addr);
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
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);
*******************************************************************************/
void bta_dm_discover (tBTA_DM_MSG *p_data)
{
+#if (SDP_INCLUDED == TRUE)
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
UINT16 len = (UINT16)(sizeof(tBT_UUID) * p_data->discover.num_uuid);
#endif
bta_dm_search_cb.name_discover_done = FALSE;
memcpy(&bta_dm_search_cb.uuid, &p_data->discover.uuid, sizeof(tSDP_UUID));
bta_dm_discover_device(p_data->discover.bd_addr);
+#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void bta_dm_di_disc_cmpl(tBTA_DM_MSG *p_data)
{
+#if (SDP_INCLUDED == TRUE)
tBTA_DM_DI_DISC_CMPL di_disc;
memset(&di_disc, 0, sizeof(tBTA_DM_DI_DISC_CMPL));
bta_dm_di_cb.p_di_db = NULL;
bta_dm_search_cb.p_search_cback(BTA_DM_DI_DISC_CMPL_EVT, (tBTA_DM_SEARCH *) &di_disc);
+#endif ///SDP_INCLUDED == TRUE
}
+#if (SDP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_dm_di_disc_callback
bta_sys_sendmsg(p_msg);
}
}
-
+#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Function bta_dm_disable_search_and_disc
*******************************************************************************/
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);
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
}
/*******************************************************************************
*******************************************************************************/
void bta_dm_di_disc (tBTA_DM_MSG *p_data)
{
+#if (SDP_INCLUDED == TRUE)
UINT16 result = BTA_FAILURE;
tBTA_DM_MSG *p_msg;
p_data->hdr.offset = result;
bta_sys_sendmsg(p_msg);
}
+#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
{
-
+#if (SDP_INCLUDED == TRUE)
tSDP_DISC_REC *p_sdp_rec = NULL;
tBTA_DM_MSG *p_msg;
BOOLEAN scn_found = FALSE;
bta_sys_sendmsg(p_msg);
}
}
+#endif ///SDP_INCLUDE == TRUE
}
/*******************************************************************************
*******************************************************************************/
void bta_dm_free_sdp_db (tBTA_DM_MSG *p_data)
{
+#if (SDP_INCLUDED == TRUE)
UNUSED(p_data);
if (bta_dm_search_cb.p_sdp_db) {
GKI_freebuf(bta_dm_search_cb.p_sdp_db);
bta_dm_search_cb.p_sdp_db = NULL;
}
-
+#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void bta_dm_queue_disc (tBTA_DM_MSG *p_data)
{
+#if (SDP_INCLUDED == TRUE)
if (bta_dm_search_cb.p_search_queue) {
GKI_freebuf(bta_dm_search_cb.p_search_queue);
}
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
}
/*******************************************************************************
*******************************************************************************/
void bta_dm_search_cancel_transac_cmpl(tBTA_DM_MSG *p_data)
{
+#if (SDP_INCLUDED == TRUE)
UNUSED(p_data);
if (bta_dm_search_cb.p_sdp_db) {
GKI_freebuf(bta_dm_search_cb.p_sdp_db);
}
bta_dm_search_cancel_notify(NULL);
+#endif ///SDP_INCLUDED == TRUE
}
*******************************************************************************/
static void bta_dm_find_services ( BD_ADDR bd_addr)
{
-
+#if (SDP_INCLUDED == TRUE)
tSDP_UUID uuid;
tBTA_DM_MSG *p_msg;
bta_sys_sendmsg(p_msg);
}
}
+#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
}
}
+#if (SDP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_dm_sdp_callback
}
}
-
+#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Function bta_dm_inq_results_cb
static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_DATA *p_data)
{
tBTM_STATUS status = BTM_SUCCESS;
+#if (SMP_INCLUDED == TRUE)
tBTA_DM_SEC sec_event;
char *p_name = NULL;
status = BTM_NOT_AUTHORIZED;
break;
}
+#endif ///SMP_INCLUDED == TRUE
return status;
}
#endif /* SMP_INCLUDED == TRUE */
void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search)
{
+#if (SDP_INCLUDED == TRUE)
tBTA_DM_API_DISCOVER *p_msg;
if ((p_msg = (tBTA_DM_API_DISCOVER *) GKI_getbuf(sizeof(tBTA_DM_API_DISCOVER))) != NULL) {
p_msg->sdp_search = sdp_search;
bta_sys_sendmsg(p_msg);
}
-
+#endif ///SDP_INCLUDED == TRUE
}
+#if (SDP_INCLUDED == TRUE)
+
/*******************************************************************************
**
** Function BTA_DmDiscoverUUID
memcpy( &p_msg->uuid, uuid, sizeof(tSDP_UUID) );
bta_sys_sendmsg(p_msg);
}
-
}
+#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
return (p_dev && p_dev->conn_state == BTA_DM_CONNECTED);
}
-
+#if (SDP_INCLUDED == TRUE)
/*******************************************************************************
** Device Identification (DI) Server Functions
*******************************************************************************/
return status;
}
-
+#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Function bta_dmexecutecallback
** 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)
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
}
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
#endif
} tBTA_DM_API_SEARCH;
+#if (SDP_INCLUDED == TRUE)
/* data type for BTA_DM_API_DISCOVER_EVT */
typedef struct {
BT_HDR hdr;
#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;
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;
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;
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 */
/* 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;
#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 ||
*******************************************************************************/
void bta_gattc_sdp_callback (UINT16 sdp_status)
{
+#if (SDP_INCLUDED == TRUE)
tSDP_DISC_REC *p_sdp_rec = NULL;
tBT_UUID service_uuid;
tSDP_PROTOCOL_ELEM pe;
GKI_freebuf(bta_gattc_cb.p_sdp_db);
bta_gattc_cb.p_sdp_db = NULL;
bta_gattc_cb.sdp_conn_id = 0;
+#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
**
*******************************************************************************/
static tBTA_GATT_STATUS bta_gattc_sdp_service_disc(UINT16 conn_id, tBTA_GATTC_SERV *p_server_cb)
{
+#if (SDP_INCLUDED == TRUE)
tSDP_UUID uuid;
UINT16 num_attrs = 2;
UINT16 attr_list[2];
}
}
return status;
+#else
+ return BTA_GATT_NO_RESOURCES;
+#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
**
#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
tBTA_HH_CFG *p_bta_hh_cfg = (tBTA_HH_CFG *) &bta_hh_cfg;
+#endif ///defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
\ No newline at end of file
//#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
extern void bta_hh_trace_dev_db(void);
#endif
+#endif ///defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
#endif
} 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)
#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
#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 */
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;
#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 */
#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
typedef UINT8 tBTA_DM_ROUTE_PATH;
-
+#if (SDP_INCLUDED == TRUE)
/* Device Identification (DI) data structure
*/
/* Used to set the 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
*******************************************************************************/
extern void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
-
+#if (SDP_INCLUDED == TRUE)
// btla-specific ++
/*******************************************************************************
**
*******************************************************************************/
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
*******************************************************************************/
extern UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr );
-
+#if (SDP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function BTA_DmSetLocalDiRecord
*******************************************************************************/
extern tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
UINT32 *p_handle );
-
+#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
**
#include "bta_av_api.h"
#include "bta_sys.h"
+#if (BTA_AR_INCLUDED == TRUE)
+
/*****************************************************************************
** Constants and data types
*****************************************************************************/
}
#endif
+#endif ///BTA_AR_INCLUDED == TRUE
+
#endif /* BTA_AR_API_H */
#include "a2d_api.h"
#include "bta_api.h"
+#if (BTA_AV_INCLUDED == TRUE)
+
/*****************************************************************************
** Constants and data types
*****************************************************************************/
}
#endif
+#endif ///BTA_AV_INCLUDED == TRUE
+
#endif /* BTA_AV_API_H */
#include "bta_av_api.h"
+#if (BTA_AV_INCLUDED == TRUE)
+
/*****************************************************************************
** Function Declarations
*****************************************************************************/
}
#endif
+#endif ///BTA_AV_INCLUDED == TRUE
+
#endif /* BTA_AV_CI_H */
#include "l2c_api.h"
#include "bta_av_api.h"
+#if (BTA_AV_INCLUDED == TRUE)
+
/*****************************************************************************
** Constants and data types
*****************************************************************************/
*******************************************************************************/
extern void bta_av_co_video_delay(tBTA_AV_HNDL hndl, UINT16 delay);
+#endif ///BTA_AV_INCLUDED == TRUE
+
#endif /* BTA_AV_CO_H */
#ifndef BTA_AV_SBC_H
#define BTA_AV_SBC_H
+#if (BTA_AV_INCLUDED == TRUE)
+
/*****************************************************************************
** constants
*****************************************************************************/
*******************************************************************************/
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 */
#ifndef BTA_GATT_DEBUG
-#define BTA_GATT_DEBUG FALSE
+#define BTA_GATT_DEBUG TRUE
#endif
/*****************************************************************************
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;
#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"
}
#endif
+#endif ///defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
+
+
#endif /* BTA_HH_API_H */
#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. */
/* 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
}
#endif
+#endif ///SDP_INCLUDED == TRUE
+
#endif /* BTA_SDP_API_H */
#include "btm_int.h"
#include "sdp_api.h"
-#if defined(BTA_SDP_INCLUDED) && (BTA_SDP_INCLUDED == TRUE)
+#if (SDP_INCLUDED == TRUE)
+
/*****************************************************************************
** Constants
*****************************************************************************/
static void bta_create_raw_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_REC *p_rec)
{
+#if (SDP_INCLUDED == TRUE)
tSDP_DISC_ATTR *p_attr;
tSDP_PROTOCOL_ELEM pe;
}
record->hdr.user1_ptr_len = p_bta_sdp_cfg->p_sdp_db->raw_size;
record->hdr.user1_ptr = p_bta_sdp_cfg->p_sdp_db->raw_data;
+#endif ///SDP_INCLUDED == TRUE
}
*******************************************************************************/
static void bta_sdp_search_cback(UINT16 result, void *user_data)
{
+#if (SDP_INCLUDED == TRUE)
tSDP_DISC_REC *p_rec = NULL;
tBTA_SDP_SEARCH_COMP evt_data = {0}; // We need to zero-initialize
tBTA_SDP_STATUS status = BTA_SDP_FAILURE;
bta_sdp_cb.p_dm_cback(BTA_SDP_SEARCH_COMP_EVT, (tBTA_SDP *) &evt_data, (void *)&uuid->uu.uuid128);
osi_free(user_data); // We no longer need the user data to track the search
+#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void bta_sdp_search(tBTA_SDP_MSG *p_data)
{
+#if (SDP_INCLUDED == TRUE)
int x = 0;
// TODO: Leaks!!! but needed as user-data pointer
tBT_UUID *bta_sdp_search_uuid = osi_malloc(sizeof(tBT_UUID));
/*
else report the result when the cback is called
*/
+#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
}
}
-#endif /* #if defined(BTA_SDP_INCLUDED) && (BTA_SDP_INCLUDED == TRUE) */
+#endif ///SDP_INCLUDED == TRUE
\ No newline at end of file
#include "bta_api.h"
#include "bta_sdp_api.h"
+#if (SDP_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
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 */
+
#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;
}
LOG_DEBUG("%s *p_key_mask=0x%02x",__func__, *p_key_mask);
}
+
+#endif ///SMP_INCLUDED == TRUE
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 */
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)
{
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;
}
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;
#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)
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);
\ No newline at end of file
+ tBTA_BLE_LOCAL_ID_KEYS *p_id_keys);
+#endif ///SMP_INCLUDED == TRUE
\ No newline at end of file
#include "btc_media.h"
+#if (BTA_AV_INCLUDED == TRUE)
/*******************************************************************************
** Constants & Macros
********************************************************************************/
*******************************************************************************/
BOOLEAN bta_av_co_get_remote_bitpool_pref(UINT8 *min, UINT8 *max);
+#endif ///BTA_AV_INCLUDED == TRUE
+
#endif
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;
#ifndef HID_CONN_H
#define HID_CONN_H
-
+#if (HID_HOST_INCLUDED == TRUE)
/* Define the HID Connection Block
*/
typedef struct hid_conn {
#define HIDD_SEC_CHN 3
#define HIDD_NOSEC_CHN 4
+#endif ///HID_HOST_INCLUDED == TRUE
#endif
#include "hid_conn.h"
#include "l2c_api.h"
+#if (HID_HOST_INCLUDED == TRUE)
+
enum {
HID_DEV_NO_CONN,
HID_DEV_CONNECTED
}
#endif
+#endif ///HID_HOST_INCLUDED == TRUE
+
#endif
#include "btc_sm.h"
#include "bta_av_api.h"
-
+#if (BTA_AV_INCLUDED == TRUE)
/*******************************************************************************
** Type definitions for callback functions
********************************************************************************/
********************************************************************************/
void btc_av_clear_remote_suspend_flag(void);
+#endif ///BTA_AV_INCLUDED == TRUE
+
#endif /* __BTC_AV_H__ */
#include "a2d_api.h"
#include "a2d_sbc.h"
-
+#if (BTC_AV_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
}
#endif
+#endif ///BTC_AV_INCLUDED == TRUE
+
#endif /* __BTC_AV_API_H__ */
#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
********************************************************************************/
void btc_avrc_call_handler(btc_msg_t *msg);
+#endif ///BTC_AV_INCLUDED == TRUE
+
#endif /* __BTC_AVRC_H__ */
#include "gki.h"
#include "btc_av_api.h"
+#if (BTA_AV_INCLUDED == TRUE)
/*******************************************************************************
** Constants
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
#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
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
}
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
}
/*******************************************************************************
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
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
#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
#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
#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)
#define L2CAP_CLIENT_INCLUDED FALSE
#endif
+/* The default connection link number set to 1,
+** if the user want to support muti connction, should change it in the menuconfig */
+#define MAX_ACL_CONNECTIONS 1
/* The maximum number of simultaneous links that L2CAP can support. Up to 7*/
#ifndef MAX_ACL_CONNECTIONS
/* 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 1 //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. */
/* 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 2 //There are just two fix channel in the BLE only mode(gatt,smp)
+#endif ///CLASSIC_BT_INCLUDED == TRUE
#endif
/* First fixed channel supported */
* resolution, local address rotation etc.
*/
#ifndef BLE_PRIVACY_SPT
-#define BLE_PRIVACY_SPT TRUE
+#define BLE_PRIVACY_SPT FALSE
#endif
/*
******************************************************************************/
#ifndef SMP_INCLUDED
#if BLE_INCLUDED == TRUE
-#define SMP_INCLUDED TRUE
+#define SMP_INCLUDED FALSE
#else
#define SMP_INCLUDED FALSE
#endif
******************************************************************************/
#ifndef SDP_INCLUDED
-#define SDP_INCLUDED TRUE
+#define SDP_INCLUDED FALSE //TRUE
#endif
/* This is set to enable SDP server functionality. */
/* 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
#endif
#ifndef BTM_INITIAL_TRACE_LEVEL
-#define BTM_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
+#define BTM_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
#endif
#ifndef L2CAP_INITIAL_TRACE_LEVEL
-#define L2CAP_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
+#define L2CAP_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
#endif
#ifndef RFCOMM_INITIAL_TRACE_LEVEL
#endif
#ifndef APPL_INITIAL_TRACE_LEVEL
-#define APPL_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
+#define APPL_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
#endif
#ifndef BT_TRACE_APPL
#endif
#ifndef GATT_INITIAL_TRACE_LEVEL
-#define GATT_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
+#define GATT_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
#endif
#ifndef SMP_INITIAL_TRACE_LEVEL
#define A2D_INT_H
#include "a2d_api.h"
-
+#if (A2D_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
#ifdef __cplusplus
}
#endif
-
+#endif ///A2D_INCLUDED == TRUE
#endif /* A2D_INT_H */
******************************************************************************/
#ifndef AVDT_DEFS_H
#define AVDT_DEFS_H
+#include "bt_target.h"
+
+#if (AVDT_INCLUDED == TRUE)
/*****************************************************************************
** constants
#define AVDT_MSG_BLD_NOSP(p, nosp) \
*(p)++ = (UINT8) (nosp);
+#endif ///AVRC_INCLUDED == TRUE
+
#endif /* AVDT_DEFS_H */
#include "l2c_api.h"
#include "btm_api.h"
+#if (AVRC_INCLUDED == TRUE)
+
#ifndef AVDT_DEBUG
#define AVDT_DEBUG FALSE
#endif
}
#endif
+#endif ///AVRC_INCLUDED == TRUE
+
#endif /* AVDT_INT_H */
#include "avct_defs.h"
#include "avrc_api.h"
+#if (AVRC_INCLUDED == TRUE)
/* DEBUG FLAGS
*
* #define META_DEBUG_ENABLED
}
#endif
+#endif ///AVRC_INCLUDED == TRUE
+
#endif /* AVRC_INT_H */
#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;
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) */
btm_sec_set_peer_sec_caps(p, p_dev_rec);
-
+#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);
}
- btm_establish_continue (p);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+ //btm_establish_continue (p);
return;
}
}
&& link_role == HCI_ROLE_SLAVE) {
//do nothing in this case for fix the android7.0 cann't sent security request issue
} else {
- btm_establish_continue(p);
+ //btm_establish_continue(p);
}
} else
#endif
UINT8 BTM_AllocateSCN(void)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 x;
BTM_TRACE_DEBUG ("BTM_AllocateSCN\n");
-
// stack reserves scn 1 for HFP, HSP we still do the correct way
for (x = 1; x < BTM_MAX_SCN; x++) {
if (!btm_cb.btm_scn[x]) {
return (x + 1);
}
}
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
return (0); /* No free ports */
}
BOOLEAN BTM_TryAllocateSCN(UINT8 scn)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
/* Make sure we don't exceed max port range.
* Stack reserves scn 1 for HFP, HSP we still do the correct way.
*/
btm_cb.btm_scn[scn - 1] = TRUE;
return TRUE;
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
return (FALSE); /* Port was busy */
}
*******************************************************************************/
BOOLEAN BTM_FreeSCN(UINT8 scn)
{
+
+#if (CLASSIC_BT_INCLUDED == TRUE)
BTM_TRACE_DEBUG ("BTM_FreeSCN \n");
if (scn <= BTM_MAX_SCN) {
btm_cb.btm_scn[scn - 1] = FALSE;
} else {
return (FALSE); /* Illegal SCN passed in */
}
+#else
+ return (FALSE);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void BTM_BleConfirmReply (BD_ADDR bd_addr, UINT8 res)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
tSMP_STATUS res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_PASSKEY_ENTRY_FAIL;
p_dev_rec->sec_flags |= BTM_SEC_LE_AUTHENTICATED;
BTM_TRACE_DEBUG ("%s\n", __func__);
SMP_ConfirmReply(bd_addr, res_smp);
+#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void btm_ble_rand_enc_complete (UINT8 *p, UINT16 op_code, tBTM_RAND_ENC_CB *p_enc_cplt_cback)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_RAND_ENC params;
UINT8 *p_dest = params.param_buf;
(*p_enc_cplt_cback)(¶ms); /* Call the Encryption complete callback function */
}
}
+#endif ///SMP_INCLUDED == TRUE
}
-#if (SMP_INCLUDED == TRUE)
-
/*******************************************************************************
**
** Function btm_ble_get_enc_key_type
*******************************************************************************/
void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local )
{
+#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
BTM_TRACE_DEBUG ("btm_ble_increment_sign_ctr is_local=%d", is_local);
p_dev_rec->ble.keys.local_counter,
p_dev_rec->ble.keys.counter);
}
+#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
BOOLEAN btm_ble_get_enc_key_type(BD_ADDR bd_addr, UINT8 *p_key_types)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
BTM_TRACE_DEBUG ("btm_ble_get_enc_key_type");
*p_key_types = p_dev_rec->ble.key_type;
return TRUE;
}
+
+#endif ///SMP_INCLUDED == TRUE
return FALSE;
}
*******************************************************************************/
BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_div)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
BOOLEAN status = FALSE;
BTM_TRACE_DEBUG ("btm_get_local_div");
}
BTM_TRACE_DEBUG ("btm_get_local_div status=%d (1-OK) DIV=0x%x", status, *p_div);
return status;
+#else
+ return FALSE;
+#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY_VALUE *p_keys,
BOOLEAN pass_to_application)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_rec;
tBTM_LE_EVT_DATA cb_data;
UINT8 i;
if (p_rec) {
BTM_TRACE_DEBUG ("sec_flags=0x%x", p_rec->sec_flags);
}
+#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void btm_ble_update_sec_key_size(BD_ADDR bd_addr, UINT8 enc_key_size)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_rec;
BTM_TRACE_DEBUG("btm_ble_update_sec_key_size enc_key_size = %d", enc_key_size);
if ((p_rec = btm_find_dev (bd_addr)) != NULL ) {
p_rec->enc_key_size = enc_key_size;
}
+#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
UINT8 btm_ble_read_sec_key_size(BD_ADDR bd_addr)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_rec;
if ((p_rec = btm_find_dev (bd_addr)) != NULL ) {
} else {
return 0;
}
+#else
+ return 0;
+#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE_SEC_REQ_ACT *p_sec_req_act)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
UINT8 req_sec_level = BTM_LE_SEC_NONE, cur_sec_level = BTM_LE_SEC_NONE;
req_sec_level,
*p_sec_req_act);
+#endif ///SMP_INCLUDED == TRUE
+
}
/*******************************************************************************
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;
cmd = BTM_WRONG_MODE;
break;
}
+#endif ///SMP_INCLUDED == TRUE
return cmd;
}
*******************************************************************************/
void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_CB *p_cb = &btm_cb;
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
BT_OCTET8 dummy_stk = {0};
btm_ble_ltk_request_reply(p_dev_rec->bd_addr, FALSE, dummy_stk);
}
}
+#endif ///SMP_INCLUDED == TRUE
}
*******************************************************************************/
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 ) {
p_rec->sec_state = BTM_SEC_STATE_ENCRYPTING;
}
}
-
+#endif ///SMP_INCLUDED == TRUE
return rt;
}
*******************************************************************************/
void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
BOOLEAN enc_cback;
}
/* to notify GATT to send data if any request is pending */
gatt_notify_enc_cmpl(p_dev_rec->ble.pseudo_addr);
+#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void btm_ble_ltk_request_reply(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bda);
tBTM_CB *p_cb = &btm_cb;
btsnd_hcic_ble_ltk_req_neg_reply(btm_cb.enc_handle);
}
}
+#endif ///SMP_INCLUDED == TRUE
}
/*******************************************************************************
UINT8 btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p_data)
{
UINT8 callback_rc = BTM_SUCCESS;
+#if (SMP_INCLUDED == TRUE)
BTM_TRACE_DEBUG ("btm_ble_io_capabilities_req");
if (btm_cb.api.p_le_callback) {
/* the callback function implementation may change the IO capability... */
BTM_TRACE_DEBUG ("btm_ble_io_capabilities_req 6: IO_CAP:%d oob_data:%d auth_req:0x%02x\n",
p_data->io_cap, p_data->oob_data, p_data->auth_req);
}
+#endif ///SMP_INCLUDED == TRUE
return callback_rc;
}
UINT8 btm_ble_br_keys_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p_data)
{
UINT8 callback_rc = BTM_SUCCESS;
+#if (SMP_INCLUDED)
BTM_TRACE_DEBUG ("%s\n", __func__);
if (btm_cb.api.p_le_callback) {
/* the callback function implementation may change the IO capability... */
callback_rc = (*btm_cb.api.p_le_callback) (BTM_LE_IO_REQ_EVT, p_dev_rec->bd_addr,
(tBTM_LE_EVT_DATA *)p_data);
}
-
+#endif ///SMP_INCLUDED
return callback_rc;
}
{
#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);
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;
******************************************************************************/
UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
UINT8 res = 0;
} else {
BTM_TRACE_ERROR("btm_proc_smp_cback received for unknown device");
}
-
+#endif ///SMP_INCLUDED == TRUE
return 0;
}
-#endif /* SMP_INCLUDED */
-
/*******************************************************************************
**
** Function BTM_BleDataSignature
BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
BLE_SIGNATURE signature)
{
+#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bd_addr);
BTM_TRACE_DEBUG ("%s", __func__);
+#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 {
GKI_freebuf(p_buf);
}
}
+#endif ///SMP_INCLUDED == TRUE
return ret;
}
*******************************************************************************/
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
** Returns void
**
*******************************************************************************/
+#if (SMP_INCLUDED == TRUE)
static void btm_notify_new_key(UINT8 key_type)
{
tBTM_BLE_LOCAL_KEYS *p_locak_keys = NULL;
}
}
+
/*******************************************************************************
**
** Function btm_ble_process_dhk
*******************************************************************************/
static void btm_ble_process_dhk(tSMP_ENC *p)
{
-#if SMP_INCLUDED == TRUE
UINT8 btm_ble_irk_pt = 0x01;
tSMP_ENC output;
/* reset all identity root related key */
memset(&btm_cb.devcb.id_keys, 0, sizeof(tBTM_BLE_LOCAL_ID_KEYS));
}
-#endif
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
}
-#if SMP_INCLUDED == TRUE
/*******************************************************************************
** Utility functions for Random address resolving
*******************************************************************************/
** 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;
return TRUE;
}
}
+
return FALSE;
}
+#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
*******************************************************************************/
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;
}
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;
}
rt = TRUE;
}
}
+#endif ///SMP_INCLUDED == TRUE
return rt;
}
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btm_ble_match_random_bda
*******************************************************************************/
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;
btm_ble_resolve_address_cmpl();
return TRUE;
}
-#endif
}
+#endif ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
/*******************************************************************************
**
*******************************************************************************/
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");
} else {
(*p_cback)(NULL, p);
}
-}
#endif
+}
+
+
/*******************************************************************************
** address mapping between pseudo address and real connection address
*******************************************************************************/
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;
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__,
} else {
BTM_TRACE_DEBUG("Device not a RPA enabled device\n");
}
+#endif ///SMP_INCLUDED == TRUE
return rt;
}
*******************************************************************************/
BOOLEAN BTM_SecRegister(tBTM_APPL_INFO *p_cb_info)
{
-#if BLE_INCLUDED == TRUE
+#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
BT_OCTET16 temp_value = {0};
#endif
#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
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 */
case HCI_BLE_LTK_REQ_EVT: /* received only at slave device */
btu_ble_proc_ltk_req(p);
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);
{
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. */
static void btu_ble_proc_ltk_req (UINT8 *p)
{
+#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
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 */
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;
case GATT_TRANSPORT_LE_BR_EDR:
if (p_sreg->type == GATT_UUID_PRI_SERVICE) {
p_uuid = gatts_get_service_uuid (p_sreg->p_db);
-
+#if (SDP_INCLUDED == TRUE)
p_sreg->sdp_handle = gatt_add_sdp_record(p_uuid, p_sreg->s_hdl, p_sreg->e_hdl);
+#endif ///SDP_INCLUDED == TRUE
}
break;
default:
/* 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));
BOOLEAN is_link_key_known = FALSE;
BOOLEAN is_key_mitm = FALSE;
UINT8 key_type;
+#if (SMP_INCLUDED == TRUE)
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;
}
if (!is_link_encrypted) {
btm_ble_get_enc_key_type(p_tcb->peer_bda, &key_type);
- if ( (key_type & BTM_LE_KEY_LCSRK) &&
+ 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;
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);
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;
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");
*******************************************************************************/
static void gatt_l2cif_connect_ind_cback (BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
/* do we already have a control channel for this peer? */
UINT8 result = L2CAP_CONN_OK;
tL2CAP_CFG_INFO cfg;
L2CA_ConfigReq(lcid, &cfg);
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
}
/*******************************************************************************
*******************************************************************************/
static void gatt_l2cif_connect_cfm_cback(UINT16 lcid, UINT16 result)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb;
tL2CAP_CFG_INFO cfg;
}
}
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
}
/*******************************************************************************
*******************************************************************************/
void gatt_l2cif_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb;
tGATTS_SRV_CHG *p_srv_chg_clt = NULL;
}
}
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
}
/*******************************************************************************
*******************************************************************************/
void gatt_l2cif_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb;
tGATTS_SRV_CHG *p_srv_chg_clt = NULL;
/* look up clcb for this channel */
}
}
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
}
/*******************************************************************************
*******************************************************************************/
void gatt_l2cif_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb;
UINT16 reason;
/* send disconnect callback */
gatt_cleanup_upon_disc(p_tcb->peer_bda, reason, GATT_TRANSPORT_BR_EDR);
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
}
/*******************************************************************************
*******************************************************************************/
static void gatt_l2cif_disconnect_cfm_cback(UINT16 lcid, UINT16 result)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb;
UINT16 reason;
UNUSED(result);
gatt_cleanup_upon_disc(p_tcb->peer_bda, reason, GATT_TRANSPORT_BR_EDR);
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
}
/*******************************************************************************
*******************************************************************************/
static void gatt_l2cif_data_ind_cback(UINT16 lcid, BT_HDR *p_buf)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb;
/* look up clcb for this channel */
} else { /* prevent buffer leak */
GKI_freebuf(p_buf);
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
}
/*******************************************************************************
*******************************************************************************/
static void gatt_l2cif_congest_cback (UINT16 lcid, BOOLEAN congested)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
tGATT_TCB *p_tcb = gatt_find_tcb_by_cid(lcid);
if (p_tcb != NULL) {
gatt_channel_congestion(p_tcb, congested);
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
}
/*******************************************************************************
return status;
}
-
+#if (SDP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function gatt_add_sdp_record
return (sdp_handle);
}
-
+#endif ///SDP_INCLUDED == TRUE
#if GATT_CONFORMANCE_TESTING == TRUE
/*******************************************************************************
/* 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);
{
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);
}
#ifndef A2D_API_H
#define A2D_API_H
#include "sdp_api.h"
-
+#if (A2D_INCLUDED == TRUE)
/*****************************************************************************
** constants
*****************************************************************************/
**
*******************************************************************************/
extern void A2D_Init(void);
-
+#endif ///A2D_INCLUDED
#endif /* A2D_API_H */
******************************************************************************/
#ifndef A2D_SBC_H
#define A2D_SBC_H
-
+#if (A2D_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
}
#endif
+#endif ///A2D_INCLUDED == TRUE
+
#endif /* A2D_SBC_H */
#include "avct_api.h"
#include "sdp_api.h"
#include "avrc_defs.h"
-
+#if (AVRC_INCLUDED == TRUE)
/*****************************************************************************
** constants
*****************************************************************************/
}
#endif
+#endif ///AVRC_INCLUDED == TRUE
+
+
#endif /* AVRC_API_H */
******************************************************************************/
#ifndef _AVRC_DEFS_H
#define _AVRC_DEFS_H
+#include "bt_target.h"
+#if (AVRC_INCLUDED == TRUE)
/*****************************************************************************
** constants
*****************************************************************************/
tAVRC_RSP add_to_play; /* AddToNowPlaying */
} tAVRC_RESPONSE;
-
+#endif ///AVRC_INCLUDED == TRUE
#endif
/* 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 */
#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 */
#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) */
#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;
** 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;
#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.
*/
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
#include "hiddefs.h"
#include "sdp_api.h"
+#if (HID_HOST_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
}
#endif
+#endif ///HID_HOST_INCLUDED == TRUE
+
#endif /* HIDH_API_H */
{
#endif
+#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function L2CA_Register
**
*******************************************************************************/
extern BOOLEAN L2CA_DisconnectRsp (UINT16 cid);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
/*******************************************************************************
**
*******************************************************************************/
extern UINT8 L2CA_DataWrite (UINT16 cid, BT_HDR *p_data);
+#if (CLASSIC_BT_INCLUDED == TRUE)
+
/*******************************************************************************
**
** Function L2CA_Ping
**
*******************************************************************************/
extern BOOLEAN L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_callback);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
// Given a local channel identifier, |lcid|, this function returns the bound remote
// channel identifier, |rcid|, and the ACL link handle, |handle|. If |lcid| is not
extern BOOLEAN L2CA_SetIdleTimeout (UINT16 cid, UINT16 timeout,
BOOLEAN is_global);
+
/*******************************************************************************
**
** Function L2CA_SetIdleTimeoutByBdAddr
extern BOOLEAN L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, UINT16 timeout,
tBT_TRANSPORT transport);
+
/*******************************************************************************
**
** Function L2CA_SetTraceLevel
*******************************************************************************/
extern UINT8 L2CA_SetTraceLevel (UINT8 trace_level);
+
/*******************************************************************************
**
** Function L2CA_SetDesireRole
**
*******************************************************************************/
extern UINT8 L2CA_SetDesireRole (UINT8 new_role);
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function L2CA_LocalLoopbackReq
** ACL link.
*******************************************************************************/
extern BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
**
*******************************************************************************/
extern BOOLEAN L2CA_GetBDAddrbyHandle (UINT16 handle, BD_ADDR bd_addr);
+#if (CLASSIC_BT_INCLUDED == TRUE)
+
/*******************************************************************************
**
** Function L2CA_GetChnlFcrMode
**
*******************************************************************************/
extern UINT8 L2CA_GetChnlFcrMode (UINT16 lcid);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
#endif /* (L2CAP_NUM_FIXED_CHNLS > 0) */
+#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function L2CA_GetCurrentConfig
extern BOOLEAN L2CA_GetCurrentConfig (UINT16 lcid,
tL2CAP_CFG_INFO **pp_our_cfg, tL2CAP_CH_CFG_BITS *p_our_cfg_bits,
tL2CAP_CFG_INFO **pp_peer_cfg, tL2CAP_CH_CFG_BITS *p_peer_cfg_bits);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
#if (BLE_INCLUDED == TRUE)
/*******************************************************************************
#ifndef _L2CAP_CLIENT_H_
#define _L2CAP_CLIENT_H_
+#if (defined(L2CAP_CLIENT_INCLUDED) && L2CAP_CLIENT_INCLUDED == TRUE)
//#include <hardware/bluetooth.h>
#include <stdbool.h>
// |client| nor |packet| may be NULL.
bool l2cap_client_write(l2cap_client_t *client, buffer_t *packet);
+#endif ///(defined(L2CAP_CLIENT_INCLUDED) && L2CAP_CLIENT_INCLUDED == TRUE)
+
#endif /*_L2CAP_CLIENT_H_*/
#include "bt_target.h"
#include "sdpdefs.h"
-
+#if (SDP_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
}
#endif
+#endif ///SDP_INCLUDED == TRUE
+
#endif /* SDP_API_H */
#include "btm_api.h"
#include "allocator.h"
+#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function L2CA_Register
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
+
bool L2CA_GetIdentifiers(uint16_t lcid, uint16_t *rcid, uint16_t *handle)
{
tL2C_CCB *control_block = l2cu_find_ccb_by_cid(NULL, lcid);
return (TRUE);
}
+
+
/*******************************************************************************
**
** Function L2CA_SetIdleTimeoutByBdAddr
return TRUE;
}
+
+
/*******************************************************************************
**
** Function L2CA_SetTraceLevel
return (l2cb.desire_role);
}
+#if (CLASSIC_BT_INCLUDED == TRUE)
+
/*******************************************************************************
**
** Function L2CA_LocalLoopbackReq
return (TRUE);
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
/*******************************************************************************
**
return found_dev;
}
+#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function L2CA_GetChnlFcrMode
return (L2CAP_FCR_BASIC_MODE);
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
+
#if (L2CAP_NUM_FIXED_CHNLS > 0)
/*******************************************************************************
**
*******************************************************************************/
BOOLEAN L2CA_RegisterFixedChannel (UINT16 fixed_cid, tL2CAP_FIXED_CHNL_REG *p_freg)
{
+ L2CAP_TRACE_ERROR ("L2CA_RegisterFixedChannel() CID: 0x%04x, %p", fixed_cid,p_freg);
if ( (fixed_cid < L2CAP_FIRST_FIXED_CHNL) || (fixed_cid > L2CAP_LAST_FIXED_CHNL) ) {
L2CAP_TRACE_ERROR ("L2CA_RegisterFixedChannel() Invalid CID: 0x%04x", fixed_cid);
#endif /* #if (L2CAP_NUM_FIXED_CHNLS > 0) */
+#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function L2CA_GetCurrentConfig
return TRUE;
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
**
num_lm_ble_bufs = L2C_DEF_NUM_BLE_BUF_SHARED;
l2cb.num_lm_acl_bufs -= L2C_DEF_NUM_BLE_BUF_SHARED;
}
-
+ L2CAP_TRACE_ERROR("#####################################num_lm_ble_bufs = %d",num_lm_ble_bufs);
l2cb.num_lm_ble_bufs = l2cb.controller_le_xmit_window = num_lm_ble_bufs;
}
#include "btm_int.h"
#include "btu.h"
#include "hcimsgs.h"
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
/********************************************************************************/
/* L O C A L F U N C T I O N P R O T O T Y P E S */
/********************************************************************************/
break;
}
}
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
#include "btm_int.h"
#include "btu.h"
+#if (CLASSIC_BT_INCLUDED == TRUE)
+
/* Flag passed to retransmit_i_frames() when all packets should be retransmitted */
#define L2C_FCR_RETX_ALL_PKTS 0xFF
}
}
#endif
+#endif ///CLASSIC_BT_INCLUDED == TRUE
\ No newline at end of file
{
tL2C_CONN_INFO ci;
tL2C_LCB *p_lcb;
+#if (CLASSIC_BT_INCLUDED == TRUE)
tL2C_CCB *p_ccb;
+#endif ///CLASSIC_BT_INCLUDED == TRUE
tBTM_SEC_DEV_REC *p_dev_info = NULL;
btm_acl_update_busy_level (BTM_BLI_PAGE_DONE_EVT);
l2c_process_held_packets(FALSE);
btu_stop_timer (&p_lcb->timer_entry);
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
/* For all channels, send the event through their FSMs */
for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_ccb->p_next_ccb) {
l2c_csm_execute (p_ccb, L2CEVT_LP_CONNECT_CFM, &ci);
}
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
if (p_lcb->p_echo_rsp_cb) {
l2cu_send_peer_echo_req (p_lcb, NULL, 0);
btu_start_timer (&p_lcb->timer_entry, BTU_TTYPE_L2CAP_LINK, L2CAP_ECHO_RSP_TOUT);
} else {
/* Just in case app decides to try again in the callback context */
p_lcb->link_state = LST_DISCONNECTING;
-
+#if(CLASSIC_BT_INCLUDED == TRUE)
/* Connection failed. For all channels, send the event through */
/* their FSMs. The CCBs should remove themselves from the LCB */
for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; ) {
p_ccb = pn;
}
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
p_lcb->disc_reason = status;
/* Release the LCB */
if (p_lcb->ccb_queue.p_first_ccb == NULL) {
tL2C_LCB *p_lcb;
tL2C_CCB *p_ccb;
tL2C_CCB *p_next_ccb;
+#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 event;
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
UNUSED(transport);
L2CAP_TRACE_DEBUG ("l2c_link_sec_comp: %d, %p", status, p_ref_data);
switch (status) {
case BTM_SUCCESS:
L2CAP_TRACE_DEBUG ("ccb timer ticks: %u", p_ccb->timer_entry.ticks);
+#if (CLASSIC_BT_INCLUDED == TRUE)
event = L2CEVT_SEC_COMP;
+#endif ///CLASSIC_BT_INCLUDED == TRUE
break;
case BTM_DELAY_CHECK:
return;
default:
+#if (CLASSIC_BT_INCLUDED == TRUE)
event = L2CEVT_SEC_COMP_NEG;
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+ break;
}
+#if (CLASSIC_BT_INCLUDED == TRUE)
l2c_csm_execute (p_ccb, event, &ci);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
break;
}
}
BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
{
tL2C_LCB *p_lcb;
+#if (CLASSIC_BT_INCLUDED == TRUE)
tL2C_CCB *p_ccb;
+#endif ///CLASSIC_BT_INCLUDED == TRUE
BOOLEAN status = TRUE;
BOOLEAN lcb_is_free = TRUE;
tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
btm_ble_update_link_topology_mask(p_lcb->link_role, FALSE);
}
#endif
+#if (CLASSIC_BT_INCLUDED == TRUE)
/* Link is disconnected. For all channels, send the event through */
/* their FSMs. The CCBs should remove themselves from the LCB */
for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; ) {
}
p_ccb = pn;
}
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
#if (BTM_SCO_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE)
if (p_lcb->transport == BT_TRANSPORT_BR_EDR)
BOOLEAN l2c_link_hci_qos_violation (UINT16 handle)
{
tL2C_LCB *p_lcb;
+#if (CLASSIC_BT_INCLUDED == TRUE)
tL2C_CCB *p_ccb;
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
/* See if we have a link control block for the connection */
p_lcb = l2cu_find_lcb_by_handle (handle);
if (!p_lcb) {
return (FALSE);
}
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
/* For all channels, tell the upper layer about it */
for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_ccb->p_next_ccb) {
if (p_ccb->p_rcb->api.pL2CA_QoSViolationInd_Cb) {
l2c_csm_execute (p_ccb, L2CEVT_LP_QOS_VIOLATION_IND, NULL);
}
}
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
return (TRUE);
}
*******************************************************************************/
void l2c_link_timeout (tL2C_LCB *p_lcb)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
tL2C_CCB *p_ccb;
+#endif ///CLASSIC_BT_INCLUDED == TRUE
UINT16 timeout;
tBTM_STATUS rc;
(p_lcb->link_state == LST_CONNECT_HOLDING) ||
(p_lcb->link_state == LST_DISCONNECTING)) {
p_lcb->p_pending_ccb = NULL;
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
/* For all channels, send a disconnect indication event through */
/* their FSMs. The CCBs should remove themselves from the LCB */
for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; ) {
p_ccb = pn;
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
#if (BLE_INCLUDED == TRUE)
if (p_lcb->link_state == LST_CONNECTING &&
l2cb.is_ble_connecting == TRUE) {
(*p_cb) (L2CAP_PING_RESULT_NO_RESP);
L2CAP_TRACE_WARNING ("L2CAP - ping timeout");
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
/* For all channels, send a disconnect indication event through */
/* their FSMs. The CCBs should remove themselves from the LCB */
for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; ) {
p_ccb = pn;
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
}
/* If no channels in use, drop the link. */
void l2c_info_timeout (tL2C_LCB *p_lcb)
{
tL2C_CCB *p_ccb;
+#if (CLASSIC_BT_INCLUDED == TRUE)
tL2C_CONN_INFO ci;
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
/* If we timed out waiting for info response, just continue using basic if allowed */
if (p_lcb->w4_info_rsp) {
/* If waiting for security complete, restart the info response timer */
}
p_lcb->w4_info_rsp = FALSE;
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
/* If link is in process of being brought up */
if ((p_lcb->link_state != LST_DISCONNECTED) &&
(p_lcb->link_state != LST_DISCONNECTING)) {
}
}
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
}
}
{
int xx;
BOOLEAN single_write = FALSE;
-
+ L2CAP_TRACE_ERROR("%s",__func__);
/* Save the channel ID for faster counting */
if (p_buf) {
if (p_ccb != NULL) {
** This LCB will be served when receiving number of completed packet event.
*/
if (l2cb.is_cong_cback_context) {
+ L2CAP_TRACE_ERROR("l2cab is_cong_cback_context");
return;
}
/* Loop through, starting at the next */
for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++) {
/* If controller window is full, nothing to do */
+ L2CAP_TRACE_DEBUG("window = %d,robin_unacked = %d,robin_quota=%d",l2cb.controller_le_xmit_window,l2cb.ble_round_robin_unacked,l2cb.ble_round_robin_quota);
if (((l2cb.controller_xmit_window == 0 ||
(l2cb.round_robin_unacked >= l2cb.round_robin_quota))
#if (BLE_INCLUDED == TRUE)
if (p_lcb == &l2cb.lcb_pool[MAX_L2CAP_LINKS]) {
p_lcb = &l2cb.lcb_pool[0];
}
-
+ L2CAP_TRACE_DEBUG("in_use=%d,segment_being_sent=%d,link_state=%d,link_xmit_quota=%d",p_lcb->in_use,p_lcb->partial_segment_being_sent,p_lcb->link_state,p_lcb->link_xmit_quota);
if ( (!p_lcb->in_use)
|| (p_lcb->partial_segment_being_sent)
|| (p_lcb->link_state != LST_CONNECTED)
#endif
} else { /* if this is not round-robin service */
/* If a partial segment is being sent, can't send anything else */
+ L2CAP_TRACE_DEBUG("partial_segment_being_sent=%d,link_state=%d,power_mode=%d",p_lcb->partial_segment_being_sent,p_lcb->link_state,L2C_LINK_CHECK_POWER_MODE (p_lcb));
if ( (p_lcb->partial_segment_being_sent)
|| (p_lcb->link_state != LST_CONNECTED)
|| (L2C_LINK_CHECK_POWER_MODE (p_lcb)) ) {
while ((l2cb.controller_xmit_window != 0) && (p_lcb->sent_not_acked < p_lcb->link_xmit_quota))
#endif
{
+ L2CAP_TRACE_DEBUG("l2cu_get_next_buffer_to_send = %p",l2cu_get_next_buffer_to_send(p_lcb));
if ((p_buf = l2cu_get_next_buffer_to_send (p_lcb)) == NULL) {
break;
}
UINT16 num_segs;
UINT16 xmit_window, acl_data_size;
const controller_t *controller = controller_get_interface();
-
+ L2CAP_TRACE_DEBUG("%s",__func__);
if ((p_buf->len <= controller->get_acl_packet_size_classic()
#if (BLE_INCLUDED == TRUE)
&& (p_lcb->transport == BT_TRANSPORT_BR_EDR)) ||
p_ccb = p_lcb->p_fixed_ccbs[rcv_cid - L2CAP_FIRST_FIXED_CHNL];
if (p_ccb->peer_cfg.fcr.mode != L2CAP_FCR_BASIC_MODE) {
+#if (CLASSIC_BT_INCLUDED == TRUE)
l2c_fcr_proc_pdu (p_ccb, p_msg);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
} else
(*l2cb.fixed_reg[rcv_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)
(rcv_cid, p_lcb->remote_bd_addr, p_msg);
} else {
/* Basic mode packets go straight to the state machine */
if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_BASIC_MODE) {
+#if (CLASSIC_BT_INCLUDED == TRUE)
l2c_csm_execute (p_ccb, L2CEVT_L2CAP_DATA, p_msg);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
} else {
/* eRTM or streaming mode, so we need to validate states first */
if ((p_ccb->chnl_state == CST_OPEN) || (p_ccb->chnl_state == CST_CONFIG)) {
+#if (CLASSIC_BT_INCLUDED == TRUE)
l2c_fcr_proc_pdu (p_ccb, p_msg);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
} else {
GKI_freebuf (p_msg);
}
*******************************************************************************/
static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 *p_pkt_end, *p_next_cmd, *p_cfg_end, *p_cfg_start;
UINT8 cmd_code, cfg_code, cfg_len, id;
tL2C_CONN_INFO con_info;
return;
}
}
+
+#endif ///CLASSIC_BT_INCLUDED == TRUE
}
/*******************************************************************************
case BTU_TTYPE_L2CAP_LINK:
l2c_link_timeout ((tL2C_LCB *)p_tle->param);
break;
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
case BTU_TTYPE_L2CAP_CHNL:
l2c_csm_execute (((tL2C_CCB *)p_tle->param), L2CEVT_TIMEOUT, NULL);
break;
case BTU_TTYPE_L2CAP_FCR_ACK:
l2c_csm_execute (((tL2C_CCB *)p_tle->param), L2CEVT_ACK_TIMEOUT, NULL);
break;
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
case BTU_TTYPE_L2CAP_HOLD:
/* Update the timeouts in the hold queue */
l2c_process_held_packets(TRUE);
*******************************************************************************/
UINT8 l2c_data_write (UINT16 cid, BT_HDR *p_data, UINT16 flags)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
tL2C_CCB *p_ccb;
/* Find the channel control block. We don't know the link it is on. */
if (p_ccb->cong_sent) {
return (L2CAP_DW_CONGESTED);
}
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
return (L2CAP_DW_SUCCESS);
}
btu_stop_quick_timer (&p_ccb->fcrb.mon_retrans_timer);
}
// btla-specific --
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
l2c_fcr_stop_timer (p_ccb);
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
p_ccb->ertm_info.preferred_mode = L2CAP_FCR_BASIC_MODE; /* Default mode for channel is basic mode */
p_ccb->ertm_info.allowed_modes = L2CAP_FCR_CHAN_OPT_BASIC; /* Default mode for channel is basic mode */
p_ccb->ertm_info.fcr_rx_pool_id = L2CAP_FCR_RX_POOL_ID;
while (!GKI_queue_is_empty(&p_ccb->xmit_hold_q)) {
GKI_freebuf (GKI_dequeue (&p_ccb->xmit_hold_q));
}
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
l2c_fcr_cleanup (p_ccb);
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
/* Channel may not be assigned to any LCB if it was just pre-reserved */
if ( (p_lcb) &&
( (p_ccb->local_cid >= L2CAP_BASE_APPL_CID)
BOOLEAN qos_type_ok = TRUE;
BOOLEAN flush_to_ok = TRUE;
BOOLEAN fcr_ok = TRUE;
+#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 fcr_status;
-
+#endif ///CLASSIC_BT_INCLUDED == TRUE
/* Ignore FCR parameters for basic mode */
if (!p_cfg->fcr_present) {
p_cfg->fcr.mode = L2CAP_FCR_BASIC_MODE;
p_cfg->qos_present = TRUE;
p_cfg->qos = p_ccb->peer_cfg.qos;
}
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
if ((fcr_status = l2c_fcr_process_peer_cfg_req (p_ccb, p_cfg)) == L2CAP_PEER_CFG_DISCONNECT) {
/* Notify caller to disconnect the channel (incompatible modes) */
p_cfg->result = L2CAP_CFG_FAILED_NO_REASON;
}
fcr_ok = (fcr_status == L2CAP_PEER_CFG_OK);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
/* Return any unacceptable parameters */
if (mtu_ok && flush_to_ok && qos_type_ok && fcr_ok) {
*******************************************************************************/
void l2cu_process_our_cfg_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
/* If peer wants QoS, we are allowed to change the values in a positive response */
if ( (p_cfg->qos_present) && (p_ccb->peer_cfg.qos_present) ) {
p_ccb->peer_cfg.qos = p_cfg->qos;
}
l2c_fcr_adj_our_rsp_options (p_ccb, p_cfg);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
}
*******************************************************************************/
void l2cu_resubmit_pending_sec_req (BD_ADDR p_bda)
{
+#if (CLASSIC_BT_INCLUDED == TRUE)
tL2C_LCB *p_lcb;
tL2C_CCB *p_ccb;
tL2C_CCB *p_next_ccb;
int xx;
-
L2CAP_TRACE_DEBUG ("l2cu_resubmit_pending_sec_req p_bda: %p", p_bda);
/* If we are called with a BDA, only resubmit for that BDA */
if (p_bda) {
p_lcb = l2cu_find_lcb_by_bd_addr (p_bda, BT_TRANSPORT_BR_EDR);
-
/* If we don't have one, this is an error */
if (p_lcb) {
/* For all channels, send the event through their FSMs */
l2c_csm_execute (p_ccb, L2CEVT_SEC_RE_SEND_CMD, NULL);
}
}
- }
+ }
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
}
#if L2CAP_CONFORMANCE_TESTING == TRUE
{
#if (L2CAP_NUM_FIXED_CHNLS > 0)
tL2C_CCB *p_ccb;
-
+ L2CAP_TRACE_ERROR("%s,fixed_cid=%d,p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL] = %p",__func__,fixed_cid,p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]);
/* If we already have a CCB, then simply return */
if (p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL] != NULL) {
return (TRUE);
*******************************************************************************/
void l2cu_process_fixed_chnl_resp (tL2C_LCB *p_lcb)
{
+ L2CAP_TRACE_ERROR("%s",__func__);
#if (BLE_INCLUDED == TRUE)
if (p_lcb->transport == BT_TRANSPORT_BR_EDR) {
/* ignore all not assigned BR/EDR channels */
if ( (p_ccb->ertm_info.fcr_tx_pool_id == HCI_ACL_POOL_ID) && (GKI_poolutilization (HCI_ACL_POOL_ID) > 90) ) {
continue;
}
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
/* If in eRTM mode, check for window closure */
if ( (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) && (l2c_fcr_is_flow_controlled (p_ccb)) ) {
continue;
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
}
} else {
if (GKI_queue_is_empty(&p_ccb->xmit_hold_q)) {
** Returns pointer to CCB or NULL
**
*******************************************************************************/
+#if (CLASSIC_BT_INCLUDED == TRUE)
static tL2C_CCB *l2cu_get_next_channel(tL2C_LCB *p_lcb)
{
tL2C_CCB *p_ccb;
return NULL;
}
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
#endif /* (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE) */
/******************************************************************************
BT_HDR *l2cu_get_next_buffer_to_send (tL2C_LCB *p_lcb)
{
tL2C_CCB *p_ccb;
- BT_HDR *p_buf;
+ BT_HDR *p_buf = NULL;
/* Highest priority are fixed channels */
#if (L2CAP_NUM_FIXED_CHNLS > 0)
/* eL2CAP option in use */
if (p_ccb->peer_cfg.fcr.mode != L2CAP_FCR_BASIC_MODE) {
+#if (CLASSIC_BT_INCLUDED == TRUE)
if (p_ccb->fcrb.wait_ack || p_ccb->fcrb.remote_busy) {
continue;
}
if ( (p_ccb->ertm_info.fcr_tx_pool_id == HCI_ACL_POOL_ID) && (GKI_poolutilization (HCI_ACL_POOL_ID) > 90) ) {
continue;
}
-
/* If in eRTM mode, check for window closure */
if ( (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) && (l2c_fcr_is_flow_controlled (p_ccb)) ) {
continue;
}
}
-
if ((p_buf = l2c_fcr_get_next_xmit_sdu_seg(p_ccb, 0)) != NULL) {
l2cu_check_channel_congestion (p_ccb);
l2cu_set_acl_hci_header (p_buf, p_ccb);
return (p_buf);
}
+#else
+ continue;
+#endif ///CLASSIC_BT_INCLUDED == TRUE
+
} else {
if (!GKI_queue_is_empty(&p_ccb->xmit_hold_q)) {
p_buf = (BT_HDR *)GKI_dequeue (&p_ccb->xmit_hold_q);
}
}
#endif
-
+#if (CLASSIC_BT_INCLUDED == TRUE)
#if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE)
/* get next serving channel in round-robin */
p_ccb = l2cu_get_next_channel_in_rr( p_lcb );
}
if (p_ccb->peer_cfg.fcr.mode != L2CAP_FCR_BASIC_MODE) {
+
if ((p_buf = l2c_fcr_get_next_xmit_sdu_seg(p_ccb, 0)) == NULL) {
return (NULL);
}
+
} else {
p_buf = (BT_HDR *)GKI_dequeue (&p_ccb->xmit_hold_q);
if (NULL == p_buf) {
l2cu_check_channel_congestion (p_ccb);
l2cu_set_acl_hci_header (p_buf, p_ccb);
+#endif ///CLASSIC_BT_INCLUDED == TRUE
return (p_buf);
}
#include "sdp_api.h"
#include "l2c_api.h"
-
+#if (SDP_INCLUDED == TRUE)
/* Continuation length - we use a 2-byte offset */
#define SDP_CONTINUATION_LEN 2
#define SDP_MAX_CONTINUATION_LEN 16 /* As per the spec */
#define sdp_disc_server_rsp(p_ccb, p_msg)
#endif
-
+#endif ///SDP_INCLUDED == TRUE
#endif
#include "sdpint.h"
#include "btu.h"
+#if (SDP_INCLUDED == TRUE)
/**********************************************************************
** C L I E N T F U N C T I O N P R O T O T Y P E S *
***********************************************************************/
return (sdp_cb.trace_level);
}
+
+#endif ///SDP_INCLUDED == TRUE
\ No newline at end of file
#include "sdp_api.h"
#include "sdpint.h"
+#if (SDP_INCLUDED == TRUE)
+
#if SDP_SERVER_ENABLED == TRUE
/********************************************************************************/
/* L O C A L F U N C T I O N P R O T O T Y P E S */
return (offset);
}
#endif
+
+#endif ///SDP_INCLUDED == TRUE
\ No newline at end of file
#include "sdp_api.h"
#include "sdpint.h"
-
+#if (SDP_INCLUDED == TRUE)
/********************************************************************************/
/* G L O B A L S D P D A T A */
/********************************************************************************/
sdpu_release_ccb (p_ccb);
}
+#endif ///SDP_INCLUDED == TRUE
#include "btu.h"
-
+#if (SDP_INCLUDED == TRUE)
static const UINT8 sdp_base_uuid[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
};
uuid16_bo = ntohs(uuid16);
memcpy(p_uuid128 + 2, &uuid16_bo, sizeof(uint16_t));
}
+
+#endif ///SDP_INCLUDED == TRUE
\ No newline at end of file
#ifndef SMP_INT_H
#define SMP_INT_H
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
#include "btu.h"
#include "btm_ble_api.h"
UINT16 tlen, UINT8 *p_signature);
extern void print128(BT_OCTET16 x, const UINT8 *key_name);
-#endif
+#endif ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
#endif /* SMP_INT_H */
#include <string.h>
#include "smp_int.h"
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
const char *const smp_br_state_name [SMP_BR_STATE_MAX + 1] = {
"SMP_BR_STATE_IDLE",
case ESP_GATTS_STOP_EVT:
break;
case ESP_GATTS_CONNECT_EVT:
- ESP_LOGI(GATTS_TAG, "SERVICE_START_EVT, conn_id %d, remote %02x:%02x:%02x:%02x:%02x:%02x:, is_conn %d\n",
+ ESP_LOGI(GATTS_TAG, "ESP_GATTS_CONNECT_EVT, conn_id %d, remote %02x:%02x:%02x:%02x:%02x:%02x:, is_conn %d\n",
param->connect.conn_id,
param->connect.remote_bda[0], param->connect.remote_bda[1], param->connect.remote_bda[2],
param->connect.remote_bda[3], param->connect.remote_bda[4], param->connect.remote_bda[5],