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.
抓包工具:SmartRF Packet Sniffer 2
解析工具:Wireshark
信道:26
说明:
1、在第“18”个包开始开启允许入网180秒,这个没抓到我说明一下。
2、然后从“19-81”个包为第一个设备(0x2ac8)入网成功过程。
3、在第“181”个包开始,协调器通过“bdb_resetLocalAction()”函数恢复“出厂设置”。此时第一个终端还是正常的通过“bdb_ZedAttemptRecoverNwk()”函数请求恢复原网络。
4、第“247-314”个包开始上电第二个终端设备并成功入网。
5、第“344”个包开始第一个终端节点开始被协调器请求离网。
在《Z-Stack 3.0 Developer's Guide》里的"15.3 Parent Lost"有说明父节点丢失时终端节点的情况。只要同“channel”,同“Extened PANID”,同“child device capacity”就能重入网了,我记得“Extened PANID”是不是默认为建网设备的“MAC地址”?
15.3 Parent Lost
If an end device loses contact with its parent device or is reset while being on a network, the BDB module will notify the application a status of BDB_COMMISSIONING_PARENT_LOST after which the end device cannot perform any other commissioning method. The device must either restore its network by finding another parent device or reset to factory new and then be commissioned again. To restore the network the device must call bdb_ZedAttemptRecoverNwk, this will cause the device to perform a single active scan in the same channel in which it was part of the network to search for any suitable parent (same Extended PANID and child device capacity). This means that the device will only send a single beacon request and if no suitable parent device is found, another notification BDB_COMMISSIONING_PARENT_LOST is sent to the application. The application is responsible for attempting to restore the network, but it is recommended to have a period in which the attempts have a short interval, then goes to a larger interval, to reduce the power consumption. If Finding and Binding was in progress while the device lost its parent, it will keep running and will resume its operation for the time left after the device restores its operation.
总结帖:
1、首先我在文章中提出的问题是客观存在的,但是不算是BUG,是协议栈就是这么设定的。
2、问题的原因跟我在问题描述中猜测的一样,可在《Z-Stack 3.0 Developer's Guide》文档的第“15.3 Parent Lost”中找到。
15.3 Parent Lost
If an end device loses contact with its parent device or is reset while being on a network, the BDB module will notify the application a status of BDB_COMMISSIONING_PARENT_LOST after which the end device cannot perform any other commissioning method. The device must either restore its network by finding another parent device or reset to factory new and then be commissioned again. To restore the network the device must call bdb_ZedAttemptRecoverNwk, this will cause the device to perform a single active scan in the same channel in which it was part of the network to search for any suitable parent (same Extended PANID and child device capacity). This means that the device will only send a single beacon request and if no suitable parent device is found, another notification BDB_COMMISSIONING_PARENT_LOST is sent to the application. The application is responsible for attempting to restore the network, but it is recommended to have a period in which the attempts have a short interval, then goes to a larger interval, to reduce the power consumption. If Finding and Binding was in progress while the device lost its parent, it will keep running and will resume its operation for the time left after the device restores its operation.
在协调器“恢复出厂设置”后,终端设备1失去父节点,然后调用“bdb_ZedAttemptRecoverNwk()”函数尝试恢复网络。之后协调器建立新网络,建立的新网络是同一“channel”,同一“Externed PANID”,不同“PANID”的网络,因为协议栈为了确保每一个“Externed PANID”都是唯一的,所以“Externed PANID”默认等于设备自身的MAC地址,所以两次建网时“Externed PANID”都是相同的。按照“15.3 Parent Lost”章节的描述,终端设备1是可以通过“rejoin”流程进入协调器建立的新网络的。但是我的“-DDEFAULT_KEY="{0}"”的缘故,导致两次建网网络的“NWK Key”是不同的,所以终端节点1无法顺利“rejoin”,而协调器则一直发送“leave”命令给终端设备1。当我把协调器的“-DDEFAULT_KEY”固定时,两次建网后的“NWK KEY”是一样的,终端节点1可顺利的加入新网络。
3、解决问题的方法:没什么解决方法,协调器单独恢复出厂设置后就是会出现这种情况,当原网络中终端节点很多的话估计还会造成网络堵塞。只能在协调器恢复出厂设置前或后将所有终端节点恢复出厂设置。
4、请问大家还有什么其它更好的恢复出厂设置方法吗?
以下附上在国外论坛中讨论该问题的过程: