AnsweredAssumed Answered

Cannot GetAttribute in BeeStack5.0

Question asked by Randolf Hu on Jul 28, 2016
Latest reply on Sep 15, 2016 by kajac

Hi,

We are working on BeeStack 5.0. We add the test code AppReadTemperature() in BeeAppHandleKeys() in pure Beestack5.0 as following , we found the return value of ZCL_GetAttribute is always not gZbSuccess_c.

 

if(gZbSuccess_c==ZCL_GetAttribute(appEndPoint,aClusterId,gZclAttrTemperatureMeasurement_MeasuredValueId_c,gZclServerAttr_c,&tmp, &Attrlen))

{  Temperature = OTA2Native16(tmp); /* Convert to Big Indian */}

else{

Temperature=4477;}

 

We dig into the ZCL_GetAttributePtr and found the pData is 0x0000

 

  if (ZclAttrIsInSceneData(flags))

    pData = pDeviceDef->pSceneData;

  else

    pData = pDeviceDef->pData;

  if(ZclAttrIsInstance(flags))

  {

    if ((NULL != pDeviceDef) && (NULL != pData))

    {  pAttrPtr = &pData[pClusterDef->dataOffset + pAttrDef->data.offset];

          }

     else

     {

          // go to this case }

  }

  else

    pAttrPtr = pAttrDef->data.pData;

 

We checked the afClusterDef_t const gaHaTemperatureSensorClusterList[] in HaTempSensorEndPint.c, 5 parameters but in typedef afClusterDef_tag in AppAfInterface.h (as listed below), there are 6 parameters. We also check previous BeeStack, there are 6 parameters in gaHaTemperatureSensorClusterList[] .

 

/* Used by BeeKit to pull in only the handling code needed for a set of clusters */

typedef PACKED_STRUCT afClusterDef_tag

{

  zbClusterId_t    aClusterId;    /* cluster ID */

  pfnIndication_t  pfnServerIndication; /* server indication handler for this cluster */

  pfnIndication_t  pfnClientIndication; /* client indication handler for this cluster */

  void            *pAttrSetList;     /* ptr to attribute set list (zclAttrSetList_t) */

  uint16_t         dataOffset;    /* offset of this cluster's data within instance data */

#if gAddValidationFuncPtrToClusterDef_c 

  pfnValidationFunc_t pfnValidationFunc; /* ptr to the attribute validation function */

#endif 

  void            *pCommandsDefList;  /* ptr to commands def list (zclCommandsDefList_t) */ 

} afClusterDef_t;

 

Is the test method correct?

Outcomes