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.
void ZDO_ProcessMgmtPermitJoinReq( zdoIncomingMsg_t *inMsg )
{
uint8 stat;
uint8 duration;
#if (ZG_BUILD_COORDINATOR_TYPE)
if(ZG_DEVICE_COORDINATOR_TYPE)
{
//If zgAllowRemoteTCPolicyChange is set to FALSE, the request from other
//devices cannot affect the Trust Center policies
if((zgAllowRemoteTCPolicyChange == 0) && (inMsg->srcAddr.addr.shortAddr!= 0x0000))
{
return;
}
}
#endif
duration = inMsg->asdu[ZDP_MGMT_PERMIT_JOIN_REQ_DURATION];
// Per R21 Spec this field is not longer relevant 2.4.3.3.7.2 (Mgmt_Permit_Joining_req Effect on Receipt)
//tcsig = inMsg->asdu[ZDP_MGMT_PERMIT_JOIN_REQ_TC_SIG];
// Per R21 Spec this duration cannot last forever 2.4.3.3.7.2 (Mgmt_Permit_Joining_req Effect on Receipt)
if(duration == 0xFF)
{
duration = 0xFE;
}
duration = 0xFF; //I set the var to 255,But it still doesn't work.
// Set the network layer permit join duration
stat = (byte) NLME_PermitJoiningRequest( duration );
//Handle the permit joining if running a distributed network
if(APSME_IsDistributedSecurity())
{
ZDSecMgrPermitJoining( duration );
}
// Handle the Trust Center Significance
if ( ZG_SECURE_ENABLED && ZG_BUILD_COORDINATOR_TYPE && ZG_DEVICE_COORDINATOR_TYPE )
{
ZDSecMgrPermitJoining( duration );
}
// Send a response if unicast
if ( !inMsg->wasBroadcast )
{
ZDP_MgmtPermitJoinRsp( inMsg->TransSeq, &(inMsg->srcAddr), stat, false );
}
}
Zigbee 3.0 doesn’t allow permanent permit join so you have to start a periodic timer event to enable permit join.
NLME_PermitJoiningRequest
/*
* This function defines how the next higher layer of a coordinator device
* to permit devices to join its network for a fixed period.
*
* @MT SPI_CMD_NLME_PERMIT_JOINING_REQ
*
*/
extern ZStatus_t NLME_PermitJoiningRequest( byte PermitDuration );