Hey Y'all.
I have been trying to implement the permitDuration functionality to only allow a device to join the network for a short period of time, however I don't seem to be able to implement it correctly. According to the documentation the dstNwkAddr still exists in the ZDO_ZdpReq_t. But doing a complete file search for this member, it only exists in a comment. I believe that it has been removed since the early versions and the documentation has not been updated. Thus trying all previous implementations of this on the forums, does not appear to work.
So with a slight modification, I tried the following:
volatile uint8_t permitCalledBack = 1; static ZDO_ZdpReq_t zdpRequestJoining; static APS_Address_t address; static void zdoPermitJoiningResp(ZDO_ZdpResp_t *zdpResp) //callback function { (void)zdpResp; permitCalledBack = 1; } //if button is pressed... if (permitCalledBack) { permitCalledBack = 0; //address.shortAddress = BROADCAST_ADDR_ROUTERS; address.shortAddress = 0; zdpRequestJoining.reqCluster = MGMT_PERMIT_JOINING_CLID; //Request type zdpRequestJoining.dstAddrMode = APS_SHORT_ADDRESS; //Addressing mode //zdpRequestJoining.dstNwkAddr = BROADCAST_ADDR_ROUTERS; //Address of the destination zdpRequestJoining.dstAddress = address; zdpRequestJoining.req.reqPayload.mgmtPermitJoiningReq.permitDuration = 0x00; zdpRequestJoining.req.reqPayload.mgmtPermitJoiningReq.tcSignificance = 0; zdpRequestJoining.ZDO_ZdpResp = zdoPermitJoiningResp; //Confirm callback zdpRequestJoining.req.reqPayload.mgmtPermitJoiningReq.permitDuration = 0x00; ZDO_ZdpReq(&zdpRequestJoining); }
I am using the ATRCB256rfr2 and on button press, the above is executed. I can garuntee that this does somewhat work as when I set a breakpoint in the callback, it jumps into it. However, once pressing the button I power up a fresh router and it joins the network right away. Despite both being freshly programmed.
My application is based on the WSNDemo utilising STDLINK_SECURITY_MODE and security status 0 on both devices.
Any help would be greatly appreciated =D