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.

RTOS/CC2652R: Issue of BDB reporting in SDK 2.40.0

Part Number: CC2652R
Other Parts Discussed in Thread: Z-STACK

Tool/software: TI-RTOS

If multiple attribute under one cluster were set config reporting, and one of attribute was change. To call bdb_RepChangedAttrValue will trigger bdb_RepReport( indexClusterEndpoint ) to report the changed attribute value. But in function bdb_RepReport, other attributes which were not changed will be also reported in the same packet. If multiple attribute under one cluster were changed in same time, multiple reporting command will be sent out, each of them has multiple attribute value. That is a waste of network source.

  • Part Number: CC2652R

    Tool/software: TI-RTOS

    First, in function bdb_RepReport,  find this code

        pReportCmd = MAP_osal_mem_alloc( sizeof( zclReportCmd_t ) + (clusterEndpointItem->attrLinkedList.numItems * sizeof( zclReport_t )) );
        if ( pReportCmd != NULL )
        {
          pReportCmd->numAttr = clusterEndpointItem->attrLinkedList.numItems;
          for ( i = 0; i < clusterEndpointItem->attrLinkedList.numItems; ++ i )
          {
            .
            .
            .
            .
            if(attrListItem!=NULL)
            {
              .
              .
              .
              if( attrRes == BDBREPORTING_TRUE )
              {
                pReportCmd->attrList[i].dataType = attrRec.dataType;          
                pReportCmd->attrList[i].attrData = attrRec.dataPtr;          
                //Update last value reported
                .
                .
                .
      

    Fix it like this.

        uint8 *pBuffer = MAP_osal_mem_alloc( sizeof( zclReportCmd_t ) + (clusterEndpointItem->attrLinkedList.numItems * ( sizeof( zclReport_t )) + BDBREPORTING_MAX_ANALOG_ATTR_SIZE ) ); //allocate more buffer to support attribute data.
        if( pBuffer )
        {
          pReportCmd = (zclReportCmd_t*)pBuffer;
          pBuffer += sizeof( zclReportCmd_t ) + (clusterEndpointItem->attrLinkedList.numItems * sizeof( zclReport_t ));//locate attributes data area at end of pReportCmd 
          pReportCmd->numAttr = clusterEndpointItem->attrLinkedList.numItems;
          for ( i = 0; i < clusterEndpointItem->attrLinkedList.numItems; ++ i )
          {
            .
            .
            .  
            if(attrListItem!=NULL)
            {
              .
              .
              .
              if( attrRes == BDBREPORTING_TRUE )
              {
                uint8 *dataPtr = pBuffer + i*BDBREPORTING_MAX_ANALOG_ATTR_SIZE; //locate attribute data at attributes data area. 
                pReportCmd->attrList[i].dataType = attrRec.dataType;
                MAP_osal_memcpy( dataPtr, attrRec.dataPtr, BDBREPORTING_MAX_ANALOG_ATTR_SIZE );//attrRec.dataPtr is a internal variable, copy it to dataPtr
                pReportCmd->attrList[i].attrData = dataPtr; // pReportCmd 's attrData point to right dataPtr

    
    

  • Hi,

    Extra processing may be added for special use cases.

    There is a tradeoff between power consumption (due to extra processing) and network traffic, as noted in the "Consolidation of Attribute Reporting" section of the base device behavior specification.

    Also, consider periodic reporting, which is the normal case. The device will send attribute reports at least as frequently as indicated by the max reporting interval, even if that attribute has not changed, yet this is not considered wasteful.



    Regards,
    Toby
  • I think the BDB_Reporting should work like this.

    1, If multiple attribute in same cluster were changed and reported at same time, them should be report in same command. If only one attribute was changed and others were not changed, the report-command only carry the changed attribute.

    2, Multiple attribute in same cluster had different reporting interval, whose max-reporting-interval is the least, cluster of it will be reporting follow its max-reporting-interval.
  • But z-stack code should be fixed like my suggesting, or it will has no ability to report multiple attribute.
  • Regarding your code snippet taken from bdb_RepReport, the memory allocation that currently exists should be functional.

    The attrData field in the type zclReport_t simply points to the attribute data itself, and copying is not needed at this stage.

    When the report is sent in zcl_SendReportCmdEx, the attribute data will then be copied into the message that will be sent over the air.