pvAttributeData

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,149件の閲覧回数
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,984件の閲覧回数
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,985件の閲覧回数
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 件の賞賛
返信