Hi
I tried connecting
4857.HCITester Trace Log.htm
I tried connecting with central and peripheral.
when i am discovering with default GATT profile it's working fine.
Now I made custom profile with custom UUID.
In this case although the connection is getting established but out of 5 UUID only 3 UUID and their respective handle are getting discovered.
Then I tried the same using HCI tester then in that case all UUID and their handle are getting discovered.
static void SimpleCentral_processGATTDiscEvent(gattMsgEvent_t *pMsg)
{
if (discState == BLE_DISC_STATE_MTU)
{
// MTU size response received, discover simple service
if (pMsg->method == ATT_EXCHANGE_MTU_RSP)
{
#ifdef UseTestSvcUUID
uint8_t Test_uuid[ ATT_UUID_SIZE ] = {0x66,0x9A,0x0C,0x20,
0x00,0x08,0x96,0x9E,
0xE2,0x11,0x9E,0xB1,
0xE0,0xF2,0x73,0xB9};
#endif
#ifdef UseActualSvcUUID
uint8_t uuid[ATT_BT_UUID_SIZE] = { LO_UINT16(SIMPLEPROFILE_SERV_UUID),
HI_UINT16(SIMPLEPROFILE_SERV_UUID) };
#endif
discState = BLE_DISC_STATE_SVC;
// Discovery simple service
#ifdef UseTestSvcUUID
VOID GATT_DiscPrimaryServiceByUUID(connHandle, Test_uuid, ATT_UUID_SIZE,
selfEntity);
#endif
#ifdef UseActualSvcUUID
VOID GATT_DiscPrimaryServiceByUUID(connHandle, uuid, ATT_BT_UUID_SIZE,
selfEntity);
#endif
}
}
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)
{
// Discover characteristic
discState = BLE_DISC_STATE_CHAR;
VOID GATT_DiscAllChars(
connHandle,
svcStartHdl,
svcEndHdl,
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))
{
uint8_t *pairs = &pMsg->msg.readByTypeRsp.pDataList[3];
numPairs = pMsg->msg.readByTypeRsp.numPairs;
uint16_t pairLen = pMsg->msg.readByTypeRsp.len;
if( numPairs <= cMaxNumUUID )
{
for (uint16_t idx = 0; idx < numPairs; idx++,pairs += pairLen)
{
uint16_t handle = *(uint16_t *)&pairs[0];
uint16_t uuid = *(uint16_t *)&pairs[14];
aUUID[handleIdx++] = uuid;
aUUID_Handle[uuidIdx++] = handle;
}
Display_print0(dispHandle, 2, 0, "Simple Svc Found");
procedureInProgress = FALSE;
}
else
{
/* Num of UUID exceeds the valid range - connection break */
SimpleCentral_stopEstablishing( );
}
}
discState = BLE_DISC_STATE_IDLE;
}
}
The above code performs the UUID and their handle discovery. Although it works fine with fresh Simple peripheral.
Regards
Sudhanshu