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.

RTOS/LAUNCHXL-CC2650: Discovering handles of server from multirole

Part Number: LAUNCHXL-CC2650

Tool/software: TI-RTOS

Hello I am working on Multirole project and spp_ble_server.

Stack : 2.2.1

I have the following attribute table in spp_ble_server

gattAttribute_t SerialPortServiceAttrTbl[SERVAPP_NUM_ATTR_SUPPORTED] =

 {

   // Serial Port Profile Service

   {

     { ATT_BT_UUID_SIZE, primaryServiceUUID }, /* type */

     GATT_PERMIT_READ,                         /* permissions */

     0,                                        /* handle */

     (uint8 *)&SerialPortService            /* pValue */

   },  

   // Characteristic Data Declaration

   {

     { ATT_BT_UUID_SIZE, characterUUID },

     GATT_PERMIT_READ,

     0,

     &SerialPortServiceDataProps

   },

   // Characteristic Data Value

   {

     { ATT_UUID_SIZE, SerialPortServiceDataUUID },

     GATT_PERMIT_READ | GATT_PERMIT_WRITE,

     0,

     SerialPortServiceData

   },

   // Characteristic Data configuration

   {

     { ATT_BT_UUID_SIZE, clientCharCfgUUID },

     GATT_PERMIT_READ | GATT_PERMIT_WRITE,

     0,

     (uint8 *)&SerialPortServiceDataConfig

   },

   // Characteristic Data User Description

   {

     { ATT_BT_UUID_SIZE, charUserDescUUID },

     GATT_PERMIT_READ,

     0,

     SerialPortServiceDataUserDesp

   },

   // Characteristic Status Declaration

   {

     { ATT_BT_UUID_SIZE, characterUUID },

     GATT_PERMIT_READ,

     0,

     &SerialPortServiceStatusProps

   },

   // Characteristic Status Value

   {

     { ATT_UUID_SIZE, SerialPortServiceStatusUUID },

     GATT_PERMIT_READ,

     0,

     //&SerialPortServiceChar3

     SerialPortServiceStatus

   },

   // Characteristic Status configuration

   {

     { ATT_BT_UUID_SIZE, clientCharCfgUUID },

     GATT_PERMIT_READ | GATT_PERMIT_WRITE,

     0,

     (uint8 *)&SerialPortServiceStatusConfig

   },

   // Characteristic Status User Description

   {

     { ATT_BT_UUID_SIZE, charUserDescUUID },

     GATT_PERMIT_READ,

     0,

     SerialPortServiceStatusUserDesp

   }

 };

And in the multirole side I discover serial port profile characteristic handle as shown below

       if (discInfo[connIndex].svcStartHdl != 0)

       {

         attReadByTypeReq_t req;      

         // Discover characteristic

         discInfo[connIndex].discState= BLE_DISC_STATE_CHAR;

         req.startHandle = discInfo[connIndex].svcStartHdl;

         req.endHandle = discInfo[connIndex].svcEndHdl;

         req.type.len = ATT_UUID_SIZE;

         // Discover characteristic descriptors

         GATT_DiscAllCharDescs(pMsg->connHandle,

                               req.startHandle + 1,

                               req.endHandle,

                               selfEntity);  

       }

  //if we're discovering characteristics

 else if (discInfo[connIndex].discState == BLE_DISC_STATE_CHAR)

 {  

   // Characteristic descriptors found

   if (pMsg->method == ATT_FIND_INFO_RSP &&

       pMsg->msg.findInfoRsp.numInfo > 0)

   {

     uint8_t i;

     // For each handle/uuid pair

     for (i = 0; i < pMsg->msg.findInfoRsp.numInfo; i++)

     {

       if(pMsg->msg.findInfoRsp.format == ATT_HANDLE_BT_UUID_TYPE)

       {

         if ( (ATT_BT_PAIR_UUID(pMsg->msg.findInfoRsp.pInfo, i) ==

               GATT_CHARACTER_UUID))

         {

           Display_print0(dispHandle, 0, 0, "GATT CHAR FOUND");

           Display_print1(dispHandle, 0, 0, "GATT CHAR HANDLE is %d" , ATT_PAIR_HANDLE(pMsg->msg.findInfoRsp.pInfo, i) );

           //StructHandles[connindexNum].charDeclHdl[charDeclIndex++] = ATT_PAIR_HANDLE(pMsg->msg.findInfoRsp.pInfo, i);

           break;

         }

         // Look for CCCD

         if ( (ATT_BT_PAIR_UUID(pMsg->msg.findInfoRsp.pInfo, i) ==

               GATT_CLIENT_CHAR_CFG_UUID))

         {

           //Clear Flag

           //flags &= ~DATA_CHAR;

           Display_print0(dispHandle, 0, 0, "CFG FOUND");

           Display_print1(dispHandle, 0, 0, "CFG HANDLE is %d" , ATT_PAIR_HANDLE(pMsg->msg.findInfoRsp.pInfo, i) );

           StructHandles[connindexNum].charCCCDHdl[charCCCDindex++] = ATT_PAIR_HANDLE(pMsg->msg.findInfoRsp.pInfo, i);

           break;

         }

       }

       else if(pMsg->msg.findInfoRsp.format == ATT_HANDLE_UUID_TYPE)

       {

         if (memcmp(&(pMsg->msg.findInfoRsp.pInfo[ATT_PAIR_UUID_IDX(i)]), uuidDataChar, ATT_UUID_SIZE) == 0)

         {

           Display_print0(dispHandle, 0, 0, "Char 1 FOUND");

           charDataHdl[connindexNum1++] = ATT_PAIR_HANDLE(pMsg->msg.findInfoRsp.pInfo, i);

           StructHandles[connindexNum].charDeclHdl[charDeclIndex++] = ATT_PAIR_HANDLE(pMsg->msg.findInfoRsp.pInfo, i) - 1;

           //Set Flag

           //flags |= DATA_CHAR;

           break;

         }

         if (memcmp(&(pMsg->msg.findInfoRsp.pInfo[ATT_PAIR_UUID_IDX(i)]), uuidDataCharStatus, ATT_UUID_SIZE) == 0)

         {

           Display_print0(dispHandle, 0, 0, "Char 2 FOUND");

           charDataHdl[connindexNum1++] = ATT_PAIR_HANDLE(pMsg->msg.findInfoRsp.pInfo, i);

           StructHandles[connindexNum].charDeclHdl[charDeclIndex++] = ATT_PAIR_HANDLE(pMsg->msg.findInfoRsp.pInfo, i) - 1;

           //Set Flag

           //flags |= DATA_CHAR;

           break;

         }

       }

     }

   }

GATT_CHARACTER_UUID is Discovered only for first characteristic. Have I done anything wrong in the above method of discovering

the handles.

Output:

GATT CHAR FOUND

GATT CHAR HANDLE is 29

Char 1 FOUND

CFG  FOUND

CFG HANDLE is 31

Till here Everything is fine.

After this I expect

GATT CHAR FOUND

GATT CHAR HANDLE is 33

followed by

Char 2 FOUND

CFG  FOUND

CFG HANDLE is 35

But Software is not discovering GATT_CHARACTER_UUID. So the output is

Char 2 FOUND

CFG  FOUND

CFG HANDLE is 35

  • Hi,

    Can you verify what is the value for req.endHandle? Can you hard code it to 65535 (max value) for testing?
    Also for next time, can you use rich formatting, the code is hard to read when double-spaced.

    Best wishes