The global variable "zgRejoinPollRate" is used by function "NLME_SetPollRate" when ZDO message "ZDO_NWK_DISC_CNF" received.But,when a EndDevice's associating is Failed or no parent is discovered,the polling will be no-use.
”is run in function "ZDApp_ProcessNetworkJoin".First,add a new global variable "bool ZDApp_SetRejoinPoll" for "ZDAPP.c".
When mssage "ZDO_NWK_DISC_CNF",it can be done like this:
if ( ZDO_Config_Node_Descriptor.CapabilityFlags & CAPINFO_RCVR_ON_IDLE )
{
// The receiver is on, turn network layer polling off.
NLME_SetPollRate( 0 );
NLME_SetQueuedPollRate( 0 );
NLME_SetResponseRate( 0 );
}
else
{
if ( (ZG_SECURE_ENABLED) && (devStartMode == MODE_JOIN) )
{
ZDApp_SavedPollRate = zgPollRate;
ZDApp_SetRejoinPoll = TRUE;
//NLME_SetPollRate( zgRejoinPollRate );
}
}
Then,fix some code of "ZDApp_ProcessNetworkJoin" like this
if ( ZG_SECURE_ENABLED && ( ZDApp_RestoreNwkKey() == false ) )
{
// wait for auth from trust center!!
devState = DEV_END_DEVICE_UNAUTH;
// Start the reset timer for MAX UNAUTH time
ZDApp_ResetTimerStart( MAX_DEVICE_UNAUTH_TIMEOUT );//MAX_DEVICE_UNAUTH_TIMEOUT );
if(ZDApp_SetRejoinPoll)
{
ZDApp_SetRejoinPoll = FALSE;
NLME_SetPollRate( zgRejoinPollRate );
}
}