按向上按键,central开始扫描,然后GAP_DEVICE_INFO_EVENT 产生,但是传进来的 pEvent->deviceInfo 中怎么没有 scanRspData 的数据?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Roger3
你可以尝试在事件 GAP_DEVICE_INFO_EVEN中 通过判断消息的附加内容来处理scanRspData,如
if(pEvent->deviceInfo.eventType == GAP_ADRPT_SCAN_RSP)//ScanRsp扫描相应包
{
//todo
NPI_WriteTransport(pEvent->deviceInfo.pEvtData,pEvent->deviceInfo.dataLen);//打印...
}
else if(pEvent->deviceInfo.eventType == GAP_ADRPT_ADV_IND)//广播包
{
//todo
}
嗨 Yan好久不见!
我增加这样的对Rspdata处理可不可以呢?有没有什么逻辑上的错误,我的目的是想看到他能区分广播包和从机发送的扫描响应数据。
if ( DEFAULT_DEV_DISC_BY_SVC_UUID == TRUE ) { if ( ( simpleBLEFindSvcUuid( SIMPLEPROFILE_SERV_UUID,//接受的是广播包 pEvent->deviceInfo.pEvtData, pEvent->deviceInfo.dataLen ) ) && ( pEvent->deviceInfo.eventType == GAP_ADTYPE_ADV_IND ) ) { simpleBLEAddDeviceInfo( pEvent->deviceInfo.addr, pEvent->deviceInfo.addrType ); } else if( pEvent->deviceInfo.eventType == GAP_ADTYPE_SCAN_RSP_IND )//接受的是扫描包 { NPI_WriteTransport( pEvent->deviceInfo.pEvtData,pEvent->deviceInfo.dataLen); } }