官网的串口透传只用到了char1,而没用到char4,为什么?
官网的串口透传只用到了char1,而没用到char4,为什么?
可以修改的!
请问 在 主机的simpleBLEGATTDiscoveryEvent( gattMsgEvent_t *pMsg )程序中,
是寻找 char1 的 handle值吗?
我扣扣1017545475 咱们交流一下吧!多谢了!
我在连接后 查找不到服务 ?这可能是什么原因,我很仔细的检查了 service UUID 和 char UUID 都没问题?这是什么原因?
static void simpleBLECentralStartDiscovery( void )
{
// uint8 uuid[ATT_BT_UUID_SIZE] = { LO_UINT16(SIMPLEPROFILE_SERV_UUID),
// HI_UINT16(SIMPLEPROFILE_SERV_UUID) };
uint8 uuid[ATT_BT_UUID_SIZE] = { LO_UINT16(0xAA00),
HI_UINT16(0xAA00) };
// Initialize cached handles
simpleBLESvcStartHdl = simpleBLESvcEndHdl = simpleBLECharHdl = 0;
simpleBLEDiscState = BLE_DISC_STATE_SVC;
// Discovery simple BLE service
GATT_DiscPrimaryServiceByUUID( simpleBLEConnHandle,
uuid,
ATT_BT_UUID_SIZE,
simpleBLETaskId );
}
/*********************************************************************
* @fn simpleBLEGATTDiscoveryEvent
*
* @brief Process GATT discovery event
*
* @return none
*/
static void simpleBLEGATTDiscoveryEvent( gattMsgEvent_t *pMsg )
{
attReadByTypeReq_t req;
if ( simpleBLEDiscState == BLE_DISC_STATE_SVC )
{
// Service found, store handles
if ( pMsg->method == ATT_FIND_BY_TYPE_VALUE_RSP &&
pMsg->msg.findByTypeValueRsp.numInfo > 0 )
{
simpleBLESvcStartHdl = pMsg->msg.findByTypeValueRsp.handlesInfo[0].handle;
simpleBLESvcEndHdl = pMsg->msg.findByTypeValueRsp.handlesInfo[0].grpEndHandle;
}
// 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 = ATT_BT_UUID_SIZE;
//req.type.uuid[0] = LO_UINT16(IRTEMPERATURE_DATA_UUID);
// req.type.uuid[1] = HI_UINT16(IRTEMPERATURE_DATA_UUID);
req.type.uuid[0] = LO_UINT16(0xAA01);
req.type.uuid[1] = HI_UINT16(0xAA01);
GATT_ReadUsingCharUUID( simpleBLEConnHandle, &req, simpleBLETaskId );
// GATT_DiscCharsByUUID( 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 )
{
irTempDataHdl = BUILD_UINT16( pMsg->msg.readByTypeRsp.dataList[0],
pMsg->msg.readByTypeRsp.dataList[1] );
LCD_WRITE_STRING( "Simple Svc Found", HAL_LCD_LINE_1 );