蓝牙主机接收程序
在主机中如下程序:
case GAP_DEVICE_INFO_EVENT:
{
// if filtering device discovery results based on service UUID
if ( DEFAULT_DEV_DISC_BY_SVC_UUID == TRUE )
{
if ( simpleBLEFindSvcUuid( SIMPLEPROFILE_SERV_UUID,
pEvent->deviceInfo.pEvtData,
pEvent->deviceInfo.dataLen ) )
{
simpleBLEAddDeviceInfo( pEvent->deviceInfo.addr, pEvent->deviceInfo.addrType );
uint8 result[]= "\n55555\n";
result[3] = pEvent->deviceInfo.dataLen;
HalUARTWrite(0,result,7);
HalUARTWrite(0,pEvent->deviceInfo.pEvtData,80 );.//暂时定义为输出八十个
}
}
}
break;
为什么看到的是
pEvent->deviceInfo.dataLen的值是7呀
而串口的打出来的数据怎么是pEvent->deviceInfo.pEvtData的数据不止7个呀,串口的数据给的长度远超过7这个数了。
求大神指导下!急急急!
顺便加一句在主机定义中如下
typedef struct
{
osal_event_hdr_t hdr; //!< GAP_MSG_EVENT and status
uint8 opcode; //!< GAP_DEVICE_INFO_EVENT
uint8 eventType; //!< Advertisement Type: @ref GAP_ADVERTISEMENT_TYPE_DEFINES
uint8 addrType; //!< address type: @ref GAP_ADDR_TYPE_DEFINES
uint8 addr[B_ADDR_LEN]; //!< Address of the advertisement or SCAN_RSP
int8 rssi; //!< Advertisement or SCAN_RSP RSSI
uint8 dataLen; //!< Length (in bytes) of the data field (evtData)
uint8 *pEvtData; //!< Data field of advertisement or SCAN_RSP
} gapDeviceInfoEvent_t;
dataLen明显是pEvtData的数据长度呀,我就搞不懂了
怎么看上去你直接把长度当成ascii来处理了呢。7的ascii的0x37,对应数值是55,难道长度是55?