This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AssociatedDevList使用Assoc Remove删除后怎么恢复

在协调器或者路由器端,想通过AssociatedDevList想实现设备管理,当路由设备或者终端设备掉线或者丢失,协调器或者路由器清除其AssociatedDevList中的信息,当重新上电的时候,路由器或者终端自动回到协调器中。

我在APP层定义了一个定时任务,当监测到设备离线后就调用Assoc Remove函数删除AssociatedDevList中的信息。

static void zclHeartbeat_device_detect(void)
{
	byte aItems= 0;  
  	uint8 _nodeCounter  = 0;
	
	 aItems = (uint8)AssocCount( PARENT, CHILD_FFD_RX_IDLE );
	 if(aItems > 0){
	 	for(_nodeCounter = 0; _nodeCounter < NWK_MAX_DEVICES; _nodeCounter++) 
		{
		  	//路由节点
			if((CHILD_FFD_RX_IDLE==AssociatedDevList[_nodeCounter].nodeRelation) || (CHILD_FFD==AssociatedDevList[_nodeCounter].nodeRelation))
			{
				if(AssociatedDevList[_nodeCounter].age > NWK_ROUTE_AGE_LIMIT)//离线设备
				{
					//剔除设备
				  	zclHeartbeat_remove_device(_nodeCounter);
				}
			}
		}
	 }
}

static void zclHeartbeat_remove_device(uint8 idx)
{
	 AddrMgrEntry_t addrEntry;
	 NLME_LeaveReq_t req;
	 
	 addrEntry.user = ADDRMGR_USER_DEFAULT;
	 addrEntry.index = idx;
	 
	 if(AddrMgrEntryGet(&addrEntry))
	 {
	 	req.extAddr = addrEntry.extAddr;
		req.removeChildren = FALSE;
		req.rejoin = TRUE;
		req.silent = FALSE;
		NLME_LeaveReq( &req );
		AssocRemove(addrEntry.extAddr);
		ZDApp_NVUpdate();
	 }
}

我将路由设备到点,然后查看AssociatedDevList,这个路由节点确实从AssociatedDevList中删除了,但是当我重新给路由节点上电,AssociatedDevList中还是没有该路由节点的信息。