pvAttributeData

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

pvAttributeData

跳至解决方案
1,660 次查看
kevin-zhu
Contributor I

Hi NXP Wireless Support Team,

The code below is copy from JN-SW-4270 Zigbee 3.0 SDK.

What does (uint8 *data)'s first 10 bytes mean?

PRIVATE void APP_ZCL_cbEndpointCallback(tsZCL_CallBackEvent *psEvent)
{
    //    bool_t bUpdateBulb = FALSE;
    DBG_vPrintf(TRACE_ZCL, "\n APP_ZCL_cbEndpointCallback to psEvent->eEventType %02x", psEvent->eEventType);

    switch (psEvent->eEventType)
    {
        case E_ZCL_CBET_WRITE_ATTRIBUTES:     // parke 2017.01.07
        {
            uint8 *data = psEvent->uMessage.sIndividualAttributeResponse.pvAttributeData;
        }
    }
}

Thanks,

Kevin Zhu

标签 (1)
0 项奖励
回复
1 解答
1,495 次查看
ovidiu_usturoi
NXP Employee
NXP Employee

Hi kevin zhu

pvAttributeData is a pointer to the attribute value. Based on the attribute data type, the value should be taken properly:

e.g:

if(psEvent->uMessage.sIndividualAttributeResponse.eAttributeDataType ==  E_ZCL_OSTRING)

{

       tsZCL_OctetString data = *( ( tsZCL_OctetString* ) psEvent->uMessage.sIndividualAttributeResponse.pvAttributeData );

}

else if (psEvent->uMessage.sIndividualAttributeResponse.eAttributeDataType ==  E_ZCL_UINT8)

{

      uint8_t data = *((uint8_t *) psEvent->uMessage.sIndividualAttributeResponse.pvAttributeData );

}

...

Please consider uAttribData (union defined in zcl_internal.h - sdk files) in order to do the right cast for the value.

Regards,

Ovidiu

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,496 次查看
ovidiu_usturoi
NXP Employee
NXP Employee

Hi kevin zhu

pvAttributeData is a pointer to the attribute value. Based on the attribute data type, the value should be taken properly:

e.g:

if(psEvent->uMessage.sIndividualAttributeResponse.eAttributeDataType ==  E_ZCL_OSTRING)

{

       tsZCL_OctetString data = *( ( tsZCL_OctetString* ) psEvent->uMessage.sIndividualAttributeResponse.pvAttributeData );

}

else if (psEvent->uMessage.sIndividualAttributeResponse.eAttributeDataType ==  E_ZCL_UINT8)

{

      uint8_t data = *((uint8_t *) psEvent->uMessage.sIndividualAttributeResponse.pvAttributeData );

}

...

Please consider uAttribData (union defined in zcl_internal.h - sdk files) in order to do the right cast for the value.

Regards,

Ovidiu

0 项奖励
回复