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.

what is "AIB_apsUseInsecureJoin" 's meaning?

Other Parts Discussed in Thread: Z-STACK

these code

      if ( devStartMode == MODE_RESUME )
      {
        if ( ++retryCnt <= MAX_RESUME_RETRY )
        {
          if ( _NIB.nwkPanId == 0xFFFF || _NIB.nwkPanId == INVALID_PAN_ID )
            devStartMode = MODE_JOIN;
          else
          {
            devStartMode = MODE_REJOIN;
            _tmpRejoinState = true;
          }
        }
        // Do a normal join to the network after certain times of rejoin retries
        else if( AIB_apsUseInsecureJoin == true )
        {
          //devStartMode = MODE_JOIN;
        }
      }

why Z-stack is designed like this?I think " if ( ++retryCnt <= MAX_RESUME_RETRY ) " is a mistake,it should be " if ( ++retryCnt >= MAX_RESUME_RETRY ) "

  • The MODE_RESUME is used when restoring network parameters from NV, to resume operation on the network after a reset/power cycle. In this case the NIB parameters should be restored from NV:

    if ( _NIB.nwkPanId == 0xFFFF || _NIB.nwkPanId == INVALID_PAN_ID )

    is false  and we should be in this part of your code snip (for an End Device):

            else
    
            {
    
              devStartMode = MODE_REJOIN;
    
              _tmpRejoinState = true;
    
            }

    If the NIB is not restored then:

     if ( _NIB.nwkPanId == 0xFFFF || _NIB.nwkPanId == INVALID_PAN_ID )

    will be true and we will do a normal join (devStartMode = MODE_JOIN).

    This will attempt this MAX_RESUME_RETRY times:

     if ( ++retryCnt <= MAX_RESUME_RETRY )

    If after MAX_RESUME_RETRY attempts to REJOIN (if NIB restored from NV) or JOIN (if NIB not restored from NV) this code:

            // Do a normal join to the network after certain times of rejoin retries
    
            else if( AIB_apsUseInsecureJoin == true )
    
            {
    
              devStartMode = MODE_JOIN;
    
            }
    

    Will be reached. apsUseInsecureJoin  is defined in the ZigBee spec, it defaults to true and should not be changed:

    "If the network rejoin attempt fails, and the value of the apsUseInsecureJoin attribute of the AIB has a value of TRUE, then the device should follow the procedure outlined in sub-clause 3.6.1.4.1 for joining a network, using apsChannelMask any place that a ScanChannels mask is called for. If apsUseExtendedPANID has a non-zero value, then the device should join only the specified network and the procedure should fail if that network is found to be inaccessible. If apsUseExtendedPANID is equal to 0x0000000000000000, then the device should join the best available network."  

    I hope this explains the design and satisfies your concerns as to why it was implemented in this way.

    I also notice in your code snip “devStartMode = MODE_JOIN” is commented out, please insure this is uncommented for correct behavior (as it is in our release).

    Regards, TC.

  • but,following these codes,I think it will never go to "else if( AIB_apsUseInsecureJoin == true )".Beacuse the "devStartMode" will be set to "MODE_REJOIN" for first time.The "devStartMode" will not stay in "MODE_RESUME"

  • Good answer!!!!!