component/bt: fix the build error when using classic BT, with GATTC, GATTS and SMP disabled

This commit is contained in:
wangmengyang 2017-06-02 20:43:03 +08:00
parent e45a288516
commit ca4506fba9
6 changed files with 40 additions and 21 deletions

View file

@ -104,10 +104,12 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
static void bta_dm_ble_id_key_cback (UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key);
#endif ///SMP_INCLUDED == TRUE
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE)
#if (GATTC_INCLUDED == TRUE)
static void bta_dm_gattc_register(void);
static void btm_dm_start_gatt_discovery(BD_ADDR bd_addr);
static void bta_dm_cancel_gatt_discovery(BD_ADDR bd_addr);
static void bta_dm_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC *p_data);
#endif // (GATTC_INCLUDED == TRUE)
extern tBTA_DM_CONTRL_STATE bta_dm_pm_obtain_controller_state(void);
#endif
@ -386,7 +388,7 @@ static void bta_dm_sys_hw_cback( tBTA_SYS_HW_EVT status )
#endif ///BTM_SSR_INCLUDED == TRUE
bta_sys_policy_register((tBTA_SYS_CONN_CBACK *)bta_dm_policy_cback);
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE) && (GATTC_INCLUDED == TRUE)
bta_dm_gattc_register();
#endif
@ -1105,7 +1107,7 @@ void bta_dm_search_start (tBTA_DM_MSG *p_data)
{
tBTM_INQUIRY_CMPL result;
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE) && (GATTC_INCLUDED == TRUE)
UINT16 len = (UINT16)(sizeof(tBT_UUID) * p_data->search.num_uuid);
bta_dm_gattc_register();
#endif
@ -1123,7 +1125,7 @@ void bta_dm_search_start (tBTA_DM_MSG *p_data)
bta_dm_search_cb.p_search_cback = p_data->search.p_cback;
bta_dm_search_cb.services = p_data->search.services;
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE) && (GATTC_INCLUDED == TRUE)
utl_freebuf((void **)&bta_dm_search_cb.p_srvc_uuid);
if ((bta_dm_search_cb.num_uuid = p_data->search.num_uuid) != 0 &&
@ -1198,7 +1200,7 @@ void bta_dm_search_cancel (tBTA_DM_MSG *p_data)
}
}
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && SDP_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
if (bta_dm_search_cb.gatt_disc_active) {
bta_dm_cancel_gatt_discovery(bta_dm_search_cb.peer_bdaddr);
}
@ -1218,7 +1220,7 @@ void bta_dm_search_cancel (tBTA_DM_MSG *p_data)
#if (SDP_INCLUDED == TRUE)
void bta_dm_discover (tBTA_DM_MSG *p_data)
{
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
UINT16 len = (UINT16)(sizeof(tBT_UUID) * p_data->discover.num_uuid);
#endif
APPL_TRACE_EVENT("%s services_to_search=0x%04X, sdp_search=%d", __func__,
@ -1227,7 +1229,7 @@ void bta_dm_discover (tBTA_DM_MSG *p_data)
/* save the search condition */
bta_dm_search_cb.services = p_data->discover.services;
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
bta_dm_gattc_register();
utl_freebuf((void **)&bta_dm_search_cb.p_srvc_uuid);
if ((bta_dm_search_cb.num_uuid = p_data->discover.num_uuid) != 0 &&
@ -2004,7 +2006,7 @@ void bta_dm_search_cancel_notify (tBTA_DM_MSG *p_data)
if (!bta_dm_search_cb.name_discover_done) {
BTM_CancelRemoteDeviceName();
}
#if (BLE_INCLUDED == TRUE) && (BTA_GATT_INCLUDED == TRUE) && (SDP_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE) && (BTA_GATT_INCLUDED == TRUE) && (SDP_INCLUDED == TRUE) && (GATTC_INCLUDED) == TRUE
if (bta_dm_search_cb.gatt_disc_active) {
bta_dm_cancel_gatt_discovery(bta_dm_search_cb.peer_bdaddr);
}
@ -2266,7 +2268,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
bta_dm_search_cb.wait_disc = TRUE;
}
#if (BLE_INCLUDED == TRUE && (defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && (defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE) && (GATTC_INCLUDED == TRUE)
if ( bta_dm_search_cb.p_btm_inq_info ) {
APPL_TRACE_DEBUG("%s p_btm_inq_info %p results.device_type 0x%x services_to_search 0x%x",
__func__,
@ -5294,6 +5296,7 @@ void bta_dm_ble_get_energy_info(tBTA_DM_MSG *p_data)
** Returns void
**
*******************************************************************************/
#if (GATTC_INCLUDED == TRUE)
static void bta_dm_gattc_register(void)
{
tBT_UUID app_uuid = {LEN_UUID_128, {0}};
@ -5303,7 +5306,7 @@ static void bta_dm_gattc_register(void)
BTA_GATTC_AppRegister(&app_uuid, bta_dm_gattc_callback);
}
}
#endif /* GATTC_INCLUDED == TRUE */
/*******************************************************************************
**
** Function btm_dm_start_disc_gatt_services
@ -5334,6 +5337,7 @@ static void btm_dm_start_disc_gatt_services (UINT16 conn_id)
** Parameters:
**
*******************************************************************************/
#if (GATTC_INCLUDED == TRUE)
static void bta_dm_gatt_disc_result(tBTA_GATT_ID service_id)
{
tBTA_DM_SEARCH result;
@ -5373,7 +5377,7 @@ static void bta_dm_gatt_disc_result(tBTA_GATT_ID service_id)
bta_dm_search_cb.p_search_cback(BTA_DM_DISC_BLE_RES_EVT, &result);
}
}
#endif /* #if (GATTC_INCLUDED == TRUE) */
/*******************************************************************************
**
** Function bta_dm_gatt_disc_complete
@ -5450,6 +5454,7 @@ static void bta_dm_gatt_disc_complete(UINT16 conn_id, tBTA_GATT_STATUS status)
** Parameters:
**
*******************************************************************************/
#if (GATTC_INCLUDED == TRUE)
void bta_dm_close_gatt_conn(tBTA_DM_MSG *p_data)
{
UNUSED(p_data);
@ -5461,6 +5466,7 @@ void bta_dm_close_gatt_conn(tBTA_DM_MSG *p_data)
memset(bta_dm_search_cb.pending_close_bda, 0, BD_ADDR_LEN);
bta_dm_search_cb.conn_id = BTA_GATT_INVALID_CONN_ID;
}
#endif /* #if (GATTC_INCLUDED == TRUE) */
/*******************************************************************************
**
** Function btm_dm_start_gatt_discovery
@ -5471,6 +5477,7 @@ void bta_dm_close_gatt_conn(tBTA_DM_MSG *p_data)
** Parameters:
**
*******************************************************************************/
#if (GATTC_INCLUDED == TRUE)
void btm_dm_start_gatt_discovery (BD_ADDR bd_addr)
{
bta_dm_search_cb.gatt_disc_active = TRUE;
@ -5485,7 +5492,7 @@ void btm_dm_start_gatt_discovery (BD_ADDR bd_addr)
BTA_GATTC_Open(bta_dm_search_cb.client_if, bd_addr, TRUE, BTA_GATT_TRANSPORT_LE);
}
}
#endif /* #if (GATTC_INCLUDED == TRUE) */
/*******************************************************************************
**
** Function bta_dm_cancel_gatt_discovery
@ -5495,6 +5502,7 @@ void btm_dm_start_gatt_discovery (BD_ADDR bd_addr)
** Parameters:
**
*******************************************************************************/
#if (GATTC_INCLUDED == TRUE)
static void bta_dm_cancel_gatt_discovery(BD_ADDR bd_addr)
{
if (bta_dm_search_cb.conn_id == BTA_GATT_INVALID_CONN_ID) {
@ -5503,7 +5511,7 @@ static void bta_dm_cancel_gatt_discovery(BD_ADDR bd_addr)
bta_dm_gatt_disc_complete(bta_dm_search_cb.conn_id, (tBTA_GATT_STATUS) BTA_GATT_ERROR);
}
#endif /* #if (GATTC_INCLUDED == TRUE) */
/*******************************************************************************
**
** Function bta_dm_proc_open_evt
@ -5551,6 +5559,7 @@ void bta_dm_proc_open_evt(tBTA_GATTC_OPEN *p_data)
** Parameters:
**
*******************************************************************************/
#if (GATTC_INCLUDED == TRUE)
static void bta_dm_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
{
APPL_TRACE_DEBUG("bta_dm_gattc_callback event = %d", event);
@ -5593,7 +5602,7 @@ static void bta_dm_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
break;
}
}
#endif /* #if (GATTC_INCLUDED == TRUE) */
#endif /* BTA_GATT_INCLUDED */
#if BLE_VND_INCLUDED == TRUE

View file

@ -1120,7 +1120,9 @@ extern void bta_dm_ble_set_conn_params (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_scan_params(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_scan_fil_params(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_conn_scan_params (tBTA_DM_MSG *p_data);
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE) && (GATTC_INCLUDED == TRUE)
extern void bta_dm_close_gatt_conn(tBTA_DM_MSG *p_data);
#endif /* ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE) && (GATTC_INCLUDED == TRUE) */
extern void bta_dm_ble_observe (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_rand_address(tBTA_DM_MSG *p_data);

View file

@ -175,9 +175,9 @@ enum {
#if (SDP_INCLUDED == TRUE)
BTA_DM_API_DI_DISCOVER, /* 17 bta_dm_di_disc */
#endif ///SDP_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && SDP_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
BTA_DM_CLOSE_GATT_CONN, /* 18 bta_dm_close_gatt_conn */
#endif
#endif /* BLE_INCLUDED == TRUE && SDP_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && GATTC_INCLUDED == TRUE */
BTA_DM_SEARCH_NUM_ACTIONS /* 19 */
};
@ -215,7 +215,7 @@ const tBTA_DM_ACTION bta_dm_search_action[] = {
#if (SDP_INCLUDED == TRUE)
bta_dm_di_disc /* 17 BTA_DM_API_DI_DISCOVER */
#endif ///SDP_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && SDP_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && SDP_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
, bta_dm_close_gatt_conn
#endif
};
@ -247,7 +247,8 @@ const UINT8 bta_dm_search_idle_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
#if (SDP_INCLUDED == TRUE)
/* API_DI_DISCOVER_EVT */ {BTA_DM_API_DI_DISCOVER, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
#endif ///SDP_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && SDP_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
// #if BLE_INCLUDED == TRUE
/* DISC_CLOSE_TOUT_EVT */ {BTA_DM_CLOSE_GATT_CONN, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#endif
};
@ -265,7 +266,8 @@ const UINT8 bta_dm_search_search_active_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
/* SEARCH_CMPL_EVT */ {BTA_DM_SEARCH_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
/* DISCV_RES_EVT */ {BTA_DM_SEARCH_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
/* API_DI_DISCOVER_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE}
#if BLE_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && SDP_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
// #if BLE_INCLUDED == TRUE
/* DISC_CLOSE_TOUT_EVT */ , {BTA_DM_CLOSE_GATT_CONN, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE}
#endif

View file

@ -280,7 +280,7 @@ BOOLEAN BTM_SecRegisterLinkKeyNotificationCallback (tBTM_LINK_KEY_CALLBACK *p_ca
** Returns TRUE if registered OK, else FALSE
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
#if (SMP_INCLUDED == TRUE) || (CLASSIC_BT_INCLUDED == TRUE)
BOOLEAN BTM_SecAddRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback)
{
int i;
@ -306,7 +306,7 @@ BOOLEAN BTM_SecAddRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback)
** Returns TRUE if OK, else FALSE
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
#if (SMP_INCLUDED == TRUE) || (CLASSIC_BT_INCLUDED == TRUE)
BOOLEAN BTM_SecDeleteRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback)
{
int i;

View file

@ -909,11 +909,15 @@ void gatt_data_process (tGATT_TCB *p_tcb, BT_HDR *p_buf)
{
UINT8 *p = (UINT8 *)(p_buf + 1) + p_buf->offset;
UINT8 op_code, pseudo_op_code;
#if (GATTS_INCLUDED == TRUE) || (GATTC_INCLUDED == TRUE)
UINT16 msg_len;
#endif ///(GATTS_INCLUDED == TRUE) || (GATTC_INCLUDED == TRUE)
if (p_buf->len > 0) {
#if (GATTS_INCLUDED == TRUE) || (GATTC_INCLUDED == TRUE)
msg_len = p_buf->len - 1;
#endif ///(GATTS_INCLUDED == TRUE) || (GATTC_INCLUDED == TRUE)
STREAM_TO_UINT8(op_code, p);
/* remove the two MSBs associated with sign write and write cmd */

View file

@ -847,8 +847,10 @@ typedef struct {
TIMER_LIST_ENT pairing_tle; /* Timer for pairing process */
UINT16 disc_handle; /* for legacy devices */
UINT8 disc_reason; /* for legacy devices */
tBTM_SEC_SERV_REC sec_serv_rec[BTM_SEC_MAX_SERVICE_RECORDS];
#endif ///SMP_INCLUDED == TRUE
#if SMP_INCLUDED == TRUE || CLASSIC_BT_INCLUDED == TRUE
tBTM_SEC_SERV_REC sec_serv_rec[BTM_SEC_MAX_SERVICE_RECORDS];
#endif // SMP_INCLUDED == TRUE || CLASSIC_BT_ENABLED == TRUE
tBTM_SEC_DEV_REC sec_dev_rec[BTM_SEC_MAX_DEVICE_RECORDS];
tBTM_SEC_SERV_REC *p_out_serv;
tBTM_MKEY_CALLBACK *mkey_cback;