函数如下:
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;
}
// 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 );
}
}
YiKai Chen:
Zigbee 3.0 spec不允許一直開啟permit join,如果硬要作就把下面几行拿掉试试
if(duration == 0xFF)
{
duration = 0xFE;
}
zhou jiangtao:
回复 YiKai Chen:
3。0为什么会有这样的设计呢?我连接不上,找了好长时间的原因,才找到这儿。协调器不就是服务器一样,要等着别的设备来连接的嘛
YiKai Chen:
回复 zhou jiangtao:
避免一直開啟入網讓任何設備可以隨意加入
Viki Shi:
回复 zhou jiangtao:
一直开放网络安全性就无法保证
zhou jiangtao:
回复 Viki Shi:
我使用了TC_LINK_KEY,和SECURE
YiKai Chen:
回复 zhou jiangtao:
只要你是一直开放网络,設備就可以透過一樣的TC_LINK_KEY去入网
zhou jiangtao:
回复 YiKai Chen:
没有用,因为
if(duration == 0xFF)
{
duration = 0xFE;
}*/
if ( ZG_SECURE_ENABLED && ZG_BUILD_COORDINATOR_TYPE && ZG_DEVICE_COORDINATOR_TYPE )
{
ZDSecMgrPermitJoining( duration ); 这儿传进去的duration 还是0xB4
}
如何去掉时间限制呢?
YiKai Chen:
回复 zhou jiangtao:
直接把ZDSecMgrPermitJoining( duration )改成ZDSecMgrPermitJoining(0xff)看看
zhou jiangtao:
回复 YiKai Chen:
还是不行啊,时间过去两分钟的样子就连接不上了。
YiKai Chen:
回复 zhou jiangtao:
這樣看來是協議棧的底層檔掉了,只能建議你起一個週期性的timer event一直去開啟permit join