This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2340R5: Get handle values from service discovery response

Part Number: CC2340R5

Tool/software:

Hi,

Chipset used: CC2340R5

SDK: simplelink_lowpower_f3_sdk_8_10_01_02

I am currently working on developing a BLE client application on the CC2340R5. I have been successful in scanning, connecting and service discovery. After doing service discovery I have successfully received the response along with some data. I am currently facing issues with making sense of the data that I have received from the service discovery response.

For additional info of my project, Please refer this ticket.

I am running the Data stream example provided the SDK on a CC2340R5 since it is configured to be a peripheral. I have another CC2340R5 EVK on which I running the basic BLE example code in CLIENT role.

Below is a screenshot taken from nrf connect of the services exposed by the data stream example.

After a connection is done, I am calling the "GATT_DiscAllPrimaryServices' API. Details of how I am calling the api is explained in the ticket link which I have shared at the beggining.

Once I get a "ATT_READ_BY_GRP_TYPE_RSP" Event, I print the len and numGroups fields as shown below.

The contents of the message are as follows.

0x01,0x00,0x0b,0x00,0x00,0x18,0x23,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x00,0x40,0x51,0x04,0xc0,0xc0,0x00,0xf0

Help me understand the above packet. 

  • Hello,

    I apologize for the delay, our services were down.

    You will need to build the handles, see the code below:

            for (int i = 0; i < response->numGrps; i++)
            {
                uint16_t attributeHandle = BUILD_UINT16(response->pDataList[i * response->len + 0],
                                                        response->pDataList[i * response->len + 1]);
    
                uint16_t endHandle = BUILD_UINT16(response->pDataList[i * response->len + 2],
                                                  response->pDataList[i * response->len + 3]);

    You may also want to refer to the Bluetooth Low Energy Core Specification 5.3 Volume 3. Part F Section 3.4.4.10 for more information regarding the packet format.

    Best,

    Nima Behmanesh