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.
//======= Child Aging PARENT ROUTER (ZR/ZC) configuration ========
// This is information set by the Parent Router and configured at the
// joining EndDevice.
// If RFD, this records the information received in an End Device Timeout Response command
// of FFD, this records the device抯 local capabilities
// 0x01 = MAC Data Poll Keepalive Supported
// 0x02 = Orphan Notification Keepalive Supported
// Routers SHALL support at least one method
// End Dev SHALL support both methods
#if ( ZG_BUILD_ENDDEVICE_TYPE )
uint8 zgNwkParentInformation = NWK_PARENT_INFO_UNDEFINED;
#else
uint8 zgNwkParentInformation = NWK_PARENT_INFO_ORPHAN_NOTIFICATION;
#endif
// This is an index into table Requested Timeout Enumerated Values.
// It is used by the parent router, it indicates the default timeout value
// for any end device that does not negotiate a different timeout value
uint8 zgNwkEndDeviceTimeoutDefault = NWK_END_DEV_TIMEOUT_DEFAULT;
//=====================================================================
//========== Child Aging END DEVICE configuration ===============
// Values used by End Device when sending End Device Timeout Request
uint8 zgEndDeviceTimeoutValue = END_DEV_TIMEOUT_VALUE;
uint8 zgEndDeviceConfiguration = END_DEV_CONFIGURATION;
uint32 zgEndDeviceKAInterval = 0;
//=====================================================================
// Determines if the Child Aging Table Management process is active or not.
// This feature is optional and it is disabled by default.
//uint8 zgChildAgingEnable = FALSE;
uint8 zgChildAgingEnable = TRUE;
1,我在ZGloable.c里面已经做了以上配置,是否正确,
2,请问协议栈里面已经做 了处理的话,我要去哪里获取终端的在线状态呢
3,
extern void NwkInitChildAging( void );
extern nwkNotMyChild_t notMyChildList[];
extern void NwkNotMyChildListInit( void );
extern void NwkNotMyChildListAging( void );
extern uint8 NwkNotMyChildListAdd( uint16 childAddr, uint32 timeoutValue );
extern void NwkNotMyChildListDelete( uint16 devAddr );
extern void NwkNotMyChildSendLeave( uint16 dstAddr );
这些函数是否相关,也是找不到原型和调用的地方
你好,
在Z-Stack Home 1.2.2里面,如果使能了zgChildAgingEnable功能。
那么End Device在入网成功以后,会通过Device Announce把Timeout相关的信息发给父设备。ZDApp_AnnounceNewAddress( void )里的NLME_SendEndDevTimeoutReq。
这个函数中会把下面两个变量的信息发送给父设备,也就是说不同的节点可以配置不同的timeout时间,主要也是根据节点的Data request来决定的。
uint8 zgEndDeviceTimeoutValue = END_DEV_TIMEOUT_VALUE;
uint8 zgEndDeviceConfiguration = END_DEV_CONFIGURATION;
在父设备上面,收到这个req以后,会调用到下面这个函数
NLME_ProcessEndDevTimeoutReq( NLDE_FrameFormat_t *ff )
这个函数处理的过程,主要是把收到的zgEndDeviceTimeoutValue,写到AssociateList里面去,
typedef struct
{
uint16 shortAddr; // Short address of associated device
uint16 addrIdx; // Index from the address manager
byte nodeRelation;
byte devStatus; // bitmap of various status values
byte assocCnt;
byte age;
linkInfo_t linkInfo;
aging_end_device_t endDev;
uint32 timeoutCounter;
bool keepaliveRcv;
} associated_devices_t;
在父设备会定期的去更新这个表里面的,周期性调用AssocChildAging,更新的周期是1s钟,开了一个1s的timer事件,每隔1s就会把Associate List的设备的timecounter减1.
同样只要在底层收到节点的Data request或者其他应用数据,立刻把这个变量恢复到初始值,也就刚开始的赋值,调用AssocChildTableUpdateTimeout。
那么在定义更新的时候,如果timecounter减1等于0了,就会把节点的信息放入一个NotmyChild的list里面。
// Not My Child structure
typedef struct
{
uint16 shortAddr;
uint16 timeoutCounter;
} nwkNotMyChild_t;
然后也是定期的去更新这个变量,如果这个时候收到data req,就会把节点信息从NotmyChildlist重新移到你Associate list里面去。
如果在NotmyChildList里面的counter的时候,那么就把这个节点彻底删除了NwkNotMyChildSendLeave
所以如果要判断节点是否在线,只需要判断在AssociateList还是否存在就可以了。
AssocGetWithShort( uint16 shortAddr )
你好,
1,我用一个enddevice 加入一个协调器然后查看associated list里面的信息,发现enddevice在线的时候timecounter一直在循环做减1,当这个enddevice掉电的时候,timecounter会变成0,associated list里面的关于这个enddevice的信息也会清除,但是notmychildlist里面没有这个设备的信息,不知道是什么原因。
2,协议栈里面的关联表定义
associated_devices_t AssociatedDevList[NWK_MAX_DEVICES];
nwkNotMyChild_t notMyChildList[MAX_NOT_MYCHILD_DEVICES];
请问NWK_MAX_DEVICES =21和MAX_NOT_MYCHILD_DEVICES =5,这两个参数修改会有什么问题,
3,另外如果网络中还有其他路由器设备并且有终端通过路由接入网络的话,这个associated list 里面的设备还可以统计所有设备的信息吗
谢谢!
Hi ,VV
是不是 1.21的版本 就没有child aging 的功能?
我在1.21的 ZGlobals.c 中 没有找到
//========== Child Aging END DEVICE configuration ===============
// Values used by End Device when sending End Device Timeout Request
uint8 zgEndDeviceTimeoutValue = END_DEV_TIMEOUT_VALUE;
uint8 zgEndDeviceConfiguration = END_DEV_CONFIGURATION;
我现在协调器是用 1.21的 ,终端用1.22的
是不是 有问题啊
我用的home1.21 协调器 并没有找到你说的 NLME_ProcessEndDevTimeoutReq( NLDE_FrameFormat_t *ff )函数 是因为只有1.22 才可以用zgChildAgingEnable? home1.21如何实用这个功能呢
Z-Stack Home 1.2.1 和 Z-Stack Home 1.2.2
对Child Aging功能的实现原理是一样的。
只不过Z-Stack Home 1.2.1里面,父设备对于end device来说,他的timeout时间是在父设备上实现固定的。
// Child table Management timeout values
CONST uint16 gKEEPALIVE_TIMEOUT_MAX = KEEPALIVE_TIMEOUT_MAX;
CONST uint16 gTIMEOUT_COUNTER_MAX = TIMEOUT_COUNTER_MAX;
以上两个变量主要用来判断,end device连续多久没有poll 了,然后就删除它。
其实这种做法是不合适的,因为用户在开发产品的时候,不是所有的产品poll rate都是一样的。比方说对于门磁 poll rate可能是0,对于door lock可能是10000.
那么poll rate不同,父设备对于子设备的统计方式也不一样了。
这也是为什么Z-Stack Home 1.2.2里面,需要子设备在入网以后告诉父设备自己的poll rate是多少。
void ZDApp_AnnounceNewAddress( void )
{
#if defined ( ZIGBEEPRO )
// Turn off data request hold
APSME_HoldDataRequests( 0 );
#endif
ZDP_DeviceAnnce( NLME_GetShortAddr(), NLME_GetExtAddr(),
ZDO_Config_Node_Descriptor.CapabilityFlags, 0 );
#if defined ( ZIGBEEPRO )
// Setup the timeout
APSME_HoldDataRequests( ZDAPP_HOLD_DATA_REQUESTS_TIMEOUT );
#endif
if ( ZSTACK_END_DEVICE_BUILD )
{
if ( zgChildAgingEnable == TRUE )
{
uint8 coordExtAddr[Z_EXTADDR_LEN];
// Send the message to parent
NLME_GetCoordExtAddr( coordExtAddr );
NLME_SendEndDevTimeoutReq( NLME_GetCoordShortAddr(), coordExtAddr,
zgEndDeviceTimeoutValue,
zgEndDeviceConfiguration );
}
}
}
父设备在收到这个消息以后,就会处理,把对该节点的timeout时间修改过来了。
void NLME_ProcessEndDevTimeoutReq( NLDE_FrameFormat_t *ff )
你好,VV:
在Z-Stack Home 1.2.1,如果我的一个终端设备的poll rate为0,那这个终端设备该告诉他的父节点他的timeout时间应该是多少?
因为我现在的程序时1.2.1的版本,只能之前去告诉父节点
谢谢!!
您好,我目前在做终端断网,协调器怎么知道哪一个终端断网(有的终端直接连接协调器,有的通过路由连接协调器),网上看了下说结合associated list数组做,不知道您具体怎么实现的
请问zgEndDeviceTimeoutValue如何修改,和timeoutCounter是什么对应关系?经过测试使能了child aging,但是所有终端的timeoutCounter都是从3C00开始计数,收到终端的data request该值会刷新,但是初始值该如何设置呢,在终端不管给zgEndDeviceTimeoutValue赋什么值入网之后协调器端的timeoutCounter都是3C00
// Child aging management default values // Values are specified in table of nwk_globals.h module //timeoutValue[15] // 10, // 0 10 seconds // 2, // 1 2 minutes // 4, // 2 4 minutes // 8, // 3 8 minutes // 16, // 4 16 minutes // 32, // 5 32 minutes // 64, // 6 64 minutes // 128, // 7 128 minutes // 256, // 8 256 minutes // 512, // 9 512 minutes // 1024, // 10 1024 minutes // 2048, // 11 2048 minutes // 4096, // 12 4096 minutes // 8192, // 13 8192 minutes // 16384 // 14 16384 minutes // // This value is used by the parent ROUTER #if !defined ( NWK_END_DEV_TIMEOUT_DEFAULT ) #define NWK_END_DEV_TIMEOUT_DEFAULT 8 // Default value per ZigBee core specification #endif // Value used by END DEVICE when sending End Device Timeout Request // This is an index into table timeoutValue[] defined in nwk_globals.c #if !defined ( END_DEV_TIMEOUT_VALUE ) #define END_DEV_TIMEOUT_VALUE 8 // Default value per ZigBee core specification #endif
zgEndDeviceTimeoutValue 默认是 8 既256 分钟。 最终都是取决于终端的 值,因为终端入网后会 发送这个东西给 它的父节点,如果终端没有设置(发出),那就取决于 父节点的默认值
你说的 3C00 是15360 Zstack 里面都没有这个~~~ 是不是搞错了~~~
你可以自己在终端的程序上加上 隔一段时间发一个消息 给 协调器, 类似心跳包。
协调器收到心跳包 证明终端没有断网, 如果超过多久没有收到心跳包,就证明它离线~~~。
或者是 协调器定期发条信息 给终端,要求其默认回复。 收到回复证明 终端在,否则证明终端离线
Child Aging 只支持ZED和ZC、ZR之间进行,并不支持ZR和ZC之间的状态确定,所以很多时候不适用,比如说一个ZC,所有的都是ZR,岂不是根本用不上这个特性,不得不自己在应用层重新实现类似的机制
是的,但是其实是可以管理路由的,可以去了解下我的这个方法:
www.kaleidscope.cn:1020/archives/2715
路由和终端都可以管理。时间自己设置
@VV
我用zstack 1.2.2a 的版本。 child aging 使用 data request POLL 的方式。。。
网络模式是一个协调器 和17个 终端设备。
第一次 将 所有17个终端设备 加入到协调器重, 然后再往协调器加入终端设备时, 抓到的beacon 显示Enddevice capabilitie 为false。
证明设备已满
然后我将加入的设备 拿出7个, 断电, 经过一段时间, 我打印associate list 出来,发现确实少了7个设备。
然后重新将这个7个设备 上电加入到协调器, 加了5个之后, 发现协调器无法加入设备, 这时抓到的beacon 显示Enddevice capabilitie 也为false
但是associate list 显示 只有15个设备。。。。
为什么这个时候associate list 有位置,但却无法加设备呢???