* Returns void
*
******************************************************************************/
-void bta_sdp_search(tBTA_SDP_API_SEARCH* p_data) {
- if (p_data == NULL) {
- APPL_TRACE_DEBUG("SDP control block handle is null");
- return;
- }
+void bta_sdp_search(const RawAddress bd_addr, const bluetooth::Uuid uuid) {
tBTA_SDP_STATUS status = BTA_SDP_FAILURE;
APPL_TRACE_DEBUG("%s in, sdp_active:%d", __func__, bta_sdp_cb.sdp_active);
- const Uuid& uuid = p_data->uuid;
if (bta_sdp_cb.sdp_active != BTA_SDP_ACTIVE_NONE) {
/* SDP is still in progress */
status = BTA_SDP_BUSY;
tBTA_SDP_SEARCH_COMP result;
memset(&result, 0, sizeof(result));
result.uuid = uuid;
- result.remote_addr = p_data->bd_addr;
+ result.remote_addr = bd_addr;
result.status = status;
tBTA_SDP bta_sdp;
bta_sdp.sdp_search_comp = result;
bta_sdp_cb.p_dm_cback(BTA_SDP_SEARCH_COMP_EVT, &bta_sdp, NULL);
}
- osi_free(p_data);
return;
}
bta_sdp_cb.sdp_active = BTA_SDP_ACTIVE_YES;
- bta_sdp_cb.remote_addr = p_data->bd_addr;
+ bta_sdp_cb.remote_addr = bd_addr;
/* initialize the search for the uuid */
APPL_TRACE_DEBUG("%s init discovery with UUID: %s", __func__,
Uuid* bta_sdp_search_uuid = (Uuid*)osi_malloc(sizeof(Uuid));
*bta_sdp_search_uuid = uuid;
- if (!SDP_ServiceSearchAttributeRequest2(
- p_data->bd_addr, p_bta_sdp_cfg->p_sdp_db, bta_sdp_search_cback,
- (void*)bta_sdp_search_uuid)) {
+ if (!SDP_ServiceSearchAttributeRequest2(bd_addr, p_bta_sdp_cfg->p_sdp_db,
+ bta_sdp_search_cback,
+ (void*)bta_sdp_search_uuid)) {
bta_sdp_cb.sdp_active = BTA_SDP_ACTIVE_NONE;
/* failed to start SDP. report the failure right away */
tBTA_SDP_SEARCH_COMP result;
memset(&result, 0, sizeof(result));
result.uuid = uuid;
- result.remote_addr = p_data->bd_addr;
+ result.remote_addr = bd_addr;
result.status = status;
tBTA_SDP bta_sdp;
bta_sdp.sdp_search_comp = result;
/*
else report the result when the cback is called
*/
- osi_free(p_data);
}
/*******************************************************************************
******************************************************************************/
tBTA_SDP_STATUS BTA_SdpSearch(const RawAddress& bd_addr,
const bluetooth::Uuid& uuid) {
- tBTA_SDP_API_SEARCH* p_msg =
- (tBTA_SDP_API_SEARCH*)osi_malloc(sizeof(tBTA_SDP_API_SEARCH));
-
- APPL_TRACE_API("%s", __func__);
-
- p_msg->hdr.event = BTA_SDP_API_SEARCH_EVT;
- p_msg->bd_addr = bd_addr;
- p_msg->uuid = uuid;
-
- do_in_main_thread(FROM_HERE, base::Bind(bta_sdp_search, p_msg));
-
+ do_in_main_thread(FROM_HERE, base::Bind(bta_sdp_search, bd_addr, uuid));
return BTA_SDP_SUCCESS;
}
/* data type for BTA_SDP_API_SEARCH_EVT */
typedef struct {
BT_HDR hdr;
- RawAddress bd_addr;
- bluetooth::Uuid uuid;
-} tBTA_SDP_API_SEARCH;
-
-/* data type for BTA_SDP_API_SEARCH_EVT */
-typedef struct {
- BT_HDR hdr;
void* user_data;
} tBTA_SDP_API_RECORD_USER;
typedef union {
/* GKI event buffer header */
BT_HDR hdr;
- tBTA_SDP_API_SEARCH get_search;
tBTA_SDP_API_RECORD_USER record;
} tBTA_SDP_MSG;
extern bool bta_sdp_sm_execute(BT_HDR* p_msg);
extern void bta_sdp_enable(tBTA_SDP_DM_CBACK* p_cback);
-extern void bta_sdp_search(tBTA_SDP_API_SEARCH* p_data);
+extern void bta_sdp_search(const RawAddress bd_addr,
+ const bluetooth::Uuid uuid);
extern void bta_sdp_create_record(tBTA_SDP_API_RECORD_USER* p_data);
extern void bta_sdp_remove_record(tBTA_SDP_API_RECORD_USER* p_data);