Hello,
I am trying to discover the simple service in a modified simple_central example after changing it to a 128bit UUID on the simple_peripheral side. I am having some trouble in this process, specifically with getting the handle of the service. Here is the code I have started modifying in the Gatt discovery function:
if (discState == BLE_DISC_STATE_MTU) { // MTU size response received, discover simple service if (pMsg->method == ATT_EXCHANGE_MTU_RSP) { //Look at this and fix this later!!!!!!!! uint8_t uuid[ATT_UUID_SIZE] = {FANGRECEIVER_SERV_UUID}; // Just in case we're using the default MTU size (23 octets) sprintf(displayBuff, "MTU Size: %d", ATT_MTU_SIZE); queueDisplayString(displayBuff); discState = BLE_DISC_STATE_SVC; // Discovery simple service VOID GATT_DiscPrimaryServiceByUUID(connHandle, uuid, ATT_UUID_SIZE, selfEntity); } } else if (discState == BLE_DISC_STATE_SVC) { // Service found, store handles if (pMsg->method == ATT_FIND_BY_TYPE_VALUE_RSP && pMsg->msg.findByTypeValueRsp.numInfo > 0) { svcStartHdl = ATT_ATTR_HANDLE(pMsg->msg.findByTypeValueRsp.pHandlesInfo, 0); svcEndHdl = ATT_GRP_END_HANDLE(pMsg->msg.findByTypeValueRsp.pHandlesInfo, 0); } // If procedure complete if (((pMsg->method == ATT_FIND_BY_TYPE_VALUE_RSP) && (pMsg->hdr.status == bleProcedureComplete)) || (pMsg->method == ATT_ERROR_RSP)) { if (svcStartHdl != 0) { attReadByTypeReq_t req; // Discover characteristic discState = BLE_DISC_STATE_CHAR; req.startHandle = svcStartHdl; req.endHandle = svcEndHdl; req.type.len = ATT_UUID_SIZE; // req.type.uuid[0] = LO_UINT16(SIMPLEPROFILE_CHAR1_UUID); // req.type.uuid[1] = HI_UINT16(SIMPLEPROFILE_CHAR1_UUID); //Make higher value to discover others? // req.type.uuid[] = { 0x00, 0x00, 0x00, 0x81, 0x03, 0x74, 0x19, 0x13, //0x54, 0xF1, 0xAD, 0xDE, 0xD1, 0xD1, 0xD1, 0xD1}; req.type.uuid[0] = 0x00; req.type.uuid[1] = 0x00; req.type.uuid[2] = 0x00; req.type.uuid[3] = 0x81; req.type.uuid[4] = 0x03; req.type.uuid[5] = 0x74; req.type.uuid[6] = 0x19; req.type.uuid[7] = 0x13; req.type.uuid[8] = 0x54; req.type.uuid[9] = 0xF1; req.type.uuid[10] = 0xAD; req.type.uuid[11] = 0xDE; req.type.uuid[12] = 0xD1; req.type.uuid[13] = 0xD1; req.type.uuid[14] = 0xD1; req.type.uuid[15] = 0xD1; VOID GATT_ReadUsingCharUUID(connHandle, &req, selfEntity); } } } else if (discState == BLE_DISC_STATE_CHAR) { // Characteristic found, store handle if ((pMsg->method == ATT_READ_BY_TYPE_RSP) && (pMsg->msg.readByTypeRsp.numPairs > 0)) { charHdl = BUILD_UINT16(pMsg->msg.readByTypeRsp.pDataList[0], pMsg->msg.readByTypeRsp.pDataList[1]); queueDisplayString("Simple Svc Found"); procedureInProgress = FALSE; } discState = BLE_DISC_STATE_IDLE; }
It seems to successfully find the primary service uuid which is 128 bit, however, when it moves on to the simple service discovery, it does not seem to be successful and move on to the characteristic discovery. I think I need to change the lines:
svcStartHdl = ATT_ATTR_HANDLE(pMsg->msg.findByTypeValueRsp.pHandlesInfo, 0); svcEndHdl = ATT_GRP_END_HANDLE(pMsg->msg.findByTypeValueRsp.pHandlesInfo, 0);
I am not sure what these need to be changed to or if there is anything else I am missing here. I can't seem to find any other posts about this or examples on 128bit service/characteristic discovery. Any help or pointer on this would be greatly appreciated.
Thanks,
Josh