微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > 关于GATT_ReadUsingCharUUID的问题

关于GATT_ReadUsingCharUUID的问题

时间:10-02 整理:3721RD 点击:

你好,

CC2541做Central,使用官网的例子,如果通过UUID获取handle,在simpleBLEGATTDiscoveryEvent()中是如下写的:

// If procedure complete
if ( ( pMsg->method == ATT_FIND_BY_TYPE_VALUE_RSP &&
pMsg->hdr.status == bleProcedureComplete ) ||
( pMsg->method == ATT_ERROR_RSP ) )
{
if ( simpleBLESvcStartHdl != 0 )
{
// Discover characteristic
simpleBLEDiscState = BLE_DISC_STATE_CHAR;

req.startHandle = simpleBLESvcStartHdl;
req.endHandle = simpleBLESvcEndHdl;
req.type.len = UUID_SIZE;
#if !(defined USE_128_BIT_UUID)
req.type.uuid[0] = LO_UINT16(SIMPLEPROFILE_CHAR1_UUID);
req.type.uuid[1] = HI_UINT16(SIMPLEPROFILE_CHAR1_UUID);
#else
uint8 uuid[UUID_SIZE] = { TI_UUID(SIMPLEPROFILE_CHAR1_UUID) };
VOID osal_memcpy( req.type.uuid, uuid, UUID_SIZE );
#endif
GATT_ReadUsingCharUUID( simpleBLEConnHandle, &req, simpleBLETaskId );
}
}

}
else if ( simpleBLEDiscState == BLE_DISC_STATE_CHAR )
{
// Characteristic found, store handle
if ( pMsg->method == ATT_READ_BY_TYPE_RSP &&
pMsg->msg.readByTypeRsp.numPairs > 0 )
{
simpleBLECharHdl = BUILD_UINT16( pMsg->msg.readByTypeRsp.dataList[0],
pMsg->msg.readByTypeRsp.dataList[1] );

LCD_WRITE_STRING( "Simple Svc Found", HAL_LCD_LINE_1 );
simpleBLEProcedureInProgress = FALSE;
}

simpleBLEDiscState = BLE_DISC_STATE_IDLE;

}

这样可以获取到SIMPLEPROFILE_CHAR1_UUID的handle,如果同时想一起获取SIMPLEPROFILE_CHAR2_UUID的handle、SIMPLEPROFILE_CHAR3_UUID的handle应该这么做?即同时获取多个。

谢谢!

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top