以下内容摘自ZigBee 2015 Pro文档《docs-05-3474-21-0csg-zigbee-specification》
3.6.1.5 Neighbor Tables
The neighbor table of a device shall contain information on every device within transmission range, up to some implementation-dependent limit.
The neighbor table is useful in two contexts. First of all, it is used during network discovery or rejoining to store information about routers within RF reception range that may be candidate parents. Second, after the device has joined a network, it is used to store relationship and link-state information about neighboring devices in that network. A table entry shall be updated every time a device receives any frame from the corresponding neighbor.
The outgoing cost field contains the cost of the link as measured by the neighbor. The value is obtained from the most recent link status command frame received from the neighbor. A value of 0 indicates that no link status command listing this device has been received.
The age field indicates the number of nwkLinkStatusPeriod intervals that have passed since the last link status command frame was received, up to a maximum value of nwkRouterAgeLimit. Mandatory and optional data that are used in normal network operation are listed in Table 3.53.
大意:
邻居表应该包含每一个在传输内的节点信息。
它有两个用处:
它用于网络发现或重新连接时,存储可能是候选父节点的RF接收范围内路由器的信息;
设备加入网络后,用于存储该网络中相邻设备的关系和链路状态信息;每次收到任何信息时都应该更新对应的邻居表条目。
输出损耗域包含了由邻居测量的链路成本;这个值是从邻居最新发送的Link Status帧获得,0表示没有收到该设备的Link Status帧。
老化域表示连续多少次没有收到某个设备的Link Status了,时间单位是nwkLinkStatusPeriod,上限为nwkRouterAgeLimit(额外信息:一般来说nwkLinkStatusPeriod为15秒,nwkRouterAgeLimit为3,当nwkRouterAgeLimit大于3时就将设备移出邻居表)。
以下内容摘自NXP ZigBee 3.0 Stack User Guide文档《JN-UG-3113》
B.5.1 Neighbour Table
The Neighbour table on a routing node (Router or Co-ordinator) holds information about the node’s immediate neighbours:
The first entry in the table contains information about the node’s parent
Part of the table holds information about child nodes which have joined the network through the local device
The rest of the table holds information about nodes which are neither children nor the parent (these ‘other’ nodes are only relevant to Mesh networks)
译:
路由节点(路由器或协调器)上的邻接表保存有关该节点的近邻的信息:
第一个条目保存的是本节点的父节点信息;
表的一部分保存了通过本节点入网的子节点信息;
剩下的部分保存了非本节点的子节点或父节点的节点信息(这些节点只是网状网络的其他相关节点);
在Z-Stack中ZigBee规范中的邻居表被分为了以下两个表:
// Neighbor table entry
typedef struct
{
uint16 neighborAddress;
uint8 neighborExtAddr[Z_EXTADDR_LEN];
uint16 panId;
uint8 age; // number of nwkLinkStatusPeriod since last link status
linkInfo_t linkInfo;
} neighborEntry_t;
// Table of neighboring nodes (not including child nodes)
neighborEntry_t neighborTable[MAX_NEIGHBOR_ENTRIES];
#if !defined ( MAX_NEIGHBOR_ENTRIES )
#if ( ZG_BUILD_RTR_TYPE )
#define MAX_NEIGHBOR_ENTRIES 16
#else
#define MAX_NEIGHBOR_ENTRIES 4
#endif
#endif
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;
typedef struct
{
uint8 endDevCfg;
uint32 deviceTimeout;
} aging_end_device_t;
// Statically defined Associated Device List
associated_devices_t AssociatedDevList[NWK_MAX_DEVICES];
// Don't change this value to set the number of devices. Change
// NWK_MAX_DEVICE_LIST above
#define NWK_MAX_DEVICES ( NWK_MAX_DEVICE_LIST + 1 ) // One extra space for parent
其中的linkInfo_t如下:
typedef struct
{
uint8 txCounter; // Counter of transmission success/failures
uint8 txCost; // Average of sending rssi values if link staus is enabled
// i.e. NWK_LINK_STATUS_PERIOD is defined as non zero
uint8 rxLqi; // average of received rssi values
// needs to be converted to link cost (1-7) before used
uint8 inKeySeqNum; // security key sequence number
uint32 inFrmCntr; // security frame counter..
uint16 txFailure; // higher values indicate more failures
} linkInfo_t;
其中关联表包含了本节点的全部子节点(EndDevice & Router),EndDevice子节点超时(在设定时间内无通信)后将EndDevice移出关联表,超时间范围如下表:
Table 3.44 Requested Timeout Enumerated Values
Requested Timeout Enumeration Value | Actual Timeout Value |
---|---|
0 | 10 seconds |
1 | 2 minutes |
2 | 4 minutes |
3 | 8 minutes |
4 | 16 minutes |
5 | 32 minutes |
6 | 64 minutes |
7 | 128 minutes |
8 | 256 minutes |
9 | 512 minutes |
10 | 1024 minutes |
11 | 2048 minutes |
12 | 4096 minutes |
13 | 8192 minutes |
14 | 16384 minutes |
时间范围在10秒到16384 分钟(大约11天)之间。