微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI Zigbee设计交流 > 关于zcl库读写属性命令

关于zcl库读写属性命令

时间:10-02 整理:3721RD 点击:

读属性的命令也是由zcl相关的任务处理吗?看SampleLight例子里面有 void zclSampleLight_ProcessIncomingMsg( zclIncomingMsg_t *pInMsg)这个函数,应该是处理读写属性的吧?这个和on/off命令是不一样的处理方法,读写属性的命令怎么用,有没有读写属性的例子?

关于发送的读的命令

/*********************************************************************
* @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 )

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top