/**
 * Copyright (c) 2016-2017 by the respective copyright holders.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package com.zsmartsystems.zigbee.dongle.ember.ezsp.structure;

import java.util.HashMap;
import java.util.Map;

/**
 * Class to implement the Ember Enumeration <b>EmberOutgoingMessageType</b>.
 * <p>
 * Note that this code is autogenerated. Manual changes may be overwritten.
 *
 * @author Chris Jackson - Initial contribution of Java code generator
 */
public enum EmberOutgoingMessageType {
    /**
     * Default unknown value
     */
    UNKNOWN(-1),

    /**
     * Unicast sent directly to an EmberNodeId.
     */
    EMBER_OUTGOING_DIRECT(0x0000),

    /**
     * Unicast sent using an entry in the address table.
     */
    EMBER_OUTGOING_VIA_ADDRESS_TABLE(0x0001),

    /**
     * Unicast sent using an entry in the binding table.
     */
    EMBER_OUTGOING_VIA_BINDING(0x0002),

    /**
     * Multicast message. This value is passed to emberMessageSentHandler() only. It may not be
     * passed to emberSendUnicast().
     */
    EMBER_OUTGOING_MULTICAST(0x0003),

    /**
     * Broadcast message. This value is passed to emberMessageSentHandler() only. It may not be
     * passed to emberSendUnicast().
     */
    EMBER_OUTGOING_BROADCAST(0x0004);

    /**
     * A mapping between the integer code and its corresponding type to
     * facilitate lookup by code.
     */
    private static Map<Integer, EmberOutgoingMessageType> codeMapping;

    private int key;

    private EmberOutgoingMessageType(int key) {
        this.key = key;
    }

    private static void initMapping() {
        codeMapping = new HashMap<Integer, EmberOutgoingMessageType>();
        for (EmberOutgoingMessageType s : values()) {
            codeMapping.put(s.key, s);
        }
    }

    /**
     * Lookup function based on the EmberStatus type code. Returns null if the
     * code does not exist.
     *
     * @param i
     *            the code to lookup
     * @return enumeration value of the alarm type.
     */
    public static EmberOutgoingMessageType getEmberOutgoingMessageType(int i) {
        if (codeMapping == null) {
            initMapping();
        }

        if (codeMapping.get(i) == null) {
            return UNKNOWN;
        }

        return codeMapping.get(i);
    }

    /**
     * Returns the EZSP protocol defined value for this enum
     *
     * @return the EZSP protocol key
     */
    public int getKey() {
        return key;
    }
}

@@ -1285,24 +1285,440 @@
 T(0x0003),%0A%0A
+    /**%0A     * Aliased multicast message.  This value is passed to emberMessageSentHandler() only. It may%0A     * not be passed to emberSendUnicast().%0A     */%0A    EMBER_OUTGOING_MULTICAST_WITH_ALIAS(0x0004),%0A%0A    /**%0A     * Aliased broadcast message.  This value is passed to emberMessageSentHandler() only. It may%0A     * not be passed to emberSendUnicast().%0A     */%0A    EMBER_OUTGOING_BROADCAST_WITH_ALIAS(0x0005),%0A%0A
     /**%0A    
@@ -1801,32 +1801,32 @@
 . It may not be%0A
-
      * passed to
@@ -1888,17 +1888,17 @@
 ST(0x000
-4
+6
 );%0A%0A    

Update EmberOutgoingMessageType (#73)