Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed from November 25 through December 2. Thank you for your patience.

CC2340R5: Service Discovery

Part Number: CC2340R5

Tool/software:

Hi,

Chipset Used:CC2340R5

SDK Version: simplelink_lowpower_f3_sdk_8_10_01_02

I am using the CC2340R5 in Central Role and used this example  as a reference. The example code demonstrates how we can read and write from services and characteristics.  

However, The handle values of read and write are hardcoded in the above example. What I am interested in is service discovery, If I can perform service discovery then I can perform read and write on any handle value that supports it. 

Upon reading the "gatt.h" header file, I found that we have a function called "GATT_DiscAllPrimaryServices". Once I connect to a peripheral device, I call the below function.

I have also registered for the relevant events in dataGATTHandler as shown below.

I get a BLEAPPUTIL_ATT_READ_BY_GRP_TYPE_RSP event after 20 seconds but the there are no handles present in "attReadByTypeRsp_t" structure. 

Please help me resolve the issue. 

  • Hello Sandeep,

    Thanks for reaching out.

    May I ask where are you calling your SvcDiscovery function? Is it for instance after LINK_ESTABLISHED_EVENT? In addition, when you get BLEAPPUTIL_ATT_READ_BY_GRP_TYPE_RSP, how are you parsing (with attReadByTypeRsp_t I assume) the gattMsg message that is being passed by the handler? Some more code snippets of how you are implementing this would be ideal.

    BR,

    David.

  • Hi David,

    Once I get a "LINK_ESTABLISHED_EVENT", I send an event to a custom task that I have created as shown below.

    Once I get a the event mentioned above, I invoke the service discovery function as shown below.

    The "SvcDiscovery" has the below call.

    According to the below diagram, I am supposed to look for "ATT_READ_BY_GRP_TYPE_RSP" in GATT EventHandler. 

    Hence in the GATT_EventHanlder, I parse the data as shown below. 

    I put a breakpoint and check the contents of SvcTbl but the contents are empty.

    I hope I have captured everything.

  • Hi there,

    It looks like you're using the wrong structure for that API. Instead of using attReadByTypeRsp_t, please use attReadByGrpTypeRsp_t. More info here:

    dev.ti.com/.../group___a_t_t___g_a_t_t.html