cancel
Showing results for 
Search instead for 
Did you mean: 

ModusToolbox Bluetooth SDK

TaC_4722371
New Contributor II

Hi,

I am calling the function wiced_bt_sdp_service_search_attribute_request, with correct arguments, but I am getting WICED_BT_SDP_NO_RESOURCES from the callback function that is passed as argument in the function wiced_bt_sdp_service_search_attribute_request. How I can solve this ?

Regards,

Tamilarasan C.

0 Likes
1 Solution
TaC_4722371
New Contributor II

Hi,

I finally found what was the cause. I didn't allocate buffers using the wiced_bt_cfg_buf_pool_t properly. I changed and then SDP is working fine. Thank you and Can wiced_bt_sdp_init_discovery_db() init search for 2 service UUIDs at the same time?  the preceding link helped me to figure out the cause.

Regards,

Tamilarasan C.

View solution in original post

0 Likes
4 Replies
AnjanaM_61
Moderator
Moderator

Hello TaC_4722371 ,

Hope you referred \Audio_Watch demo in MTB for the API usage. If not, please have a look.

Which peer device you are trying to connect and discover ?

What was the result of wiced_bt_sdp_init_discovery_db function ?

If possible, please share the code, steps to reproduce and your test logs to reproduce the issue at our side.

Other related threads :

Can wiced_bt_sdp_init_discovery_db() init search for 2 service UUIDs at the same time?

WICED_BT_SDP_CONN_FAILED

Regards,

Anjana

0 Likes
TaC_4722371
New Contributor II

Hello,

I am using the same code from \Audio_Watch demo in MTB for service discovery, and I configured services such as A2DP, AVRC Controller  and Target using cycfg_bt.cybt configurator and removed HCI part.

Is there any dependency to carry out to use the wiced_bt_sdp_service_search_attribute_request API ?

Which peer device you are trying to connect and discover ?

Answer: Bluetooth earphones.

What was the result of wiced_bt_sdp_init_discovery_db function ?

Answer: WICED_TRUE.

code I used:

/*

* Send SDP search request

*/

wiced_result_t av_app_initiate_sdp( BD_ADDR bda )

{

    wiced_bt_uuid_t             uuid_list;

    uint16_t attr_list[] = { ATTR_ID_SERVICE_CLASS_ID_LIST, ATTR_ID_PROTOCOL_DESC_LIST, ATTR_ID_BT_PROFILE_DESC_LIST };

    wiced_bool_t                result = WICED_FALSE;

    memcpy( av_app_cb.peer_bda, bda, BD_ADDR_LEN );

    if ( !av_app_cb.p_sdp_db )

    {

        /* Allocate memory for the discovery database */

        av_app_cb.p_sdp_db = ( wiced_bt_sdp_discovery_db_t * ) wiced_bt_get_buffer( SDP_DB_LEN );

        if ( av_app_cb.p_sdp_db == NULL )

        {

            return WICED_ERROR;

        }

    }

    WICED_BT_TRACE( "av_app_initiate_sdp %x\n\r", (uint32_t)av_app_cb.p_sdp_db );

    uuid_list.len       = LEN_UUID_16;

    uuid_list.uu.uuid16 = UUID_SERVCLASS_AUDIO_SINK;

    /* Search the contents of the database for the A2DP Sink service */

    result = wiced_bt_sdp_init_discovery_db (av_app_cb.p_sdp_db, SDP_DB_LEN,

                                             1,&uuid_list,

                                             sizeof(attr_list)/sizeof(attr_list[0]), attr_list);

    if (result == WICED_TRUE)

    {

        if ( wiced_bt_sdp_service_search_attribute_request( av_app_cb.peer_bda, av_app_cb.p_sdp_db, av_app_sdp_cback) )

        {

            av_app_cb.state = AV_STATE_SDP_IN_PROGRESS;

            return WICED_SUCCESS;

        }

        else

        {

            WICED_BT_TRACE("[%s] wiced_bt_sdp_service_search_attribute_request fail \n", __func__);

        }

    }

    else

    {

        WICED_BT_TRACE("[%s] wiced_bt_sdp_init_discovery_db fail \n", __func__);

    }

    wiced_bt_free_buffer(av_app_cb.p_sdp_db);

    av_app_cb.p_sdp_db = NULL;

    return WICED_ERROR;

}

Regards,

Tamilarasan C.

0 Likes
TaC_4722371
New Contributor II

Hi,

I finally found what was the cause. I didn't allocate buffers using the wiced_bt_cfg_buf_pool_t properly. I changed and then SDP is working fine. Thank you and Can wiced_bt_sdp_init_discovery_db() init search for 2 service UUIDs at the same time?  the preceding link helped me to figure out the cause.

Regards,

Tamilarasan C.

View solution in original post

0 Likes
AnjanaM_61
Moderator
Moderator

Hi TaC_4722371 ,

Thanks for sharing your fix with us.

Yes, you need to allocate the buffer pools first for BT applications to work consistently.

You can have a look at Application Buffer Pools (cypresssemiconductorco.github.io)​ for more details.

Regards,

Anjana