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.phoenix6.sim; 008 009import java.util.HashMap; 010 011/** 012 * Enumeration of all supported device types. 013 */ 014public enum DeviceType 015{ 016 TalonSRXType(0), 017 VictorSPXType(1), 018 PigeonIMUType(2), 019 RibbonPigeonIMUType(3), 020 TalonFXType(4), 021 CANCoderType(5), 022 PRO_TalonFXType(6), 023 PRO_CANcoderType(7), 024 PRO_Pigeon2Type(8),; 025 026 public final int value; 027 028 DeviceType(int initValue) 029 { 030 this.value = initValue; 031 } 032 033 private static HashMap<Integer, DeviceType> _map = null; 034 static 035 { 036 _map = new HashMap<Integer, DeviceType>(); 037 for (DeviceType type : DeviceType.values()) 038 { 039 _map.put(type.value, type); 040 } 041 } 042 043 /** 044 * Gets DeviceType from specified value 045 * @param value Value of DeviceType 046 * @return DeviceType of specified value 047 */ 048 public static DeviceType valueOf(int value) 049 { 050 DeviceType retval = _map.get(value); 051 if (retval != null) return retval; 052 return DeviceType.values()[0]; 053 } 054}