* Returns void
*
******************************************************************************/
-void bta_sdp_enable(tBTA_SDP_API_ENABLE* p_data) {
+void bta_sdp_enable(tBTA_SDP_DM_CBACK* p_cback) {
APPL_TRACE_DEBUG("%s in, sdp_active:%d", __func__, bta_sdp_cb.sdp_active);
tBTA_SDP_STATUS status = BTA_SDP_SUCCESS;
- bta_sdp_cb.p_dm_cback = p_data->p_cback;
+ bta_sdp_cb.p_dm_cback = p_cback;
tBTA_SDP bta_sdp;
bta_sdp.status = status;
bta_sdp_cb.p_dm_cback(BTA_SDP_ENABLE_EVT, &bta_sdp, NULL);
- osi_free(p_data);
}
/*******************************************************************************
*
******************************************************************************/
tBTA_SDP_STATUS BTA_SdpEnable(tBTA_SDP_DM_CBACK* p_cback) {
- tBTA_SDP_STATUS status = BTA_SDP_FAILURE;
-
- APPL_TRACE_API(__func__);
- if (p_cback) {
- memset(&bta_sdp_cb, 0, sizeof(tBTA_SDP_CB));
-
- if (p_cback) {
- tBTA_SDP_API_ENABLE* p_buf =
- (tBTA_SDP_API_ENABLE*)osi_malloc(sizeof(tBTA_SDP_API_ENABLE));
- p_buf->hdr.event = BTA_SDP_API_ENABLE_EVT;
- p_buf->p_cback = p_cback;
- do_in_main_thread(FROM_HERE, base::Bind(bta_sdp_enable, p_buf));
- status = BTA_SDP_SUCCESS;
- }
+ if (!p_cback) {
+ return BTA_SDP_FAILURE;
}
- return status;
+
+ memset(&bta_sdp_cb, 0, sizeof(tBTA_SDP_CB));
+ do_in_main_thread(FROM_HERE, base::Bind(bta_sdp_enable, p_cback));
+ return BTA_SDP_SUCCESS;
}
/*******************************************************************************
BTA_SDP_ACTIVE_YES /* waiting for SDP result */
};
-/* data type for BTA_SDP_API_ENABLE_EVT */
-typedef struct {
- BT_HDR hdr;
- tBTA_SDP_DM_CBACK* p_cback;
-} tBTA_SDP_API_ENABLE;
-
/* data type for BTA_SDP_API_SEARCH_EVT */
typedef struct {
BT_HDR hdr;
typedef union {
/* GKI event buffer header */
BT_HDR hdr;
- tBTA_SDP_API_ENABLE enable;
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_API_ENABLE* p_data);
+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_create_record(tBTA_SDP_API_RECORD_USER* p_data);
extern void bta_sdp_remove_record(tBTA_SDP_API_RECORD_USER* p_data);