Suspect code in JN-AN-1216-Zigbee-3-0-IoT-ControlBridge

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Suspect code in JN-AN-1216-Zigbee-3-0-IoT-ControlBridge

1,623 Views
zigbee1
Contributor III

Here is an extract of the app_general_events_handlers.c

 

case ZPS_ZDP_MGMT_LQI_RSP_CLUSTER_ID:
{
uint8 u8Values;
uint8 u8Bytes;
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length] , sApsZdpEvent.uZdpData.sMgmtLqiRsp.u8Status, u16Length );
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length] , sApsZdpEvent.uZdpData.sMgmtLqiRsp.u8NeighborTableEntries, u16Length );
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length] , sApsZdpEvent.uZdpData.sMgmtLqiRsp.u8NeighborTableListCount, u16Length );
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length] , sApsZdpEvent.uZdpData.sMgmtLqiRsp.u8StartIndex, u16Length );
if( sApsZdpEvent.uZdpData.sMgmtLqiRsp.u8Status == ZPS_E_SUCCESS )
{
for ( u8Values = 0; u8Values < sApsZdpEvent.uZdpData.sMgmtLqiRsp.u8NeighborTableListCount; u8Values++ )
{
ZNC_BUF_U16_UPD ( &au8LinkTxBuffer [u16Length] , sApsZdpEvent.uLists.asNtList[u8Values].u16NwkAddr, u16Length );
ZNC_BUF_U64_UPD ( &au8LinkTxBuffer [u16Length] , sApsZdpEvent.uLists.asNtList[u8Values].u64ExtPanId, u16Length );
ZNC_BUF_U64_UPD ( &au8LinkTxBuffer [u16Length] , sApsZdpEvent.uLists.asNtList[u8Values].u64ExtendedAddress, u16Length );
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length] , sApsZdpEvent.uLists.asNtList[u8Values].u8Depth, u16Length );
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length] , sApsZdpEvent.uLists.asNtList[u8Values].u8LinkQuality, u16Length );
 
u8Bytes = sApsZdpEvent.uLists.asNtList[u8Values].uAncAttrs.u2DeviceType;
u8Bytes |= ( sApsZdpEvent.uLists.asNtList[u8Values].uAncAttrs.u2PermitJoining << 2 );
u8Bytes |= ( sApsZdpEvent.uLists.asNtList[u8Values].uAncAttrs.u2Relationship << 4 );
u8Bytes |= ( sApsZdpEvent.uLists.asNtList[u8Values].uAncAttrs.u2RxOnWhenIdle << 6 );
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length] , u8Bytes, u16Length );
}
}
vSL_WriteMessage ( E_SL_MSG_MANAGEMENT_LQI_RESPONSE,
u16Length,

au8LinkTxBuffer );

 

I'm a bit surprise with the line:

sApsZdpEvent.uLists.asNtList[u8Values].uAncAttrs.u2Relationship << 4

as in fact Relationship is a 3bits field and not a 2 bit field !!!

Labels (1)
0 Kudos
Reply
4 Replies

1,584 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi @zigbee1,

I am checking this, I will get back to you as soon as possible.

Regards,

Mario

0 Kudos
Reply

1,600 Views
zigbee1
Contributor III

any update ? Thanks

0 Kudos
Reply

1,550 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi @zigbee1,

Please look at the comments below.

3 bits are allocated to u2Relationship in ZPS_tsAplZdpNtListEntry per Zigbee spec, but its value is from 0 ~ 3, so 2 bits are actually used.

We are going to update the user guide.

Regards,

Mario

0 Kudos
Reply

1,547 Views
zigbee1
Contributor III

From the documentation and from the Zigbee Alliance this could have 4 values and not 3

 

0x00: Parent

0x01: Child

0x02: Sibling

0x03: None

0x04: Former Child