读属性的命令也是由zcl相关的任务处理吗?看SampleLight例子里面有 void zclSampleLight_ProcessIncomingMsg( zclIncomingMsg_t *pInMsg)这个函数,应该是处理读写属性的吧?这个和on/off命令是不一样的处理方法,读写属性的命令怎么用,有没有读写属性的例子?
VV:
关于发送的读的命令
/********************************************************************* * @fn zcl_SendRead * * @brief Send a Read command * * @param srcEP – Application's endpoint * @param dstAddr – destination address * @param clusterID – cluster ID * @param readCmd – read command to be sent * @param direction – direction of the command * @param seqNum – transaction sequence number * * @return ZSuccess if OK */ZStatus_t zcl_SendRead( uint8 srcEP, afAddrType_t *dstAddr, uint16 clusterID, zclReadCmd_t *readCmd, uint8 direction, uint8 disableDefaultRsp, uint8 seqNum){ uint16 dataLen; uint8 *buf; uint8 *pBuf; ZStatus_t status;
dataLen = readCmd->numAttr * 2; // Attribute ID
buf = zcl_mem_alloc( dataLen ); if ( buf != NULL ) { uint8 i;
// Load the buffer – serially pBuf = buf; for (i = 0; i < readCmd->numAttr; i++) { *pBuf++ = LO_UINT16( readCmd->attrID[i] ); *pBuf++ = HI_UINT16( readCmd->attrID[i] ); }
status = zcl_SendCommand( srcEP, dstAddr, clusterID, ZCL_CMD_READ, FALSE, direction, disableDefaultRsp, 0, seqNum, dataLen, buf ); zcl_mem_free( buf ); } else { status = ZMemError; }
return ( status );}
关于处理读属性的命令
static uint8 zclProcessInReadCmd( zclIncoming_t *pInMsg )