CYW 20706 example GATT service discovery 'Hello_Client'

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RiBe_4725556
Level 2
Level 2
10 replies posted 5 replies posted 5 questions asked

Hi,

I am trying to rebuild the 'Hello_Client' example on the CYW20706 dev kit to connect to a 3rd party BLE device but am having problems with the service handles.

I found out that the example does not perform GATT discovery so the discovery data is invalid.

Is there a way to implement this into the example or a reference guide on how to implement this?

With kind regards,

Richard

0 Likes
1 Solution

Hi XingZao,

i found the problem, in my code is copy pasted the search handles in the same variables, see below:

        discoveryparams.s_handle = 0x01;

        discoveryparams.s_handle = 0xFFFF;

i have it working now but maybe for future reference is someone tries to use custom hardware with the Hello Client example keep in mind that the example does NOT serach for the service, characteristic and descriptor handles, you need to implement this yourself.

below are the steps i used in order to get it working:

1. Connect custom device based on the UUID advertising data.

2. Find service handle using the follwoing function: wiced_bt_gatt_send_discover

3. Find characteristic handle using the same functions but different variables

3. Find characteristic descriptor handles using the same functions but different variables

4. Enable notifications by writing to the characteristic descriptor handle

5. Receive notification callbacks.

Thank you for your time and response

With kind regards,

Richard

View solution in original post

0 Likes
3 Replies
RiBe_4725556
Level 2
Level 2
10 replies posted 5 replies posted 5 questions asked

Update,

I found out that i can use the function 'wiced_bt_gatt_send_discover' in order to retrieve the uuid service handles but the function keeps returning "WICED_BT_GATT_ILLEGAL_PARAMETER".

Any idea to which parameter it is referring? Code below is actual function call for retrieving the common service "Generic access"

        discoveryparams.uuid.len = LEN_UUID_16;

        discoveryparams.uuid.uu.uuid16 = 0x1800;

        discoveryparams.s_handle = 0x01;

        discoveryparams.s_handle = 0xFFFF;

        wiced_bt_gatt_status_t result = wiced_bt_gatt_send_discover(g_hello_client.conn_id ,GATT_DISCOVER_SERVICES_BY_UUID, &discoveryparams);

        if (result != WICED_BT_GATT_SUCCESS)

I also tried to find the specific custom service (128 bit) neccessary and therefore change the argument  to below but this also returns the WICED_BT_GATT_ILLEGAL_PARAMETER value.

wiced_bt_gatt_discovery_param_t discoveryparams;

discoveryparams.uuid.len = LEN_UUID_128;

for (int i = 0; i < LEN_UUID_128; i++)

{

    discoveryparams.uuid.uu.uuid128 = uuid_128_ptt_key_button;

    WICED_BT_TRACE("uuid[%d], %d\r\n", i, discoveryparams.uuid.uu.uuid128);

}

        discoveryparams.s_handle = 0x01;

        discoveryparams.s_handle = 0xFFFF;

        wiced_bt_gatt_status_t result = wiced_bt_gatt_send_discover(g_hello_client.conn_id ,GATT_DISCOVER_SERVICES_BY_UUID, &discoveryparams);

        if (result != WICED_BT_GATT_SUCCESS)

With kind regards,

Richard

0 Likes

Could you try the demo/hci_audio_gateway or snip/gatt_db which has the function hci_control_le_handle_service_discovery.

You can use the clientcontrol to send the discovery command.

0 Likes

Hi XingZao,

i found the problem, in my code is copy pasted the search handles in the same variables, see below:

        discoveryparams.s_handle = 0x01;

        discoveryparams.s_handle = 0xFFFF;

i have it working now but maybe for future reference is someone tries to use custom hardware with the Hello Client example keep in mind that the example does NOT serach for the service, characteristic and descriptor handles, you need to implement this yourself.

below are the steps i used in order to get it working:

1. Connect custom device based on the UUID advertising data.

2. Find service handle using the follwoing function: wiced_bt_gatt_send_discover

3. Find characteristic handle using the same functions but different variables

3. Find characteristic descriptor handles using the same functions but different variables

4. Enable notifications by writing to the characteristic descriptor handle

5. Receive notification callbacks.

Thank you for your time and response

With kind regards,

Richard

0 Likes