Here is an extract of the app_general_events_handlers.c
case ZPS_ZDP_MGMT_LQI_RSP_CLUSTER_ID: |
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, |
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 !!!