/******************************************************************************* ** ** Function bta_hf_client_disc_acp_res ** ** Description This function handles a discovery result when acceptor. ** ** ** Returns void ** *******************************************************************************/ void bta_hf_client_disc_acp_res(tBTA_HF_CLIENT_DATA *p_data) { /* if found service */ if (p_data->disc_result.status == SDP_SUCCESS || p_data->disc_result.status == SDP_DB_FULL) { /* get attributes */ bta_hf_client_sdp_find_attr(); } /* free discovery db */ bta_hf_client_free_db(p_data); }
/******************************************************************************* ** ** Function bta_hf_client_do_disc ** ** Description Do service discovery. ** ** ** Returns void ** *******************************************************************************/ void bta_hf_client_do_disc(void) { tSDP_UUID uuid_list[2]; UINT16 num_uuid = 1; UINT16 attr_list[4]; UINT8 num_attr; BOOLEAN db_inited = FALSE; /* initiator; get proto list and features */ if (bta_hf_client_cb.scb.role == BTA_HF_CLIENT_INT) { attr_list[0] = ATTR_ID_SERVICE_CLASS_ID_LIST; attr_list[1] = ATTR_ID_PROTOCOL_DESC_LIST; attr_list[2] = ATTR_ID_BT_PROFILE_DESC_LIST; attr_list[3] = ATTR_ID_SUPPORTED_FEATURES; num_attr = 4; uuid_list[0].uu.uuid16 = UUID_SERVCLASS_AG_HANDSFREE; } /* acceptor; get features */ else { attr_list[0] = ATTR_ID_SERVICE_CLASS_ID_LIST; attr_list[1] = ATTR_ID_BT_PROFILE_DESC_LIST; attr_list[2] = ATTR_ID_SUPPORTED_FEATURES; num_attr = 3; uuid_list[0].uu.uuid16 = UUID_SERVCLASS_AG_HANDSFREE; } /* allocate buffer for sdp database */ bta_hf_client_cb.scb.p_disc_db = (tSDP_DISCOVERY_DB *) osi_malloc(BT_DEFAULT_BUFFER_SIZE); if (bta_hf_client_cb.scb.p_disc_db) { /* set up service discovery database; attr happens to be attr_list len */ uuid_list[0].len = LEN_UUID_16; uuid_list[1].len = LEN_UUID_16; db_inited = SDP_InitDiscoveryDb(bta_hf_client_cb.scb.p_disc_db, BT_DEFAULT_BUFFER_SIZE, num_uuid, uuid_list, num_attr, attr_list); } if (db_inited) { /*Service discovery not initiated */ db_inited = SDP_ServiceSearchAttributeRequest(bta_hf_client_cb.scb.peer_addr, bta_hf_client_cb.scb.p_disc_db, bta_hf_client_sdp_cback); } if (!db_inited) { /*free discover db */ bta_hf_client_free_db(NULL); /* sent failed event */ bta_hf_client_sm_execute(BTA_HF_CLIENT_DISC_FAIL_EVT, NULL); } }
/******************************************************************************* ** ** Function bta_hf_client_disc_int_res ** ** Description This function handles a discovery result when initiator. ** ** ** Returns void ** *******************************************************************************/ void bta_hf_client_disc_int_res(tBTA_HF_CLIENT_DATA *p_data) { UINT16 event = BTA_HF_CLIENT_DISC_FAIL_EVT; APPL_TRACE_DEBUG ("bta_hf_client_disc_int_res: Status: %d", p_data->disc_result.status); /* if found service */ if (p_data->disc_result.status == SDP_SUCCESS || p_data->disc_result.status == SDP_DB_FULL) { /* get attributes */ if (bta_hf_client_sdp_find_attr()) { event = BTA_HF_CLIENT_DISC_OK_EVT; } } /* free discovery db */ bta_hf_client_free_db(p_data); /* send ourselves sdp ok/fail event */ bta_hf_client_sm_execute(event, p_data); }