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.

用zcl_SendReportCmd

Other Parts Discussed in Thread: CC2530, Z-STACK

协议栈: Z-stack 3.0.2 
参考程序为:GenericApp
芯片型号:CC2530

问题:我使用按键触发了一个通过zcl_SendReportCmd报告自定义数据的函数,抓包显示发出去了接收方也ACK了,可是抓到的无线数据包多了9个字节的数据,并且接收方好像没有进入case ZCL_CMD_REPORT里面,求解,感谢。关键以及抓包文件附上。7月30日18_26_33_test1.rar

//发送方发送函数
void GenericApp_SendTheMessage(void)
{
  zclReportCmd_t *pReportCmd;
  uint8 send_data[5] = {0x04,0x11,0x22,0x33,0x99};
  
  afAddrType_t devDstAddr;
  devDstAddr.addrMode=(afAddrMode_t)Addr16Bit;
  devDstAddr.endPoint=GENERICAPP_ENDPOINT;
  devDstAddr.addr.shortAddr=0x0000; 
  
  pReportCmd = osal_mem_alloc( sizeof(zclReportCmd_t) + sizeof(zclReport_t) );
  if ( pReportCmd != NULL )
  {
    pReportCmd->numAttr = 1;
    pReportCmd->attrList[0].attrID = ATTRID_ON_OFF;
    pReportCmd->attrList[0].dataType = ZCL_DATATYPE_UINT64;
    pReportCmd->attrList[0].attrData = (uint8*)send_data;
    
    zcl_SendReportCmd( GENERICAPP_ENDPOINT, &devDstAddr,
                       ZCL_CLUSTER_ID_GEN_ON_OFF,
                        pReportCmd, ZCL_FRAME_SERVER_CLIENT_DIR, TRUE, bdb_getZCLFrameCounter() );
  }
  osal_mem_free(pReportCmd);
}
//接收方
void zclGenericApp_ProcessInReportCmd(  zclIncomingMsg_t *pInMsg )
{
  zclReportCmd_t *pReportCmd;
  pReportCmd=(zclReportCmd_t *)pInMsg->attrCmd;
  
  
  if ( pReportCmd->attrList[0].attrID == ATTRID_ON_OFF )
  { 
    HalUARTWrite(0,pReportCmd->attrList[0].attrData,5 );
    HalUARTWrite(0,"success",sizeof("success") );
  }
  else
  {
    HalUARTWrite(0,"fail",sizeof("fail") );
  }
}