Quantcast
Channel: Zigbee 和 Thread
Viewing all articles
Browse latest Browse all 16962

帖子: RE: 终端设备无法重入网络 使用 (zstack1.2.2a)

$
0
0

VV:

      不知道你是否记得 自己 发的一篇关于ZigBee 状态机的文章:http://www.deyisupport.com/question_answer/wireless_connectivity/zigbee/f/104/t/104629.aspx

      在 第 20 点  DEV_NWK_REJOIN状态到DEV_END_DEVICE_UNAUTH(20)

     有这么一句话:

      如果在ZDApp_RestoreNwkKey( uint8 incrFrmCnt ),读取network key错误,或者之前保存的network key已经不在的情况下,那么就发了Unsecure Rejoin的方式

     读取network 可以错误 的几率,我相信 非常少吧!

     那么 network key 不见呢????,这是有可能! 比如终端设备 寻网 过程中 自己把 NWK  KEY 清除, 然后把NV flash 里面的东西全清了!!

    

      我假设 一下, 如果 终端设备发送了Rejoin Request以后,收到父设备回复的Rejoin Response消息,那么程序会次进入到ZDApp_ProcessNetworkJoin( void

)  , 进行 Verify NWK key is available before sending Device_annce 对吧!

     

else if ( devState == DEV_NWK_ORPHAN ||             <strong><span style="color:#ff0000;">devState == DEV_NWK_SEC_REJOIN_CURR_CHANNEL</span></strong> ||             devState == DEV_NWK_TC_REJOIN_CURR_CHANNEL ||             devState == DEV_NWK_TC_REJOIN_ALL_CHANNEL ||             devState == DEV_NWK_SEC_REJOIN_ALL_CHANNEL )   { ......................  // results of an orphaning attempt by this device      // results of an orphaning attempt by this device   <strong><span style="color:#ff0000;"> if (nwkStatus == ZSuccess)</span></strong>     {       //When the device has successfully rejoined then reset retryCnt       retryCnt = 0;        // Verify NWK key is available before sending Device_annce       if ( ZG_SECURE_ENABLED && ( ZDApp_RestoreNwkKey( TRUE ) == false ) )       {         // wait for auth from trust center         ZDApp_ChangeState( DEV_END_DEVICE_UNAUTH );          // Start the reset timer for MAX UNAUTH time         ZDApp_ResetTimerStart( MAX_DEVICE_UNAUTH_TIMEOUT );       }

      但是在此之前  终端设备 进入predevState == DEV_NWK_SEC_REJOIN_ALL_CHANNEL 时,

      会把NWK KEY 清掉。。。。

      这时ZDApp_ResetTimerStart( MAX_DEVICE_UNAUTH_TIMEOUT ); 时间一到!!!! 是不是就悲剧了!!!!


Viewing all articles
Browse latest Browse all 16962

Trending Articles