diff --git a/components/bt/bluedroid/bta/ar/bta_ar_int.h b/components/bt/bluedroid/bta/ar/bta_ar_int.h index 4bbf20401..e9997ec78 100644 --- a/components/bt/bluedroid/bta/ar/bta_ar_int.h +++ b/components/bt/bluedroid/bta/ar/bta_ar_int.h @@ -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 */ diff --git a/components/bt/bluedroid/bta/av/bta_av_int.h b/components/bt/bluedroid/bta/av/bta_av_int.h index b4fd9755d..2409c3a48 100644 --- a/components/bt/bluedroid/bta/av/bta_av_int.h +++ b/components/bt/bluedroid/bta/av/bta_av_int.h @@ -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 */ diff --git a/components/bt/bluedroid/bta/dm/bta_dm_act.c b/components/bt/bluedroid/bta/dm/bta_dm_act.c index a533bb74b..0fcc503c8 100644 --- a/components/bt/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/bluedroid/bta/dm/bta_dm_act.c @@ -52,7 +52,9 @@ static void bta_dm_service_search_remname_cback (BD_ADDR bd_addr, DEV_CLASS dc, 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); @@ -1195,6 +1197,7 @@ void bta_dm_search_cancel (tBTA_DM_MSG *p_data) *******************************************************************************/ 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 @@ -1231,6 +1234,7 @@ void bta_dm_discover (tBTA_DM_MSG *p_data) 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 } /******************************************************************************* @@ -1244,6 +1248,7 @@ void bta_dm_discover (tBTA_DM_MSG *p_data) *******************************************************************************/ 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)); @@ -1258,8 +1263,10 @@ void bta_dm_di_disc_cmpl(tBTA_DM_MSG *p_data) 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 @@ -1281,7 +1288,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 +1302,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 +1317,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 } /******************************************************************************* @@ -1323,6 +1332,7 @@ static void bta_dm_disable_search_and_disc (void) *******************************************************************************/ void bta_dm_di_disc (tBTA_DM_MSG *p_data) { +#if (SDP_INCLUDED == TRUE) UINT16 result = BTA_FAILURE; tBTA_DM_MSG *p_msg; @@ -1346,6 +1356,7 @@ void bta_dm_di_disc (tBTA_DM_MSG *p_data) p_data->hdr.offset = result; bta_sys_sendmsg(p_msg); } +#endif ///SDP_INCLUDED == TRUE } /******************************************************************************* @@ -1482,7 +1493,7 @@ void bta_dm_disc_rmt_name (tBTA_DM_MSG *p_data) *******************************************************************************/ 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; @@ -1714,6 +1725,7 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data) bta_sys_sendmsg(p_msg); } } +#endif ///SDP_INCLUDE == TRUE } /******************************************************************************* @@ -1839,12 +1851,13 @@ static void bta_dm_search_timer_cback (TIMER_LIST_ENT *p_tle) *******************************************************************************/ 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 } /******************************************************************************* @@ -1878,13 +1891,14 @@ void bta_dm_queue_search (tBTA_DM_MSG *p_data) *******************************************************************************/ 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 } /******************************************************************************* @@ -1936,6 +1950,7 @@ void bta_dm_search_cancel_cmpl (tBTA_DM_MSG *p_data) *******************************************************************************/ 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); @@ -1943,6 +1958,7 @@ void bta_dm_search_cancel_transac_cmpl(tBTA_DM_MSG *p_data) } bta_dm_search_cancel_notify(NULL); +#endif ///SDP_INCLUDED == TRUE } @@ -1983,7 +1999,7 @@ void bta_dm_search_cancel_notify (tBTA_DM_MSG *p_data) *******************************************************************************/ static void bta_dm_find_services ( BD_ADDR bd_addr) { - +#if (SDP_INCLUDED == TRUE) tSDP_UUID uuid; tBTA_DM_MSG *p_msg; @@ -2089,6 +2105,7 @@ static void bta_dm_find_services ( BD_ADDR bd_addr) bta_sys_sendmsg(p_msg); } } +#endif ///SDP_INCLUDED == TRUE } /******************************************************************************* @@ -2272,6 +2289,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr) } } +#if (SDP_INCLUDED == TRUE) /******************************************************************************* ** ** Function bta_dm_sdp_callback @@ -2293,7 +2311,7 @@ static void bta_dm_sdp_callback (UINT16 sdp_status) } } - +#endif ///SDP_INCLUDED == TRUE /******************************************************************************* ** ** Function bta_dm_inq_results_cb @@ -4102,6 +4120,7 @@ static void bta_dm_observe_cmpl_cb (void *p_result) 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; @@ -4215,6 +4234,7 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D status = BTM_NOT_AUTHORIZED; break; } +#endif ///SMP_INCLUDED == TRUE return status; } #endif /* SMP_INCLUDED == TRUE */ diff --git a/components/bt/bluedroid/bta/dm/bta_dm_api.c b/components/bt/bluedroid/bta/dm/bta_dm_api.c index aa58e8406..5f81a616c 100644 --- a/components/bt/bluedroid/bta/dm/bta_dm_api.c +++ b/components/bt/bluedroid/bta/dm/bta_dm_api.c @@ -279,6 +279,7 @@ void BTA_DmSearchCancel(void) 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) { @@ -291,9 +292,11 @@ void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services, p_msg->sdp_search = sdp_search; bta_sys_sendmsg(p_msg); } - +#endif ///SDP_INCLUDED == TRUE } +#if (SDP_INCLUDED == TRUE) + /******************************************************************************* ** ** Function BTA_DmDiscoverUUID @@ -324,8 +327,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 /******************************************************************************* ** @@ -613,7 +616,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 +648,7 @@ tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info, return status; } - +#endif ///SDP_INCLUDED == TRUE /******************************************************************************* ** ** Function bta_dmexecutecallback @@ -1393,7 +1396,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 +1450,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 +1474,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 diff --git a/components/bt/bluedroid/bta/dm/bta_dm_int.h b/components/bt/bluedroid/bta/dm/bta_dm_int.h index b2cdb0c33..f524c6df5 100644 --- a/components/bt/bluedroid/bta/dm/bta_dm_int.h +++ b/components/bt/bluedroid/bta/dm/bta_dm_int.h @@ -201,6 +201,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 +216,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 +679,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; @@ -918,7 +922,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,7 +934,9 @@ 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 */ @@ -955,7 +963,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; diff --git a/components/bt/bluedroid/bta/dm/bta_dm_pm.c b/components/bt/bluedroid/bta/dm/bta_dm_pm.c index 10521ee07..988e57057 100644 --- a/components/bt/bluedroid/bta/dm/bta_dm_pm.c +++ b/components/bt/bluedroid/bta/dm/bta_dm_pm.c @@ -700,7 +700,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 || diff --git a/components/bt/bluedroid/bta/gatt/bta_gattc_cache.c b/components/bt/bluedroid/bta/gatt/bta_gattc_cache.c index bd50064f1..b887cb328 100644 --- a/components/bt/bluedroid/bta/gatt/bta_gattc_cache.c +++ b/components/bt/bluedroid/bta/gatt/bta_gattc_cache.c @@ -788,6 +788,7 @@ static tBTA_GATT_STATUS bta_gattc_add_char_to_list(tBTA_GATTC_SERV *p_srvc_cb, *******************************************************************************/ 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; @@ -842,6 +843,7 @@ void bta_gattc_sdp_callback (UINT16 sdp_status) 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 } /******************************************************************************* ** @@ -854,6 +856,7 @@ void bta_gattc_sdp_callback (UINT16 sdp_status) *******************************************************************************/ 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]; @@ -881,6 +884,9 @@ static tBTA_GATT_STATUS bta_gattc_sdp_service_disc(UINT16 conn_id, tBTA_GATTC_SE } } return status; +#else + return BTA_GATT_NO_RESOURCES; +#endif ///SDP_INCLUDED == TRUE } /******************************************************************************* ** diff --git a/components/bt/bluedroid/bta/hh/bta_hh_cfg.c b/components/bt/bluedroid/bta/hh/bta_hh_cfg.c index 5cdc0b728..d80de5e8b 100644 --- a/components/bt/bluedroid/bta/hh/bta_hh_cfg.c +++ b/components/bt/bluedroid/bta/hh/bta_hh_cfg.c @@ -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) \ No newline at end of file diff --git a/components/bt/bluedroid/bta/hh/bta_hh_int.h b/components/bt/bluedroid/bta/hh/bta_hh_int.h index a5374dac0..e3d296ee7 100644 --- a/components/bt/bluedroid/bta/hh/bta_hh_int.h +++ b/components/bt/bluedroid/bta/hh/bta_hh_int.h @@ -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 diff --git a/components/bt/bluedroid/bta/include/bta_api.h b/components/bt/bluedroid/bta/include/bta_api.h index d428bed8e..a645a25b1 100644 --- a/components/bt/bluedroid/bta/include/bta_api.h +++ b/components/bt/bluedroid/bta/include/bta_api.h @@ -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 @@ -1448,7 +1453,7 @@ extern void BTA_DmSearchCancel(void); *******************************************************************************/ 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 ++ /******************************************************************************* ** @@ -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 /******************************************************************************* ** ** diff --git a/components/bt/bluedroid/bta/include/bta_ar_api.h b/components/bt/bluedroid/bta/include/bta_ar_api.h index af8ea535e..acfac9df4 100644 --- a/components/bt/bluedroid/bta/include/bta_ar_api.h +++ b/components/bt/bluedroid/bta/include/bta_ar_api.h @@ -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 */ diff --git a/components/bt/bluedroid/bta/include/bta_av_api.h b/components/bt/bluedroid/bta/include/bta_av_api.h index 683b67369..24c359910 100644 --- a/components/bt/bluedroid/bta/include/bta_av_api.h +++ b/components/bt/bluedroid/bta/include/bta_av_api.h @@ -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 */ diff --git a/components/bt/bluedroid/bta/include/bta_av_ci.h b/components/bt/bluedroid/bta/include/bta_av_ci.h index c95326f7d..a537b8a4c 100644 --- a/components/bt/bluedroid/bta/include/bta_av_ci.h +++ b/components/bt/bluedroid/bta/include/bta_av_ci.h @@ -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 */ diff --git a/components/bt/bluedroid/bta/include/bta_av_co.h b/components/bt/bluedroid/bta/include/bta_av_co.h index ce93cfbd0..c2f94b635 100644 --- a/components/bt/bluedroid/bta/include/bta_av_co.h +++ b/components/bt/bluedroid/bta/include/bta_av_co.h @@ -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 */ diff --git a/components/bt/bluedroid/bta/include/bta_av_sbc.h b/components/bt/bluedroid/bta/include/bta_av_sbc.h index 59778edb8..966ee61bb 100644 --- a/components/bt/bluedroid/bta/include/bta_av_sbc.h +++ b/components/bt/bluedroid/bta/include/bta_av_sbc.h @@ -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 */ diff --git a/components/bt/bluedroid/bta/include/bta_gatt_api.h b/components/bt/bluedroid/bta/include/bta_gatt_api.h index f4c0e06f0..40b661c2e 100644 --- a/components/bt/bluedroid/bta/include/bta_gatt_api.h +++ b/components/bt/bluedroid/bta/include/bta_gatt_api.h @@ -40,7 +40,7 @@ #ifndef BTA_GATT_DEBUG -#define BTA_GATT_DEBUG FALSE +#define BTA_GATT_DEBUG TRUE #endif /***************************************************************************** diff --git a/components/bt/bluedroid/bta/include/bta_gattc_int.h b/components/bt/bluedroid/bta/include/bta_gattc_int.h index d50c66226..952686087 100644 --- a/components/bt/bluedroid/bta/include/bta_gattc_int.h +++ b/components/bt/bluedroid/bta/include/bta_gattc_int.h @@ -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; diff --git a/components/bt/bluedroid/bta/include/bta_hh_api.h b/components/bt/bluedroid/bta/include/bta_hh_api.h index d6b317404..aa9fd0a23 100644 --- a/components/bt/bluedroid/bta/include/bta_hh_api.h +++ b/components/bt/bluedroid/bta/include/bta_hh_api.h @@ -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 */ diff --git a/components/bt/bluedroid/bta/include/bta_sdp_api.h b/components/bt/bluedroid/bta/include/bta_sdp_api.h index c2df4bb95..6f27f5ccb 100644 --- a/components/bt/bluedroid/bta/include/bta_sdp_api.h +++ b/components/bt/bluedroid/bta/include/bta_sdp_api.h @@ -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 */ diff --git a/components/bt/bluedroid/bta/sdp/bta_sdp_act.c b/components/bt/bluedroid/bta/sdp/bta_sdp_act.c index de563b56c..09bdf058f 100644 --- a/components/bt/bluedroid/bta/sdp/bta_sdp_act.c +++ b/components/bt/bluedroid/bta/sdp/bta_sdp_act.c @@ -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 *****************************************************************************/ @@ -326,6 +327,7 @@ static void bta_create_sap_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE 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; @@ -348,6 +350,7 @@ static void bta_create_raw_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE } 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 } @@ -362,6 +365,7 @@ static void bta_create_raw_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE *******************************************************************************/ 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; @@ -425,6 +429,7 @@ static void bta_sdp_search_cback(UINT16 result, void *user_data) 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 } /******************************************************************************* @@ -455,6 +460,7 @@ void bta_sdp_enable(tBTA_SDP_MSG *p_data) *******************************************************************************/ 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)); @@ -509,6 +515,7 @@ void bta_sdp_search(tBTA_SDP_MSG *p_data) /* else report the result when the cback is called */ +#endif ///SDP_INCLUDED == TRUE } /******************************************************************************* @@ -545,4 +552,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 \ No newline at end of file diff --git a/components/bt/bluedroid/bta/sdp/bta_sdp_int.h b/components/bt/bluedroid/bta/sdp/bta_sdp_int.h index 21be47e06..4f9f7d2cb 100644 --- a/components/bt/bluedroid/bta/sdp/bta_sdp_int.h +++ b/components/bt/bluedroid/bta/sdp/bta_sdp_int.h @@ -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 */ + diff --git a/components/bt/bluedroid/btc/core/btc_ble_storage.c b/components/bt/bluedroid/btc/core/btc_ble_storage.c index 820537c9e..1c885f4b5 100644 --- a/components/bt/bluedroid/btc/core/btc_ble_storage.c +++ b/components/bt/bluedroid/btc/core/btc_ble_storage.c @@ -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 diff --git a/components/bt/bluedroid/btc/core/btc_dm.c b/components/bt/bluedroid/btc/core/btc_dm.c index 121ee9d46..e4658a840 100644 --- a/components/bt/bluedroid/btc/core/btc_dm.c +++ b/components/bt/bluedroid/btc/core/btc_dm.c @@ -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; diff --git a/components/bt/bluedroid/btc/include/btc_ble_storage.h b/components/bt/bluedroid/btc/include/btc_ble_storage.h index 1efbb0ec5..2884d6acf 100644 --- a/components/bt/bluedroid/btc/include/btc_ble_storage.h +++ b/components/bt/bluedroid/btc/include/btc_ble_storage.h @@ -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); \ No newline at end of file + tBTA_BLE_LOCAL_ID_KEYS *p_id_keys); +#endif ///SMP_INCLUDED == TRUE \ No newline at end of file diff --git a/components/bt/bluedroid/btc/profile/std/a2dp/include/btc_av_co.h b/components/bt/bluedroid/btc/profile/std/a2dp/include/btc_av_co.h index 43a83002e..9ec9b5d44 100644 --- a/components/bt/bluedroid/btc/profile/std/a2dp/include/btc_av_co.h +++ b/components/bt/bluedroid/btc/profile/std/a2dp/include/btc_av_co.h @@ -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 diff --git a/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c b/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c index f9ec31bba..062c957e4 100644 --- a/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c +++ b/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c @@ -928,11 +928,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; diff --git a/components/bt/bluedroid/btc/profile/std/hid/include/hid_conn.h b/components/bt/bluedroid/btc/profile/std/hid/include/hid_conn.h index 220ae9a5b..320b78fa3 100644 --- a/components/bt/bluedroid/btc/profile/std/hid/include/hid_conn.h +++ b/components/bt/bluedroid/btc/profile/std/hid/include/hid_conn.h @@ -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 diff --git a/components/bt/bluedroid/btc/profile/std/hid/include/hidh_int.h b/components/bt/bluedroid/btc/profile/std/hid/include/hidh_int.h index afdb9308e..a1d40781d 100644 --- a/components/bt/bluedroid/btc/profile/std/hid/include/hidh_int.h +++ b/components/bt/bluedroid/btc/profile/std/hid/include/hidh_int.h @@ -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 diff --git a/components/bt/bluedroid/btc/profile/std/include/btc_av.h b/components/bt/bluedroid/btc/profile/std/include/btc_av.h index 92ab08149..8a8664cd2 100644 --- a/components/bt/bluedroid/btc/profile/std/include/btc_av.h +++ b/components/bt/bluedroid/btc/profile/std/include/btc_av.h @@ -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__ */ diff --git a/components/bt/bluedroid/btc/profile/std/include/btc_av_api.h b/components/bt/bluedroid/btc/profile/std/include/btc_av_api.h index dc773bb9e..c7672a075 100644 --- a/components/bt/bluedroid/btc/profile/std/include/btc_av_api.h +++ b/components/bt/bluedroid/btc/profile/std/include/btc_av_api.h @@ -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__ */ diff --git a/components/bt/bluedroid/btc/profile/std/include/btc_avrc.h b/components/bt/bluedroid/btc/profile/std/include/btc_avrc.h index b9efb9db3..3f16d10f3 100644 --- a/components/bt/bluedroid/btc/profile/std/include/btc_avrc.h +++ b/components/bt/bluedroid/btc/profile/std/include/btc_avrc.h @@ -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__ */ diff --git a/components/bt/bluedroid/btc/profile/std/include/btc_media.h b/components/bt/bluedroid/btc/profile/std/include/btc_media.h index 3ff0d1e10..a25da9877 100644 --- a/components/bt/bluedroid/btc/profile/std/include/btc_media.h +++ b/components/bt/bluedroid/btc/profile/std/include/btc_media.h @@ -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 diff --git a/components/bt/bluedroid/btif/bta_dm_co.c b/components/bt/bluedroid/btif/bta_dm_co.c index 269f51780..3c45d65ff 100644 --- a/components/bt/bluedroid/btif/bta_dm_co.c +++ b/components/bt/bluedroid/btif/bta_dm_co.c @@ -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 diff --git a/components/bt/bluedroid/include/bt_target.h b/components/bt/bluedroid/include/bt_target.h index e684a0ecf..7f9203828 100644 --- a/components/bt/bluedroid/include/bt_target.h +++ b/components/bt/bluedroid/include/bt_target.h @@ -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 @@ -635,7 +635,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) @@ -684,6 +688,9 @@ #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 @@ -694,12 +701,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 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. */ @@ -785,7 +800,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 2 //There are just two fix channel in the BLE only mode(gatt,smp) +#endif ///CLASSIC_BT_INCLUDED == TRUE #endif /* First fixed channel supported */ @@ -853,7 +872,7 @@ * resolution, local address rotation etc. */ #ifndef BLE_PRIVACY_SPT -#define BLE_PRIVACY_SPT TRUE +#define BLE_PRIVACY_SPT FALSE #endif /* @@ -992,7 +1011,7 @@ ******************************************************************************/ #ifndef SMP_INCLUDED #if BLE_INCLUDED == TRUE -#define SMP_INCLUDED TRUE +#define SMP_INCLUDED FALSE #else #define SMP_INCLUDED FALSE #endif @@ -1036,7 +1055,7 @@ ******************************************************************************/ #ifndef SDP_INCLUDED -#define SDP_INCLUDED TRUE +#define SDP_INCLUDED FALSE //TRUE #endif /* This is set to enable SDP server functionality. */ @@ -1535,7 +1554,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 diff --git a/components/bt/bluedroid/include/bt_trace.h b/components/bt/bluedroid/include/bt_trace.h index 787c4c8ae..5d11ef5cb 100644 --- a/components/bt/bluedroid/include/bt_trace.h +++ b/components/bt/bluedroid/include/bt_trace.h @@ -193,11 +193,11 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len) #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 @@ -245,7 +245,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len) #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 @@ -253,7 +253,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len) #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 diff --git a/components/bt/bluedroid/stack/a2dp/include/a2d_int.h b/components/bt/bluedroid/stack/a2dp/include/a2d_int.h index d362f3f5b..89055bce9 100644 --- a/components/bt/bluedroid/stack/a2dp/include/a2d_int.h +++ b/components/bt/bluedroid/stack/a2dp/include/a2d_int.h @@ -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 */ diff --git a/components/bt/bluedroid/stack/avdt/include/avdt_defs.h b/components/bt/bluedroid/stack/avdt/include/avdt_defs.h index b6dbbc4f5..ad1d9d1ef 100644 --- a/components/bt/bluedroid/stack/avdt/include/avdt_defs.h +++ b/components/bt/bluedroid/stack/avdt/include/avdt_defs.h @@ -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 */ diff --git a/components/bt/bluedroid/stack/avdt/include/avdt_int.h b/components/bt/bluedroid/stack/avdt/include/avdt_int.h index 5c2939c49..5050f0668 100644 --- a/components/bt/bluedroid/stack/avdt/include/avdt_int.h +++ b/components/bt/bluedroid/stack/avdt/include/avdt_int.h @@ -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 */ diff --git a/components/bt/bluedroid/stack/avrc/include/avrc_int.h b/components/bt/bluedroid/stack/avrc/include/avrc_int.h index 9efafff73..ed0be01b2 100644 --- a/components/bt/bluedroid/stack/avrc/include/avrc_int.h +++ b/components/bt/bluedroid/stack/avrc/include/avrc_int.h @@ -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 */ diff --git a/components/bt/bluedroid/stack/btm/btm_acl.c b/components/bt/bluedroid/stack/btm/btm_acl.c index 269737447..b011ed590 100644 --- a/components/bt/bluedroid/stack/btm/btm_acl.c +++ b/components/bt/bluedroid/stack/btm/btm_acl.c @@ -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,18 +277,19 @@ 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) */ 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; } } @@ -308,7 +310,7 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn, && 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 @@ -1479,9 +1481,9 @@ void btm_acl_role_changed (UINT8 hci_status, BD_ADDR bd_addr, UINT8 new_role) 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]) { @@ -1489,7 +1491,7 @@ UINT8 BTM_AllocateSCN(void) return (x + 1); } } - +#endif ///CLASSIC_BT_INCLUDED == TRUE return (0); /* No free ports */ } @@ -1505,6 +1507,7 @@ UINT8 BTM_AllocateSCN(void) 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. */ @@ -1517,6 +1520,7 @@ BOOLEAN BTM_TryAllocateSCN(UINT8 scn) btm_cb.btm_scn[scn - 1] = TRUE; return TRUE; } +#endif ///CLASSIC_BT_INCLUDED == TRUE return (FALSE); /* Port was busy */ } @@ -1532,6 +1536,8 @@ BOOLEAN BTM_TryAllocateSCN(UINT8 scn) *******************************************************************************/ 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; @@ -1539,6 +1545,9 @@ BOOLEAN BTM_FreeSCN(UINT8 scn) } else { return (FALSE); /* Illegal SCN passed in */ } +#else + return (FALSE); +#endif ///CLASSIC_BT_INCLUDED == TRUE } /******************************************************************************* diff --git a/components/bt/bluedroid/stack/btm/btm_ble.c b/components/bt/bluedroid/stack/btm/btm_ble.c index 17f1d43e2..ddf5849ca 100644 --- a/components/bt/bluedroid/stack/btm/btm_ble.c +++ b/components/bt/bluedroid/stack/btm/btm_ble.c @@ -432,6 +432,7 @@ void BTM_BlePasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey) *******************************************************************************/ 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; @@ -443,6 +444,7 @@ void BTM_BleConfirmReply (BD_ADDR bd_addr, UINT8 res) 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 } /******************************************************************************* @@ -836,6 +838,7 @@ tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length) *******************************************************************************/ 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; @@ -863,11 +866,10 @@ void btm_ble_rand_enc_complete (UINT8 *p, UINT16 op_code, tBTM_RAND_ENC_CB *p_en (*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 @@ -878,6 +880,7 @@ void btm_ble_rand_enc_complete (UINT8 *p, UINT16 op_code, tBTM_RAND_ENC_CB *p_en *******************************************************************************/ 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); @@ -893,6 +896,7 @@ void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local ) p_dev_rec->ble.keys.local_counter, p_dev_rec->ble.keys.counter); } +#endif ///SMP_INCLUDED == TRUE } /******************************************************************************* @@ -907,6 +911,7 @@ void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local ) *******************************************************************************/ 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"); @@ -915,6 +920,8 @@ 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; } + +#endif ///SMP_INCLUDED == TRUE return FALSE; } @@ -928,6 +935,7 @@ BOOLEAN btm_ble_get_enc_key_type(BD_ADDR bd_addr, UINT8 *p_key_types) *******************************************************************************/ 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"); @@ -946,6 +954,9 @@ BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_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 } /******************************************************************************* @@ -964,6 +975,7 @@ BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_div) 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; @@ -1091,6 +1103,7 @@ void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY if (p_rec) { BTM_TRACE_DEBUG ("sec_flags=0x%x", p_rec->sec_flags); } +#endif ///SMP_INCLUDED == TRUE } /******************************************************************************* @@ -1104,6 +1117,7 @@ void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY *******************************************************************************/ 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); @@ -1111,6 +1125,7 @@ void btm_ble_update_sec_key_size(BD_ADDR bd_addr, UINT8 enc_key_size) if ((p_rec = btm_find_dev (bd_addr)) != NULL ) { p_rec->enc_key_size = enc_key_size; } +#endif ///SMP_INCLUDED == TRUE } /******************************************************************************* @@ -1124,6 +1139,7 @@ void btm_ble_update_sec_key_size(BD_ADDR bd_addr, UINT8 enc_key_size) *******************************************************************************/ UINT8 btm_ble_read_sec_key_size(BD_ADDR bd_addr) { +#if (SMP_INCLUDED == TRUE) tBTM_SEC_DEV_REC *p_rec; if ((p_rec = btm_find_dev (bd_addr)) != NULL ) { @@ -1131,6 +1147,9 @@ UINT8 btm_ble_read_sec_key_size(BD_ADDR bd_addr) } else { return 0; } +#else + return 0; +#endif ///SMP_INCLUDED == TRUE } /******************************************************************************* @@ -1144,6 +1163,7 @@ UINT8 btm_ble_read_sec_key_size(BD_ADDR bd_addr) *******************************************************************************/ 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; @@ -1195,6 +1215,8 @@ 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 +1235,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 +1284,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; } @@ -1277,6 +1301,7 @@ tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, void *p_ref_data, UINT8 lin *******************************************************************************/ 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}; @@ -1292,6 +1317,7 @@ void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv) btm_ble_ltk_request_reply(p_dev_rec->bd_addr, FALSE, dummy_stk); } } +#endif ///SMP_INCLUDED == TRUE } @@ -1307,11 +1333,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 +1372,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; } @@ -1358,6 +1387,7 @@ tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk) *******************************************************************************/ 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; @@ -1389,6 +1419,7 @@ 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 } /******************************************************************************* @@ -1403,6 +1434,7 @@ void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable) *******************************************************************************/ 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; @@ -1425,6 +1457,7 @@ void btm_ble_ltk_request_reply(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk) btsnd_hcic_ble_ltk_req_neg_reply(btm_cb.enc_handle); } } +#endif ///SMP_INCLUDED == TRUE } /******************************************************************************* @@ -1439,6 +1472,7 @@ void btm_ble_ltk_request_reply(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk) 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... */ @@ -1508,6 +1542,7 @@ UINT8 btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p 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; } @@ -1524,13 +1559,14 @@ UINT8 btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p 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; } @@ -1673,10 +1709,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 +1725,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; @@ -1765,6 +1804,7 @@ void btm_ble_create_ll_conn_complete (UINT8 status) ******************************************************************************/ 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; @@ -1870,12 +1910,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"); } - +#endif ///SMP_INCLUDED == TRUE return 0; } -#endif /* SMP_INCLUDED */ - /******************************************************************************* ** ** Function BTM_BleDataSignature @@ -1895,10 +1933,13 @@ UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data) 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 { @@ -1929,6 +1970,7 @@ BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len, GKI_freebuf(p_buf); } } +#endif ///SMP_INCLUDED == TRUE return ret; } @@ -1988,7 +2030,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 +2167,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 +2278,7 @@ static void btm_ble_process_irk(tSMP_ENC *p) } } + /******************************************************************************* ** ** Function btm_ble_process_dhk @@ -2248,7 +2292,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,8 +2313,8 @@ 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 } +#endif ///SMP_INCLUDED == TRUE /******************************************************************************* ** diff --git a/components/bt/bluedroid/stack/btm/btm_ble_addr.c b/components/bt/bluedroid/stack/btm/btm_ble_addr.c index 95a2ad9cc..5c4c772e6 100644 --- a/components/bt/bluedroid/stack/btm/btm_ble_addr.c +++ b/components/bt/bluedroid/stack/btm/btm_ble_addr.c @@ -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 *******************************************************************************/ diff --git a/components/bt/bluedroid/stack/btm/btm_ble_gap.c b/components/bt/bluedroid/stack/btm/btm_ble_gap.c index 5864419e2..c2b356fc7 100644 --- a/components/bt/bluedroid/stack/btm/btm_ble_gap.c +++ b/components/bt/bluedroid/stack/btm/btm_ble_gap.c @@ -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; diff --git a/components/bt/bluedroid/stack/btm/btm_ble_privacy.c b/components/bt/bluedroid/stack/btm/btm_ble_privacy.c index 08870d9e7..59aa49fba 100644 --- a/components/bt/bluedroid/stack/btm/btm_ble_privacy.c +++ b/components/bt/bluedroid/stack/btm/btm_ble_privacy.c @@ -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; } diff --git a/components/bt/bluedroid/stack/btm/btm_sec.c b/components/bt/bluedroid/stack/btm/btm_sec.c index 364c03f62..a54a8ce6b 100644 --- a/components/bt/bluedroid/stack/btm/btm_sec.c +++ b/components/bt/bluedroid/stack/btm/btm_sec.c @@ -221,7 +221,7 @@ static BOOLEAN btm_serv_trusted(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_SEC_SERV_REC * *******************************************************************************/ 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 diff --git a/components/bt/bluedroid/stack/btu/btu_hcif.c b/components/bt/bluedroid/stack/btu/btu_hcif.c index a3a4d9154..36eaf89f7 100644 --- a/components/bt/bluedroid/stack/btu/btu_hcif.c +++ b/components/bt/bluedroid/stack/btu/btu_hcif.c @@ -124,9 +124,9 @@ 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 @@ -304,7 +304,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 */ @@ -322,11 +322,11 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg) 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); @@ -1686,12 +1686,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. */ @@ -1712,13 +1712,14 @@ static void btu_ble_read_remote_feat_evt (UINT8 *p) 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 */ diff --git a/components/bt/bluedroid/stack/gap/include/gap_int.h b/components/bt/bluedroid/stack/gap/include/gap_int.h index fbddf67c9..af7acf231 100644 --- a/components/bt/bluedroid/stack/gap/include/gap_int.h +++ b/components/bt/bluedroid/stack/gap/include/gap_int.h @@ -127,8 +127,8 @@ 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; diff --git a/components/bt/bluedroid/stack/gatt/gatt_api.c b/components/bt/bluedroid/stack/gatt/gatt_api.c index e0f633709..5beffe875 100644 --- a/components/bt/bluedroid/stack/gatt/gatt_api.c +++ b/components/bt/bluedroid/stack/gatt/gatt_api.c @@ -480,8 +480,9 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle, 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: @@ -531,9 +532,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)); diff --git a/components/bt/bluedroid/stack/gatt/gatt_auth.c b/components/bt/bluedroid/stack/gatt/gatt_auth.c index c7bdc13cd..09f686bb9 100644 --- a/components/bt/bluedroid/stack/gatt/gatt_auth.c +++ b/components/bt/bluedroid/stack/gatt/gatt_auth.c @@ -293,18 +293,22 @@ tGATT_SEC_ACTION gatt_determine_sec_act(tGATT_CLCB *p_clcb ) 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; } @@ -350,7 +354,10 @@ tGATT_SEC_ACTION gatt_determine_sec_act(tGATT_CLCB *p_clcb ) 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; diff --git a/components/bt/bluedroid/stack/gatt/gatt_main.c b/components/bt/bluedroid/stack/gatt/gatt_main.c index d7997a847..0a69ff125 100644 --- a/components/bt/bluedroid/stack/gatt/gatt_main.c +++ b/components/bt/bluedroid/stack/gatt/gatt_main.c @@ -120,12 +120,12 @@ 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); @@ -177,10 +177,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 +218,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"); @@ -527,6 +532,7 @@ static void gatt_le_data_ind (UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf) *******************************************************************************/ 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; @@ -563,6 +569,8 @@ static void gatt_l2cif_connect_ind_cback (BD_ADDR bd_addr, UINT16 lcid, UINT16 L2CA_ConfigReq(lcid, &cfg); } +#endif ///CLASSIC_BT_INCLUDED == TRUE + } /******************************************************************************* @@ -577,6 +585,7 @@ static void gatt_l2cif_connect_ind_cback (BD_ADDR bd_addr, UINT16 lcid, UINT16 *******************************************************************************/ static void gatt_l2cif_connect_cfm_cback(UINT16 lcid, UINT16 result) { +#if (CLASSIC_BT_INCLUDED == TRUE) tGATT_TCB *p_tcb; tL2CAP_CFG_INFO cfg; @@ -608,6 +617,8 @@ static void gatt_l2cif_connect_cfm_cback(UINT16 lcid, UINT16 result) } } } +#endif ///CLASSIC_BT_INCLUDED == TRUE + } /******************************************************************************* @@ -622,6 +633,7 @@ static void gatt_l2cif_connect_cfm_cback(UINT16 lcid, UINT16 result) *******************************************************************************/ 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; @@ -657,6 +669,8 @@ void gatt_l2cif_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg) } } } +#endif ///CLASSIC_BT_INCLUDED == TRUE + } /******************************************************************************* @@ -671,6 +685,7 @@ void gatt_l2cif_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg) *******************************************************************************/ 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 */ @@ -709,6 +724,8 @@ void gatt_l2cif_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg) } } } +#endif ///CLASSIC_BT_INCLUDED == TRUE + } /******************************************************************************* @@ -723,6 +740,7 @@ void gatt_l2cif_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg) *******************************************************************************/ void gatt_l2cif_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed) { +#if (CLASSIC_BT_INCLUDED == TRUE) tGATT_TCB *p_tcb; UINT16 reason; @@ -745,6 +763,8 @@ void gatt_l2cif_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed) /* send disconnect callback */ gatt_cleanup_upon_disc(p_tcb->peer_bda, reason, GATT_TRANSPORT_BR_EDR); } +#endif ///CLASSIC_BT_INCLUDED == TRUE + } /******************************************************************************* @@ -759,6 +779,7 @@ void gatt_l2cif_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed) *******************************************************************************/ static void gatt_l2cif_disconnect_cfm_cback(UINT16 lcid, UINT16 result) { +#if (CLASSIC_BT_INCLUDED == TRUE) tGATT_TCB *p_tcb; UINT16 reason; UNUSED(result); @@ -780,6 +801,8 @@ static void gatt_l2cif_disconnect_cfm_cback(UINT16 lcid, UINT16 result) gatt_cleanup_upon_disc(p_tcb->peer_bda, reason, GATT_TRANSPORT_BR_EDR); } +#endif ///CLASSIC_BT_INCLUDED == TRUE + } /******************************************************************************* @@ -794,6 +817,7 @@ static void gatt_l2cif_disconnect_cfm_cback(UINT16 lcid, UINT16 result) *******************************************************************************/ 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 */ @@ -804,6 +828,8 @@ static void gatt_l2cif_data_ind_cback(UINT16 lcid, BT_HDR *p_buf) } else { /* prevent buffer leak */ GKI_freebuf(p_buf); } +#endif ///CLASSIC_BT_INCLUDED == TRUE + } /******************************************************************************* @@ -817,11 +843,14 @@ static void gatt_l2cif_data_ind_cback(UINT16 lcid, BT_HDR *p_buf) *******************************************************************************/ 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 + } /******************************************************************************* diff --git a/components/bt/bluedroid/stack/gatt/gatt_utils.c b/components/bt/bluedroid/stack/gatt/gatt_utils.c index fb8d51aec..776004c11 100644 --- a/components/bt/bluedroid/stack/gatt/gatt_utils.c +++ b/components/bt/bluedroid/stack/gatt/gatt_utils.c @@ -1439,7 +1439,7 @@ tGATT_STATUS gatt_send_error_rsp (tGATT_TCB *p_tcb, UINT8 err_code, UINT8 op_cod return status; } - +#if (SDP_INCLUDED == TRUE) /******************************************************************************* ** ** Function gatt_add_sdp_record @@ -1505,7 +1505,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 /******************************************************************************* diff --git a/components/bt/bluedroid/stack/gatt/include/gatt_int.h b/components/bt/bluedroid/stack/gatt/include/gatt_int.h index 5004f5bbf..6412aed6a 100644 --- a/components/bt/bluedroid/stack/gatt/include/gatt_int.h +++ b/components/bt/bluedroid/stack/gatt/include/gatt_int.h @@ -589,7 +589,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); diff --git a/components/bt/bluedroid/stack/hcic/hciblecmds.c b/components/bt/bluedroid/stack/hcic/hciblecmds.c index 8fa4ae8b3..3222ea5d7 100644 --- a/components/bt/bluedroid/stack/hcic/hciblecmds.c +++ b/components/bt/bluedroid/stack/hcic/hciblecmds.c @@ -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); } diff --git a/components/bt/bluedroid/stack/include/a2d_api.h b/components/bt/bluedroid/stack/include/a2d_api.h index 2c2f410f6..1b999d5c4 100644 --- a/components/bt/bluedroid/stack/include/a2d_api.h +++ b/components/bt/bluedroid/stack/include/a2d_api.h @@ -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 */ diff --git a/components/bt/bluedroid/stack/include/a2d_sbc.h b/components/bt/bluedroid/stack/include/a2d_sbc.h index e9dbaa880..98b63e46c 100644 --- a/components/bt/bluedroid/stack/include/a2d_sbc.h +++ b/components/bt/bluedroid/stack/include/a2d_sbc.h @@ -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 */ diff --git a/components/bt/bluedroid/stack/include/avrc_api.h b/components/bt/bluedroid/stack/include/avrc_api.h index dad8b3bd2..3ca3e2d76 100644 --- a/components/bt/bluedroid/stack/include/avrc_api.h +++ b/components/bt/bluedroid/stack/include/avrc_api.h @@ -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 */ diff --git a/components/bt/bluedroid/stack/include/avrc_defs.h b/components/bt/bluedroid/stack/include/avrc_defs.h index fe261a74f..8a6254ef8 100644 --- a/components/bt/bluedroid/stack/include/avrc_defs.h +++ b/components/bt/bluedroid/stack/include/avrc_defs.h @@ -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 diff --git a/components/bt/bluedroid/stack/include/btm_api.h b/components/bt/bluedroid/stack/include/btm_api.h index 44d0d8e4f..d48dc68b0 100644 --- a/components/bt/bluedroid/stack/include/btm_api.h +++ b/components/bt/bluedroid/stack/include/btm_api.h @@ -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; diff --git a/components/bt/bluedroid/stack/include/btm_int.h b/components/bt/bluedroid/stack/include/btm_int.h index 827114f0c..7b7aac980 100644 --- a/components/bt/bluedroid/stack/include/btm_int.h +++ b/components/bt/bluedroid/stack/include/btm_int.h @@ -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; diff --git a/components/bt/bluedroid/stack/include/hiddefs.h b/components/bt/bluedroid/stack/include/hiddefs.h index c8c3d3cbb..23777f3ad 100644 --- a/components/bt/bluedroid/stack/include/hiddefs.h +++ b/components/bt/bluedroid/stack/include/hiddefs.h @@ -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 diff --git a/components/bt/bluedroid/stack/include/hidh_api.h b/components/bt/bluedroid/stack/include/hidh_api.h index 499e64625..29344df90 100644 --- a/components/bt/bluedroid/stack/include/hidh_api.h +++ b/components/bt/bluedroid/stack/include/hidh_api.h @@ -21,6 +21,7 @@ #include "hiddefs.h" #include "sdp_api.h" +#if (HID_HOST_INCLUDED == TRUE) /***************************************************************************** ** Constants *****************************************************************************/ @@ -232,4 +233,6 @@ extern UINT8 HID_HostSetTraceLevel (UINT8 new_level); } #endif +#endif ///HID_HOST_INCLUDED == TRUE + #endif /* HIDH_API_H */ diff --git a/components/bt/bluedroid/stack/include/l2c_api.h b/components/bt/bluedroid/stack/include/l2c_api.h index d79c17a1b..f2a4d7c4c 100644 --- a/components/bt/bluedroid/stack/include/l2c_api.h +++ b/components/bt/bluedroid/stack/include/l2c_api.h @@ -331,6 +331,7 @@ extern "C" { #endif +#if (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** ** Function L2CA_Register @@ -483,6 +484,8 @@ extern BOOLEAN L2CA_DisconnectReq (UINT16 cid); ** *******************************************************************************/ extern BOOLEAN L2CA_DisconnectRsp (UINT16 cid); +#endif ///CLASSIC_BT_INCLUDED == TRUE + /******************************************************************************* ** @@ -497,6 +500,8 @@ extern BOOLEAN L2CA_DisconnectRsp (UINT16 cid); *******************************************************************************/ extern UINT8 L2CA_DataWrite (UINT16 cid, BT_HDR *p_data); +#if (CLASSIC_BT_INCLUDED == TRUE) + /******************************************************************************* ** ** Function L2CA_Ping @@ -519,6 +524,8 @@ extern BOOLEAN L2CA_Ping (BD_ADDR p_bd_addr, tL2CA_ECHO_RSP_CB *p_cb); ** *******************************************************************************/ 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 @@ -544,6 +551,7 @@ bool L2CA_GetIdentifiers(uint16_t lcid, uint16_t *rcid, uint16_t *handle); extern BOOLEAN L2CA_SetIdleTimeout (UINT16 cid, UINT16 timeout, BOOLEAN is_global); + /******************************************************************************* ** ** Function L2CA_SetIdleTimeoutByBdAddr @@ -566,6 +574,7 @@ extern BOOLEAN L2CA_SetIdleTimeout (UINT16 cid, UINT16 timeout, extern BOOLEAN L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, UINT16 timeout, tBT_TRANSPORT transport); + /******************************************************************************* ** ** Function L2CA_SetTraceLevel @@ -578,6 +587,7 @@ extern BOOLEAN L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, UINT16 timeout, *******************************************************************************/ extern UINT8 L2CA_SetTraceLevel (UINT8 trace_level); + /******************************************************************************* ** ** Function L2CA_SetDesireRole @@ -595,7 +605,7 @@ extern UINT8 L2CA_SetTraceLevel (UINT8 trace_level); ** *******************************************************************************/ extern UINT8 L2CA_SetDesireRole (UINT8 new_role); - +#if (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** ** Function L2CA_LocalLoopbackReq @@ -722,6 +732,7 @@ typedef void (tL2CA_RESERVE_CMPL_CBACK) (void); ** ACL link. *******************************************************************************/ extern BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout); +#endif ///CLASSIC_BT_INCLUDED == TRUE /******************************************************************************* ** @@ -780,6 +791,8 @@ extern BOOLEAN L2CA_GetPeerFeatures (BD_ADDR bd_addr, UINT32 *p_ext_feat, UINT8 *******************************************************************************/ extern BOOLEAN L2CA_GetBDAddrbyHandle (UINT16 handle, BD_ADDR bd_addr); +#if (CLASSIC_BT_INCLUDED == TRUE) + /******************************************************************************* ** ** Function L2CA_GetChnlFcrMode @@ -792,6 +805,7 @@ extern BOOLEAN L2CA_GetBDAddrbyHandle (UINT16 handle, BD_ADDR bd_addr); ** *******************************************************************************/ extern UINT8 L2CA_GetChnlFcrMode (UINT16 lcid); +#endif ///CLASSIC_BT_INCLUDED == TRUE /******************************************************************************* @@ -1044,6 +1058,7 @@ extern BOOLEAN L2CA_SetFixedChannelTout (BD_ADDR rem_bda, UINT16 fixed_cid, UINT #endif /* (L2CAP_NUM_FIXED_CHNLS > 0) */ +#if (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** ** Function L2CA_GetCurrentConfig @@ -1060,6 +1075,8 @@ extern BOOLEAN L2CA_SetFixedChannelTout (BD_ADDR rem_bda, UINT16 fixed_cid, UINT 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) /******************************************************************************* diff --git a/components/bt/bluedroid/stack/include/l2cap_client.h b/components/bt/bluedroid/stack/include/l2cap_client.h index 168c8db55..d18be32c4 100644 --- a/components/bt/bluedroid/stack/include/l2cap_client.h +++ b/components/bt/bluedroid/stack/include/l2cap_client.h @@ -18,6 +18,7 @@ #ifndef _L2CAP_CLIENT_H_ #define _L2CAP_CLIENT_H_ +#if (defined(L2CAP_CLIENT_INCLUDED) && L2CAP_CLIENT_INCLUDED == TRUE) //#include #include @@ -74,4 +75,6 @@ bool l2cap_client_is_connected(const l2cap_client_t *client); // |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_*/ diff --git a/components/bt/bluedroid/stack/include/sdp_api.h b/components/bt/bluedroid/stack/include/sdp_api.h index c35c12439..db11df558 100644 --- a/components/bt/bluedroid/stack/include/sdp_api.h +++ b/components/bt/bluedroid/stack/include/sdp_api.h @@ -20,7 +20,7 @@ #include "bt_target.h" #include "sdpdefs.h" - +#if (SDP_INCLUDED == TRUE) /***************************************************************************** ** Constants *****************************************************************************/ @@ -721,4 +721,6 @@ BOOLEAN SDP_FindServiceUUIDInRec(tSDP_DISC_REC *p_rec, tBT_UUID *p_uuid); } #endif +#endif ///SDP_INCLUDED == TRUE + #endif /* SDP_API_H */ diff --git a/components/bt/bluedroid/stack/l2cap/l2c_api.c b/components/bt/bluedroid/stack/l2cap/l2c_api.c index 156757d01..5f5b854e4 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_api.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_api.c @@ -38,6 +38,7 @@ #include "btm_api.h" #include "allocator.h" +#if (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** ** Function L2CA_Register @@ -723,6 +724,9 @@ BOOLEAN L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_cal } +#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); @@ -785,6 +789,8 @@ BOOLEAN L2CA_SetIdleTimeout (UINT16 cid, UINT16 timeout, BOOLEAN is_global) return (TRUE); } + + /******************************************************************************* ** ** Function L2CA_SetIdleTimeoutByBdAddr @@ -837,6 +843,8 @@ BOOLEAN L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, UINT16 timeout, tBT_TRANSPO return TRUE; } + + /******************************************************************************* ** ** Function L2CA_SetTraceLevel @@ -895,6 +903,8 @@ UINT8 L2CA_SetDesireRole (UINT8 new_role) return (l2cb.desire_role); } +#if (CLASSIC_BT_INCLUDED == TRUE) + /******************************************************************************* ** ** Function L2CA_LocalLoopbackReq @@ -1198,6 +1208,8 @@ BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout) return (TRUE); } +#endif ///CLASSIC_BT_INCLUDED == TRUE + /******************************************************************************* ** @@ -1260,6 +1272,7 @@ BOOLEAN L2CA_GetBDAddrbyHandle (UINT16 handle, BD_ADDR bd_addr) return found_dev; } +#if (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** ** Function L2CA_GetChnlFcrMode @@ -1284,6 +1297,9 @@ UINT8 L2CA_GetChnlFcrMode (UINT16 lcid) return (L2CAP_FCR_BASIC_MODE); } +#endif ///CLASSIC_BT_INCLUDED == TRUE + + #if (L2CAP_NUM_FIXED_CHNLS > 0) /******************************************************************************* ** @@ -1299,6 +1315,7 @@ UINT8 L2CA_GetChnlFcrMode (UINT16 lcid) *******************************************************************************/ 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); @@ -1638,6 +1655,7 @@ BOOLEAN L2CA_SetFixedChannelTout (BD_ADDR rem_bda, UINT16 fixed_cid, UINT16 idle #endif /* #if (L2CAP_NUM_FIXED_CHNLS > 0) */ +#if (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** ** Function L2CA_GetCurrentConfig @@ -1723,6 +1741,7 @@ BOOLEAN L2CA_RegForNoCPEvt(tL2CA_NOCP_CB *p_cb, BD_ADDR p_bda) return TRUE; } +#endif ///CLASSIC_BT_INCLUDED == TRUE /******************************************************************************* ** diff --git a/components/bt/bluedroid/stack/l2cap/l2c_ble.c b/components/bt/bluedroid/stack/l2cap/l2c_ble.c index 70d2ba75a..330d9791b 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_ble.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_ble.c @@ -759,7 +759,7 @@ void l2c_link_processs_ble_num_bufs (UINT16 num_lm_ble_bufs) 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; } diff --git a/components/bt/bluedroid/stack/l2cap/l2c_csm.c b/components/bt/bluedroid/stack/l2cap/l2c_csm.c index 13d9beed5..1bcee7019 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_csm.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_csm.c @@ -35,7 +35,7 @@ #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 */ /********************************************************************************/ @@ -1115,7 +1115,7 @@ static void l2c_csm_w4_l2ca_disconnect_rsp (tL2C_CCB *p_ccb, UINT16 event, void break; } } - +#endif ///CLASSIC_BT_INCLUDED == TRUE #if (BT_TRACE_VERBOSE == TRUE) /******************************************************************************* diff --git a/components/bt/bluedroid/stack/l2cap/l2c_fcr.c b/components/bt/bluedroid/stack/l2cap/l2c_fcr.c index 788d841e1..c31e4b7f3 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_fcr.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_fcr.c @@ -37,6 +37,8 @@ #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 @@ -2189,3 +2191,4 @@ static void l2c_fcr_collect_ack_delay (tL2C_CCB *p_ccb, UINT8 num_bufs_acked) } } #endif +#endif ///CLASSIC_BT_INCLUDED == TRUE \ No newline at end of file diff --git a/components/bt/bluedroid/stack/l2cap/l2c_link.c b/components/bt/bluedroid/stack/l2cap/l2c_link.c index ed1787c42..09d7fae92 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_link.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_link.c @@ -150,7 +150,9 @@ BOOLEAN l2c_link_hci_conn_comp (UINT8 status, UINT16 handle, BD_ADDR p_bda) { 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); @@ -211,12 +213,12 @@ BOOLEAN l2c_link_hci_conn_comp (UINT8 status, UINT16 handle, BD_ADDR p_bda) 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); @@ -232,7 +234,7 @@ BOOLEAN l2c_link_hci_conn_comp (UINT8 status, UINT16 handle, BD_ADDR p_bda) } 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; ) { @@ -242,7 +244,7 @@ BOOLEAN l2c_link_hci_conn_comp (UINT8 status, UINT16 handle, BD_ADDR p_bda) 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) { @@ -276,8 +278,9 @@ void l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data 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); @@ -306,7 +309,9 @@ void l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT transport, void *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: @@ -315,9 +320,14 @@ void l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data 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; } } @@ -337,7 +347,9 @@ void l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data 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; @@ -366,6 +378,7 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason) 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; ) { @@ -382,7 +395,7 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason) } 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) @@ -469,8 +482,9 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason) 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); @@ -478,14 +492,14 @@ BOOLEAN l2c_link_hci_qos_violation (UINT16 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); } @@ -502,7 +516,9 @@ BOOLEAN l2c_link_hci_qos_violation (UINT16 handle) *******************************************************************************/ 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; @@ -515,7 +531,7 @@ void l2c_link_timeout (tL2C_LCB *p_lcb) (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; ) { @@ -525,6 +541,7 @@ void l2c_link_timeout (tL2C_LCB *p_lcb) p_ccb = pn; } +#endif ///CLASSIC_BT_INCLUDED == TRUE #if (BLE_INCLUDED == TRUE) if (p_lcb->link_state == LST_CONNECTING && l2cb.is_ble_connecting == TRUE) { @@ -547,7 +564,7 @@ void l2c_link_timeout (tL2C_LCB *p_lcb) (*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; ) { @@ -557,6 +574,7 @@ void l2c_link_timeout (tL2C_LCB *p_lcb) p_ccb = pn; } +#endif ///CLASSIC_BT_INCLUDED == TRUE } /* If no channels in use, drop the link. */ @@ -609,8 +627,9 @@ void l2c_link_timeout (tL2C_LCB *p_lcb) 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 */ @@ -622,7 +641,7 @@ void l2c_info_timeout (tL2C_LCB *p_lcb) } 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)) { @@ -636,6 +655,7 @@ void l2c_info_timeout (tL2C_LCB *p_lcb) } } } +#endif ///CLASSIC_BT_INCLUDED == TRUE } } @@ -1021,7 +1041,7 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf) { 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) { @@ -1048,6 +1068,7 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf) ** 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; } @@ -1064,6 +1085,7 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf) /* Loop through, starting at the next */ for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++) { /* If controller window is full, nothing to do */ + 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) @@ -1082,7 +1104,7 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf) 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) @@ -1125,6 +1147,7 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf) #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)) ) { @@ -1162,6 +1185,7 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf) 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; } @@ -1196,7 +1220,7 @@ static BOOLEAN l2c_link_send_to_lower (tL2C_LCB *p_lcb, BT_HDR *p_buf) 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)) || diff --git a/components/bt/bluedroid/stack/l2cap/l2c_main.c b/components/bt/bluedroid/stack/l2cap/l2c_main.c index 814bc9f85..5938a1205 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_main.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_main.c @@ -255,7 +255,9 @@ void l2c_rcv_acl_data (BT_HDR *p_msg) 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); @@ -273,11 +275,15 @@ void l2c_rcv_acl_data (BT_HDR *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); } @@ -298,6 +304,7 @@ void l2c_rcv_acl_data (BT_HDR *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; @@ -731,6 +738,8 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len) return; } } + +#endif ///CLASSIC_BT_INCLUDED == TRUE } /******************************************************************************* @@ -864,7 +873,7 @@ void l2c_process_timeout (TIMER_LIST_ENT *p_tle) 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; @@ -872,7 +881,7 @@ void l2c_process_timeout (TIMER_LIST_ENT *p_tle) 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); @@ -897,6 +906,7 @@ void l2c_process_timeout (TIMER_LIST_ENT *p_tle) *******************************************************************************/ 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. */ @@ -935,7 +945,7 @@ UINT8 l2c_data_write (UINT16 cid, BT_HDR *p_data, UINT16 flags) if (p_ccb->cong_sent) { return (L2CAP_DW_CONGESTED); } - +#endif ///CLASSIC_BT_INCLUDED == TRUE return (L2CAP_DW_SUCCESS); } diff --git a/components/bt/bluedroid/stack/l2cap/l2c_utils.c b/components/bt/bluedroid/stack/l2cap/l2c_utils.c index e910d3cfb..bf35e8b26 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_utils.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_utils.c @@ -1479,9 +1479,9 @@ tL2C_CCB *l2cu_allocate_ccb (tL2C_LCB *p_lcb, UINT16 cid) 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; @@ -1613,9 +1613,9 @@ void l2cu_release_ccb (tL2C_CCB *p_ccb) 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) @@ -1812,8 +1812,9 @@ UINT8 l2cu_process_peer_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) 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; @@ -1879,7 +1880,7 @@ UINT8 l2cu_process_peer_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) 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; @@ -1889,6 +1890,7 @@ UINT8 l2cu_process_peer_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) } 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) { @@ -2048,6 +2050,7 @@ void l2cu_process_our_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) *******************************************************************************/ 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; @@ -2056,6 +2059,7 @@ void l2cu_process_our_cfg_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) } l2c_fcr_adj_our_rsp_options (p_ccb, p_cfg); +#endif ///CLASSIC_BT_INCLUDED == TRUE } @@ -2418,17 +2422,16 @@ void l2cu_set_non_flushable_pbf (BOOLEAN is_supported) *******************************************************************************/ 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 */ @@ -2449,8 +2452,9 @@ void l2cu_resubmit_pending_sec_req (BD_ADDR p_bda) l2c_csm_execute (p_ccb, L2CEVT_SEC_RE_SEND_CMD, NULL); } } - } + } } +#endif ///CLASSIC_BT_INCLUDED == TRUE } #if L2CAP_CONFORMANCE_TESTING == TRUE @@ -2526,7 +2530,7 @@ BOOLEAN l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, UINT16 fixed_cid, tL2CAP_FCR { #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); @@ -2651,6 +2655,7 @@ void l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb) *******************************************************************************/ 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 */ @@ -2977,11 +2982,12 @@ static tL2C_CCB *l2cu_get_next_channel_in_rr(tL2C_LCB *p_lcb) 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)) { @@ -3026,6 +3032,7 @@ static tL2C_CCB *l2cu_get_next_channel_in_rr(tL2C_LCB *p_lcb) ** 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; @@ -3065,6 +3072,8 @@ static tL2C_CCB *l2cu_get_next_channel(tL2C_LCB *p_lcb) return NULL; } +#endif ///CLASSIC_BT_INCLUDED == TRUE + #endif /* (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE) */ /****************************************************************************** @@ -3080,7 +3089,7 @@ static tL2C_CCB *l2cu_get_next_channel(tL2C_LCB *p_lcb) 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) @@ -3093,6 +3102,7 @@ BT_HDR *l2cu_get_next_buffer_to_send (tL2C_LCB *p_lcb) /* 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; } @@ -3107,18 +3117,20 @@ BT_HDR *l2cu_get_next_buffer_to_send (tL2C_LCB *p_lcb) 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); @@ -3138,7 +3150,7 @@ BT_HDR *l2cu_get_next_buffer_to_send (tL2C_LCB *p_lcb) } } #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 ); @@ -3152,9 +3164,11 @@ BT_HDR *l2cu_get_next_buffer_to_send (tL2C_LCB *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) { @@ -3171,6 +3185,7 @@ BT_HDR *l2cu_get_next_buffer_to_send (tL2C_LCB *p_lcb) l2cu_check_channel_congestion (p_ccb); l2cu_set_acl_hci_header (p_buf, p_ccb); +#endif ///CLASSIC_BT_INCLUDED == TRUE return (p_buf); } diff --git a/components/bt/bluedroid/stack/sdp/include/sdpint.h b/components/bt/bluedroid/stack/sdp/include/sdpint.h index 9e935ea5a..3e89606f0 100644 --- a/components/bt/bluedroid/stack/sdp/include/sdpint.h +++ b/components/bt/bluedroid/stack/sdp/include/sdpint.h @@ -29,7 +29,7 @@ #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 */ @@ -309,6 +309,6 @@ extern void sdp_disc_server_rsp (tCONN_CB *p_ccb, BT_HDR *p_msg); #define sdp_disc_server_rsp(p_ccb, p_msg) #endif - +#endif ///SDP_INCLUDED == TRUE #endif diff --git a/components/bt/bluedroid/stack/sdp/sdp_api.c b/components/bt/bluedroid/stack/sdp/sdp_api.c index 1f5715913..bc793c22b 100644 --- a/components/bt/bluedroid/stack/sdp/sdp_api.c +++ b/components/bt/bluedroid/stack/sdp/sdp_api.c @@ -37,6 +37,7 @@ #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 * ***********************************************************************/ @@ -1239,3 +1240,5 @@ UINT8 SDP_SetTraceLevel (UINT8 new_level) return (sdp_cb.trace_level); } + +#endif ///SDP_INCLUDED == TRUE \ No newline at end of file diff --git a/components/bt/bluedroid/stack/sdp/sdp_db.c b/components/bt/bluedroid/stack/sdp/sdp_db.c index 2d3308ebf..978c85973 100644 --- a/components/bt/bluedroid/stack/sdp/sdp_db.c +++ b/components/bt/bluedroid/stack/sdp/sdp_db.c @@ -37,6 +37,8 @@ #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 */ @@ -964,3 +966,5 @@ INT32 SDP_ReadRecord(UINT32 handle, UINT8 *p_data, INT32 *p_data_len) return (offset); } #endif + +#endif ///SDP_INCLUDED == TRUE \ No newline at end of file diff --git a/components/bt/bluedroid/stack/sdp/sdp_main.c b/components/bt/bluedroid/stack/sdp/sdp_main.c index 3511aee98..0b7e9aa40 100644 --- a/components/bt/bluedroid/stack/sdp/sdp_main.c +++ b/components/bt/bluedroid/stack/sdp/sdp_main.c @@ -42,7 +42,7 @@ #include "sdp_api.h" #include "sdpint.h" - +#if (SDP_INCLUDED == TRUE) /********************************************************************************/ /* G L O B A L S D P D A T A */ /********************************************************************************/ @@ -688,6 +688,7 @@ void sdp_conn_timeout (tCONN_CB *p_ccb) sdpu_release_ccb (p_ccb); } +#endif ///SDP_INCLUDED == TRUE diff --git a/components/bt/bluedroid/stack/sdp/sdp_utils.c b/components/bt/bluedroid/stack/sdp/sdp_utils.c index 38bac33f6..2a93fe567 100644 --- a/components/bt/bluedroid/stack/sdp/sdp_utils.c +++ b/components/bt/bluedroid/stack/sdp/sdp_utils.c @@ -41,7 +41,7 @@ #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 }; @@ -1023,3 +1023,5 @@ void sdpu_uuid16_to_uuid128(UINT16 uuid16, UINT8 *p_uuid128) uuid16_bo = ntohs(uuid16); memcpy(p_uuid128 + 2, &uuid16_bo, sizeof(uint16_t)); } + +#endif ///SDP_INCLUDED == TRUE \ No newline at end of file diff --git a/components/bt/bluedroid/stack/smp/include/smp_int.h b/components/bt/bluedroid/stack/smp/include/smp_int.h index ad6e99ea5..734c3fcba 100644 --- a/components/bt/bluedroid/stack/smp/include/smp_int.h +++ b/components/bt/bluedroid/stack/smp/include/smp_int.h @@ -24,7 +24,7 @@ #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" @@ -530,6 +530,6 @@ extern BOOLEAN aes_cipher_msg_auth_code(BT_OCTET16 key, UINT8 *input, UINT16 len UINT16 tlen, UINT8 *p_signature); extern void print128(BT_OCTET16 x, const UINT8 *key_name); -#endif +#endif ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE #endif /* SMP_INT_H */ diff --git a/components/bt/bluedroid/stack/smp/smp_br_main.c b/components/bt/bluedroid/stack/smp/smp_br_main.c index 1ccbc0971..8360bf978 100644 --- a/components/bt/bluedroid/stack/smp/smp_br_main.c +++ b/components/bt/bluedroid/stack/smp/smp_br_main.c @@ -21,7 +21,7 @@ #include #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", diff --git a/examples/bluetooth/gatt_server/main/gatts_demo.c b/examples/bluetooth/gatt_server/main/gatts_demo.c index 9114beaeb..1715b65fc 100644 --- a/examples/bluetooth/gatt_server/main/gatts_demo.c +++ b/examples/bluetooth/gatt_server/main/gatts_demo.c @@ -259,7 +259,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i 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],