package com.beanit.asn1dsrc.enums;

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

public enum eControlDeviceId {

    ControlDeviceId_Controller (0x00, "ControlDeviceId_Controller"),
    ControlDeviceId_Antena1    (0x01, "ControlDeviceId_Antenna1"),
    ControlDeviceId_Antena2    (0x02, "ControlDeviceId_Antenna2"),
    ControlDeviceId_Antena3    (0x03, "ControlDeviceId_Antenna3"),
    ControlDeviceId_Antena4    (0x04, "ControlDeviceId_Antenna4");

    private final int value;
    private final String string;

    private static final Map<Integer, eControlDeviceId> map;
    static {
        map = new HashMap<>();
        for (eControlDeviceId e : values()) {
            map.put(Integer.valueOf(e.value), e);
        }
    }
    public static eControlDeviceId getByValue(int value) {
        return map.get(Integer.valueOf(value));
    }
    public static eControlDeviceId getByValue(byte value) {
        int intValue = (int)(value & 0x0F);
        return map.get(Integer.valueOf(intValue));
    }

    eControlDeviceId(int value, String string) {
        this.value  = value;
        this.string = string;
    }

    public int getValue() {
        return this.value;
    }
    public String toString() {
        return this.string;
    }
}
