/*
   Copyright 2008-2013 ITACA-TSB, http://www.tsb.upv.es/
   Instituto Tecnologico de Aplicaciones de Comunicacion 
   Avanzadas - Grupo Tecnologias para la Salud y el 
   Bienestar (TSB)


   See the NOTICE file distributed with this work for additional 
   information regarding copyright ownership

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

package org.bubblecloud.zigbee.network.packet.zdo;

import org.bubblecloud.zigbee.network.packet.ZToolAddress16;
import org.bubblecloud.zigbee.network.packet.ZToolCMD;
import org.bubblecloud.zigbee.network.packet.ZToolPacket;
import org.bubblecloud.zigbee.util.DoubleByte;

/**
 * @author <a href="mailto:alfiva@aaa.upv.es">Alvaro Fides Valero</a>
 * @version $LastChangedRevision: 799 $ ($LastChangedDate: 2013-08-06 19:00:05 +0300 (Tue, 06 Aug 2013) $)
 */
public class ZDO_MGMT_PERMIT_JOIN_REQ extends ZToolPacket /*implements IREQUEST,IZDO*/ {
    /// <name>TI.ZPI1.ZDO_MGMT_PERMIT_JOIN_REQ.DstAddr</name>
    /// <summary>Destination network address.</summary>
    public ZToolAddress16 DstAddr;
    /// <name>TI.ZPI1.ZDO_MGMT_PERMIT_JOIN_REQ.Duration</name>
    /// <summary>The duration to permit joining.  0 = join disabled.  0xff = join enabled. 0x01-0xfe = number of seconds to permit joining</summary>
    public int Duration;
    /// <name>TI.ZPI1.ZDO_MGMT_PERMIT_JOIN_REQ.TCSignificance</name>
    /// <summary>Trust Center Significance</summary>
    public int TCSignificance;

    /// <name>TI.ZPI1.ZDO_MGMT_PERMIT_JOIN_REQ</name>
    /// <summary>Constructor</summary>
    public ZDO_MGMT_PERMIT_JOIN_REQ() {
    }

    /// <name>TI.ZPI1.ZDO_MGMT_PERMIT_JOIN_REQ</name>
    /// <summary>Constructor</summary>
    public ZDO_MGMT_PERMIT_JOIN_REQ(ZToolAddress16 num1, int num2, int num3) {
        this.DstAddr = num1;
        this.Duration = num2;
        this.TCSignificance = num3;

        int[] framedata = new int[4];
        framedata[0] = this.DstAddr.getLsb();
        framedata[1] = this.DstAddr.getMsb();
        framedata[2] = this.Duration;
        framedata[3] = this.TCSignificance;
        super.buildPacket(new DoubleByte(ZToolCMD.ZDO_MGMT_PERMIT_JOIN_REQ), framedata);
    }
}

@@ -902,16 +902,75 @@
 t.zdo;%0A%0A
+import org.bubblecloud.zigbee.network.packet.ZToolAddress;%0A
 import o
@@ -1457,16 +1457,199 @@
 ZDO*/ %7B%0A
+    /// %3Cname%3ETI.ZPI1.ZDO_MGMT_PERMIT_JOIN_REQ.AddrMode%3C/name%3E%0A    /// %3Csummary%3EDestination address type: 0x02 %E2%80%93 Address 16 bit, 0x0F %E2%80%93 Broadcast.%3C/summary%3E%0A    public byte AddrMode;%0A
     /// 
@@ -2453,16 +2453,27 @@
 OIN_REQ(
+byte num1, 
 ZToolAdd
@@ -2482,17 +2482,17 @@
 ss16 num
-1
+2
 , int nu
@@ -2488,25 +2488,25 @@
 um2, int num
-2
+3
 , int num3) 
@@ -2506,13 +2506,43 @@
  num
-3
+4
 ) %7B%0A
+        this.AddrMode = num1;%0A
     
@@ -2559,25 +2559,25 @@
 stAddr = num
-1
+2
 ;%0A        th
@@ -2589,25 +2589,25 @@
 ration = num
-2
+3
 ;%0A        th
@@ -2629,17 +2629,17 @@
 ce = num
-3
+4
 ;%0A%0A     
@@ -2667,17 +2667,17 @@
 new int%5B
-4
+5
 %5D;%0A     
@@ -2693,16 +2693,54 @@
 ata%5B0%5D =
+ this.AddrMode;%0A        framedata%5B1%5D =
  this.Ds
@@ -2765,33 +2765,33 @@
       framedata%5B
-1
+2
 %5D = this.DstAddr
@@ -2811,33 +2811,33 @@
       framedata%5B
-2
+3
 %5D = this.Duratio
@@ -2849,33 +2849,33 @@
       framedata%5B
-3
+4
 %5D = this.TCSigni

Update ZDO_MGMT_PERMIT_JOIN_REQ for new firmware The format of ZDO_MGMT_PERMIT_JOIN_REQ has changed in the new firmware. Add the AddrMode field to specify the address type.