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.

[参考译文] CC2652P:我对 z 堆栈中的 APS-ack 的看法

Guru**** 2587365 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1075665/cc2652p-my-opinion-about-aps-ack-in-z-stack

部件号:CC2652P

对于采用 ZigBee 标准的 APS Ack,没有严格的规则。 但我认为在这种情况下应该启用 APS-Ack。

1,ZPD 响应命令应启用 APS-Ack。 因为 ZDP 响应命令是由系统发送的,应用程序无法控制它。 但应用程序可以生成任何 ZDP 请求命令,也可以接收 ZDP 响应命令。 当  ZDP 请求命令丢失时,应用程序无法接收 ZDP 响应命令。

第二,已禁用 ZCL-default-response 的 ZCL 命令应启用 APS-ack。 例如,所有 ZCL-general-response-命令都应 禁用 ZCL-default-response 并启用 APS-Ack。 因为 ZCL-Response 由 ZCL-processing 发送,而 ZCL-processing 无法由应用程序控制。 但 ZCL-Request 是通过应用程序发送的,因此应用程序可以接收 ZCL-Response 而不是 APS-Ack。  

3,ZCL 报告由 BDB 控制,因此 BDB 应提供对应用程序的回调,以检测 ZCL-default-response 或 APS-ack。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    ZDP 的固定

    afStatus_t ZDP_SendDataExt( uint8_t *TransSeq, zAddrType_t *dstAddr, uint16_t cmd, byte len, uint8_t *buf,
                                byte SecurityEnable, pfnAfCnfCB cnfCB, void* param, bool ackReq )
    {
      uint8_t *pBuf = ZDP_TmpBuf;
      byte cnt = len;
    
      while ( cnt-- )
      {
        *pBuf++ = *buf++;
      }
    
      // set send confirm callback
      ZDP_afCnfCB = cnfCB;
      ZDP_afCnfParam = param;
    
      //Enable APS Ack request for some ZDP command,added by Luoyiming
      FillAndSendTxOptions( TransSeq, dstAddr, cmd, len,
                           ((SecurityEnable) ? AF_EN_SECURITY : 0)
                             |((ackReq) ? AF_MSG_ACK_REQUEST : 0) );
    }

    ZCL 的固定

    ZStatus_t zcl_SendCommandEx( uint8_t srcEP, afAddrType_t *destAddr,
                               uint16_t clusterID, uint8_t cmd, uint8_t specific, uint8_t direction,
                               uint8_t disableDefaultRsp, uint16_t manuCode, uint8_t seqNum,
                               uint16_t cmdFormatLen, uint8_t *cmdFormat, uint8_t isReqFromApp )
    {
      endPointDesc_t *epDesc;
      zclFrameHdr_t hdr;
      uint8_t *msgBuf;
      uint16_t msgLen;
      uint8_t *pBuf;
      uint8_t options;
      ZStatus_t status;
    
      //seting send-extParam, add by luoyiming, fix at 2019-3-15
      pfnAfCnfCB cnfCB = NULL;
      void* cnfParam = NULL;
      uint8_t optionsMsk = 0;
      if ( pZclSendExtParam )
      {
        cnfCB = pZclSendExtParam->cnfCB;
        cnfParam = pZclSendExtParam->cnfParam;
        optionsMsk = pZclSendExtParam->options;
        zcl_ClearSendExtParam();
      }
    
      epDesc = afFindEndPointDesc( srcEP );
      if ( epDesc == NULL )
      {
        return ( ZInvalidParameter ); // EMBEDDED RETURN
      }
    
    #if defined ( INTER_PAN ) || defined ( BDB_TL_INITIATOR ) || defined ( BDB_TL_TARGET )
      if ( StubAPS_InterPan( destAddr->panId, destAddr->endPoint ) )
      {
        options = AF_TX_OPTIONS_NONE;
      }
      else
    #endif
      {
        options = zclGetClusterOption( srcEP, clusterID );
    
        // The cluster might not have been defined to use security but if this message
        // is in response to another message that was using APS security this message
        // will be sent with APS security
        if ( !( options & AF_EN_SECURITY ) )
        {
          afIncomingMSGPacket_t *origPkt = zcl_getRawAFMsg();
    
          if ( ( origPkt != NULL ) && ( origPkt->SecurityUse == TRUE ) )
          {
            options |= AF_EN_SECURITY;
          }
        }
      }
      //set zcl send options, add by luoyiming
      options |= optionsMsk;
    
      zcl_memset( &hdr, 0, sizeof( zclFrameHdr_t ) );
    
      // Not Profile wide command (like READ, WRITE)
      if ( specific )
      {
        hdr.fc.type = ZCL_FRAME_TYPE_SPECIFIC_CMD;
      }
      else
      {
        hdr.fc.type = ZCL_FRAME_TYPE_PROFILE_CMD;
      }
    
      if ( ( epDesc->simpleDesc == NULL ) ||
           ( zcl_DeviceOperational( srcEP, clusterID, hdr.fc.type,
                                    cmd, epDesc->simpleDesc->AppProfId ) == FALSE ) )
      {
        return ( ZFailure ); // EMBEDDED RETURN
      }
    
      // Fill in the Maufacturer Code
      if ( manuCode != 0 )
      {
        hdr.fc.manuSpecific = 1;
        hdr.manuCode = manuCode;
      }
    
      // Set the Command Direction
      if ( direction )
      {
        hdr.fc.direction = ZCL_FRAME_SERVER_CLIENT_DIR;
      }
      else
      {
        hdr.fc.direction = ZCL_FRAME_CLIENT_SERVER_DIR;
      }
    
      // Set the Disable Default Response field
      if ( disableDefaultRsp )
      {
        hdr.fc.disableDefaultRsp = 1;
        // Enable APS-ack for Disable Default Response command, luoyiming 2022-01-30
        options |= AF_ACK_REQUEST;
      }
      else
      {
        hdr.fc.disableDefaultRsp = 0;
      }
    
      // Fill in the Transaction Sequence Number
      hdr.transSeqNum = seqNum;
    
      // Fill in the command
      hdr.commandID = cmd;
    
      // calculate the needed buffer size
      msgLen = zclCalcHdrSize( &hdr );
      msgLen += cmdFormatLen;
    
      // Allocate the buffer needed
      msgBuf = zcl_mem_alloc( msgLen );
      if ( msgBuf != NULL )
      {
        //1-junp radius for no-routing,add by luoyiming
        uint8_t radius = zcl_radius;
        if (options & AF_SKIP_ROUTING)
        {
          radius = 1;
        }
    
        // Fill in the ZCL Header
        pBuf = zclBuildHdr( &hdr, msgBuf );
    
        // Fill in the command frame
        zcl_memcpy( pBuf, cmdFormat, cmdFormatLen );
    
        if(isReqFromApp)
        {
          status = zcl_AF_DataRequestExt( destAddr, epDesc, clusterID, msgLen, msgBuf,
                                         &zcl_TransID, options, radius, cnfCB, cnfParam );
        }
        else
        {
          status = AF_DataRequestExt( destAddr, epDesc, clusterID, msgLen, msgBuf,
                                     &zcl_TransID, options, radius, cnfCB, cnfParam );
        }
        zcl_mem_free ( msgBuf );
      }
      else
      {
        status = ZMemError;
      }
    
      return ( status );
    }

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,Aries,

    感谢您与社区分享您的想法和解决方案!

    此致,
    瑞安

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    你好,Aries! 我正在尝试修复 SDK 代码,以支持您的 zcl 文件的制造商群集和制造商属性,但我遇到编译错误,因为它无法识别标识符 pfnAfCnfCB。 请帮帮我。谢谢 
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    u 需要我完整的固定 SDK

    https://gitee.com/zigbee_luo/simplelink_ti_rtos_7.git  

    我已修复 AF_DataRequest 并添加参数“cnfCB”和“cnfParam”