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