compoent/bt:change the code style

This commit is contained in:
Yulong 2017-04-23 05:52:18 -04:00
parent 1016ab1c2a
commit 2cfde4dfd9
7 changed files with 82 additions and 44 deletions

View file

@ -50,7 +50,9 @@ static void bta_dm_inq_results_cb (tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
static void bta_dm_inq_cmpl_cb (void *p_result);
static void bta_dm_service_search_remname_cback (BD_ADDR bd_addr, DEV_CLASS dc, BD_NAME bd_name);
static void bta_dm_remname_cback (tBTM_REMOTE_DEV_NAME *p_remote_name);
#if (SDP_INCLUDED == TRUE)
static void bta_dm_find_services ( BD_ADDR bd_addr);
#endif ///SDP_INCLUDED == TRUE
static void bta_dm_discover_next_device(void);
#if (SDP_INCLUDED == TRUE)
static void bta_dm_sdp_callback (UINT16 sdp_status);
@ -72,11 +74,11 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data);
#endif /* (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE) */
static void bta_dm_set_eir (char *local_name);
#if (SDP_INCLUDED == TRUE)
static void bta_dm_eir_search_services( tBTM_INQ_RESULTS *p_result,
tBTA_SERVICE_MASK *p_services_to_search,
tBTA_SERVICE_MASK *p_services_found);
#endif ///SDP_INCLUDED == TRUE
static void bta_dm_search_timer_cback (TIMER_LIST_ENT *p_tle);
static void bta_dm_disable_conn_down_timer_cback (TIMER_LIST_ENT *p_tle);
static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
@ -85,10 +87,10 @@ static void bta_dm_adjust_roles(BOOLEAN delay_role_switch);
static char *bta_dm_get_remname(void);
#endif ///SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE
static void bta_dm_bond_cancel_complete_cback(tBTM_STATUS result);
#if (SDP_INCLUDED == TRUE)
static BOOLEAN bta_dm_read_remote_device_name (BD_ADDR bd_addr, tBT_TRANSPORT transport);
static void bta_dm_discover_device(BD_ADDR remote_bd_addr);
#endif ///SDP_INCLUDED == TRUE
static void bta_dm_sys_hw_cback( tBTA_SYS_HW_EVT status );
static void bta_dm_disable_search_and_disc(void);
@ -1197,9 +1199,9 @@ void bta_dm_search_cancel (tBTA_DM_MSG *p_data)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_dm_discover (tBTA_DM_MSG *p_data)
{
#if (SDP_INCLUDED == TRUE)
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
UINT16 len = (UINT16)(sizeof(tBT_UUID) * p_data->discover.num_uuid);
#endif
@ -1236,7 +1238,6 @@ 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
}
/*******************************************************************************
@ -1250,7 +1251,6 @@ 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));
@ -1265,10 +1265,8 @@ 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
@ -1332,9 +1330,9 @@ static void bta_dm_disable_search_and_disc (void)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_dm_di_disc (tBTA_DM_MSG *p_data)
{
#if (SDP_INCLUDED == TRUE)
UINT16 result = BTA_FAILURE;
tBTA_DM_MSG *p_msg;
@ -1358,8 +1356,8 @@ void bta_dm_di_disc (tBTA_DM_MSG *p_data)
p_data->hdr.offset = result;
bta_sys_sendmsg(p_msg);
}
#endif ///SDP_INCLUDED == TRUE
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
@ -1370,6 +1368,7 @@ void bta_dm_di_disc (tBTA_DM_MSG *p_data)
** Returns TRUE if started to get remote name
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
static BOOLEAN bta_dm_read_remote_device_name (BD_ADDR bd_addr, tBT_TRANSPORT transport)
{
tBTM_STATUS btm_status;
@ -1401,6 +1400,7 @@ static BOOLEAN bta_dm_read_remote_device_name (BD_ADDR bd_addr, tBT_TRANSPORT tr
return (FALSE);
}
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
@ -1425,7 +1425,9 @@ void bta_dm_inq_cmpl (tBTA_DM_MSG *p_data)
/* start name and service discovery from the first device on inquiry result */
bta_dm_search_cb.name_discover_done = FALSE;
bta_dm_search_cb.peer_name[0] = 0;
#if (SDP_INCLUDED == TRUE)
bta_dm_discover_device(bta_dm_search_cb.p_btm_inq_info->results.remote_bd_addr);
#endif ///SDP_INCLUDED == TRUE
} else {
/* no devices, search complete */
bta_dm_search_cb.services = 0;
@ -1454,8 +1456,9 @@ void bta_dm_rmt_name (tBTA_DM_MSG *p_data)
if ( p_data->rem_name.result.disc_res.bd_name[0] && bta_dm_search_cb.p_btm_inq_info) {
bta_dm_search_cb.p_btm_inq_info->appl_knows_rem_name = TRUE;
}
#if (SDP_INCLUDED == TRUE)
bta_dm_discover_device(bta_dm_search_cb.peer_bdaddr);
#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
@ -1480,8 +1483,9 @@ void bta_dm_disc_rmt_name (tBTA_DM_MSG *p_data)
p_btm_inq_info->appl_knows_rem_name = TRUE;
}
}
#if (SDP_INCLUDED == TRUE)
bta_dm_discover_device(p_data->rem_name.result.disc_res.bd_addr);
#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************
@ -1493,9 +1497,9 @@ void bta_dm_disc_rmt_name (tBTA_DM_MSG *p_data)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
{
#if (SDP_INCLUDED == TRUE)
tSDP_DISC_REC *p_sdp_rec = NULL;
tBTA_DM_MSG *p_msg;
BOOLEAN scn_found = FALSE;
@ -1727,8 +1731,8 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
bta_sys_sendmsg(p_msg);
}
}
#endif ///SDP_INCLUDE == TRUE
}
#endif ///SDP_INCLUDE == TRUE
/*******************************************************************************
**
@ -1748,7 +1752,9 @@ void bta_dm_search_cmpl (tBTA_DM_MSG *p_data)
#endif
if (p_data->hdr.layer_specific == BTA_DM_API_DI_DISCOVER_EVT) {
#if (SDP_INCLUDED == TRUE)
bta_dm_di_disc_cmpl(p_data);
#endif ///SDP_INCLUDED == TRUE
} else {
bta_dm_search_cb.p_search_cback(BTA_DM_DISC_CMPL_EVT, NULL);
}
@ -1891,17 +1897,17 @@ void bta_dm_queue_search (tBTA_DM_MSG *p_data)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_dm_queue_disc (tBTA_DM_MSG *p_data)
{
#if (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
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
@ -1950,9 +1956,9 @@ void bta_dm_search_cancel_cmpl (tBTA_DM_MSG *p_data)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_dm_search_cancel_transac_cmpl(tBTA_DM_MSG *p_data)
{
#if (SDP_INCLUDED == TRUE)
UNUSED(p_data);
if (bta_dm_search_cb.p_sdp_db) {
GKI_freebuf(bta_dm_search_cb.p_sdp_db);
@ -1960,8 +1966,8 @@ void bta_dm_search_cancel_transac_cmpl(tBTA_DM_MSG *p_data)
}
bta_dm_search_cancel_notify(NULL);
#endif ///SDP_INCLUDED == TRUE
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
@ -1999,9 +2005,9 @@ void bta_dm_search_cancel_notify (tBTA_DM_MSG *p_data)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
static void bta_dm_find_services ( BD_ADDR bd_addr)
{
#if (SDP_INCLUDED == TRUE)
tSDP_UUID uuid;
tBTA_DM_MSG *p_msg;
@ -2107,8 +2113,8 @@ static void bta_dm_find_services ( BD_ADDR bd_addr)
bta_sys_sendmsg(p_msg);
}
}
#endif ///SDP_INCLUDED == TRUE
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
@ -2130,7 +2136,9 @@ static void bta_dm_discover_next_device(void)
if ((bta_dm_search_cb.p_btm_inq_info = BTM_InqDbNext(bta_dm_search_cb.p_btm_inq_info)) != NULL) {
bta_dm_search_cb.name_discover_done = FALSE;
bta_dm_search_cb.peer_name[0] = 0;
#if (SDP_INCLUDED == TRUE)
bta_dm_discover_device(bta_dm_search_cb.p_btm_inq_info->results.remote_bd_addr);
#endif ///SDP_INCLUDED == TRUE
} else {
/* no devices, search complete */
bta_dm_search_cb.services = 0;
@ -2152,6 +2160,7 @@ static void bta_dm_discover_next_device(void)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
{
tBTA_DM_MSG *p_msg;
@ -2291,7 +2300,6 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
}
}
#if (SDP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_dm_sdp_callback
@ -3803,6 +3811,7 @@ static void bta_dm_set_eir (char *local_name)
** Returns None
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
static void bta_dm_eir_search_services( tBTM_INQ_RESULTS *p_result,
tBTA_SERVICE_MASK *p_services_to_search,
tBTA_SERVICE_MASK *p_services_found)
@ -3861,6 +3870,7 @@ static void bta_dm_eir_search_services( tBTM_INQ_RESULTS *p_result,
APPL_TRACE_ERROR("BTA EIR search result, services_to_search=0x%08X, services_found=0x%08X",
*p_services_to_search, *p_services_found);
}
#endif ///SDP_INCLUDED == TRUE
#if (BTA_EIR_CANNED_UUID_LIST != TRUE)
/*******************************************************************************
@ -4124,7 +4134,6 @@ 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;
@ -4238,7 +4247,6 @@ 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 */

