hi,各位大牛!
由于贵司对CC2540的BLE协议部分代码不开源,在看代码是对相关函数使用不是怎么理解请指导!
本人在看HostTestApp项目的时,看hci_ext_app.c中的processExMsgATT函数看到对于ATT消息的处理,有如下代码:
case ATT_READ_BY_TYPE_REQ:
stat = ATT_ParseReadByTypeReq( ATT_SIG_NOT_INCLUDED, FALSE, &pBuf[2], pCmd->len-2, &msg );
if ( stat == SUCCESS )
{
attReadByTypeReq_t *pReq = &msg.readByTypeReq;
// Find out what's been requested
if ( gattIncludeType( pReq->type ) )
{
// Find included services
stat = GATT_FindIncludedServices( connHandle, pReq->startHandle,
pReq->endHandle, hciExtApp_TaskID );
}
else if ( gattCharacterType( pReq->type ) )
{
// Discover all characteristics of a service
stat = GATT_DiscAllChars( connHandle, pReq->startHandle,
pReq->endHandle, hciExtApp_TaskID );
}
else
{
// Read using characteristic UUID
stat = GATT_ReadUsingCharUUID( connHandle, pReq, hciExtApp_TaskID );
}
}
break;
case ATT_READ_BY_TYPE_RSP:
stat = ATT_ParseReadByTypeRsp( &pBuf[2], pCmd->len-2, &msg );
if ( stat == SUCCESS )
{
stat = ATT_ReadByTypeRsp( connHandle, &msg.readByTypeRsp );
}
break;
代码中 stat = GATT_ReadUsingCharUUID( connHandle, pReq, hciExtApp_TaskID );通过UUID获得characteristic value;我的疑问是:该函数需要的UUID是从哪个参数传入的(pReq?);那它获得的characteristic value有时从哪里输出的?该函数调用成功会产生一个ATT_READ_BY_TYPE_RSP消息,是否它的输出characteristic value就是通过ATT_ReadByTypeRsp( connHandle, &msg.readByTypeRsp );获得的?该characteristic value包括在msg中吗?
另外还有类似的函数,如:GATT_DiscAllChars,GATT_DiscPrimaryServiceByUUID,因为贵司没有提供其源码无法深入了解,知道其功能,但是不知道其输入,输出该如何传入?请指教,谢谢!!