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_SendRead在哪里处理呢

zcl_SendRead发送读属性后,接收端在哪里处理呢?在哪里做zcl_SendReadRsp处理

ZStatus_t zcl_SendRead( uint8 srcEP, afAddrType_t *dstAddr,
uint16 clusterID, zclReadCmd_t *readCmd,
uint8 direction, uint8 disableDefaultRsp, uint8 seqNum)

  • 接收端收到信息后,会触发zclCmdTable[ZCL_CMD_READ]函数,此函数通过函数zcl_SendReadRsp()自动读取相关属性,并返回给客户端,命令是ZCL_CMD_READ_RSP

  • 那么也就是说读取属性的时候在接收端是不需要做什么处理的,协议栈已经实现了发送属性的功能?

    但是在客户端做的测试总是发现收到的数据错误,要读的属性如下:

    readCmd.attrID[0] = ATTRID_BASIC_HW_VERSION;
    readCmd.attrID[1] = ATTRID_BASIC_ZCL_VERSION;

    接收端读取属性的代码如下

    static uint8 zclHomeAppSw0_ProcessInReadRspCmd( zclIncomingMsg_t *pInMsg )
    {
    zclReadRspCmd_t *readRspCmd;
    uint8 i;
    uint16 attrID;
    uint8 dataType;

    readRspCmd = (zclReadRspCmd_t *)pInMsg->attrCmd;
    for (i = 0; i < readRspCmd->numAttr; i++)
    {
    // Notify the originator of the results of the original read attributes
    // attempt and, for each successfull request, the value of the requested
    // attribute
    attrID = readRspCmd->attrList[i].attrID;
    dataType = readRspCmd->attrList[i].dataType;
    //a = *(readRspCmd->attrList[i].data);
    }
    return TRUE;
    }


    总是第一个属性的数据错误,第二个正确,不知道什么原因,

  • 看了空中过来的数据吗,是传输的时候就错误了,还是收到的数据有错误的。

  • 没有看空中数据,但是做了几个读取不同属性的测试,都发现这个问题,第一个属性的错误,之后的都对,我现在的处理方式就是增加一个属性,如读一个属性按如下方式:

    readCmd.attrID[0] = ATTRID_BASIC_HW_VERSION;
    readCmd.attrID[1] = ATTRID_BASIC_HW_VERSION;

    然后把以一个抛弃,以第二个为准。

    还没有看空中数据,接下来有空了查找下原因。

  • 参考下zclProcessInReadCmd( zclIncoming_t *pInMsg )