zigbee关联表AssociatedDevList的操作
[复制链接]
关联表的操作
AssociatedDevList 表为与此设备相关联的设备表,并不是 ZigBee 网络中的所有设备
信息表。表中信息的 IEEE 地址是唯一的,每个设备加入它的父节点时会在表中添加一个记
录,但是子节点断电离开网络时不会删除该条记录,如果有多个子节点,频繁更换父节点会
造成 AssociatedDevList 表满或溢出,使其它子节点无法加入该父节点,因此需要及时的删
除一些已离开的子节点记录。
5.1、关联表的定义
在 nwk_globals.C 文件中有对关联表的定义,代码如下:
#if defined(RTR_NWK)
// Statically defined
Associated Device List
associated_devices_t
AssociatedDevList[NWK_MAX_DEVICES];
#endif
5.2、关联表的结构
在 AssocList.h 文件中有对关联表结构 associated_devices_t 的定义,代码如下:
typedef struct
{
UINT16 shortAddr;
uint16 addrIdx;
byte nodeRelation;
byte devStatus;
byte assocCnt;
linkInfo_t linkInfo;
}
associated_devices_t;
devStatus
可以设置为以下的值
#define
DEV_LINK_STATUS
#define
DEV_LINK_REPAIR
0x01 // link is in-active ? 活动联接
0x02 // link repair in progress ?正在修复联接
#define
DEV_SEC_INIT_STATUS 0x04 // security init 初后的安全
#define
DEV_SEC_AUTH_STATUS 0x08 // security authenticated 验正过的安全
在 ZComDef.h 文件中有对 linkInfo_t 的定义,代码如下:
typedef struct
{
uint8 txCost;
uint8 rxCost;
// counter of transmission success/failures
// average of received rssi values
uint8 inKeySeqNum; //
security key sequence number
uint32 inFrmCntr;
// security frame counter..
} linkInfo_t;
5.3、关联表记录的查看
可以直接从
AssociatedDevList[NWK_MAX_DEVICES]数组中查看关联设备的信息,比如:
for (uint8 x=0;x<NWK_MAX_DEVICES;x++)
{
byte nr = AssociatedDevList[x].nodeRelation;
…
|