using DTS.Common.Behaviors; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; namespace DTS.Common.Enums.DASFactory { public static class DFConstantsAndEnums { /// /// whether to show ADC as signed or unsigned /// http://manuscript.dts.local/f/cases/32992/Add-a-flag-to-show-ADC-in-0-64k-rather-than-32k-to-32k /// this property only holds the value of the attribute and does not /// store or retrieve it /// public static bool AlwaysShowUnsignedADC = false; /// /// the time to wait for FPGA to unlatch in a one shot /// /// public static int OneShotWaitTimeMs = 3000; [Flags] public enum TempLogChannelBits { OnBoardTemp, OnBoardHumidity, EnvironmentalCh1, EnvironmentalCh2, EnvironmentalCh3, EnvironmentalCh4, } public static string TemperatureLogTimeFormat { get; set; } = "MM-dd-yyyy HH:mm:ss"; public static string TemperatureLogValueFormat { get; set; } = "N2"; public const int TSR_AIR_HIGH_G_CUTOFF_RATE_SPS = 500; /// /// 29796 Add ability to configure multiple samples rates for TSR AIR /// public static readonly int[] TSRAIR_ValidSampleRates = new[] { 100, 500, 1000, 5000, 10000, 15000, 20000 }; /// /// Legacy SLICE 1 ARM status faults /// public enum FaultFlags { IncomingStatusLineDropped = 1 << 0, ADCBufferOverrun = 1 << 1, FlashCRCError = 1 << 2, TriggerBeforeStart = 1 << 3, InputVoltageLow = 1 << 4, InputVoltageHigh = 1 << 5, BackupVoltageLow = 1 << 6, BackupVoltageHigh = 1 << 7, OutOfMemory = 1 << 8, SquibResistanceOutOfRange = 1 << 9, SafeSwitchUnplugged = 1 << 10, SquibPowerOutOfRange = 1 << 11, AutoSquibDisableActivated = 1 << 12, NO_DATA = 1 << 13 }; /// /// possible excitation status for DAS /// public enum ExcitationStatus { Off, On, Unknown } public enum T0CorrectionStatus { ScanningForPowerLoss, ScanningForPeaksAndTroughs, SettingAttributes } /// /// Whether to use drop down for test object and position /// does not query database, so property must be set and maintained separately, /// this merely allows passing the information between modules /// 17567 Option to bring back Test Object and Position drop down in Test Set up -> Groups. /// public static bool UseDropDownForTestObjectAndPosition { get; set; } = false; /// /// whether to send EnableFaultChecking to S6DB or not /// public static bool AllowEnableFaultCheckingOnS6DB { get; set; } = true; /// /// returns true if the S6A firmware belongs to an ethernet recorder or not /// /// the amount of weight to add for a single channel when trying to predict the slowest module through diagnostics /// when the channel uses remove offset /// note that the time to remove offset can be highly dependent on the amount of offset present, etc /// implemented for 21200 Correct SlowestModule calculation for TDAS /// public static double TDASRemoveOffsetWeighting { get; set; } = 1D; /// /// amount of weight to add for a single channel when trying to predict the slowest module through diagnostics when /// the channel uses shunt emulation /// public static double TDASShuntEmulationWeighting { get; set; } = .5D; /// /// the expected amount of time in ms MAX for an individual channel in TDAS diagnostics /// public static int ExpectedMaxTDASDiagnosticRunTimePerChannelMS { get; set; } = 8000; /// /// returns true if the S6A firmware belongs to an ethernet recorder or not /// public static bool IsSLICE6ERFirmware(string firmwareVersion) { var tokens = firmwareVersion.Split('-'); var token = tokens.Last(); if (token.Length == 4) { //G1 and G3 are EDRs //http://dtsinfo/dtswiki/index.php/SLICE_Base_Types return token.StartsWith("G1") || token.StartsWith("G3"); } return false; } public static bool UseUDPForAutoArmATDMonitor { get; set; } = false; public const byte ArmStateIdle = 0; public const string MADEUPEVENT_TESTID = "__MadeUp__"; /// /// indicates that no configuration was found on the unit /// originally added as this was an error condition when checking for TOMs on TDAS /// public const string NO_CONFIGURATION = "NO_CONFIGURATION"; /// /// indiciates that a tom safety switch is in the armed position /// public const string TOMSWITCH_ARMED = "TOMSAFETY_ARMED"; /// /// indicates there was an exception and the tom safety switch state could not be determined /// public const string SAFETYSWITCH_EXCEPTION = "SAFETYSWITCH_EXCEPTION"; public const string CHANNEL_SEPARATOR = "_"; public const string SERIAL_SEPARATOR = "-"; public const string LOWG_SERIAL_APPEND = "Low g"; public const string HIGHG_SERIAL_APPEND = "High g"; public const string ARS_SERIAL_APPEND = "ARS"; public const string ANGACCEL_SERIAL_APPEND = "Ang Acc"; public const string ATMOSPHERIC_SERIAL_APPEND = "Atm"; public const string OPTICAL_SERIAL_APPEND = "Opt"; public const string MAGNETIC_SERIAL_APPEND = "Mag"; public const string MAGNETICSWITCH_SERIAL_APPEND = "Mag Sw"; public const string MICROPHONE_SERIAL_APPEND = "Mic"; public const string RTCSECONDANDMARKER_SERIAL_APPEND = "RTC S"; public const string RTCCLOCKNANOPAD_SERIAL_APPEND = "RTC NS"; public const string STREAMOUT_SERIAL_APPEND = "StreamOut"; public const string UART_SERIAL_APPEND = "Uart"; public const int CHANNEL_X = 0; public const int CHANNEL_Y = 1; public const int CHANNEL_Z = 2; public const int CHANNEL_TEMPERATURE = 0; public const int CHANNEL_HUMIDITY = 1; public const int CHANNEL_PRESSURE = 2; public const string USER_CHANNEL_NAME_LOWG = "Low g"; public const string USER_CHANNEL_NAME_HIGHG = "High g"; public const string USER_CHANNEL_NAME_ANGULAR_RATE = "Angular Rate"; public const string USER_CHANNEL_NAME_TEMPERATURE = "Temperature"; public const string USER_CHANNEL_NAME_HUMIDITY = "Humidity"; public const string USER_CHANNEL_NAME_PRESSURE = "Pressure"; public static bool ExtraCommunicationLogging { get; set; } = false; /// /// ReceiveBufferSize in Bytes /// amount of bytes for Ethernet sockets in dasfactory /// 17589 Add new properties from 3.2 tweaks /// public static int ReceiveBufferSizeBytes { get; set; } = 65536; /// /// SendBufferSize in Bytes /// amount of bytes for Ethernet sockets in dasfactory /// 17589 Add new properties from 3.2 tweaks /// public static int SendBufferSizeBytes { get; set; } = 65536; /// /// keep alive time to send to remote clients for time between keep alives in seconds /// 16053 Implement KeepAliveSeconds and KeepAliveRetrySeconds in the .config file /// public static uint RemoteKeepAliveSeconds { get; set; } = 60; /// /// keep alive time to send to remote clients for time for retry interval in seconds /// 16053 Implement KeepAliveSeconds and KeepAliveRetrySeconds in the .config file /// public static uint RemoteKeepAliveRetryIntervalSeconds { get; set; } = 5; /// /// keep alive time to send to local sockets for time between keep alives in ms /// 16053 Implement KeepAliveSeconds and KeepAliveRetrySeconds in the .config file /// public static uint LocalKeepAliveTimeOutMS { get; set; } = 5 * 1000; /// /// keep alive time to set for local sockets for time for retry interval in ms /// 16053 Implement KeepAliveSeconds and KeepAliveRetrySeconds in the .config file /// public static uint LocalKeepAliveRetryIntervalMS = 1000; public static int HeartbeatAsyncConnectTimeoutMS = 10000; public static int WaitTimeBetweenUnitConnects = 100; //15873 TDC vs DP speed improvements //this is just to allow us to skip an SDL during the diagnostics process public static bool DontDoSDL { get; set; } = false; public const int SCHEDULE_AHEAD_IN_MINUTES = 2; //FB 29510 Index for High g sensors public const int High_g_Linear_1_Index = 3; public const int High_g_Linear_2_Index = 4; public const int High_g_Linear_3_Index = 5; /// /// This tells us what type of device it is /// public enum DASType { NONE, HID_SLICE, WINUSB_SLICE, G5, SIM, TOM, DIM, TSR, HEADS, MINIDAU, ETHERNET_SLICE, ETHERNET_RIBEYE, SLICE_DB, TSR2, ETHERNET_TDAS, CDCUSB_SLICE, ETHERNET_SLICE2, WINUSB_SLICE1_5, ETHERNET_SLICE1_5, ETHERNET_SLICE6, ETHERNET_SLICE6AIR, WINUSB_SLICE6, WINUSB_SLICE6AIR, ETHERNET_SLICE6DB, SERIAL_TDAS, ETHERNET_POWERPRO, ETHERNET_TSR_AIR, ETHERNET_SLICE6DB3, WINUSB_TSR_AIR, ETHERNET_SLICEPRODB, WINUSB_SLICE6AIR_BR, ETHERNET_SLICE6AIR_BR, } public enum VoltageStatusColor { Green, Red, Yellow, Off } public const int EVENT_NUMBER_PRETEST_DIAG = -1; public const int EVENT_NUMBER_POSTTEST_DIAG = -2; public const int EVENT_NUMBER_MEASURE_BRIDGE = -3; public static string RealtimeUDPAddress { get; set; } = "UDP://239.1.2.10:8400"; /// /// The different types of modules. /// public enum ModuleType { SliceBridge, SliceARS, G5Analog, G5Digital, ProSIM, ProTOM, ProDIM, RibeyeLED, SLICEIEPE, SliceBridge2High, SliceBridge2Low, SliceIEPE2High, SliceIEPE2Low, EMPTYBANK, SLICEPro_TOM, EmbeddedLinearAccelLowG, EmbeddedLinearAccelHighG, EmbeddedAngularAccel, EmbeddedAngularRate, EmbeddedAtmospheric, EmbeddedMicrophone, EmbeddedMagnetometer, EmbeddedMagnetInput, EmbeddedOptical, EmbeddedClockSecondsAndMarker, EmbeddedClockNanosAndPad, UART, StreamOut, StreamIn } /// /// All available recording mode options. /// public enum RecordingMode { /// /// invalid mode, this can't be used /// [Description("Invalid arm mode")] InvalidArmMode = 0, /// /// circular buffer mode (constant recording, trigger) /// [Description("Circular buffer")] CircularBuffer = 1, /// /// recorder mode (start, trigger) /// [Description("Recorder mode")] RecorderMode = 2, /// /// contant recording, trigger, rearm after data collected /// [Description("Circular buffer multiple-events")] AutoCircularBufferMode = 4, /// /// recorder mode (start, trigger) rearm after data collected /// [Description("Recorder mode multiple-events")] AutoRecorderMode = 5, /// /// ??? /// [Description("Immediate mode")] ImmediateMode = 0x06, /// /// ??? /// [Description("High Power mode")] HighPowerRecorderMode = 0x07, /// /// ??? /// [Description("Low Power mode")] LowPowerRecorderMode = 0x08, /// /// ??? /// [Description("Continuous mode")] ContinuousRecorderMode = 0x09, /// /// ??? /// [Description("Hybrid mode")] HybridRecorderMode = 0x0A, /// /// ??? /// [Description("Hybrid mode Multiple-Events")] MultiHybridRecorderMode = 0x0B, [Description("Active RAM")] RAMActive = 0x0C, // slice6 only. Circular buffer in 32-KB Ram until trigger occur. [Description("Active RAM Multiple-Events")] MultipleEventRAMActive = 0x0D, // multiple event mode /// /// added S6A FM G0K9 (protocol 29) /// 18090 Implement chapter 10 streaming while recording (in DTS format) /// [Description("Recorder and stream subsample")] a14_NormalRecorderAndStreamSubSampleMode = 0x0E, // S6A. Record and streaming realtime out to IRIG IP address. [Description("Multiple event recorder and stream")] a15_MultiRecorderAndStreamSubSampleMode = 0x0F, // S6A. Record and streaming realtime out to IRIG IP address. /// /// added S6A FM G0K9 (protocol 29) /// 18090 Implement chapter 10 streaming while recording (in DTS format) /// [Description("Circular buffer and stream subsample")] a16_CircularBufferAndStreamSubSampleMode = 0x10, // S6A. Record and streaming realtime out to IRIG IP address. [Description("Multiple event circular buffer and stream")] a17_MultiCircularBufferAndStreamSubSampleMode = 0x11, // S6A. Record and streaming realtime out to IRIG IP address. [Description("Hybrid recorder and stream")] a18_HybridRecorderAndStreamSubSampleMode = 0x12, // S6A. Record and streaming realtime out to IRIG IP address. [Description("Multiple event hybrid and stream")] a19_MultiHybridRecorderAndStreamSubSampleMode = 0x13, // S6A. Record and streaming realtime out to IRIG IP address. /// /// ??? /// [Description("Streaming")] S6A_DeviceStreamingOnly = 0x14, /// /// circular buffer mode (constant recording, trigger) + UART recording /// [Description("Circular buffer + UART")] CircularBufferPlusUART = 0x15, /// /// recorder mode (start, trigger) + UART recording /// [Description("Recorder mode + UART")] RecorderModePlusUART = 0x16, /* these display modes don't show up in the UI, they are just internal to the OBR-DDR*/ EthernetUDPRecordingCircularMode = 0x17, EthernetUDPRecordingRecorderMode = 0x18, MultiEthernetUDPRecordingCircularMode = 0x19, MultiEthernetUDPRecordingRecorderMode = 0x1A, EthernetHybridRecorderMode = 0x1B, MultiEthernetHybridRecorderMode = 0x1C, //The following are for TSR AIR only [Description("Aerospace mode")] Aerospace = 0x1D, /// /// active mode (start, trigger) /// not sure why this is duplicated here [AutoActiveMode = AeroSpace] but both have the same value /// I'll just preserve it for now since I want to avoid any side effects /// [Description("Active mode")] AutoActiveMode = Aerospace, // 0x1D, [Description("AerospaceWithMotion mode")] AerospaceWithMotion = 0x1E, [Description("MultipleEventRecorderTriggerStart")] MultipleEventRecorderTriggerStart = 0x1F, [Description("Scheduled mode")] Scheduled = 0x20, [Description("Interval mode")] Interval = 0x21, [Description("Streaming mode")] Streaming = 0x22, //The preceding are for TSR AIR only // Multiple Event + UART [Description("Circular buffer + UART, multiple events")] AutoCircularBufferPlusUART = 0x23, [Description("Recorder mode + UART, multiple events")] AutoRecorderModePlusUART = 0x24, [Description("Continuous mode + UART, multiple events")] ContinuousRecorderModePlusUART = 0x25, [Description("Record on boot, multiple events")] a26_MultiRecordOnBootDataMode = 0x26, [Description("Record on boot + UART, multiple events")] a28_MultiRecordOnBootAndUartDataMode = 0x28, } /// /// All available 3 Axis assignments for the Slice 6 Bubble level tilt feature. /// public enum TiltAxes { [Description("+X+Y+Z")] XYZ = 0, [Description("+X+Z+Y")] XZY = 1, [Description("+Y+X+Z")] YXZ = 2, [Description("+Y+Z+X")] YZX = 3, [Description("+Z+X+Y")] ZXY = 4, [Description("+Z+Y+X")] ZYX = 5, [Description("+X+Y-Z")] XYIZ = 6, [Description("+X+Z-Y")] XZIY = 7, [Description("+Y+X-Z")] YXIZ = 8, [Description("+Y+Z-X")] YZIX = 9, [Description("+Z+X-Y")] ZXIY = 10, [Description("+Z+Y-X")] ZYIX = 11, [Description("+X-Y+Z")] XIYZ = 12, [Description("+X-Z+Y")] XIZY = 13, [Description("+Y-X+Z")] YIXZ = 14, [Description("+Y-Z+X")] YIZX = 15, [Description("+Z-X+Y")] ZIXY = 16, [Description("+Z-Y+X")] ZIYX = 17, [Description("+X-Y-Z")] XIYIZ = 18, [Description("+X-Z-Y")] XIZIY = 19, [Description("+Y-X-Z")] YIXIZ = 20, [Description("+Y-Z-X")] YIZIX = 21, [Description("+Z-X-Y")] ZIXIY = 22, [Description("+Z-Y-X")] ZIYIX = 23, [Description("-X+Y+Z")] IXYZ = 24, [Description("-X+Z+Y")] IXZY = 25, [Description("-Y+X+Z")] IYXZ = 26, [Description("-Y+Z+X")] IYZX = 27, [Description("-Z+X+Y")] IZXY = 28, [Description("-Z+Y+X")] IZYX = 29, [Description("-X+Y-Z")] IXYIZ = 30, [Description("-X+Z-Y")] IXZIY = 31, [Description("-Y+X-Z")] IYXIZ = 32, [Description("-Y+Z-X")] IYZIX = 33, [Description("-Z+X-Y")] IZXIY = 34, [Description("-Z+Y-X")] IZYIX = 35, [Description("-X-Y+Z")] IXIYZ = 36, [Description("-X-Z+Y")] IXIZY = 37, [Description("-Y-X+Z")] IYIXZ = 38, [Description("-Y-Z+X")] IYIZX = 39, [Description("-Z-X+Y")] IZIXY = 40, [Description("-Z-Y+X")] IZIYX = 41, [Description("-X-Y-Z")] IXIYIZ = 42, [Description("-X-Z-Y")] IXIZIY = 43, [Description("-Y-X-Z")] IYIXIZ = 44, [Description("-Y-Z-X")] IYIZIX = 45, [Description("-Z-X-Y")] IZIXIY = 46, [Description("-Z-Y-X")] IZIYIX = 47 } /// /// When the DAS unit arms each channel will be handled based on this mode. /// public enum ConfigMode { /// /// This channel is not part of Data Acquisition in this test. /// Disabled, /// /// Channel is part of current test/event and it's input WILL be sampled on recording. /// Normal, /// /// This channel is only used for 'Dummy' arming and recording and should not be downloaded. /// DummyArm, /// /// This channel is only used for clock recording and should not be downloaded to normal .chn files. /// Clock, /// /// This channel is only used for UART recording and should not be downloaded to normal .chn files. /// UART, /// /// This channel is only used for streaming out and should not be downloaded to normal .chn files. /// StreamOut, /// /// This channel is only used for streaming in and should not be downloaded to normal .chn files. /// StreamIn, } /// /// Determines known device type from udp response /// This is a bitwise device list that is hardcoded on the fw side and part of the UDP brodcast response back to the host /// /// NextOne is reserved for the next device type /// public enum MultiCastDeviceClasses { Unknown = 0, Slice6 = 1 << 0, SDB = 1 << 1, ECM = 1 << 2, S6DB = 1 << 3, Slice6Air = 1 << 4, PowerPro = 1 << 5, TsrAir = 1 << 6, S6DB3 = 1 << 7, S6FALCON = 1 << 8, SPDB = 1 << 9, NextOne = 1 << 10, Any = 0xFFFF, }; public enum ProtocolLimitedCommands { DiangosShuntDAC, QueryMSP430Firmware, MultipleAndHybridEvents, AutoArm, FlashCardInfo, Arm, OnOverride, EnableFaultChecking, OMAP_GPIO, VoltageInsertion, SetDefaultMIF, StackFirmwareUpdate, FileData, StackSensors, BaseSystemTime, PhysicalStartAddress, TestCommunication, StackLowPowerMode, StackChannelTypeConfiguration, SetRealtimeSampleRate, SLICE2_OneWireID, QueryBatteryVoltage, HardwareRevision, HardwareConfiguration, ProgramStackChannels, EventFaultFlags, EventArmAttempts, QueryActualSampleRateImmediate, InitHardwareInputLines, VoltageSysAttributes, DiagnosticTwoVoltExcitation, ExcitationLevel, MultipleEvents, LevelTrigger, Diagnostics, AttributeStoreBlocks, QueryArmAndTriggerStatus_VoltageReadings, MaxEvents, AutoArmDiagnosticDelay, StackChannelAutoArmDiagLevel, FlashClear, DiagnosticsMode, MultipleSamplesRealtime, ResetAttributeStore, IgnoreShortedStartEvent, BaseCalibrationDate, PTPTimestamp, QueryArmAndTriggerStatus_TimeLeftInArm, MeasureInternalOffset, MeasureInternalOffsetSwitches, QueryBatterySOC, StartRecDelayInSecond, QueryTiltSensorData, InSliceTiltSensorADCPre, MeasureBaseDiagnosticChannel, InSliceTemperatureCPre, StartRealtimeStream, HalfBridgeSigPlusSupport, DownloadStreaming, IEPE, QueryEthernetMacTable, QueryClockSyncStatus, SetClockSyncConfig, UDPRealtimeStream, QueryUARTDownload, GetUARTSettings, SetUARTSettings, AutoArmRepeatEnable, MeasurePowerProAllDiagnosticChannel, SetDSPFilterSettings, PTPSyncStatus, QueryTempLogFile, QueryExternalTiltInfo, QueryStackActualSampleRateImmediate, RecordAndStreamSubSample, //17583 Monitor Test UI AutoArmUDPSetting, //18294 Implement Bridge AC/DC coupling (fw update dependent) StackChannelBridgeACCouplerEnable, GenerateEvent, MaxEventsPossible, AdcClockSource, SliceBusEnabled, QATSCurrentAndMaxSample, DBTiltSensor, RemoveLeapSeconds, ADCSamplesPerPacket, DisableStreamingFeature, //30513 PTP Domain ID PTPDomainID, ActiveRAM, RecordOnBoot } /// /// possible command status /// this appears to be common across all commands /// public enum CommandStatus { #pragma warning disable 1591 //disable xml warnings for all the enum values StatusNoError = 0x00, StatusInvalidParameter, StatusInvalidParameterLength, StatusInvalidCommandType, StatusInvalidCommand, StatusInvalidCRC, StatusInvalidModeForCommand, StatusUnimplemented, StatusInvalidReceivedHeaderCRC, StatusInvalidIDForCommand, StatusInvalidPacket, StatusPacketNotAvailableToReceive, StatusPacketNotAvailableToSend, StatusFlashEraseError = 0x10, StatusFlashWriteError, StatusFlashInvalidBlockCRC, StatusFlashInvalidImageCRC, StatusAttributeInvalidNumber = 0x20, StatusAttributeSetError, StatusAttributeBackupSetError, StatusAttributeInvalidBuffer, StatusAttributeNotRegistered, StatusAttributeRegisteredCannotOverwrite, StatusAttributeReadError, StatusAttributeBackupReadError, StatusAttributeInvalidLength, StatusAttributeTypeMismatch, StatusAttributeTypeNotInternallyImplemented = 0x2A, StatusArmInvalidSampleRate = 0x30, StatusArmInvalidEventLength = 0x31, StatusArmInvalidArmMode = 0x32, StatusArmUnimplementedArmMode = 0x33, StatusArmEventNumberTooLarge = 0x34, StatusArmMemoryFull = 0x35, StatusArmInvalidSliceCount = 0x36, StatusArmShortedStartRecordInput = 0x37, StatusArmShortedTriggerInput = 0x38, StatusArmInvalidPretriggerSamplesRequested = 0x39, StatusArmShortedStartAndTrigger = 0x3A, StatusArmEventUncompleted = 0x3B, /** Event completed without end block. Must be interrupted! **/ StatusArmSafeSwitchUnplugged = 0x3C, /** stop arming if safety switch is not connected. **/ StatusArmSquibResistanceFault = 0x3D, /** stop if resistance check fails . **/ StatusArmHardwareFault = 0x3F, StatusSDUnableToStartMultipleBlockWrite = 0x40, StatusSDUnableToFlushWriteBlock, StatusSDUnableToStartMultipleBlockRead, StatusSDUnexpectedAmountOfDataReadOrWritten, StatusSDUnableToResetCard, StatusSDBlockWriteCRCError = 0x45, /** The card reported a CRC error on a block write */ StatusSDWriteTimeout = 0x46, StatusSDReadTimeout = 0x47, StatusSwitchNumberInvalid = 0x50, StatusSwitchSettingInvalid = 0x51, StatusSwitchChannelInvalid = 0x52, StatusDownloadFirstSampleGreaterThanLastSample = 0x60, StatusFirstSampleGreaterThanTotalSamples, StatusDownloadEventHasNoSamples, StatusDownloadInvalidChannelRequested, StatusDownloadInvalidEventRequested, StatusMemoryNullPointerError = 0x70, StatusTestRecorderFull = 0x80, StatusTestRecorderEmpty, StatusSPIInvalidMode = 0x90, StatusSPIInvalidModeForWrite, StatusSlicebusInvalidHeaderCRC = 0xA0, StatusSlicebusInvalidDataCRC, StatusSlicebusNullDescriptor, StatusSlicebusNotImplemented, StatusSlicebusNoResponse, StatusSlicebusNullCommandBuffer, StatusSlicebusCommandBufferTooShort, StatusSetupRequestedSensorRangeTooSmall = 0xB0, StatusSetupInvalidStackChannel, StatusSetupInvalidChannelRequested, StatusSetupInconsistentChannelCountFound, StatusSetupNoShuntTargetsSet, StatusSetupNoBridgeResistancesSet, StatusSetupChannelDoesNotSupportShunt, StatusSetupShuntDACOutputExceeded, StatusSetupRequestedSensorRangeTooLarge, StatusSetupInvalidExciteLevel = 0xB9, StatusSetupI2CWriteFail = 0xBA, StatusSetupI2CReadFail = 0xBB, StatusSetupCALDACOutputExceeded = 0xC0, StatusNoResponse #pragma warning restore 1591 }; /// /// max amount of time to wait for UDP thread to rejoin /// public static int UDP_RECEIVE_TIMEOUT = 10000; /// /// this error code indicates that a socket is not connected /// 15575 No notification if unplug comm cable during downloading on G5 /// https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2 /// public const int WSAEISCONN = 0X2748; /// /// this value signifies an uninitialized date time [date time not set] as opposed to an invalid date time /// [feature not supported] /// 15524 DAS "First Use Date" /// public static readonly DateTime FIRST_USE_DATE_NOT_SET = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue; } public static class RecordingModeExtensions { private static readonly HashSet _recordingModesUsingTestLength = new HashSet() { RecordingModes.Recorder, RecordingModes.RecorderPlusUART, RecordingModes.MultipleEventRecorder, RecordingModes.MultipleEventRecorderPlusUART, RecordingModes.RecorderAndStreamSubSample, RecordingModes.Scheduled, RecordingModes.Interval }; public static bool UsesTestLength(RecordingModes mode) { return _recordingModesUsingTestLength.Contains(mode); } /// /// returns true if the recording mode is only for TSR AIR /// /// /// public static bool IsTSRAIROnlyRecordingMode(RecordingModes mode) { switch (mode) { case RecordingModes.Active: case RecordingModes.MultipleEventActive: case RecordingModes.Scheduled: case RecordingModes.Interval: return true; } return false; } /// /// returns true if the recording mode is allowed on a TSR AIR /// public static bool IsTSRAirRecordingMode(RecordingModes mode) { switch (mode) { case RecordingModes.Active: case RecordingModes.MultipleEventActive: case RecordingModes.Scheduled: case RecordingModes.Interval: case RecordingModes.Streaming: return true; default: return false; } } public static bool SupportsT0Correction(DFConstantsAndEnums.RecordingMode recordingMode) { if (IsACircularBufferMode(recordingMode)) { return true; } if (IsAHybridRecorderMode(recordingMode)) { return true; } return false; } private static readonly IReadOnlyDictionary _altToLookup = new Dictionary() { {DFConstantsAndEnums.RecordingMode.MultiHybridRecorderMode, RecordingModes.MultipleEventHybridRecorder }, {DFConstantsAndEnums.RecordingMode.AutoRecorderMode, RecordingModes.MultipleEventRecorder}, {DFConstantsAndEnums.RecordingMode.Interval, RecordingModes.Interval}, {DFConstantsAndEnums.RecordingMode.AutoCircularBufferMode, RecordingModes.MultipleEventCircularBuffer}, {DFConstantsAndEnums.RecordingMode.AutoActiveMode, RecordingModes.MultipleEventActive} }; private static readonly IReadOnlyDictionary _toLookup = new Dictionary() { { DFConstantsAndEnums.RecordingMode.CircularBuffer, RecordingModes.CircularBuffer }, { DFConstantsAndEnums.RecordingMode.a16_CircularBufferAndStreamSubSampleMode, RecordingModes.CircularBufferAndStreamSubSample}, { DFConstantsAndEnums.RecordingMode.CircularBufferPlusUART, RecordingModes.CircularBufferPlusUART}, { DFConstantsAndEnums.RecordingMode.RecorderMode, RecordingModes.Recorder}, { DFConstantsAndEnums.RecordingMode.RecorderModePlusUART, RecordingModes.RecorderPlusUART}, { DFConstantsAndEnums.RecordingMode.ContinuousRecorderMode, RecordingModes.ContinuousRecorder}, { DFConstantsAndEnums.RecordingMode.AutoCircularBufferMode, RecordingModes.CircularBuffer}, { DFConstantsAndEnums.RecordingMode.AutoRecorderMode, RecordingModes.Recorder}, { DFConstantsAndEnums.RecordingMode.MultiHybridRecorderMode, RecordingModes.HybridRecorder}, { DFConstantsAndEnums.RecordingMode.S6A_DeviceStreamingOnly, RecordingModes.S6A_DeviceStreamingOnly}, { DFConstantsAndEnums.RecordingMode.a14_NormalRecorderAndStreamSubSampleMode, RecordingModes.RecorderAndStreamSubSample}, { DFConstantsAndEnums.RecordingMode.AutoActiveMode, RecordingModes.Active}, { DFConstantsAndEnums.RecordingMode.Streaming, RecordingModes.Streaming}, { DFConstantsAndEnums.RecordingMode.Scheduled, RecordingModes.Scheduled}, { DFConstantsAndEnums.RecordingMode.Interval, RecordingModes.Scheduled}, { DFConstantsAndEnums.RecordingMode.MultipleEventRecorderTriggerStart, RecordingModes.Active}, { DFConstantsAndEnums.RecordingMode.AerospaceWithMotion, RecordingModes.MultipleEventActive }, { DFConstantsAndEnums.RecordingMode.HybridRecorderMode, RecordingModes.HybridRecorder }, { DFConstantsAndEnums.RecordingMode.AutoCircularBufferPlusUART, RecordingModes.MultipleEventCircularBufferPlusUART }, { DFConstantsAndEnums.RecordingMode.AutoRecorderModePlusUART, RecordingModes.MultipleEventRecorderPlusUART }, { DFConstantsAndEnums.RecordingMode.ContinuousRecorderModePlusUART, RecordingModes.ContinuousRecorderPlusUART }, { DFConstantsAndEnums.RecordingMode.RAMActive, RecordingModes.RAMActive }, { DFConstantsAndEnums.RecordingMode.MultipleEventRAMActive, RecordingModes.MultipleEventRAMActive }, { DFConstantsAndEnums.RecordingMode.a26_MultiRecordOnBootDataMode, RecordingModes.RecordOnBoot }, { DFConstantsAndEnums.RecordingMode.a28_MultiRecordOnBootAndUartDataMode, RecordingModes.RecordOnBootPlusUART }, { DFConstantsAndEnums.RecordingMode.a18_HybridRecorderAndStreamSubSampleMode, RecordingModes.HybridAndStream }, { DFConstantsAndEnums.RecordingMode.a19_MultiHybridRecorderAndStreamSubSampleMode, RecordingModes.MultipleEventHybridAndStream }, { DFConstantsAndEnums.RecordingMode.a15_MultiRecorderAndStreamSubSampleMode, RecordingModes.MultipleEventRecorderAndStream }, { DFConstantsAndEnums.RecordingMode.a17_MultiCircularBufferAndStreamSubSampleMode, RecordingModes.MultipleEventCircularBufferAndStream } }; /// /// map from DFConstantAndEnums.RecordingMode to RecordingModes /// This was an alternate form of mapping found in quick build ... /// /// /// public static RecordingModes ToRecordingModesAlt(DFConstantsAndEnums.RecordingMode mode) { return _altToLookup.ContainsKey(mode) ? _altToLookup[mode] : ToRecordingModes(mode); } public static RecordingModes ToRecordingModes(DFConstantsAndEnums.RecordingMode recordingMode) { return _toLookup.ContainsKey(recordingMode) ? _toLookup[recordingMode] : RecordingModes.CircularBuffer; } private static readonly IReadOnlyDictionary _fromLookup = new Dictionary() { { RecordingModes.CircularBuffer, DFConstantsAndEnums.RecordingMode.CircularBuffer}, { RecordingModes.CircularBufferAndStreamSubSample, DFConstantsAndEnums.RecordingMode.a16_CircularBufferAndStreamSubSampleMode}, { RecordingModes.CircularBufferPlusUART, DFConstantsAndEnums.RecordingMode.CircularBufferPlusUART}, { RecordingModes.Recorder, DFConstantsAndEnums.RecordingMode.RecorderMode}, { RecordingModes.RecorderPlusUART, DFConstantsAndEnums.RecordingMode.RecorderModePlusUART}, { RecordingModes.HybridRecorder, DFConstantsAndEnums.RecordingMode.HybridRecorderMode}, { RecordingModes.ContinuousRecorder, DFConstantsAndEnums.RecordingMode.ContinuousRecorderMode}, { RecordingModes.ContinuousRecorderPlusUART, DFConstantsAndEnums.RecordingMode.ContinuousRecorderModePlusUART}, { RecordingModes.MultipleEventCircularBuffer, DFConstantsAndEnums.RecordingMode.AutoCircularBufferMode}, { RecordingModes.MultipleEventCircularBufferPlusUART, DFConstantsAndEnums.RecordingMode.AutoCircularBufferPlusUART}, { RecordingModes.MultipleEventRecorder, DFConstantsAndEnums.RecordingMode.AutoRecorderMode}, { RecordingModes.MultipleEventRecorderPlusUART, DFConstantsAndEnums.RecordingMode.AutoRecorderModePlusUART}, { RecordingModes.MultipleEventHybridRecorder, DFConstantsAndEnums.RecordingMode.MultiHybridRecorderMode}, { RecordingModes.S6A_DeviceStreamingOnly, DFConstantsAndEnums.RecordingMode.S6A_DeviceStreamingOnly}, { RecordingModes.RecorderAndStreamSubSample, DFConstantsAndEnums.RecordingMode.a14_NormalRecorderAndStreamSubSampleMode}, { RecordingModes.MultipleEventActive, DFConstantsAndEnums.RecordingMode.AutoActiveMode}, { RecordingModes.Streaming, DFConstantsAndEnums.RecordingMode.Streaming}, { RecordingModes.Scheduled, DFConstantsAndEnums.RecordingMode.Scheduled}, { RecordingModes.Interval, DFConstantsAndEnums.RecordingMode.Interval}, { RecordingModes.RAMActive, DFConstantsAndEnums.RecordingMode.RAMActive }, { RecordingModes.MultipleEventRAMActive, DFConstantsAndEnums.RecordingMode.MultipleEventRAMActive }, { RecordingModes.RecordOnBoot, DFConstantsAndEnums.RecordingMode.a26_MultiRecordOnBootDataMode }, { RecordingModes.RecordOnBootPlusUART, DFConstantsAndEnums.RecordingMode.a28_MultiRecordOnBootAndUartDataMode }, { RecordingModes.HybridAndStream, DFConstantsAndEnums.RecordingMode.a18_HybridRecorderAndStreamSubSampleMode }, { RecordingModes.MultipleEventHybridAndStream, DFConstantsAndEnums.RecordingMode.a19_MultiHybridRecorderAndStreamSubSampleMode }, { RecordingModes.MultipleEventCircularBufferAndStream, DFConstantsAndEnums.RecordingMode.a17_MultiCircularBufferAndStreamSubSampleMode }, { RecordingModes.MultipleEventRecorderAndStream, DFConstantsAndEnums.RecordingMode.a15_MultiRecorderAndStreamSubSampleMode }, }; public static DFConstantsAndEnums.RecordingMode FromRecordingModes( this RecordingModes recordingMode) { return _fromLookup.ContainsKey(recordingMode)?_fromLookup[recordingMode] : DFConstantsAndEnums.RecordingMode.CircularBuffer; } private static readonly HashSet _circularBufferModes = new HashSet() { DFConstantsAndEnums.RecordingMode.a16_CircularBufferAndStreamSubSampleMode, DFConstantsAndEnums.RecordingMode.AutoCircularBufferMode, DFConstantsAndEnums.RecordingMode.CircularBuffer, DFConstantsAndEnums.RecordingMode.CircularBufferPlusUART, DFConstantsAndEnums.RecordingMode.AutoCircularBufferPlusUART, DFConstantsAndEnums.RecordingMode.AerospaceWithMotion, DFConstantsAndEnums.RecordingMode.AutoActiveMode, DFConstantsAndEnums.RecordingMode.RAMActive, DFConstantsAndEnums.RecordingMode.MultipleEventRAMActive }; /// /// returns true if mode is a circular buffer mode /// /// /// public static bool IsACircularBufferMode(DFConstantsAndEnums.RecordingMode mode) { return _circularBufferModes.Contains(mode); } private static readonly HashSet _nonAutoArmModes = new HashSet() { RecordingModes.Active, RecordingModes.MultipleEventActive, RecordingModes.Scheduled, RecordingModes.Interval, RecordingModes.Streaming //Not really needed since Auto-Arm and Streaming checkboxes are mutually exclusive }; /// /// returns true if recording mode supports AutoArm, false otherwise /// /// recording mode to check /// true if mode can be used with auto-arm public static bool DoesModeSupportAutoArm(RecordingModes mode) { return !_nonAutoArmModes.Contains(mode); } /// /// returns true if mode is a circular buffer mode /// /// /// public static bool IsACircularBufferMode(RecordingModes mode) { return IsACircularBufferMode(FromRecordingModes(mode)); } private static readonly HashSet _recorderModes = new HashSet() { DFConstantsAndEnums.RecordingMode.a14_NormalRecorderAndStreamSubSampleMode, DFConstantsAndEnums.RecordingMode.AutoRecorderMode, DFConstantsAndEnums.RecordingMode.RecorderMode, DFConstantsAndEnums.RecordingMode.RecorderModePlusUART, DFConstantsAndEnums.RecordingMode.AutoRecorderModePlusUART }; /// /// returns true if the mode is a recorder mode /// /// /// public static bool IsARecorderMode(DFConstantsAndEnums.RecordingMode mode) { return _recorderModes.Contains(mode); } /// /// returns true if mode is a recorder mode /// /// /// public static bool IsARecorderMode(RecordingModes mode) { return IsARecorderMode(FromRecordingModes(mode)); } /// /// returns true if the mode is a hybrid recorder mode /// /// /// public static bool IsAHybridRecorderMode(DFConstantsAndEnums.RecordingMode mode) { switch (mode) { case DFConstantsAndEnums.RecordingMode.MultiHybridRecorderMode: case DFConstantsAndEnums.RecordingMode.HybridRecorderMode: return true; } return false; } /// /// returns true if mode is a hybrid recorder mode /// /// /// public static bool IsAHybridRecorderMode(RecordingModes mode) { switch (mode) { case RecordingModes.HybridRecorder: case RecordingModes.MultipleEventHybridRecorder: return true; } return false; } private static readonly HashSet _multipleEventModes = new HashSet() { RecordingModes.MultipleEventActive, RecordingModes.MultipleEventCircularBuffer, RecordingModes.MultipleEventRecorder, RecordingModes.ContinuousRecorder, RecordingModes.MultipleEventCircularBufferPlusUART, RecordingModes.MultipleEventRecorderPlusUART, RecordingModes.ContinuousRecorderPlusUART, RecordingModes.MultipleEventHybridRecorder, RecordingModes.Interval, RecordingModes.MultipleEventRAMActive, RecordingModes.RecordOnBoot, RecordingModes.RecordOnBootPlusUART, RecordingModes.MultipleEventCircularBufferAndStream, RecordingModes.MultipleEventHybridAndStream, RecordingModes.MultipleEventRecorderAndStream }; /// /// returns true if recording mode is a form of multiple event recording /// /// /// public static bool IsAMultipleEvent(RecordingModes mode) { return _multipleEventModes.Contains(mode); } private static readonly HashSet _multipleEventSupportingModes = new HashSet() { RecordingModes.Active, RecordingModes.MultipleEventActive, RecordingModes.CircularBuffer, RecordingModes.CircularBufferPlusUART, RecordingModes.MultipleEventCircularBuffer, RecordingModes.MultipleEventCircularBufferPlusUART, RecordingModes.Recorder, RecordingModes.RecorderPlusUART, RecordingModes.MultipleEventRecorder, RecordingModes.MultipleEventRecorderPlusUART, RecordingModes.HybridRecorder, RecordingModes.MultipleEventHybridRecorder, RecordingModes.ContinuousRecorder, RecordingModes.ContinuousRecorderPlusUART, RecordingModes.Scheduled, RecordingModes.Interval, RecordingModes.RAMActive, RecordingModes.MultipleEventRAMActive, RecordingModes.RecordOnBoot, RecordingModes.RecordOnBootPlusUART, RecordingModes.RecorderAndStreamSubSample, RecordingModes.CircularBufferAndStreamSubSample, RecordingModes.HybridAndStream }; /// /// returns true if recording mode is a form of multiple event recording /// /// /// public static bool CanBeAMultipleEvent(RecordingModes mode) { return _multipleEventSupportingModes.Contains(mode); } private static readonly HashSet _streamModes = new HashSet() { RecordingModes.CircularBufferAndStreamSubSample, RecordingModes.RecorderAndStreamSubSample, RecordingModes.S6A_DeviceStreamingOnly, RecordingModes.Streaming, RecordingModes.HybridAndStream, RecordingModes.MultipleEventCircularBufferAndStream, RecordingModes.MultipleEventRecorderAndStream, RecordingModes.MultipleEventHybridAndStream }; /// /// returns true if the mode is a recording mode /// /// /// public static bool IsAStreamMode(RecordingModes mode) { return _streamModes.Contains(mode); } /// /// returns true if either the mode is a recording mode or it will be set to a recording mode shortly /// /// /// /// //29609 At times, especially when Adding a new Test Setup, the recording mode may not yet have been set to the proper streaming value, so this checks DoStreaming also public static bool TestWillBeStreaming(RecordingModes recordingMode, bool streaming) { return IsAStreamMode(recordingMode) || streaming; } /// /// returns true if the mode is a recording mode /// /// /// public static bool IsAStreamMode(DFConstantsAndEnums.RecordingMode mode) { return IsAStreamMode(ToRecordingModes(mode)); } private static HashSet _uartModes = new HashSet() { RecordingModes.CircularBufferPlusUART, RecordingModes.RecorderPlusUART, RecordingModes.MultipleEventCircularBufferPlusUART, RecordingModes.MultipleEventRecorderPlusUART, RecordingModes.ContinuousRecorderPlusUART, RecordingModes.RecordOnBootPlusUART }; /// /// returns true if the mode is a recording mode w/uart /// /// /// public static bool IsAUartMode(RecordingModes mode) { return _uartModes.Contains(mode); } /// /// returns true if the mode is a recording mode w/uart /// /// /// public static bool IsAUartMode(DFConstantsAndEnums.RecordingMode mode) { return IsAUartMode(ToRecordingModes(mode)); } private static HashSet _openEndedModes = new HashSet() { RecordingModes.ContinuousRecorder, RecordingModes.ContinuousRecorderPlusUART, RecordingModes.RecordOnBoot, RecordingModes.RecordOnBootPlusUART }; /// /// returns true if the recording mode is open-ended (i.e. has no set recording time or post-trigger time) /// public static bool IsAnOpenEndedRecordingMode(RecordingModes mode) { return _openEndedModes.Contains(mode); } /// /// returns true if the recording mode is open-ended (i.e. has no set recording time or post-trigger time) /// public static bool IsAnOpenEndedRecordingMode(DFConstantsAndEnums.RecordingMode mode) { return IsAnOpenEndedRecordingMode(ToRecordingModes(mode)); } } public enum QATSExtendedFault { EXT_FAULT_TYPE_NONE = 0, //S6DB & S6DB-3 EXT_FAULT_TYPE_STATUSLINE_PORT_1_DROPPED = 1 << 0, EXT_FAULT_TYPE_STATUSLINE_PORT_2_DROPPED = 1 << 1, EXT_FAULT_TYPE_STATUSLINE_PORT_3_DROPPED = 1 << 2, EXT_FAULT_TYPE_STATUSLINE_PORT_4_DROPPED = 1 << 3, EXT_FAULT_TYPE_STATUSLINE_PWRHUB__DROPPED = 1 << 4, //Skip bit 5 for reserve. //Hardware Detection Faults //TSAIR FAULT_FLAG__DEVICE = 1 << 6, FAULT_FLAG__DEVICE__KX134 = 1 << 7, FAULT_FLAG__DEVICE__ADXL373 = 1 << 8, FAULT_FLAG__DEVICE__BMI270 = 1 << 9, FAULT_FLAG__DEVICE__FRAM = 1 << 10, FAULT_FLAG__DEVICE__BMI280 = 1 << 11, FAULT_FLAG__DEVICE__MAGNET_SENSOR = 1 << 12, FAULT_FLAG__DEVICE__RTC = 1 << 13, FAULT_FLAG__DEVICE__KSZ = 1 << 14, FAULT_FLAG__DEVICE__FPGA = 1 << 15, FAULT_FLAG__DEVICE__NAND = 1 << 16, FAULT_FLAG__DEVICE__FUEL_GAUGE = 1 << 17, FAULT_FLAG__CONDITION__FRAM_WAKEUP = 1 << 18, FAULT_FLAG__CONDITION__RTOS = 1 << 19, FAULT_FLAG__CONDITION__NETWORK_CONFIG = 1 << 20, FAULT_FLAG__CONDITION__DHCP_FAIL = 1 << 21, //SPDB EXT_FAULT_TYPE_STATUSLINE_SUPER_CAP = 1 << 22, EXT_FAULT_TYPE_STATUSLINE_TEMPERATURE = 1 << 23, //S6DB & S6DB-3 EXT_FAULT_TYPE_STATUSLINE_PORT_1_PG = 1 << 24, EXT_FAULT_TYPE_STATUSLINE_PORT_2_PG = 1 << 25, EXT_FAULT_TYPE_STATUSLINE_PORT_3_PG = 1 << 26, EXT_FAULT_TYPE_STATUSLINE_PORT_4_PG = 1 << 27, /* bit_31:22 = reserves */ EXT_FAULT_TYPE_MAX = 1 << 31, // limit to 32-bit }; /// /// describes different TMAT templates that are used for creating TMATs entry /// public enum TMAT_TEMPLATES { [StringMetaDataAttr("S6ATMTTemplate_PCM.tmt")] S6Air_PCM, [StringMetaDataAttr("S6ATMTTemplate_ANALOG.tmt")] S6Air_ANALOG, //FB 28292 Templates for "TmNS 144 bit PCM" and "TmNS Supercom 4x ADC PCM" [StringMetaDataAttr("S6ATMTTemplate_TmNS_144PCM.tmt")] S6Air_TmNS_144PPCM, [StringMetaDataAttr("S6ATMTTemplate_TmNS_SuperCom4xPCM.tmt")] S6Air_TmNS_SuperCom4xPCM, //FB 30035 Added supported templates [StringMetaDataAttr("TSRAIRTMTTemplate_PCM.tmt")] TSRAIR_PCM, [StringMetaDataAttr("TSRAIRTMTTemplate_ANALOG.tmt")] TSRAIR_ANALOG } }