void ZDO_ProcessDeviceAnnce( zdoIncomingMsg_t *inMsg )中的一段代码:
if ( ZSTACK_ROUTER_BUILD )
{
// If the device annce comes from a end device child that has moved
// to another parent, remove it from associated device list
// If the dev annce is coming from other device's children,
// (The dev annce from its own children shall be unicast to itself,
// So check the mac destination address)
// Remove it from the associated device list. If it is not
// a child, no action will be taken in AssocRemove() anyway.
if ( inMsg->macDestAddr != NLME_GetShortAddr() )
{
associated_devices_t *dev_ptr;
// If it's an end device child
dev_ptr = AssocGetWithExt( Annce.extAddr );
if ( dev_ptr )
{
if ( dev_ptr->nodeRelation == CHILD_RFD ||
dev_ptr->nodeRelation == CHILD_RFD_RX_IDLE )
{
AssocRemove( Annce.extAddr );
}
}
// Remove the address from the SrcMatch table,
// just in case the device was aged out by Child Management Table process
if ( ( pNwkNotMyChildListDelete != NULL ) &&
( zgChildAgingEnable == TRUE ) )
{
pNwkNotMyChildListDelete( Annce.nwkAddr );
}
}
}
代码中的注释:
// (The dev annce from its own children shall be unicast to itself,
// So check the mac destination address)
可以单播?
抓包发现Device Announce都是广播的,那么AssocRemove( Annce.extAddr );将会执行,即删除关联表。