Hi,
Why doesn't GATT_DiscCharsByUUID(pMsg->connHandle, &req, selfEntity) find any handles?
I have created a custom profile with a read-/writeable characteristic.
To discover the characteristic I use the function "multi_role_processGATTDiscEvent(gattMsgEvent_t *pMsg)" which originally discovers the "SIMPLE_SERVICE".
Inside this function I changed the the service uuid and characteristic uuid to my uuids , now the program is able to discover my service but not my characteristic.
I assume the problem occurs at "GATT_DiscCharsByUUID(pMsg->connHandle, &req, selfEntity);" cause the number of attribute handle-UUID pairs (numPairs) found is 0.
However the problem might be a little earlier in the code, because my service end handle is 65535.
For further details please see the code below.
Thanks in advance.
Sebastian
static void multi_role_processGATTDiscEvent(gattMsgEvent_t *pMsg) { ... else if (discInfo[connIndex].discState == BLE_DISC_STATE_MTU) // MTU size response received, discover simple service { ... // old: uint8_t uuid[ATT_BT_UUID_SIZE] = { LO_UINT16(SIMPLEPROFILE_SERV_UUID), HI_UINT16(SIMPLEPROFILE_SERV_UUID) }; // uuid = FFF0 uint8_t My_uuid[ATT_BT_UUID_SIZE] = { LO_UINT16(MY_RW_SERVICE_SERV_UUID), HI_UINT16(MY_RW_SERVICE_SERV_UUID) }; // uuid = BA55 discInfo[connIndex].discState= BLE_DISC_STATE_SVC; // Discovery of simple service //old: VOID GATT_DiscPrimaryServiceByUUID(pMsg->connHandle, uuid, ATT_BT_UUID_SIZE, selfEntity); VOID GATT_DiscPrimaryServiceByUUID(pMsg->connHandle, My_uuid, ATT_BT_UUID_SIZE, selfEntity); } else if (discInfo[connIndex].discState == BLE_DISC_STATE_SVC) // If we're performing service discovery { // Service found, store handles if (pMsg->method == ATT_FIND_BY_TYPE_VALUE_RSP && pMsg->msg.findByTypeValueRsp.numInfo > 0) { discInfo[connIndex].svcStartHdl = ATT_ATTR_HANDLE(pMsg->msg.findByTypeValueRsp.pHandlesInfo, 0); // svcStartHdl = 47 discInfo[connIndex].svcEndHdl = ATT_GRP_END_HANDLE(pMsg->msg.findByTypeValueRsp.pHandlesInfo, 0); // svcEndHdl = 65535 } // If procedure is complete if (((pMsg->method == ATT_FIND_BY_TYPE_VALUE_RSP) && (pMsg->hdr.status == bleProcedureComplete)) || (pMsg->method == ATT_ERROR_RSP)) { // If we've discovered the service if (discInfo[connIndex].svcStartHdl != 0) { attReadByTypeReq_t req; // Discover characteristic --> MY_RW_SERVICE_MYREADWRITE_UUID = 0xDEAD discInfo[connIndex].discState = BLE_DISC_STATE_CHAR; req.startHandle = discInfo[connIndex].svcStartHdl; req.endHandle = discInfo[connIndex].svcEndHdl; req.type.len = ATT_BT_UUID_SIZE; req.type.uuid[0] = LO_UINT16(MY_RW_SERVICE_MYREADWRITE_UUID); //old: SIMPLEPROFILE_CHAR1_UUID req.type.uuid[1] = HI_UINT16(MY_RW_SERVICE_MYREADWRITE_UUID); //old: SIMPLEPROFILE_CHAR1_UUID // Send characteristic discovery request VOID GATT_DiscCharsByUUID(pMsg->connHandle, &req, selfEntity); } } } // If we're discovering characteristics else if (discInfo[connIndex].discState == BLE_DISC_STATE_CHAR) { // Characteristic found // --> I get ATT_READ_BY_TYPE_RSP but numPairs = 0 !!! if ((pMsg->method == ATT_READ_BY_TYPE_RSP) && (pMsg->msg.readByTypeRsp.numPairs > 0)) { // Store handle discInfo[connIndex].charHdl = BUILD_UINT16(pMsg->msg.readByTypeRsp.pDataList[3], pMsg->msg.readByTypeRsp.pDataList[4]); Display_print0(dispHandle, MR_ROW_STATUS1, 0, "my Svc Found"); Display_print2(dispHandle, 18, 0, "lowbyte3: %d, highbyte4: %d", pMsg->msg.readByTypeRsp.pDataList[3], pMsg->msg.readByTypeRsp.pDataList[4]); Display_print1(dispHandle, 22, 0, "charHdl: %d", discInfo[connIndex].charHdl); } } }