大家好:
请问在SimpleBLECentral如何解析出从机的设备名称,我尝试在case GAP_DEVICE_INFO_EVENT:的pEvent->deviceInfo.pEvtData,中解析,可是不知道如何解析,是在第二次进入这个事件的时候解析吗,如何判断是广播数据还是扫描请求回应数据。
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.
大家好:
请问在SimpleBLECentral如何解析出从机的设备名称,我尝试在case GAP_DEVICE_INFO_EVENT:的pEvent->deviceInfo.pEvtData,中解析,可是不知道如何解析,是在第二次进入这个事件的时候解析吗,如何判断是广播数据还是扫描请求回应数据。
Hi silver
主机收到广播包或者扫描Rsp都会触发这个事件的产生。以下做法可以参考下:
if(pEvent->deviceInfo.eventType == GAP_ADRPT_ADV_IND )//判断是否是广播包
{
...
}
else if(pEvent->deviceInfo.eventType == GAP_ADRPT_SCAN_RSP)//判断是否是扫描Rsp
{
if(SUCCESS == CheckDeviceScanRspData(pEvent->deviceInfo.pEvtData,
pEvent->deviceInfo.dataLen))//校对扫描Rsp的内容,信息存在pEvent->deviceInfo的结构体里
{
...
}//注:CheckDeviceScanRspData()不是API,是自己添加的,可以在这个函数里对扫描Rsp数据进行校验
}