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