using DTS.Common.Converters; using DTS.Common.Enums.DASFactory; using System.ComponentModel; using DTS.Common.Constant.DASSpecific; using System.Windows.Media; using DTS.Common.Interface.DataRecorders; namespace DTS.Common.Enums.Hardware { [TypeConverter(typeof(EnumDescriptionTypeConverter))] public enum HardwareTypes { SLICE_Base = 0, SLICE_Bridge = 1, [Description("SLICE_Distributor_Description")] SLICE_Distributor = 2, [Description("TDAS_Pro_Rack_Description")] TDAS_Pro_Rack = 3, SLICE2_IEPE_Hi = 4, SLICE2_IEPE_Lo = 5, SLICE2_Bridge_Hi = 6, SLICE2_Bridge_Lo = 7, SLICE2_Base = 8, TOM = 9, SIM = 10, DIM = 11, [Description("G5_VDS_Description")] G5VDS = 12, Ribeye = 13, RibeyeLED = 14, SLICE_IEPE = 15, [Description("SLICE1_5Nano_Description")] SLICE1_5_Nano_Base = 16, [Description("SLICE_Micro_Description")] SLICE_Micro_Base = 17, [Description("SLICE_Nano_Description")] SLICE_NANO_Base = 18, [Description("SLICE2_SIM_Description")] SLICE2_SIM = 19, [Description("SLICE2_DIM_Description")] SLICE2_DIM = 20, [Description("SLICE2_TOM_Description")] SLICE2_TOM = 21, //G5IPORT=22, [Description("G5InDummy_Description")] G5INDUMMY = 23, [Description("SLICE_EthernetController_Description")] SLICE_EthernetController = 24, [Description("SLICE_15Micro_Description")] SLICE1_5_Micro_Base = 25, [Description("SLICE_Lab_Ethernet_Description")] SLICE_LabEthernet = 26, [Description("SLICE2_SLS_Description")] SLICE2_SLS = 27, [Description("SLICE1_G5Stack_Description")] SLICE1_G5Stack = 28, [Description("SLICE2_SLT_Description")] SLICE2_SLT = 29, [Description("SLICE2_SLD_Description")] SLICE2_SLD = 30, [Description("TDAS_LabRack_Description")] TDAS_LabRack = 31, [Description("SLICE6_Base_Description")] SLICE6_Base = 32, [Description("SLICE6_DB_Description")] SLICE6DB = 33, [Description("SLICE6_DBInDummy_Description")] SLICE6DB_InDummy = 34, //doesn't exist //[Description("SLICE6_DBAir_Description")] //SLICE6DB_AIR = 35, [Description("SLICE6_AIR_Description")] SLICE6_AIR = 36, [Description("PowerPRO_Description")] PowerPro = 37, [Description("HardwareType_EMPTY")] UNDEFINED = 38, [Description("SLICE_Mini_Distributor_Description")] SLICE_Mini_Distributor = 39, [Description("TSR_AIR_Description")] TSR_AIR = 40, // TSR Air "Rev A" [Description("TSR_AIR_RevB_Description")] TSR_AIR_RevB = 41, // TSR Air "Rev B" [Description("DKR_Description")] DKR = 42, // NGTSR - NASA SBIR [Description("DIR_Description")] DIR = 43, // NGTSR - USAF SBIR [Description("Embedded_LowG_Module_Description")] EMB_LIN_ACC_LO = 44, [Description("Embedded_HighG_Module_Description")] EMB_LIN_ACC_HI = 45, [Description("Embedded_Angular_Module_Description")] EMB_ANG_ACC = 46, [Description("Embedded_ARS_Module_Description")] EMB_ANG_ARS = 47, [Description("Embedded_Atmosphere_Module_Description")] EMB_ATM = 48, [Description("Embedded_Magnetometer_Module_Description")] EMB_MAG = 49, [Description("Embedded_MagnetSwitch_Module_Description")] EMB_MAG_SWITCH = 50, [Description("Embedded_Microphone_Module_Description")] EMB_MIC = 51, [Description("Embedded_Optical_Module_Description")] EMB_OPT = 52, [Description("Embedded_Clock_Seconds_Module_Description")] EMB_RTC_S_MARK = 53, [Description("Embedded_Clock_Nanos_Module_Description")] EMB_RTC_NS_PAD = 54, [Description("SLICE6DB3_Description")] SLICE6DB3 = 55, [Description("SLICE6ER_Description")] S6A_EthernetRecorder = 56, //(25460 Placeholder) [Description("SLICE_Pro_Distributor_Description")] SLICE_Pro_Distributor = 57, //28283 SLICE6AIR-BR (falcon-id) infrastructure [Description("SLICE6_AIR_BR_Description")] SLICE6_AIR_BR = 58, //43955 SLICE-TC infrastructure [Description("SLICE_TC_Description")] SLICE6_AIR_TC = 59, //44870 SPFD [Description("SLICE_PRO_CAN_FD_Description")] SLICE_PRO_CAN_FD = 60, } [TypeConverter(typeof(EnumDescriptionTypeConverter))] public enum SLICEBridgeTypes { [Description("BRIDGETYPE_BRIDGE_DESCRIPTION")] Bridge, [Description("BRIDGETYPE_IEPE_DESCRIPTION")] IEPE, [Description("BRIDGETYPE_ARS_DESCRIPTION")] ARS, [Description("BRIDGETYPE_ACC_DESCRIPTION")] ACC, [Description("BRIDGETYPE_RTC_DESCRIPTION")] RTC, [Description("BRIDGETYPE_UART_DESCRIPTION")] UART, [Description("BRIDGETYPE_STREAM_OUT_DESCRIPTION")] StreamOut, [Description("BRIDGETYPE_THERMOCOUPLER_DESCRIPTION")] Thermocoupler, [Description("BRIDGETYPE_CAN_DESCRIPTION")] CAN } [TypeConverter(typeof(EnumDescriptionTypeConverter))] public enum RackSizes { [Description("RACK_SIZE_4M")] FOUR, [Description("RACK_SIZE_8M")] EIGHT } public abstract class HardwareConstants { //http://manuscript.dts.local/f/cases/37929/Implement-TSRAIR-module-on-off-selection-via-Max-Slice-Enable-system-attribute public const int TSRAIR_MAXSLICENABLE_VERSION = 28; //this is the max modules according to firmware (18 channels) // it does not consider the streaming module nor the UART module which are SW only concepts and not // part of the module count in firmware public const int TSRAIR_MAX_MODULES = 6; public const string TSR_AIR_PREPEND = "TA"; public static bool IsTSRAIRSerialNumber(string serialNumber) { if (string.IsNullOrEmpty(serialNumber)) { return false; } return serialNumber.StartsWith(TSR_AIR_PREPEND); } public static SolidColorBrush GetBrushForVoltageStatus(DFConstantsAndEnums.VoltageStatusColor status) { switch (status) { case DFConstantsAndEnums.VoltageStatusColor.Green: return BrushesAndColors.BrushApplicationStatusPowerGreen; case DFConstantsAndEnums.VoltageStatusColor.Red: return BrushesAndColors.BrushApplicationStatusPowerRed; case DFConstantsAndEnums.VoltageStatusColor.Yellow: return BrushesAndColors.BrushApplicationStatusPowerYellow; case DFConstantsAndEnums.VoltageStatusColor.Off: default: return BrushesAndColors.BrushApplicationStatusPowerClear; } } /// /// returns whether the device supports trigger inversion or not /// currently only SLICE1, SLICE1.5, SLICE2 support it and only when connected via USB? /// protocol version could be a deciding factor for whether a device supports trigger inversion /// /// type of DAS /// protocol version of das /// true if the device supports trigger inversion, false otherwise public static bool SupportsTriggerInversion(HardwareTypes type, int protocolVersion) { switch (type) { case HardwareTypes.SLICE1_5_Micro_Base: case HardwareTypes.SLICE_Base: case HardwareTypes.SLICE2_Base: case HardwareTypes.SLICE_IEPE: case HardwareTypes.SLICE1_5_Nano_Base: case HardwareTypes.SLICE_Micro_Base: case HardwareTypes.SLICE_NANO_Base: case HardwareTypes.SLICE2_SIM: case HardwareTypes.SLICE2_DIM: case HardwareTypes.SLICE2_TOM: case HardwareTypes.SLICE2_SLS: case HardwareTypes.SLICE1_G5Stack: case HardwareTypes.SLICE2_SLT: case HardwareTypes.SLICE2_SLD: return true; default: return false; } } /// /// returns whether the device supports start inversion or not /// currently only SLICE1, SLICE1.5, SLICE2 support it and only when connected via USB? /// protocol version could be a deciding factor for whether a device supports start inversion /// /// type of DAS /// protocol version of das /// true if the device supports start inversion, false otherwise public static bool SupportsStartInversion(HardwareTypes type, int protocolVersion) { switch (type) { case HardwareTypes.SLICE1_5_Micro_Base: case HardwareTypes.SLICE_Base: case HardwareTypes.SLICE2_Base: case HardwareTypes.SLICE_IEPE: case HardwareTypes.SLICE1_5_Nano_Base: case HardwareTypes.SLICE_Micro_Base: case HardwareTypes.SLICE_NANO_Base: case HardwareTypes.SLICE2_SIM: case HardwareTypes.SLICE2_DIM: case HardwareTypes.SLICE2_TOM: case HardwareTypes.SLICE2_SLS: case HardwareTypes.SLICE1_G5Stack: case HardwareTypes.SLICE2_SLT: case HardwareTypes.SLICE2_SLD: case HardwareTypes.SLICE6_AIR: return true; default: return false; } } /// /// returns true if the hardware type is a type of ethernet recorder /// /// /// public static bool IsEthernetRecorder(HardwareTypes type) { return type == HardwareTypes.S6A_EthernetRecorder; } public const int INVALID_IDASCOMMUNICATION_RECORD_ID = -1; /// /// this is just a global variable for whether to allow soft disconnects or not /// and provide access to the variable across modules /// must be set by the application. /// public static bool AllowSoftDisconnects { get; set; } = false; public const int DEFAULTMEMORYSIZE_PRO = 16000000; public const int DEFAULTMEMORYSIZE_DIM = 2000000; public const int DEFAULTMEMORYSIZE_TOM = 2000000; /// /// returns true if the hardware in question uses embedded sensors /// /// /// public static bool HasEmbeddedSensors(HardwareTypes hardware) { switch (hardware) { case HardwareTypes.EMB_ANG_ACC: case HardwareTypes.EMB_ANG_ARS: case HardwareTypes.EMB_ATM: case HardwareTypes.EMB_LIN_ACC_HI: case HardwareTypes.EMB_LIN_ACC_LO: case HardwareTypes.EMB_MAG: case HardwareTypes.EMB_MAG_SWITCH: case HardwareTypes.EMB_MIC: case HardwareTypes.EMB_OPT: case HardwareTypes.EMB_RTC_NS_PAD: case HardwareTypes.EMB_RTC_S_MARK: case HardwareTypes.TSR_AIR: case HardwareTypes.TSR_AIR_RevB: case HardwareTypes.DIR: case HardwareTypes.DKR: case HardwareTypes.SLICE6_AIR_TC: return true; default: return false; } } /// /// returns whether the given channel type is supported by the given das for TSR AIR variants /// 18284 DKR device should only populate channels that are embedded in the device /// /// /// /// public static bool HasEmbeddedChannelType(HardwareTypes hardware, string channelType) { if (hardware == HardwareTypes.TSR_AIR || hardware == HardwareTypes.TSR_AIR_RevB) { return true; } switch (channelType) { case DFConstantsAndEnums.LOWG_SERIAL_APPEND: return true; case DFConstantsAndEnums.HIGHG_SERIAL_APPEND: return hardware == HardwareTypes.DIR; case DFConstantsAndEnums.ARS_SERIAL_APPEND: return false; case DFConstantsAndEnums.ANGACCEL_SERIAL_APPEND: return true; case DFConstantsAndEnums.ATMOSPHERIC_SERIAL_APPEND: return false; case DFConstantsAndEnums.OPTICAL_SERIAL_APPEND: return false; case DFConstantsAndEnums.MAGNETIC_SERIAL_APPEND: return false; case DFConstantsAndEnums.MAGNETICSWITCH_SERIAL_APPEND: return false; case DFConstantsAndEnums.MICROPHONE_SERIAL_APPEND: return hardware != HardwareTypes.DKR; case DFConstantsAndEnums.RTCSECONDANDMARKER_SERIAL_APPEND: case DFConstantsAndEnums.RTCCLOCKNANOPAD_SERIAL_APPEND: return false; default: return false; } } private static bool IsRecordingModeSupportedCAN(RecordingModes mode) { return RecordingModeExtensions.IsACircularBufferMode(mode); } /// /// returns true if the recording mode is supported on the given hardware and protocol version /// /// recording mode to check /// hardware type /// protocol version of hardware /// Use false (default) to find out if hardware supports given recording mode /// or an equivalent recording mode (example Circ Buffer, Circ Buffer + UART, use true to only consider the recording /// mode explicitly and not any related modes /// true if the mode is supported, false otherwise public static bool IsRecordingModeSupported(RecordingModes mode, HardwareTypes dasType, int protocolVersion, bool includeNativeSupportOnly = false) { if (dasType == HardwareTypes.SLICE6_AIR_TC) { return SLICE6AIRTC.IsRecordingModeSupported(mode); } if (dasType == HardwareTypes.SLICE_PRO_CAN_FD) { return IsRecordingModeSupportedCAN(mode); } if (dasType != HardwareTypes.TSR_AIR && dasType != HardwareTypes.TSR_AIR_RevB) { switch (mode) { //All non-TSRAIR DAS support Recorder and CircularBuffer case RecordingModes.CircularBuffer: case RecordingModes.Recorder: return true; case RecordingModes.CircularBufferPlusUART: case RecordingModes.RecorderPlusUART: if (!includeNativeSupportOnly) { return true; } break; } } if ((dasType == HardwareTypes.SLICE6DB_InDummy || dasType == HardwareTypes.SLICE6DB3 || dasType == HardwareTypes.SLICE6DB) && mode == RecordingModes.RAMActive) { return true; } bool result; switch (dasType) { case HardwareTypes.SLICE1_5_Micro_Base: case HardwareTypes.SLICE1_5_Nano_Base: result = SLICE1_5.IsRecordingModeSupported(mode, protocolVersion); break; case HardwareTypes.SLICE6_Base: result = SLICE6.IsRecordingModeSupported(mode, protocolVersion); break; case HardwareTypes.SLICE6_AIR: result = SLICE6AIR.IsRecordingModeSupported_S6AIR(mode, protocolVersion); break; case HardwareTypes.S6A_EthernetRecorder: //43626 Since S6A_EthernetRecorder is really a SLICE6_AIR with different firmware //we use the SLICE6AIR class to avoid creating a new class for only a few features. result = SLICE6AIR.IsRecordingModeSupported_S6EDR(mode, protocolVersion); break; case HardwareTypes.SLICE6_AIR_BR: result = SLICE6AIRBR.IsRecordingModeSupported(mode, protocolVersion); break; case HardwareTypes.SLICE2_TOM: result = SLICE2_TOM.IsRecordingModeSupported(mode, protocolVersion); break; case HardwareTypes.TSR_AIR: case HardwareTypes.TSR_AIR_RevB: result = TSRAIR.IsRecordingModeSupported(mode, protocolVersion); break; //TDAS hardware only supports Recorder and CircularBuffer, so if we get here the mode is not supported case HardwareTypes.DIM: case HardwareTypes.G5INDUMMY: case HardwareTypes.G5VDS: case HardwareTypes.Ribeye: case HardwareTypes.RibeyeLED: case HardwareTypes.SIM: case HardwareTypes.TDAS_Pro_Rack: case HardwareTypes.TDAS_LabRack: case HardwareTypes.TOM: result = false; break; case HardwareTypes.SLICE6_AIR_TC: result = SLICE6AIRTC.IsRecordingModeSupported(mode); break; //All other hardware types support the same modes default: switch (mode) { case RecordingModes.MultipleEventCircularBuffer: case RecordingModes.MultipleEventRecorder: case RecordingModes.HybridRecorder: case RecordingModes.ContinuousRecorder: result = true; break; default: result = false; break; } break; } return result; } /// /// Gets the Maximum sample rate for a particular recording mode, first implemented because the maximum sample rate /// can vary depending on model and the baud rate set for UART recording (39151) /// /// /// /// /// /// public static double MaxSampleRateForRecordingMode(IDASHardware h, RecordingModes mode, int protocolVersion = 1, uint baudRate = 0) { switch (h.DASTypeEnum) { case HardwareTypes.SLICE6_AIR: return SLICE6AIR.MaxSampleRateHzForRecordingMode(mode, false, protocolVersion, baudRate); case HardwareTypes.S6A_EthernetRecorder: return SLICE6AIR.MaxSampleRateHz_OBRDDR; default: return h.GetMaxSampleRateDouble(); } } /// /// returns true if the streaming profile is supported on the given hardware and protocol version /// /// streaming profile to check /// hardware type /// protocol version of hardware /// true if the profile is supported, false otherwise public static bool IsStreamingProfileSupported(UDPStreamProfile profile, HardwareTypes dasType, int protocolVersion, bool includeNativeSupportOnly = false) { bool result; switch (dasType) { case HardwareTypes.SLICE6_Base: result = SLICE6.IsStreamingProfileSupported(profile, protocolVersion); break; case HardwareTypes.SLICE6_AIR: result = SLICE6AIR.IsStreamingProfileSupported(profile, protocolVersion); break; case HardwareTypes.SLICE6_AIR_BR: result = SLICE6AIRBR.IsStreamingProfileSupported(profile, protocolVersion); break; case HardwareTypes.TSR_AIR: case HardwareTypes.TSR_AIR_RevB: result = TSRAIR.IsStreamingProfileSupported(profile, protocolVersion); break; case HardwareTypes.SLICE6_AIR_TC: result = SLICE6AIRTC.IsStreamingProfileSupported(profile, protocolVersion); break; //All other hardware types can't stream out default: result = false; break; } return result; } /// /// returns true if the clock sync profile is supported on the given hardware and protocol version /// /// clock sync profile to check /// hardware type /// protocol version of hardware /// true if the profile is supported, false otherwise public static bool IsClockSyncProfileSupported(ClockSyncProfile profile, HardwareTypes dasType, int protocolVersion, bool includeNativeSupportOnly, bool master) { bool result; switch (dasType) { case HardwareTypes.SLICE6_Base: result = SLICE6.IsClockSyncProfileSupported(profile, protocolVersion); break; case HardwareTypes.SLICE6_AIR: result = SLICE6AIR.IsClockSyncProfileSupported(profile, protocolVersion); break; case HardwareTypes.SLICE6_AIR_TC: result = SLICE6AIRTC.IsClockSyncProfileSupported(profile, protocolVersion); break; case HardwareTypes.SLICE6_AIR_BR: result = SLICE6AIRBR.IsClockSyncProfileSupported(profile, protocolVersion); break; case HardwareTypes.SLICE6DB: case HardwareTypes.SLICE6DB_InDummy: result = SLICE6DB.IsClockSyncProfileSupported(profile, protocolVersion); break; case HardwareTypes.TSR_AIR: case HardwareTypes.TSR_AIR_RevB: result = TSRAIR.IsClockSyncProfileSupported(profile, protocolVersion, master); break; //All other hardware types can't sync default: result = false; break; } return result; } } }