Ext PANID是怎么用的?
我初始化了zgApsUseExtendedPANID,发现设备在加入网络的时候,没有从协调器或者路由器去获取网络地址,而是随机生成一个网络地址,然后发一条Rejoin命令给协调器或者路由器,这种方法会不会导致网络内有雷同的网络地址出现?
zigbee pro就是这样的。你这里是新节点第一次入网,但采用重新加入的方法,寻找指定的ExtendedPANID的网络加入。因此,节点会自己分配一个地址。父节点会检查这个地址是否和已知的地址发生冲突,如果有才会重新分配,没有就沿用。地址冲突有检测机制(默认打开了)并有解决方法。TI协议支持,具体细节可参考zigbee规范。
为什么不会雷同,请参见如下,来自 Z-Stack Developer's Guide.pdf SWRA176
When a device joins, it receives its randomly generated address from its parent. The new network node then generates a “Device Announce” (which contains its new short address and its extended address) to the rest of the network. If there is another device with the same short address, a node (router) in the network will send out a broadcast “Network Status – Address Conflict” to the entire network and all devices with the conflicting short address will change its short address. When the conflicted devices change their address they issue their own “Device Announce” to check their new address for conflicts within the network.
End devices do not participate in the “Address Conflict”. Their parents do that for them. If an “Address Conflict” occurs for an end device, its parent will issue the end device a “Rejoin Response” message to change the end device’s short address and the end device issues a “Device Announce” to check their new address for conflicts within the network.
When a “Device Announce” is received, the association and binding tables are updated with the new short address, routing table information is not updated (new routes must be established). If a parent determines that the “Device Announce” pertains to one of its end device children, but it didn’t come directly from the child, the parent will assume that the child moved to another parent.