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