001/*
002 * Copyright (C) Cross The Road Electronics.  All rights reserved.
003 * License information can be found in CTRE_LICENSE.txt
004 * For support and suggestions contact support@ctr-electronics.com or file
005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
006 */
007package com.ctre.phoenixpro.signals;
008
009import java.util.HashMap;
010
011/**
012 *  System state of the device
013 */
014public enum System_StateValue
015{
016    Bootup_0(0),
017    Bootup_1(1),
018    Bootup_2(2),
019    Bootup_3(3),
020    Bootup_4(4),
021    Bootup_5(5),
022    Bootup_6(6),
023    Bootup_7(7),
024    BootBeep(8),
025    ControlDisabled(9),
026    ControlEnabled(10),
027    Fault(11),
028    Recover(12),
029    NotLicensed(13),;
030
031    public final int value;
032
033    System_StateValue(int initValue)
034    {
035        this.value = initValue;
036    }
037
038    private static HashMap<Integer, System_StateValue> _map = null;
039    static
040    {
041        _map = new HashMap<Integer, System_StateValue>();
042        for (System_StateValue type : System_StateValue.values())
043        {
044            _map.put(type.value, type);
045        }
046    }
047
048    /**
049     * Gets System_StateValue from specified value
050     * @param value Value of System_StateValue
051     * @return System_StateValue of specified value
052     */
053    public static System_StateValue valueOf(int value)
054    {
055        System_StateValue retval = _map.get(value);
056        if(retval != null) return retval;
057        return System_StateValue.values()[0];
058    }
059}