关于GATT_ReadUsingCharUUID的问题
你好,
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应该这么做?即同时获取多个。
谢谢!