001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.wpilibj;
006
007import edu.wpi.first.hal.HALUtil;
008
009public enum RuntimeType {
010  kRoboRIO(HALUtil.RUNTIME_ROBORIO),
011  kRoboRIO2(HALUtil.RUNTIME_ROBORIO2),
012  kSimulation(HALUtil.RUNTIME_SIMULATION);
013
014  public final int value;
015
016  RuntimeType(int value) {
017    this.value = value;
018  }
019
020  /**
021   * Construct a runtime type from an int value.
022   *
023   * @param type Runtime type as int
024   * @return Matching runtime type
025   */
026  public static RuntimeType getValue(int type) {
027    if (type == HALUtil.RUNTIME_ROBORIO) {
028      return RuntimeType.kRoboRIO;
029    } else if (type == HALUtil.RUNTIME_ROBORIO2) {
030      return RuntimeType.kRoboRIO2;
031    }
032    return RuntimeType.kSimulation;
033  }
034}