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;
008
009import java.util.HashMap;
010
011public enum StatusCode {
012    /**
013     *  No Error
014     */
015    OK(0),
016    /**
017     *  InvalidDeviceSpec
018     */
019    InvalidDeviceSpec(-101),
020    /**
021     *  EcuIsNotPresent
022     */
023    EcuIsNotPresent(-102),
024    /**
025     *  CouldNotEnterBl
026     */
027    CouldNotEnterBl(-103),
028    /**
029     *  CouldNotConfirmBl
030     */
031    CouldNotConfirmBl(-104),
032    /**
033     *  CouldNotErase
034     */
035    CouldNotErase(-105),
036    /**
037     *  CouldNotSendFlash
038     */
039    CouldNotSendFlash(-106),
040    /**
041     *  CouldNotValidate
042     */
043    CouldNotValidate(-107),
044    /**
045     *  CouldNotRunApp
046     */
047    CouldNotRunApp(-108),
048    /**
049     *  CouldNotReqSetId
050     */
051    CouldNotReqSetId(-109),
052    /**
053     *  CouldNotConfirmId
054     */
055    CouldNotConfirmId(-110),
056    /**
057     *  FlashWasGood
058     */
059    FlashWasGood(-111),
060    /**
061     *  AppTooOld
062     */
063    AppTooOld(-112),
064    /**
065     *  CouldNotReqSetDesc
066     */
067    CouldNotReqSetDesc(-113),
068    /**
069     *  CompileSzIsWrong
070     */
071    CompileSzIsWrong(-114),
072    /**
073     *  GadgeteerDeviceNoSetId
074     */
075    GadgeteerDeviceNoSetId(-115),
076    /**
077     *  InvalidTask
078     */
079    InvalidTask(-116),
080    /**
081     *  Not Implemented, check latest installer.
082     */
083    NotImplemented(-117),
084    /**
085     *  NoDevicesOnBus
086     */
087    NoDevicesOnBus(-118),
088    /**
089     *  MoreThanOneFile
090     */
091    MoreThanOneFile(-119),
092    /**
093     *  NodeIsInvalid
094     */
095    NodeIsInvalid(-120),
096    /**
097     *  InvalidDeviceDescriptor
098     */
099    InvalidDeviceDescriptor(-121),
100    /**
101     *  CouldNotSendCanFrame
102     */
103    CouldNotSendCanFrame(-123),
104    /**
105     *  NormalModeMsgNotPresent
106     */
107    NormalModeMsgNotPresent(-124),
108    /**
109     *  This feature is not supported.
110     */
111    FeatureNotSupported(-125),
112    /**
113     *  NotUpdating
114     */
115    NotUpdating(-126),
116    /**
117     *  CorruptedPOST
118     */
119    CorruptedPOST(-127),
120    /**
121     *  NoConfigs
122     */
123    NoConfigs(-128),
124    /**
125     *  ConfigFailed
126     */
127    ConfigFailed(-129),
128    /**
129     *  CouldNotReqFactoryDefault
130     */
131    CouldNotReqFactoryDefault(-130),
132    /**
133     *  CustomNameNotSupported
134     */
135    CustomNameNotSupported(-131),
136    /**
137     *  ConfigReadWriteMismatch
138     */
139    ConfigReadWriteMismatch(-132),
140    /**
141     *  CouldNotReqSetConfigs
142     */
143    CouldNotReqSetConfigs(-133),
144    /**
145     *  InsufficientSz
146     */
147    InsufficientSz(-134),
148    /**
149     *  InvalidModel
150     */
151    InvalidModel(-135),
152    /**
153     *  CouldNotReqDevInfo
154     */
155    CouldNotReqDevInfo(-140),
156    /**
157     *  NoControls
158     */
159    NoControls(-141),
160    /**
161     *  DeviceIsNull
162     */
163    DeviceIsNull(-142),
164    /**
165     *  DeviceDidNotRespondToDiagReq
166     */
167    DeviceDidNotRespondToDiagReq(-143),
168    /**
169     *  OnlySupportedInTunerX
170     */
171    OnlySupportedInTunerX(-144),
172    /**
173     *  CanivCliError
174     */
175    CanivCliError(-145),
176    /**
177     *  InvalidCrfBadHeader
178     */
179    InvalidCrfBadHeader(-200),
180    /**
181     *  InvalidCrfFileSzInvald
182     */
183    InvalidCrfFileSzInvald(-201),
184    /**
185     *  InvalidCrfWrongProduct
186     */
187    InvalidCrfWrongProduct(-202),
188    /**
189     *  InvalidCrfNoSects
190     */
191    InvalidCrfNoSects(-203),
192    /**
193     *  InvalidCrfBadSectHeader
194     */
195    InvalidCrfBadSectHeader(-204),
196    /**
197     *  InvalidCrfBadSectSize
198     */
199    InvalidCrfBadSectSize(-205),
200    /**
201     *  NoCrfFile
202     */
203    NoCrfFile(-206),
204    /**
205     *  CouldNotFindDynamicId
206     */
207    CouldNotFindDynamicId(-300),
208    /**
209     *  DidNotGetDhcp
210     */
211    DidNotGetDhcp(-301),
212    /**
213     *  DidNotGetFullDhcp
214     */
215    DidNotGetFullDhcp(-302),
216    /**
217     *  InvalidLicenseResp
218     */
219    InvalidLicenseResp(-350),
220    /**
221     *  InvalidCanivCache
222     */
223    InvalidCanivCache(-351),
224    /**
225     *  CannotOpenSerialPort
226     */
227    CannotOpenSerialPort(-500),
228    /**
229     *  CannotWriteSerialPort
230     */
231    CannotWriteSerialPort(-501),
232    /**
233     *  CannotReadSerialPort
234     */
235    CannotReadSerialPort(-502),
236    /**
237     *  CannotSerialToDevice
238     */
239    CannotSerialToDevice(-503),
240    /**
241     *  NoSerialControlFrameResp
242     */
243    NoSerialControlFrameResp(-504),
244    /**
245     *  CannotOpenUdpPort
246     */
247    CannotOpenUdpPort(-600),
248    /**
249     *  CannotWriteUdpPort
250     */
251    CannotWriteUdpPort(-601),
252    /**
253     *  CannotReadUdpPort
254     */
255    CannotReadUdpPort(-602),
256    /**
257     *  CannotUdpToDevice
258     */
259    CannotUdpToDevice(-603),
260    /**
261     *  NoUdpControlFrameResp
262     */
263    NoUdpControlFrameResp(-604),
264    /**
265     *  TimeoutIso15Response
266     */
267    TimeoutIso15Response(-605),
268    /**
269     *  InvalidJson
270     */
271    InvalidJson(-700),
272    /**
273     *  AppIsTerminating
274     */
275    AppIsTerminating(-800),
276    /**
277     *  CAN Message is stale.
278     */
279    CanMessageStale(1000),
280    /**
281     *  Buffer is full, cannot insert more data.
282     */
283    BufferFull(1006),
284    /**
285     *  PulseWidthSensorNotPresent
286     */
287    PulseWidthSensorNotPresent(1010),
288    /**
289     *  General Warning Occurred.
290     */
291    GeneralWarning(1100),
292    /**
293     *  Firm Vers could not be retrieved. Use Phoenix Tuner to check ID and
294     *  firmware(CRF) version.
295     */
296    FirmVersionCouldNotBeRetrieved(1103),
297    /**
298     *  This feature will be supported in a future update.
299     */
300    FeaturesNotAvailableYet(1104),
301    /**
302     *  The control mode is not valid for this function.
303     */
304    ControlModeNotValid(1105),
305    /**
306     *  This control mode is not supported yet.  A future release will supported
307     *  this soon.
308     */
309    ControlModeNotSupportedYet(1106),
310    /**
311     *  Motor Controller must have >= 3.2 firmware for motion profile control mode.
312     */
313    MotProfFirmThreshold(1109),
314    /**
315     *  Motor Controller must have >= 3.4 firmware for advanced PID0/PID1 features.
316     */
317    MotProfFirmThreshold2(1110),
318    /**
319     *  SimDeviceNotFound
320     */
321    SimDeviceNotFound(1200),
322    /**
323     *  SimPhysicsTypeNotSupported
324     */
325    SimPhysicsTypeNotSupported(1201),
326    /**
327     *  SimDeviceAlreadyExists
328     */
329    SimDeviceAlreadyExists(1202),
330    /**
331     *  Could not transmit CAN Frame.
332     */
333    TxFailed(-1001),
334    /**
335     *  Incorrect argument passed into function/VI.
336     */
337    InvalidParamValue(-1002),
338    /**
339     *  CAN frame not received/too-stale.
340     */
341    RxTimeout(-1003),
342    /**
343     *  CAN Transmit timed out.
344     */
345    TxTimeout(-1004),
346    /**
347     *  ArbID is incorrect.
348     */
349    UnexpectedArbId(-1005),
350    /**
351     *  CanOverflowed
352     */
353    CanOverflowed(-1006),
354    /**
355     *  Sensor Not Present.
356     */
357    SensorNotPresent(-1007),
358    /**
359     *  Firmware Too Old.  Use Phoenix Tuner to field upgrade your CTRE CAN device
360     *  firmware(CRF).  Then restart your robot application to clear this error.
361     */
362    FirmwareTooOld(-1008),
363    /**
364     *  Control Frame Period could not be changed.  Most likely it is not being
365     *  transmitted.
366     */
367    CouldNotChangePeriod(-1009),
368    /**
369     *  BufferFailure
370     */
371    BufferFailure(-1010),
372    /**
373     *  Firmware is legacy non-FRC version.  Use Phoenix Tuner to field upgrade your
374     *  CTRE CAN device firmware(CRF).  Firmware greater than 20.0 required.
375     */
376    FirmwareNonFRC(-1011),
377    /**
378     *  General Error Occurred.
379     */
380    GeneralError(-1100),
381    /**
382     *  No new response to update signal.
383     */
384    SigNotUpdated(-1200),
385    /**
386     *  NotAllPIDValuesUpdated
387     */
388    NotAllPIDValuesUpdated(-1201),
389    /**
390     *  GEN_PORT_ERROR
391     */
392    GEN_PORT_ERROR(-1300),
393    /**
394     *  PORT_MODULE_TYPE_MISMATCH
395     */
396    PORT_MODULE_TYPE_MISMATCH(-1301),
397    /**
398     *  GEN_MODULE_ERROR
399     */
400    GEN_MODULE_ERROR(-1400),
401    /**
402     *  MODULE_NOT_INIT_SET_ERROR
403     */
404    MODULE_NOT_INIT_SET_ERROR(-1401),
405    /**
406     *  MODULE_NOT_INIT_GET_ERROR
407     */
408    MODULE_NOT_INIT_GET_ERROR(-1402),
409    /**
410     *  Wheel Radius is too small, cannot get distance traveled.
411     */
412    WheelRadiusTooSmall(-1500),
413    /**
414     *  Ticks per revolution is 0, cannot get heading.
415     */
416    TicksPerRevZero(-1501),
417    /**
418     *  Distance between wheels is too small, cannot get heading.
419     */
420    DistanceBetweenWheelsTooSmall(-1502),
421    /**
422     *  GainsAreNotSet
423     */
424    GainsAreNotSet(-1503),
425    /**
426     *  Use RemoteLimitSwitchSource instead of LimitSwitchSource.
427     */
428    WrongRemoteLimitSwitchSource(-1504),
429    /**
430     *  Motor Controller Voltage Compensation should not be used with setVoltage(). 
431     *  This causes compensation to happen twice.  Disable Voltage Compensation by
432     *  calling enableVoltageCompensation(false) in order to use setVoltage().
433     */
434    DoubleVoltageCompensatingWPI(-1505),
435    /**
436     *  CANdleAnimSlotOutOfBounds
437     */
438    CANdleAnimSlotOutOfBounds(-1506),
439    /**
440     *  IncompatibleMode
441     */
442    IncompatibleMode(-1600),
443    /**
444     *  Handle passed into function is incorrect.
445     */
446    InvalidHandle(-1601),
447    /**
448     *  Features requires newer firmware version.
449     */
450    FeatureRequiresHigherFirm(-1700),
451    /**
452     *  Config factory default features require firmware >=3.10.
453     */
454    ConfigFactoryDefaultRequiresHigherFirm(-1702),
455    /**
456     *  Config Motion S Curve Strength features require firmware >=4.16.
457     */
458    ConfigMotionSCurveRequiresHigherFirm(-1703),
459    /**
460     *  Talon FX(Falcon 500) Firmware Too Old.  Use Phoenix Tuner to field upgrade
461     *  your CTRE CAN device firmware(CRF) to >=20.3. Then restart your robot
462     *  application to clear this error.
463     */
464    TalonFXFirmwarePreVBatDetect(-1704),
465    /**
466     *  CANdleAnimationsRequireHigherFirm
467     */
468    CANdleAnimationsRequireHigherFirm(-1705),
469    /**
470     *  LibraryCouldNotBeLoaded
471     */
472    LibraryCouldNotBeLoaded(-1800),
473    /**
474     *  MissingRoutineInLibrary
475     */
476    MissingRoutineInLibrary(-1801),
477    /**
478     *  ResourceNotAvailable
479     */
480    ResourceNotAvailable(-1802),
481    /**
482     *  Could not find music file specified, try specifying an absolute path.
483     */
484    MusicFileNotFound(-1900),
485    /**
486     *  Music file size is incorrect, could not parse correctly. Ensure you're using
487     *  Tuner to generate file.
488     */
489    MusicFileWrongSize(-1901),
490    /**
491     *  Music file version is too new, update Phoenix to utilize this file.
492     */
493    MusicFileTooNew(-1902),
494    /**
495     *  Music file is invalid. Ensure you're using Tuner to generate file.
496     */
497    MusicFileInvalid(-1903),
498    /**
499     *  An invalid orchestra action occurred. Ensure a music file is loaded.
500     */
501    InvalidOrchestraAction(-1904),
502    /**
503     *  This music file version is too old. Regenerate file using Tuner.
504     */
505    MusicFileTooOld(-1905),
506    /**
507     *  Music interrupted due to one of the instruments being commanded a different
508     *  control mode. Press Play to resume music.
509     */
510    MusicInterrupted(-1906),
511    /**
512     *  This device doesn't support MusicTone control mode.
513     */
514    MusicNotSupported(-1907),
515    /**
516     *  kInvalidInterface
517     */
518    kInvalidInterface(-2000),
519    /**
520     *  kInvalidGuid
521     */
522    kInvalidGuid(-2001),
523    /**
524     *  kInvalidClass
525     */
526    kInvalidClass(-2002),
527    /**
528     *  kInvalidProtocol
529     */
530    kInvalidProtocol(-2003),
531    /**
532     *  kInvalidPath
533     */
534    kInvalidPath(-2004),
535    /**
536     *  kGeneralWinUsbError
537     */
538    kGeneralWinUsbError(-2005),
539    /**
540     *  kFailedSetup
541     */
542    kFailedSetup(-2006),
543    /**
544     *  kListenFailed
545     */
546    kListenFailed(-2007),
547    /**
548     *  kSendFailed
549     */
550    kSendFailed(-2008),
551    /**
552     *  kReceiveFailed
553     */
554    kReceiveFailed(-2009),
555    /**
556     *  kInvalidRespFormat
557     */
558    kInvalidRespFormat(-2010),
559    /**
560     *  kWinUsbInitFailed
561     */
562    kWinUsbInitFailed(-2011),
563    /**
564     *  kWinUsbQueryFailed
565     */
566    kWinUsbQueryFailed(-2012),
567    /**
568     *  kWinUsbGeneralError
569     */
570    kWinUsbGeneralError(-2013),
571    /**
572     *  kAccessDenied
573     */
574    kAccessDenied(-2014),
575    /**
576     *  kFirmwareInvalidResponse
577     */
578    kFirmwareInvalidResponse(-2015),
579    /**
580     *  This StatusCode has not been initialized. Make sure the StatusCode is
581     *  getting assigned to the return of a method.
582     */
583    StatusCodeNotInitialized(-10000),
584    /**
585     *  WarningNotInitialized
586     */
587    WarningNotInitialized(10000),
588    /**
589     *  The timestamp reported by CANivore is at least 10ms older than the timestamp
590     *  reported by the system, indicating it's fallen out of sync. This does not
591     *  impact the data of this message, only the timing.
592     */
593    HwTimestampOutOfSync(10001),
594    /**
595     *  InvalidNetwork
596     */
597    InvalidNetwork(-10001),
598    /**
599     *  MultiSignalNotSupported
600     */
601    MultiSignalNotSupported(-10002),
602    /**
603     *  Could not cast from base value to this particular signal's type
604     */
605    CouldNotCast(-10003),
606    /**
607     *  Could not find this value when searching for it
608     */
609    NotFound(-10004),
610    /**
611     *  This is not supported
612     */
613    NotSupported(-10005),
614    /**
615     *  Could not determine context from this device hash
616     */
617    MissingContext(-10006),
618    /**
619     *  Model name in license file does not match model name of selected device.
620     */
621    ModelMismatch(-10007),
622    /**
623     *  Serial Number in license file does not match model name of selected device.
624     */
625    SerialMismatch(-10008),
626    /**
627     *  Could not find specified file.
628     */
629    NoFile(-10009),
630    /**
631     *  License did not successfully download to Device.
632     */
633    LicenseDownloadFailed(-10010),
634    /**
635     *  Self Test report does not have any values, is the firmware up to date?
636     */
637    SelfTestIsEmpty(-10011),
638    /**
639     *  Failed to lookup signal properties.  This can happen if the fimware is too
640     *  new and supports signals that older APIs do not support.
641     */
642    SignalLookupFailed(-10012),
643    /**
644     *  The current mode of the device is invalid for getting this signal.
645     */
646    InvalidModeToGetSignal(-10013),
647    /**
648     *  Device is not licensed. Cannot get any data from it.
649     */
650    UnlicensedDevice(-10014),
651    /**
652     *  Size is invalid.
653     */
654    InvalidSize(-10015),
655    /**
656     *  InvalidLicenseResponse
657     */
658    InvalidLicenseResponse(-10016),
659    /**
660     *  InvalidContext
661     */
662    InvalidContext(-10017),
663    /**
664     *  InternalError
665     */
666    InternalError(-10018),
667    /**
668     *  TaskIsBusy
669     */
670    TaskIsBusy(-10019),
671    /**
672     *  kDeviceResponseIncorrect
673     */
674    kDeviceResponseIncorrect(-10020),
675    /**
676     *  kErrorPollingForDevices
677     */
678    kErrorPollingForDevices(-10021),
679    /**
680     *  Device firmware could not be retrieved. Check that the device is running Pro
681     *  firmware, that the device ID is correct, that the specified CAN bus is
682     *  correct, and that the device is powered.
683     */
684    CouldNotRetrieveProFirmware(-10022),
685    /**
686     *  Device firmware could not be decoded. Check that the device is running Pro
687     *  firmware, that the device ID is correct, that the specified CAN bus is
688     *  correct, and that the device is powered.
689     */
690    CouldNotDecodeDeviceFirmware(-10023),
691    /**
692     *  The values specified for master are in valid.  Make sure the Device ID of
693     *  master are correct.
694     */
695    InvalidIDToFollow(-10024),;
696
697    public final int value;
698
699    StatusCode(int initValue) {
700        this.value = initValue;
701    }
702
703    private static HashMap<Integer, StatusCode> _map = null;
704    static {
705        _map = new HashMap<Integer, StatusCode>();
706        for (StatusCode type : StatusCode.values()) {
707            _map.put(type.value, type);
708        }
709    }
710
711    /**
712     * Gets StatusCode from specified value
713     *
714     * @param value Value of StatusCode
715     * @return StatusCode of specified value
716     */
717    public static StatusCode valueOf(int value) {
718        StatusCode retval = _map.get(value);
719        if (retval != null)
720            return retval;
721        return StatusCode.values()[0];
722    }
723
724    /**
725     * @return true if this code is an error
726     */
727    public boolean isError() {
728        return value < 0;
729    }
730
731    /**
732     * @return true if this code is a warning
733     */
734    public boolean isWarning() {
735        return value > 0;
736    }
737
738    /**
739     * @return true if this code is OK
740     */
741    public boolean isOK() {
742        return value == StatusCode.OK.value;
743    }
744
745    /**
746     * Gets the name of this StatusCode
747     *
748     * @return Name of this StatusCode
749     */
750    public String getName() {
751        switch (value) {
752            case 0: return "OK";
753            case -101: return "InvalidDeviceSpec";
754            case -102: return "EcuIsNotPresent";
755            case -103: return "CouldNotEnterBl";
756            case -104: return "CouldNotConfirmBl";
757            case -105: return "CouldNotErase";
758            case -106: return "CouldNotSendFlash";
759            case -107: return "CouldNotValidate";
760            case -108: return "CouldNotRunApp";
761            case -109: return "CouldNotReqSetId";
762            case -110: return "CouldNotConfirmId";
763            case -111: return "FlashWasGood";
764            case -112: return "AppTooOld";
765            case -113: return "CouldNotReqSetDesc";
766            case -114: return "CompileSzIsWrong";
767            case -115: return "GadgeteerDeviceNoSetId";
768            case -116: return "InvalidTask";
769            case -117: return "NotImplemented";
770            case -118: return "NoDevicesOnBus";
771            case -119: return "MoreThanOneFile";
772            case -120: return "NodeIsInvalid";
773            case -121: return "InvalidDeviceDescriptor";
774            case -123: return "CouldNotSendCanFrame";
775            case -124: return "NormalModeMsgNotPresent";
776            case -125: return "FeatureNotSupported";
777            case -126: return "NotUpdating";
778            case -127: return "CorruptedPOST";
779            case -128: return "NoConfigs";
780            case -129: return "ConfigFailed";
781            case -130: return "CouldNotReqFactoryDefault";
782            case -131: return "CustomNameNotSupported";
783            case -132: return "ConfigReadWriteMismatch";
784            case -133: return "CouldNotReqSetConfigs";
785            case -134: return "InsufficientSz";
786            case -135: return "InvalidModel";
787            case -140: return "CouldNotReqDevInfo";
788            case -141: return "NoControls";
789            case -142: return "DeviceIsNull";
790            case -143: return "DeviceDidNotRespondToDiagReq";
791            case -144: return "OnlySupportedInTunerX";
792            case -145: return "CanivCliError";
793            case -200: return "InvalidCrfBadHeader";
794            case -201: return "InvalidCrfFileSzInvald";
795            case -202: return "InvalidCrfWrongProduct";
796            case -203: return "InvalidCrfNoSects";
797            case -204: return "InvalidCrfBadSectHeader";
798            case -205: return "InvalidCrfBadSectSize";
799            case -206: return "NoCrfFile";
800            case -300: return "CouldNotFindDynamicId";
801            case -301: return "DidNotGetDhcp";
802            case -302: return "DidNotGetFullDhcp";
803            case -350: return "InvalidLicenseResp";
804            case -351: return "InvalidCanivCache";
805            case -500: return "CannotOpenSerialPort";
806            case -501: return "CannotWriteSerialPort";
807            case -502: return "CannotReadSerialPort";
808            case -503: return "CannotSerialToDevice";
809            case -504: return "NoSerialControlFrameResp";
810            case -600: return "CannotOpenUdpPort";
811            case -601: return "CannotWriteUdpPort";
812            case -602: return "CannotReadUdpPort";
813            case -603: return "CannotUdpToDevice";
814            case -604: return "NoUdpControlFrameResp";
815            case -605: return "TimeoutIso15Response";
816            case -700: return "InvalidJson";
817            case -800: return "AppIsTerminating";
818            case 1000: return "CanMessageStale";
819            case 1006: return "BufferFull";
820            case 1010: return "PulseWidthSensorNotPresent";
821            case 1100: return "GeneralWarning";
822            case 1103: return "FirmVersionCouldNotBeRetrieved";
823            case 1104: return "FeaturesNotAvailableYet";
824            case 1105: return "ControlModeNotValid";
825            case 1106: return "ControlModeNotSupportedYet";
826            case 1109: return "MotProfFirmThreshold";
827            case 1110: return "MotProfFirmThreshold2";
828            case 1200: return "SimDeviceNotFound";
829            case 1201: return "SimPhysicsTypeNotSupported";
830            case 1202: return "SimDeviceAlreadyExists";
831            case -1001: return "TxFailed";
832            case -1002: return "InvalidParamValue";
833            case -1003: return "RxTimeout";
834            case -1004: return "TxTimeout";
835            case -1005: return "UnexpectedArbId";
836            case -1006: return "CanOverflowed";
837            case -1007: return "SensorNotPresent";
838            case -1008: return "FirmwareTooOld";
839            case -1009: return "CouldNotChangePeriod";
840            case -1010: return "BufferFailure";
841            case -1011: return "FirmwareNonFRC";
842            case -1100: return "GeneralError";
843            case -1200: return "SigNotUpdated";
844            case -1201: return "NotAllPIDValuesUpdated";
845            case -1300: return "GEN_PORT_ERROR";
846            case -1301: return "PORT_MODULE_TYPE_MISMATCH";
847            case -1400: return "GEN_MODULE_ERROR";
848            case -1401: return "MODULE_NOT_INIT_SET_ERROR";
849            case -1402: return "MODULE_NOT_INIT_GET_ERROR";
850            case -1500: return "WheelRadiusTooSmall";
851            case -1501: return "TicksPerRevZero";
852            case -1502: return "DistanceBetweenWheelsTooSmall";
853            case -1503: return "GainsAreNotSet";
854            case -1504: return "WrongRemoteLimitSwitchSource";
855            case -1505: return "DoubleVoltageCompensatingWPI";
856            case -1506: return "CANdleAnimSlotOutOfBounds";
857            case -1600: return "IncompatibleMode";
858            case -1601: return "InvalidHandle";
859            case -1700: return "FeatureRequiresHigherFirm";
860            case -1702: return "ConfigFactoryDefaultRequiresHigherFirm";
861            case -1703: return "ConfigMotionSCurveRequiresHigherFirm";
862            case -1704: return "TalonFXFirmwarePreVBatDetect";
863            case -1705: return "CANdleAnimationsRequireHigherFirm";
864            case -1800: return "LibraryCouldNotBeLoaded";
865            case -1801: return "MissingRoutineInLibrary";
866            case -1802: return "ResourceNotAvailable";
867            case -1900: return "MusicFileNotFound";
868            case -1901: return "MusicFileWrongSize";
869            case -1902: return "MusicFileTooNew";
870            case -1903: return "MusicFileInvalid";
871            case -1904: return "InvalidOrchestraAction";
872            case -1905: return "MusicFileTooOld";
873            case -1906: return "MusicInterrupted";
874            case -1907: return "MusicNotSupported";
875            case -2000: return "kInvalidInterface";
876            case -2001: return "kInvalidGuid";
877            case -2002: return "kInvalidClass";
878            case -2003: return "kInvalidProtocol";
879            case -2004: return "kInvalidPath";
880            case -2005: return "kGeneralWinUsbError";
881            case -2006: return "kFailedSetup";
882            case -2007: return "kListenFailed";
883            case -2008: return "kSendFailed";
884            case -2009: return "kReceiveFailed";
885            case -2010: return "kInvalidRespFormat";
886            case -2011: return "kWinUsbInitFailed";
887            case -2012: return "kWinUsbQueryFailed";
888            case -2013: return "kWinUsbGeneralError";
889            case -2014: return "kAccessDenied";
890            case -2015: return "kFirmwareInvalidResponse";
891            case -10000: return "StatusCodeNotInitialized";
892            case 10000: return "WarningNotInitialized";
893            case 10001: return "HwTimestampOutOfSync";
894            case -10001: return "InvalidNetwork";
895            case -10002: return "MultiSignalNotSupported";
896            case -10003: return "CouldNotCast";
897            case -10004: return "NotFound";
898            case -10005: return "NotSupported";
899            case -10006: return "MissingContext";
900            case -10007: return "ModelMismatch";
901            case -10008: return "SerialMismatch";
902            case -10009: return "NoFile";
903            case -10010: return "LicenseDownloadFailed";
904            case -10011: return "SelfTestIsEmpty";
905            case -10012: return "SignalLookupFailed";
906            case -10013: return "InvalidModeToGetSignal";
907            case -10014: return "UnlicensedDevice";
908            case -10015: return "InvalidSize";
909            case -10016: return "InvalidLicenseResponse";
910            case -10017: return "InvalidContext";
911            case -10018: return "InternalError";
912            case -10019: return "TaskIsBusy";
913            case -10020: return "kDeviceResponseIncorrect";
914            case -10021: return "kErrorPollingForDevices";
915            case -10022: return "CouldNotRetrieveProFirmware";
916            case -10023: return "CouldNotDecodeDeviceFirmware";
917            case -10024: return "InvalidIDToFollow";
918            default:
919                return "Could not find name";
920        }
921    }
922
923    /**
924     * Gets the description of this StatusCode
925     *
926     * @return Description of this StatusCode
927     */
928    public String getDescription() {
929        switch (value) {
930            case 0: return "No Error";
931            case -101: return "InvalidDeviceSpec";
932            case -102: return "EcuIsNotPresent";
933            case -103: return "CouldNotEnterBl";
934            case -104: return "CouldNotConfirmBl";
935            case -105: return "CouldNotErase";
936            case -106: return "CouldNotSendFlash";
937            case -107: return "CouldNotValidate";
938            case -108: return "CouldNotRunApp";
939            case -109: return "CouldNotReqSetId";
940            case -110: return "CouldNotConfirmId";
941            case -111: return "FlashWasGood";
942            case -112: return "AppTooOld";
943            case -113: return "CouldNotReqSetDesc";
944            case -114: return "CompileSzIsWrong";
945            case -115: return "GadgeteerDeviceNoSetId";
946            case -116: return "InvalidTask";
947            case -117: return "Not Implemented, check latest installer.";
948            case -118: return "NoDevicesOnBus";
949            case -119: return "MoreThanOneFile";
950            case -120: return "NodeIsInvalid";
951            case -121: return "InvalidDeviceDescriptor";
952            case -123: return "CouldNotSendCanFrame";
953            case -124: return "NormalModeMsgNotPresent";
954            case -125: return "This feature is not supported.";
955            case -126: return "NotUpdating";
956            case -127: return "CorruptedPOST";
957            case -128: return "NoConfigs";
958            case -129: return "ConfigFailed";
959            case -130: return "CouldNotReqFactoryDefault";
960            case -131: return "CustomNameNotSupported";
961            case -132: return "ConfigReadWriteMismatch";
962            case -133: return "CouldNotReqSetConfigs";
963            case -134: return "InsufficientSz";
964            case -135: return "InvalidModel";
965            case -140: return "CouldNotReqDevInfo";
966            case -141: return "NoControls";
967            case -142: return "DeviceIsNull";
968            case -143: return "DeviceDidNotRespondToDiagReq";
969            case -144: return "OnlySupportedInTunerX";
970            case -145: return "CanivCliError";
971            case -200: return "InvalidCrfBadHeader";
972            case -201: return "InvalidCrfFileSzInvald";
973            case -202: return "InvalidCrfWrongProduct";
974            case -203: return "InvalidCrfNoSects";
975            case -204: return "InvalidCrfBadSectHeader";
976            case -205: return "InvalidCrfBadSectSize";
977            case -206: return "NoCrfFile";
978            case -300: return "CouldNotFindDynamicId";
979            case -301: return "DidNotGetDhcp";
980            case -302: return "DidNotGetFullDhcp";
981            case -350: return "InvalidLicenseResp";
982            case -351: return "InvalidCanivCache";
983            case -500: return "CannotOpenSerialPort";
984            case -501: return "CannotWriteSerialPort";
985            case -502: return "CannotReadSerialPort";
986            case -503: return "CannotSerialToDevice";
987            case -504: return "NoSerialControlFrameResp";
988            case -600: return "CannotOpenUdpPort";
989            case -601: return "CannotWriteUdpPort";
990            case -602: return "CannotReadUdpPort";
991            case -603: return "CannotUdpToDevice";
992            case -604: return "NoUdpControlFrameResp";
993            case -605: return "TimeoutIso15Response";
994            case -700: return "InvalidJson";
995            case -800: return "AppIsTerminating";
996            case 1000: return "CAN Message is stale.";
997            case 1006: return "Buffer is full, cannot insert more data.";
998            case 1010: return "PulseWidthSensorNotPresent";
999            case 1100: return "General Warning Occurred.";
1000            case 1103: return "Firm Vers could not be retrieved. Use Phoenix Tuner to check ID and firmware(CRF) version.";
1001            case 1104: return "This feature will be supported in a future update.";
1002            case 1105: return "The control mode is not valid for this function.";
1003            case 1106: return "This control mode is not supported yet.  A future release will supported this soon.";
1004            case 1109: return "Motor Controller must have >= 3.2 firmware for motion profile control mode.";
1005            case 1110: return "Motor Controller must have >= 3.4 firmware for advanced PID0/PID1 features.";
1006            case 1200: return "SimDeviceNotFound";
1007            case 1201: return "SimPhysicsTypeNotSupported";
1008            case 1202: return "SimDeviceAlreadyExists";
1009            case -1001: return "Could not transmit CAN Frame.";
1010            case -1002: return "Incorrect argument passed into function/VI.";
1011            case -1003: return "CAN frame not received/too-stale.";
1012            case -1004: return "CAN Transmit timed out.";
1013            case -1005: return "ArbID is incorrect.";
1014            case -1006: return "CanOverflowed";
1015            case -1007: return "Sensor Not Present.";
1016            case -1008: return "Firmware Too Old.  Use Phoenix Tuner to field upgrade your CTRE CAN device firmware(CRF).  Then restart your robot application to clear this error.";
1017            case -1009: return "Control Frame Period could not be changed.  Most likely it is not being transmitted.";
1018            case -1010: return "BufferFailure";
1019            case -1011: return "Firmware is legacy non-FRC version.  Use Phoenix Tuner to field upgrade your CTRE CAN device firmware(CRF).  Firmware greater than 20.0 required.";
1020            case -1100: return "General Error Occurred.";
1021            case -1200: return "No new response to update signal.";
1022            case -1201: return "NotAllPIDValuesUpdated";
1023            case -1300: return "GEN_PORT_ERROR";
1024            case -1301: return "PORT_MODULE_TYPE_MISMATCH";
1025            case -1400: return "GEN_MODULE_ERROR";
1026            case -1401: return "MODULE_NOT_INIT_SET_ERROR";
1027            case -1402: return "MODULE_NOT_INIT_GET_ERROR";
1028            case -1500: return "Wheel Radius is too small, cannot get distance traveled.";
1029            case -1501: return "Ticks per revolution is 0, cannot get heading.";
1030            case -1502: return "Distance between wheels is too small, cannot get heading.";
1031            case -1503: return "GainsAreNotSet";
1032            case -1504: return "Use RemoteLimitSwitchSource instead of LimitSwitchSource.";
1033            case -1505: return "Motor Controller Voltage Compensation should not be used with setVoltage().  This causes compensation to happen twice.  Disable Voltage Compensation by calling enableVoltageCompensation(false) in order to use setVoltage().";
1034            case -1506: return "CANdleAnimSlotOutOfBounds";
1035            case -1600: return "IncompatibleMode";
1036            case -1601: return "Handle passed into function is incorrect.";
1037            case -1700: return "Features requires newer firmware version.";
1038            case -1702: return "Config factory default features require firmware >=3.10.";
1039            case -1703: return "Config Motion S Curve Strength features require firmware >=4.16.";
1040            case -1704: return "Talon FX(Falcon 500) Firmware Too Old.  Use Phoenix Tuner to field upgrade your CTRE CAN device firmware(CRF) to >=20.3. Then restart your robot application to clear this error.";
1041            case -1705: return "CANdleAnimationsRequireHigherFirm";
1042            case -1800: return "LibraryCouldNotBeLoaded";
1043            case -1801: return "MissingRoutineInLibrary";
1044            case -1802: return "ResourceNotAvailable";
1045            case -1900: return "Could not find music file specified, try specifying an absolute path.";
1046            case -1901: return "Music file size is incorrect, could not parse correctly. Ensure you're using Tuner to generate file.";
1047            case -1902: return "Music file version is too new, update Phoenix to utilize this file.";
1048            case -1903: return "Music file is invalid. Ensure you're using Tuner to generate file.";
1049            case -1904: return "An invalid orchestra action occurred. Ensure a music file is loaded.";
1050            case -1905: return "This music file version is too old. Regenerate file using Tuner.";
1051            case -1906: return "Music interrupted due to one of the instruments being commanded a different control mode. Press Play to resume music.";
1052            case -1907: return "This device doesn't support MusicTone control mode.";
1053            case -2000: return "kInvalidInterface";
1054            case -2001: return "kInvalidGuid";
1055            case -2002: return "kInvalidClass";
1056            case -2003: return "kInvalidProtocol";
1057            case -2004: return "kInvalidPath";
1058            case -2005: return "kGeneralWinUsbError";
1059            case -2006: return "kFailedSetup";
1060            case -2007: return "kListenFailed";
1061            case -2008: return "kSendFailed";
1062            case -2009: return "kReceiveFailed";
1063            case -2010: return "kInvalidRespFormat";
1064            case -2011: return "kWinUsbInitFailed";
1065            case -2012: return "kWinUsbQueryFailed";
1066            case -2013: return "kWinUsbGeneralError";
1067            case -2014: return "kAccessDenied";
1068            case -2015: return "kFirmwareInvalidResponse";
1069            case -10000: return "This StatusCode has not been initialized. Make sure the StatusCode is getting assigned to the return of a method.";
1070            case 10000: return "WarningNotInitialized";
1071            case 10001: return "The timestamp reported by CANivore is at least 10ms older than the timestamp reported by the system, indicating it's fallen out of sync. This does not impact the data of this message, only the timing.";
1072            case -10001: return "InvalidNetwork";
1073            case -10002: return "MultiSignalNotSupported";
1074            case -10003: return "Could not cast from base value to this particular signal's type";
1075            case -10004: return "Could not find this value when searching for it";
1076            case -10005: return "This is not supported";
1077            case -10006: return "Could not determine context from this device hash";
1078            case -10007: return "Model name in license file does not match model name of selected device.";
1079            case -10008: return "Serial Number in license file does not match model name of selected device.";
1080            case -10009: return "Could not find specified file.";
1081            case -10010: return "License did not successfully download to Device.";
1082            case -10011: return "Self Test report does not have any values, is the firmware up to date?";
1083            case -10012: return "Failed to lookup signal properties.  This can happen if the fimware is too new and supports signals that older APIs do not support.";
1084            case -10013: return "The current mode of the device is invalid for getting this signal.";
1085            case -10014: return "Device is not licensed. Cannot get any data from it.";
1086            case -10015: return "Size is invalid.";
1087            case -10016: return "InvalidLicenseResponse";
1088            case -10017: return "InvalidContext";
1089            case -10018: return "InternalError";
1090            case -10019: return "TaskIsBusy";
1091            case -10020: return "kDeviceResponseIncorrect";
1092            case -10021: return "kErrorPollingForDevices";
1093            case -10022: return "Device firmware could not be retrieved. Check that the device is running Pro firmware, that the device ID is correct, that the specified CAN bus is correct, and that the device is powered.";
1094            case -10023: return "Device firmware could not be decoded. Check that the device is running Pro firmware, that the device ID is correct, that the specified CAN bus is correct, and that the device is powered.";
1095            case -10024: return "The values specified for master are in valid.  Make sure the Device ID of master are correct.";
1096            default:
1097                return "Could not find name";
1098        }
1099    }
1100}