View file

@ -276,10 +276,10 @@ void BTA_DmSearchCancel(void)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search)
{
#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) {
@ -292,11 +292,8 @@ 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

View file

@ -1162,10 +1162,14 @@ extern UINT8 bta_dm_get_av_count(void);
extern void bta_dm_search_start (tBTA_DM_MSG *p_data);
extern void bta_dm_search_cancel (tBTA_DM_MSG *p_data);
extern void bta_dm_discover (tBTA_DM_MSG *p_data);
#if (SDP_INCLUDED == TRUE)
extern void bta_dm_di_disc (tBTA_DM_MSG *p_data);
#endif ///SDP_INCLUDED == TRUE
extern void bta_dm_inq_cmpl (tBTA_DM_MSG *p_data);
extern void bta_dm_rmt_name (tBTA_DM_MSG *p_data);
#if (SDP_INCLUDED == TRUE)
extern void bta_dm_sdp_result (tBTA_DM_MSG *p_data);
#endif ///SDP_INCLUDED == TRUE
extern void bta_dm_search_cmpl (tBTA_DM_MSG *p_data);
extern void bta_dm_free_sdp_db (tBTA_DM_MSG *p_data);
extern void bta_dm_disc_result (tBTA_DM_MSG *p_data);

View file

@ -144,22 +144,32 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
enum {
BTA_DM_API_SEARCH, /* 0 bta_dm_search_start */
BTA_DM_API_SEARCH_CANCEL, /* 1 bta_dm_search_cancel */
#if (SDP_INCLUDED == TRUE)
BTA_DM_API_DISCOVER, /* 2 bta_dm_discover */
#endif ///SDP_INCLUDED == TRUE
BTA_DM_INQUIRY_CMPL, /* 3 bta_dm_inq_cmpl */
BTA_DM_REMT_NAME, /* 4 bta_dm_rmt_name */
#if (SDP_INCLUDED == TRUE)
BTA_DM_SDP_RESULT, /* 5 bta_dm_sdp_result */
#endif ///SDP_INCLUDED == TRUE
BTA_DM_SEARCH_CMPL, /* 6 bta_dm_search_cmpl*/
BTA_DM_FREE_SDP_DB, /* 7 bta_dm_free_sdp_db */
BTA_DM_DISC_RESULT, /* 8 bta_dm_disc_result */
BTA_DM_SEARCH_RESULT, /* 9 bta_dm_search_result */
BTA_DM_QUEUE_SEARCH, /* 10 bta_dm_queue_search */
#if (SDP_INCLUDED == TRUE)
BTA_DM_QUEUE_DISC, /* 11 bta_dm_queue_disc */
#endif ///SDP_INCLUDED == TRUE
BTA_DM_SEARCH_CLEAR_QUEUE, /* 12 bta_dm_search_clear_queue */
BTA_DM_SEARCH_CANCEL_CMPL, /* 13 bta_dm_search_cancel_cmpl */
BTA_DM_SEARCH_CANCEL_NOTIFY, /* 14 bta_dm_search_cancel_notify */
#if (SDP_INCLUDED == TRUE)
BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, /* 15 bta_dm_search_cancel_transac_cmpl */
#endif ///SDP_INCLUDED == TRUE
BTA_DM_DISC_RMT_NAME, /* 16 bta_dm_disc_rmt_name */
#if (SDP_INCLUDED == TRUE)
BTA_DM_API_DI_DISCOVER, /* 17 bta_dm_di_disc */
#endif ///SDP_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE
BTA_DM_CLOSE_GATT_CONN, /* 18 bta_dm_close_gatt_conn */
#endif
@ -172,22 +182,32 @@ const tBTA_DM_ACTION bta_dm_search_action[] = {
bta_dm_search_start, /* 0 BTA_DM_API_SEARCH */
bta_dm_search_cancel, /* 1 BTA_DM_API_SEARCH_CANCEL */
#if (SDP_INCLUDED == TRUE)
bta_dm_discover, /* 2 BTA_DM_API_DISCOVER */
#endif ///SDP_INCLUDED == TRUE
bta_dm_inq_cmpl, /* 3 BTA_DM_INQUIRY_CMPL */
bta_dm_rmt_name, /* 4 BTA_DM_REMT_NAME */
#if (SDP_INCLUDED == TRUE)
bta_dm_sdp_result, /* 5 BTA_DM_SDP_RESULT */
#endif ///SDP_INCLUDED == TRUE
bta_dm_search_cmpl, /* 6 BTA_DM_SEARCH_CMPL */
bta_dm_free_sdp_db, /* 7 BTA_DM_FREE_SDP_DB */
bta_dm_disc_result, /* 8 BTA_DM_DISC_RESULT */
bta_dm_search_result, /* 9 BTA_DM_SEARCH_RESULT */
bta_dm_queue_search, /* 10 BTA_DM_QUEUE_SEARCH */
#if (SDP_INCLUDED == TRUE)
bta_dm_queue_disc, /* 11 BTA_DM_QUEUE_DISC */
#endif ///SDP_INCLUDED == TRUE
bta_dm_search_clear_queue, /* 12 BTA_DM_SEARCH_CLEAR_QUEUE */
bta_dm_search_cancel_cmpl, /* 13 BTA_DM_SEARCH_CANCEL_CMPL */
bta_dm_search_cancel_notify, /* 14 BTA_DM_SEARCH_CANCEL_NOTIFY */
#if (SDP_INCLUDED == TRUE)
bta_dm_search_cancel_transac_cmpl, /* 15 BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL */
#endif ///SDP_INCLUDED == TRUE
bta_dm_disc_rmt_name, /* 16 BTA_DM_DISC_RMT_NAME */
#if (SDP_INCLUDED == TRUE)
bta_dm_di_disc /* 17 BTA_DM_API_DI_DISCOVER */
#endif ///SDP_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && SDP_INCLUDED == TRUE
, bta_dm_close_gatt_conn
#endif
@ -207,15 +227,19 @@ const UINT8 bta_dm_search_idle_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
/* Event Action 1 Action 2 Next State */
/* API_SEARCH */ {BTA_DM_API_SEARCH, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
/* API_SEARCH_CANCEL */ {BTA_DM_SEARCH_CANCEL_NOTIFY, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#if (SDP_INCLUDED == TRUE)
/* API_SEARCH_DISC */ {BTA_DM_API_DISCOVER, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
#endif ///SDP_INCLUDED == TRUE
/* INQUIRY_CMPL */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
/* REMT_NAME_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
/* SDP_RESULT_EVT */ {BTA_DM_FREE_SDP_DB, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
/* SEARCH_CMPL_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
/* DISCV_RES_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
/* API_DI_DISCOVER_EVT */ {BTA_DM_API_DI_DISCOVER, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE}
#if (SDP_INCLUDED == TRUE)
/* API_DI_DISCOVER_EVT */ {BTA_DM_API_DI_DISCOVER, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
#endif ///SDP_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE
/* DISC_CLOSE_TOUT_EVT */ , {BTA_DM_CLOSE_GATT_CONN, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE}
/* DISC_CLOSE_TOUT_EVT */ {BTA_DM_CLOSE_GATT_CONN, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#endif
};
const UINT8 bta_dm_search_search_active_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
@ -226,7 +250,9 @@ const UINT8 bta_dm_search_search_active_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
/* API_SEARCH_DISC */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
/* INQUIRY_CMPL */ {BTA_DM_INQUIRY_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
/* REMT_NAME_EVT */ {BTA_DM_REMT_NAME, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
#if (SDP_INCLUDED == TRUE)
/* SDP_RESULT_EVT */ {BTA_DM_SDP_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
#endif ///SDP_INCLUDED == TRUE
/* SEARCH_CMPL_EVT */ {BTA_DM_SEARCH_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
/* DISCV_RES_EVT */ {BTA_DM_SEARCH_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
/* API_DI_DISCOVER_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE}
@ -241,12 +267,16 @@ const UINT8 bta_dm_search_search_cancelling_st_table[][BTA_DM_SEARCH_NUM_COLS] =
/* Event Action 1 Action 2 Next State */
/* API_SEARCH */ {BTA_DM_QUEUE_SEARCH, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING},
/* API_SEARCH_CANCEL */ {BTA_DM_SEARCH_CLEAR_QUEUE, BTA_DM_SEARCH_CANCEL_NOTIFY, BTA_DM_SEARCH_CANCELLING},
#if (SDP_INCLUDED == TRUE)
/* API_SEARCH_DISC */ {BTA_DM_QUEUE_DISC, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING},
#endif ///SDP_INCLUDED == TRUE
/* INQUIRY_CMPL */ {BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#if (SDP_INCLUDED == TRUE)
/* REMT_NAME_EVT */ {BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IDLE},
/* SDP_RESULT_EVT */ {BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IDLE},
/* SEARCH_CMPL_EVT */ {BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IDLE},
/* DISCV_RES_EVT */ {BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IDLE},
#endif ///SDP_INCLUDED == TRUE
/* API_DI_DISCOVER_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING}
#if BLE_INCLUDED == TRUE
/* DISC_CLOSE_TOUT_EVT */ , {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING}
@ -262,7 +292,9 @@ const UINT8 bta_dm_search_disc_active_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
/* API_SEARCH_DISC */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
/* INQUIRY_CMPL */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
/* REMT_NAME_EVT */ {BTA_DM_DISC_RMT_NAME, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
#if (SDP_INCLUDED == TRUE)
/* SDP_RESULT_EVT */ {BTA_DM_SDP_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
#endif ///SDP_INCLUDED == TRUE
/* SEARCH_CMPL_EVT */ {BTA_DM_SEARCH_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
/* DISCV_RES_EVT */ {BTA_DM_DISC_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
/* API_DI_DISCOVER_EVT */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE}

View file

@ -41,9 +41,10 @@
// #include "osi/include/log.h"
static void bta_gattc_char_dscpt_disc_cmpl(UINT16 conn_id, tBTA_GATTC_SERV *p_srvc_cb);
#if (SDP_INCLUDED == TRUE)
static tBTA_GATT_STATUS bta_gattc_sdp_service_disc(UINT16 conn_id, tBTA_GATTC_SERV *p_server_cb);
#define BTA_GATT_SDP_DB_SIZE 4096
#endif ///SDP_INCLUDED == TRUE
/*****************************************************************************
** Constants
@ -457,7 +458,9 @@ tBTA_GATT_STATUS bta_gattc_discover_pri_service(UINT16 conn_id, tBTA_GATTC_SERV
if (p_clcb->transport == BTA_TRANSPORT_LE) {
status = bta_gattc_discover_procedure(conn_id, p_server_cb, disc_type);
} else {
#if (SDP_INCLUDED == TRUE)
status = bta_gattc_sdp_service_disc(conn_id, p_server_cb);
#endif ///SDP_INCLUDED == TRUE
}
}
@ -786,9 +789,9 @@ static tBTA_GATT_STATUS bta_gattc_add_char_to_list(tBTA_GATTC_SERV *p_srvc_cb,
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
void bta_gattc_sdp_callback (UINT16 sdp_status)
{
#if (SDP_INCLUDED == TRUE)
tSDP_DISC_REC *p_sdp_rec = NULL;
tBT_UUID service_uuid;
tSDP_PROTOCOL_ELEM pe;
@ -843,8 +846,9 @@ 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
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Function bta_gattc_sdp_service_disc
@ -854,9 +858,9 @@ void bta_gattc_sdp_callback (UINT16 sdp_status)
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
static tBTA_GATT_STATUS bta_gattc_sdp_service_disc(UINT16 conn_id, tBTA_GATTC_SERV *p_server_cb)
{
#if (SDP_INCLUDED == TRUE)
tSDP_UUID uuid;
UINT16 num_attrs = 2;
UINT16 attr_list[2];
@ -884,10 +888,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
}
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Function bta_gattc_disc_res_cback

View file

@ -1451,9 +1451,9 @@ extern void BTA_DmSearchCancel(void);
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
extern void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
#if (SDP_INCLUDED == TRUE)
// btla-specific ++
/*******************************************************************************
**

View file

@ -327,7 +327,6 @@ 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;
@ -350,7 +349,6 @@ 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
}
@ -365,7 +363,6 @@ 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;
@ -429,7 +426,6 @@ 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
}
/*******************************************************************************
@ -460,7 +456,6 @@ 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));
@ -515,7 +510,6 @@ void bta_sdp_search(tBTA_SDP_MSG *p_data)
/*
else report the result when the cback is called
*/
#endif ///SDP_INCLUDED == TRUE
}
/*******************************************************************************