求大神进来看看,为什么会这样!
时间:10-02
整理:3721RD
点击:
- /*****************点对点通信发送函数*************************/
- uint8 fs[]="";
- uint8 buf[]="";
- void SampleApp_SendPointToPointMessage( void )
- {
- fasong++;
- sprintf(fs,"发送数据包总数:%4d---",fasong);
- HalUARTWrite(0,fs,strlen(fs));
- sprintf(buf,"This is a test_丢包 fasong_个数:%d\n",fasong);
- if ( AF_DataRequest( &Point_To_Point_DstAddr,
- &SampleApp_epDesc,
- SAMPLEAPP_POINT_TO_POINT_CLUSTERID,
- strlen(buf),
- buf,
- &SampleApp_TransID,
- AF_DISCV_ROUTE,
- AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
- {
- HalUARTWrite(0,buf,strlen(buf));
- //点灯
- HalLedSet (HAL_LED_2, HAL_LED_MODE_TOGGLE);
-
- }
- else
- {
- // Error occurred in request to send.
- }
-
- if(fasong==10001)
- {
- uint8 data[]="1000个数据包发送结束!\n\r";
- HalUARTWrite(0,data,strlen(data));
- while(1);
- }
-
- }
- /****************接收处理函数******************/
- void SampleApp_MessageMSGCB( afIncomingMSGPacket_t *pkt )
- {
- uint16 flashTime;
- unsigned char count[100]="";
-
- switch ( pkt->clusterId )
- {
- case SAMPLEAPP_POINT_TO_POINT_CLUSTERID:
- if(fasong == 1)
- {
- jieshou = 1;
- }
- jieshou++;
- sprintf(count,"接收到的数据包总数:%4d---",jieshou);
- HalUARTWrite(0,count,strlen(count));
- HalUARTWrite(0, pkt->cmd.Data,strlen(pkt->cmd.Data));
- HalUARTWrite(0,"\n",1);
- HalLedSet (HAL_LED_1, HAL_LED_MODE_TOGGLE);
-
- break;
-
- case SAMPLEAPP_FLASH_CLUSTERID:
- flashTime = BUILD_UINT16(pkt->cmd.Data[1], pkt->cmd.Data[2] );
- HalLedBlink( HAL_LED_4, 4, 50, (flashTime / 4) );
- break;
- }
- }
为什么发送的数据正常:
==========================而接收的多了个感叹号