TI中文支持网
TI专业的中文技术问题搜集分享网站

Z-Stack 2.6.1中simplemeter_ProcessInConfigReportCmd函数的问题

/*********************************************************************
 * @fnsimplemeter_ProcessInConfigReportCmd
 *
 * @briefProcess the "Profile" Configure Reporting Command
 *
 * @parampInMsg - incoming message to process
 *
 * @return  TRUE if attribute was found in the Attribute list,
 *FALSE if not
 */
static uint8 simplemeter_ProcessInConfigReportCmd( zclIncomingMsg_t *pInMsg )
{zclCfgReportCmd_t *cfgReportCmd;zclCfgReportRec_t *reportRec;zclCfgReportRspCmd_t *cfgReportRspCmd;zclAttrRec_t attrRec;uint8 status;uint8 i, j = 0;cfgReportCmd = (zclCfgReportCmd_t *)pInMsg->attrCmd;// Allocate space for the response commandcfgReportRspCmd = (zclCfgReportRspCmd_t *)osal_mem_alloc( sizeof ( zclCfgReportRspCmd_t ) + \sizeof ( zclCfgReportStatus_t) * cfgReportCmd->numAttr );if ( cfgReportRspCmd == NULL )return FALSE; // EMBEDDED RETURN// Process each Attribute Reporting Configuration recordfor ( i = 0; i < cfgReportCmd->numAttr; i++ ){reportRec = &(cfgReportCmd->attrList[i]);status = ZCL_STATUS_SUCCESS;if ( zclFindAttrRec( SIMPLEMETER_ENDPOINT, pInMsg->clusterId, reportRec->attrID, &attrRec ) ){if ( reportRec->direction == ZCL_SEND_ATTR_REPORTS ){if ( reportRec->dataType == attrRec.attr.dataType ){// This the attribute that is to be reportedif ( zcl_MandatoryReportableAttribute( &attrRec ) == TRUE ){if ( reportRec->minReportInt < SIMPLEMETER_MIN_REPORTING_INTERVAL ||( reportRec->maxReportInt != 0 &&reportRec->maxReportInt < reportRec->minReportInt ) ){// Invalid fieldsstatus = ZCL_STATUS_INVALID_VALUE;}else{// Set the Min and Max Reporting Intervals and Reportable Change//status = zclSetAttrReportInterval( pAttr, cfgReportCmd );status = ZCL_STATUS_UNREPORTABLE_ATTRIBUTE; // for now}}else{// Attribute cannot be reportedstatus = ZCL_STATUS_UNREPORTABLE_ATTRIBUTE;}}else{// Attribute data type is incorrectstatus = ZCL_STATUS_INVALID_DATA_TYPE;}}else{// We shall expect reports of values of this attributeif ( zcl_MandatoryReportableAttribute( &attrRec ) == TRUE ){// Set the Timeout Period//status = zclSetAttrTimeoutPeriod( pAttr, cfgReportCmd );status = ZCL_STATUS_UNSUPPORTED_ATTRIBUTE; // for now}else{// Reports of attribute cannot be receivedstatus = ZCL_STATUS_UNSUPPORTED_ATTRIBUTE;}}}else{// Attribute is not supportedstatus = ZCL_STATUS_UNSUPPORTED_ATTRIBUTE;}// If not successful then record the statusif ( status != ZCL_STATUS_SUCCESS ){cfgReportRspCmd->attrList[j].status = status;cfgReportRspCmd->attrList[j++].attrID = reportRec->attrID;}} // for loopif ( j == 0 ){// Since all attributes were configured successfully, include a single// attribute status record in the response command with the status field// set to SUCCESS and the attribute ID field omitted.cfgReportRspCmd->attrList[0].status = ZCL_STATUS_SUCCESS;cfgReportRspCmd->numAttr = 1;}else{cfgReportRspCmd->numAttr = j;}// Send the response backzcl_SendConfigReportRspCmd( SIMPLEMETER_ENDPOINT, &(pInMsg->srcAddr),pInMsg->clusterId, cfgReportRspCmd, ZCL_FRAME_SERVER_CLIENT_DIR,TRUE, pInMsg->zclHdr.transSeqNum );osal_mem_free( cfgReportRspCmd );return TRUE ;
}

根据提示这个函数的功能应该是设置属性值并把未成功设置的属性值报告给发送方,当但是程序中并未有设置属性这部分,而且在程序里面循环中status值一定会从ZCL_STATUS_SUCCESS变为其他的错误指示值,这是什么原因呢?

VV:

你的Attribute有没有事先注册过?断点调试过吗

赞(0)
未经允许不得转载:TI中文支持网 » Z-Stack 2.6.1中simplemeter_ProcessInConfigReportCmd函数的问题
分享到: 更多 (0)