Other Parts Discussed in Thread: Z-STACK
使用Z-Stack Home 1.2.2a.44539协议栈时发现,当我的设备反复退网并加网多次后,出现设备无法入网的现象,在准备入网的时候,会收到协调器发送的Remove Device指令,导致设备无法加网,
我在协议栈里作了如下修改:
void ZDSecMgrUpdateDeviceInd( ZDO_UpdateDeviceInd_t* ind )
{
ZDSecMgrDevice_t device;
device.nwkAddr = ind->devAddr;
device.extAddr = ind->devExtAddr;
device.parentAddr = ind->srcAddr;
device.devStatus = DEV_SEC_INIT_STATUS;
device.secure = FALSE;
// Trust Center should identify the type of JOIN/REJOIN and
// Transport the NWK key accordingly, it will only be transported for:
// APSME_UD_STANDARD_UNSECURED_JOIN
// OR APSME_UD_STANDARD_TRUST_CENTER_REJOIN
if ( ind->status != APSME_UD_DEVICE_LEFT )
{
if ( ind->status == APSME_UD_STANDARD_SECURED_REJOIN )
{
device.devStatus &= ~DEV_SEC_INIT_STATUS;
device.devStatus |= DEV_SEC_AUTH_STATUS;
device.secure = TRUE;
}
ZDSecMgrDeviceJoin( &device );
}
+else
+{
+ // remove the TCLK NV entry for a device which has left the network
+ APSME_TCLinkKeyInit(TRUE);
+}
