init
This commit is contained in:
@@ -0,0 +1,190 @@
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using DTS.Common.Classes;
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Base;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Microsoft.Windows.Controls.Ribbon;
|
||||
|
||||
//https://fluent.codeplex.com/SourceControl/latest
|
||||
namespace DTS.Common.RibbonControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Enables use of the <see cref="Microsoft.Windows.Controls.Ribbon.Ribbon"/> in a Prism <see cref="RegionNames.RibbonRegion"/>.
|
||||
/// To install Ribbon Controls Library, run the following command in the Package Manager Console - Install-Package RibbonControlsLibrary
|
||||
/// or install from https://www.microsoft.com/en-us/download/details.aspx?id=11877
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <see cref="RibbonRegionAdapter"/> adapts controls derived from the class <see cref="Microsoft.Windows.Controls.Ribbon.Ribbon"/> such as <see cref="RibbonTab"/>.
|
||||
/// </remarks>
|
||||
public class RibbonRegionAdapter : RegionAdapterBase<Ribbon>, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Injected region manager
|
||||
/// </summary>
|
||||
private readonly IRegionManager _regionManager;
|
||||
|
||||
/// <summary>
|
||||
/// Injected event aggregator
|
||||
/// </summary>
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
|
||||
private static readonly object Lock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="RibbonRegionAdapter"/> class.
|
||||
/// </summary>
|
||||
/// <param name="regionBehaviorFactory">Allows the registration of the default set of RegionBehaviors.</param>
|
||||
/// <param name="regionManager">Obtained reference of the region manager by using dependency injection.</param>
|
||||
/// <param name="eventAggregator">Obtained reference of the revent aggregator by using dependency injection.</param>
|
||||
public RibbonRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory, IRegionManager regionManager, IEventAggregator eventAggregator)
|
||||
: base(regionBehaviorFactory)
|
||||
{
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator = eventAggregator;
|
||||
_eventAggregator.GetEvent<TabControlSelectionChanged>().Subscribe(OnTabControlSelectionChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adapts the <see cref="Microsoft.Windows.Controls.Ribbon.Ribbon"/> to an <see cref="IRegion"/>.
|
||||
/// </summary>
|
||||
/// <param name="region">The new region being used.</param>
|
||||
/// <param name="regionTarget">The object to adapt.</param>
|
||||
protected override void Adapt(IRegion region, Ribbon regionTarget)
|
||||
{
|
||||
if (regionTarget == null)
|
||||
throw new ArgumentNullException("regionTarget");
|
||||
|
||||
region.ActiveViews.CollectionChanged += (o, e) =>
|
||||
{
|
||||
switch (e.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
foreach (var item in e.NewItems.OfType<RibbonTab>())
|
||||
AddRibbonTabToRegion(item, regionTarget);
|
||||
foreach (var item in e.NewItems.OfType<RibbonApplicationMenu>())
|
||||
AddApplicationMenuToRegion(item, regionTarget);
|
||||
|
||||
break;
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
foreach (var item in e.OldItems.OfType<RibbonTab>())
|
||||
RemoveRibbonTabFromRibbonRegion(item, regionTarget);
|
||||
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void AddRibbonTabToRegion(RibbonTab ribbonTab, Ribbon regionTarget)
|
||||
{
|
||||
lock (Lock)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ribbonTab.Uid))
|
||||
ribbonTab.Uid = Guid.NewGuid().GetHashCode().ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
regionTarget.Items.Add(ribbonTab);
|
||||
}
|
||||
|
||||
regionTarget.Items.SortDescriptions.Add(new SortDescription("TabIndex", ListSortDirection.Ascending));
|
||||
|
||||
var config = ConfigurationManager.AppSettings["DefaultRibbonTab"];
|
||||
if (!string.IsNullOrWhiteSpace(config))
|
||||
{
|
||||
ribbonTab.IsSelected = ribbonTab.Header.ToString().ToLower() == config.ToLower();
|
||||
}
|
||||
}
|
||||
|
||||
private void AddApplicationMenuToRegion(RibbonApplicationMenu applicationMenu, Ribbon regionTarget)
|
||||
{
|
||||
if (string.IsNullOrEmpty(applicationMenu.Uid))
|
||||
applicationMenu.Uid = Guid.NewGuid().GetHashCode().ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
regionTarget.ApplicationMenu = applicationMenu;
|
||||
}
|
||||
|
||||
private void RemoveRibbonTabFromRibbonRegion(RibbonTab ribbonTab, Ribbon regionTarget)
|
||||
{
|
||||
regionTarget.Items.Remove(ribbonTab);
|
||||
}
|
||||
|
||||
private void OnTabControlSelectionChanged(TabControlSelectionEventArgs e)
|
||||
{
|
||||
if (e.Operation == TabControlOperation.RemovedItem) return;
|
||||
|
||||
var view = e.Item as IBaseView;
|
||||
if (view == null) return;
|
||||
if (view.DataContext == null) return;
|
||||
|
||||
var ribbonTabInfo = view.DataContext as IRibbonTabInfoProvider;
|
||||
if (ribbonTabInfo == null) return;
|
||||
if (string.IsNullOrEmpty(ribbonTabInfo.RibbonTabUid)) return;
|
||||
|
||||
var currentTab = _regionManager.Regions[RegionNames.RibbonRegion].ActiveViews.OfType<RibbonTab>().FirstOrDefault(t => t.IsSelected);
|
||||
if (currentTab == null) return;
|
||||
|
||||
if (ribbonTabInfo.RibbonTabUid != currentTab.Uid)
|
||||
{
|
||||
var selectedTab = _regionManager.Regions[RegionNames.RibbonRegion].ActiveViews.OfType<RibbonTab>().FirstOrDefault(t => t.Uid == ribbonTabInfo.RibbonTabUid);
|
||||
|
||||
if (selectedTab != null)
|
||||
selectedTab.IsSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Template method to create a new instance of <see cref="Prism.Regions.IRegion"/>
|
||||
/// that will be used to adapt the object.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A new instance of <see cref="Prism.Regions.IRegion"/>.
|
||||
/// </returns>
|
||||
protected override IRegion CreateRegion()
|
||||
{
|
||||
return new AllActiveRegion();
|
||||
}
|
||||
|
||||
#region IDisposable Support
|
||||
|
||||
private bool _disposedValue; // To detect redundant calls.
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the object.
|
||||
/// </summary>
|
||||
/// <param name="disposing">True if called by the public Dispose method.</param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposedValue)
|
||||
{
|
||||
if (_eventAggregator != null)
|
||||
_eventAggregator.GetEvent<TabControlSelectionChanged>().Unsubscribe(OnTabControlSelectionChanged);
|
||||
}
|
||||
_disposedValue = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the object.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Object finalizer.
|
||||
/// </summary>
|
||||
~RibbonRegionAdapter()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.Common.Enums.Viewer
|
||||
{
|
||||
public enum TestGraphsFields
|
||||
{
|
||||
Name,
|
||||
HardwareChannelName,
|
||||
Channels,
|
||||
Channel,
|
||||
ChannelId
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace DTS.Common.Enums.Database
|
||||
{
|
||||
public enum DbType
|
||||
{
|
||||
RemoteOnly = 0,
|
||||
LocalOnly = 1,
|
||||
RemoteLocalHybrid = 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,721 @@
|
||||
using DTS.Common.Converters;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO.Ports;
|
||||
|
||||
namespace DTS.Common.Enums.Sensors
|
||||
{
|
||||
public abstract class SensorConstants
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether TOM squibs should record initiation signal or voltage
|
||||
/// http://manuscript.dts.local/f/cases/44299/SW-Re-Implement-GM-ISF-Style-Real-Time-tags-for-EQX-import
|
||||
/// does not populate value, only holds the value between processes
|
||||
/// </summary>
|
||||
public static bool UseInitSignalTOM { get; set; } = false;
|
||||
public const string VOLTAGE_INSERTION_UNIT = "mV";
|
||||
public const string TSRAIR_ACCEL_UNIT = "g";
|
||||
public const string TSRAIR_ARS_UNIT = "deg/sec";
|
||||
public const string TSRAIR_TEMPERATURE_UNIT = "C";
|
||||
public const string TSRAIR_HUMIDITY_UNIT = "%";
|
||||
public const string TSRAIR_PRESSURE_UNIT = "PSI";
|
||||
//these are 3D IR-TRACC values for equations
|
||||
//taken originally from config file for
|
||||
//http://manuscript.dts.local/f/cases/29720/config-file-properties-not-being-used-in-view-3D-IRTRACC-channel-add
|
||||
public static double δThorax { get; set; } = 15.65;
|
||||
public static double δAbdomen { get; set; } = 0;
|
||||
public static double D0Thorax { get; set; } = 141.8;
|
||||
public static double D0Abdomen { get; set; } = 150.9;
|
||||
public static double δThoraxLower { get; set; } = -15.65;
|
||||
public static double D0ThoraxLower { get; set; } = 141.8;
|
||||
//EU string for degrees
|
||||
public const string DEGREES = "deg";
|
||||
//EUstring for degrees used by GM
|
||||
public const string DEGREE_ANGLE = "deg-ang";
|
||||
/// <summary>
|
||||
/// these are the units we accept when filtering channels for add calculated channel
|
||||
/// 25513 GM requests option to filter channels available for pots for 3d-IR TRACC to include sensors with "deg-ang"
|
||||
/// </summary>
|
||||
public static readonly string[] POTUnits = new[] { DEGREES, DEGREE_ANGLE };
|
||||
public const double MIN_BRIDGE_RESISTANCE_OHMS = 1;
|
||||
public const double MAX_BRIDGE_RESISTANCE_OHMS = 32000;
|
||||
/// <summary>
|
||||
/// the DEFAULT value for whether sensor calibrations intervals start after calibration or first use
|
||||
/// </summary>
|
||||
public const bool SENSOR_FIRST_USE_DEFAULT = false;
|
||||
|
||||
public const bool ALLOW_INSPECT_BEFORE_USE_DEFAULT = false;
|
||||
/// <summary>
|
||||
/// The DEFAULT value for whether or not to keep track of, and validate a Test Setup based on, sensor use.
|
||||
/// </summary>
|
||||
public const bool SENSOR_OVERUSE_DEFAULT = false;
|
||||
/// <summary>
|
||||
/// The DEFAULT value for when a warning will be displayed if a sensor's usage is within this amount of its maximum.
|
||||
/// </summary>
|
||||
public const int SENSOR_USAGE_REMAINING_FOR_WARNING_DEFAULT = 5;
|
||||
/// <summary>
|
||||
/// The DEFAULT value for the default maximum number of uses for sensors
|
||||
/// </summary>
|
||||
public const int SENSOR_DEFAULT_MAX_USAGE_DEFAULT = 2500;
|
||||
/// <summary>
|
||||
/// the current value for whether sensor calibration intervals start after calibration or first use
|
||||
/// note does not query the value, just holds the value between different modules
|
||||
/// </summary>
|
||||
public static bool UseSensorFirstUseDate { get; set; } = false;
|
||||
/// <summary>
|
||||
/// The current value for whether or not to keep track of, and validate Test Setups based on, sensor use.
|
||||
/// </summary>
|
||||
public static bool DontAllowDataCollectionIfOverused { get; set; } = false;
|
||||
/// <summary>
|
||||
/// The current value for whether or not allow Inspect before use feature
|
||||
/// </summary>
|
||||
public static bool AllowInspectBeforeUse { get; set; } = false;
|
||||
/// <summary>
|
||||
/// A warning will be displayed if a sensor's usage is within this amount of its maximum.
|
||||
/// </summary>
|
||||
public static int UsageRemainingForWarning { get; set; }
|
||||
/// <summary>
|
||||
/// The default maximum number of uses for sensors
|
||||
/// </summary>
|
||||
public static int DefaultMaxUsageAllowed { get; set; }
|
||||
/// <summary>
|
||||
/// a cached indicator of whether to use isocode filter mapping or not
|
||||
/// is updated whenever the setting is updated by the application, and on startup
|
||||
/// </summary>
|
||||
public static bool UseISOCodeFilterMapping { get; set; } = true;
|
||||
/// <summary>
|
||||
/// FB12764 a cached value for default zero method type
|
||||
/// is updated whenever the setting is updated by the application, and on startup
|
||||
/// </summary>
|
||||
public static ZeroMethodType DefaultZeroMethodType { get; set; } = ZeroMethodType.AverageOverTime;
|
||||
/// <summary>
|
||||
/// FB12764 a cached value for default window start time, if zero method type is Average Over Time
|
||||
/// is updated whenever the setting is updated by the application, and on startup
|
||||
/// </summary>
|
||||
public static double DefaultZeroMethodStart { get; set; } = -0.05D;
|
||||
/// <summary>
|
||||
/// FB12764 a cached value for default window end time, if zero method type is Average Over Time
|
||||
/// is updated whenever the setting is updated by the application, and on startup
|
||||
/// </summary>
|
||||
public static double DefaultZeroMethodEnd { get; set; } = -0.02D;
|
||||
/// <summary>
|
||||
/// 29759 the default range for TSR AIR HiG channels
|
||||
/// </summary>
|
||||
public static double DefaultRangeHiG { get; set; } = 400D;
|
||||
/// <summary>
|
||||
/// 29759 the default range for TSR AIR LowG channels
|
||||
/// </summary>
|
||||
public static double DefaultRangeLowG { get; set; } = 64D;
|
||||
public static double DefaultRangeLowGDisplay { get; set; } = 50D;
|
||||
///
|
||||
/// 29759 the default range for TSR AIR ARS channels
|
||||
///
|
||||
public static double DefaultRangeARS { get; set; } = 2000D;
|
||||
/// <summary>
|
||||
/// 29917 the default range for the TSR AIR Temperature channel
|
||||
/// </summary>
|
||||
public static double DefaultRangeTemperature { get; set; } = 85D;
|
||||
/// <summary>
|
||||
/// 29917 the default range for the TSR AIR Humidity channel
|
||||
/// </summary>
|
||||
public static double DefaultRangeHumidity { get; set; } = 100D;
|
||||
/// <summary>
|
||||
/// 29917 the default range for the TSR AIR Pressure channel
|
||||
/// </summary>
|
||||
public static double DefaultRangePressure { get; set; } = 16D; //Actually 15.95 PSI (1100 hPa x 0.0145)
|
||||
|
||||
/// <summary>
|
||||
/// represents the _original_ default for SQUIB DELAY in ms (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// 13677 Restore defaults page button not functional for sensor settings nav step in system settings tile.
|
||||
/// </summary>
|
||||
public const double SQUIB_DELAY_CONSTANT = 0D;
|
||||
|
||||
/// <summary>
|
||||
/// represents the _original_ default for whether to limit squib output (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// 13677 Restore defaults page button not functional for sensor settings nav step in system settings tile.
|
||||
/// </summary>
|
||||
public const bool SQUIB_LIMIT_DURATION_CONSTANT = true;
|
||||
|
||||
/// <summary>
|
||||
/// represents the _original_ default for squib output duration (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// 13677 Restore defaults page button not functional for sensor settings nav step in system settings tile.
|
||||
/// </summary>
|
||||
public const double SQUIB_DURATION_CONSTANT = 10D;
|
||||
|
||||
/// <summary>
|
||||
/// represents the _original_ default for squib low tolerance (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// 13677 Restore defaults page button not functional for sensor settings nav step in system settings tile.
|
||||
/// </summary>
|
||||
public const double SQUIB_LOW_TOLERANCE_CONSTANT = 1D;
|
||||
|
||||
/// <summary>
|
||||
/// represents the _original_ default for squib high tolerance (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// 13677 Restore defaults page button not functional for sensor settings nav step in system settings tile.
|
||||
/// 26826 Max Squib Resistance Limit needs to be raised from 8.0 ohms to 10.0 ohms
|
||||
/// </summary>
|
||||
public const double SQUIB_HIGH_TOLERANCE_CONSTANT = 10D;
|
||||
|
||||
/// <summary>
|
||||
/// represents the _original_ default for squib fire mode (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// 13677 Restore defaults page button not functional for sensor settings nav step in system settings tile.
|
||||
/// </summary>
|
||||
public const SquibFireMode SQUIB_FIREMODE_CONSTANT = SquibFireMode.CAP;
|
||||
|
||||
/// <summary>
|
||||
/// represents the _original_ default for squib output current (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// 13677 Restore defaults page button not functional for sensor settings nav step in system settings tile.
|
||||
/// </summary>
|
||||
public const double SQUIB_CURRENT_CONSTANT = 1.5D;
|
||||
|
||||
/// <summary>
|
||||
/// represents the _original_ default for digital output mode (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// 13677 Restore defaults page button not functional for sensor settings nav step in system settings tile.
|
||||
/// </summary>
|
||||
public const DigitalOutputModes DIGITALOUT_MODE_CONSTANT = DigitalOutputModes.FVLH;
|
||||
|
||||
/// <summary>
|
||||
/// represents the _original_ default for digital output delay (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// 13677 Restore defaults page button not functional for sensor settings nav step in system settings tile.
|
||||
/// </summary>
|
||||
public const double DIGITALOUT_DELAY_CONSTANT = 0D;
|
||||
|
||||
/// <summary>
|
||||
/// represents the _original_ default for digital output limit duration (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// 13677 Restore defaults page button not functional for sensor settings nav step in system settings tile.
|
||||
/// </summary>
|
||||
public const bool DIGITALOUT_LIMITDURATION_CONSTANT = true;
|
||||
|
||||
/// <summary>
|
||||
/// represents the _original_ default for digital output duration (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// 13677 Restore defaults page button not functional for sensor settings nav step in system settings tile.
|
||||
/// </summary>
|
||||
public const double DIGITALOUT_DURATION_CONSTANT = 10D;
|
||||
|
||||
/// <summary>
|
||||
/// represents the _original_ default for uart data bits (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// </summary>
|
||||
public const uint UART_DATABITS_CONSTANT = 8;
|
||||
/// <summary>
|
||||
/// represents the _original_ default for uart stop bits (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// </summary>
|
||||
public const StopBits UART_STOPBITS_CONSTANT = StopBits.One;
|
||||
/// <summary>
|
||||
/// represents the _original_ default for uart parity (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// </summary>
|
||||
public const Parity UART_PARITY_CONSTANT = Parity.None;
|
||||
/// <summary>
|
||||
/// represents the _original_ default for uart flow control (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// </summary>
|
||||
public const Handshake UART_FLOWCONTROL_CONSTANT = Handshake.None;
|
||||
/// <summary>
|
||||
/// represents the _original_ default for uart data format (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// </summary>
|
||||
public const UartDataFormat UART_DATAFORMAT_CONSTANT = UartDataFormat.Binary;
|
||||
/// <summary>
|
||||
/// represents the _original_ default for stream input udp address (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// </summary>
|
||||
public const string STREAMIN_ADDRESS_CONSTANT = "UDP://239.1.2.10:8400";
|
||||
/// <summary>
|
||||
/// represents the _original_ default for stream output udp profile (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// </summary>
|
||||
public const UDPStreamProfile STREAMOUT_PROFILE_CONSTANT = UDPStreamProfile.CH10_PCM_128BIT_2HDR;
|
||||
/// <summary>
|
||||
/// represents the _original_ default for stream output udp address (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// </summary>
|
||||
public const string STREAMOUT_ADDRESS_CONSTANT = "UDP://239.1.2.10:8400";
|
||||
/// <summary>
|
||||
/// represents the _original_ default for stream output time channel id (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// </summary>
|
||||
public const ushort STREAMOUT_TIME_CHID_CONSTANT = 1;
|
||||
/// <summary>
|
||||
/// represents the _original_ default for stream output data channel id (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// </summary>
|
||||
public const ushort STREAMOUT_DATA_CHID_CONSTANT = 3;
|
||||
/// <summary>
|
||||
/// represents the _original_ default for stream output TmNS configuration (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// </summary>
|
||||
public const string STREAMOUT_TMNS_CONFIG_CONSTANT = "(1,6,60,0,0,0,0,0)";
|
||||
/// <summary>
|
||||
/// represents the _original_ default for stream output irig time data packet interval (in milliseconds) (not the default in the db)
|
||||
/// used for restoring defaults
|
||||
/// </summary>
|
||||
public const ushort STREAMOUT_IRIG_TDP_INTERVAL_CONSTANT = 500;
|
||||
|
||||
public const string TEST_SPECIFIC_DOUT = "TSD_";
|
||||
public const string TEST_SPECIFIC_SQUIB = "TSQ_";
|
||||
public const string TEST_SPECIFIC_DIN = "TSI_";
|
||||
public const string TEST_SPECIFIC_EMB = "TSA_";
|
||||
public const string TEST_SPECIFIC_EMB_CLK = "TSC_";
|
||||
public const string TEST_SPECIFIC_UART = "TSU_";
|
||||
public const string TEST_SPECIFIC_STREAM_OUT = "TSS_";
|
||||
public const string TEST_SPECIFIC_STREAM_IN = "TSN_";
|
||||
|
||||
public const string TEST_SPECIFIC_DIGITAL_IN_SERIAL = "TSI_TestSpecific";
|
||||
public const string TEST_SPECIFIC_DIGITAL_OUT_SERIAL = "TSD_TestSpecific";
|
||||
public const string TEST_SPECIFIC_SQUIB_SERIAL = "TSQ_TestSpecific";
|
||||
public const string TEST_SPECIFIC_ANALOG_SERIAL = "TSA_Embedded";
|
||||
public const string TEST_SPECIFIC_CLOCK_SERIAL = "TSC_Embedded";
|
||||
public const string TEST_SPECIFIC_UART_SERIAL = "TSU_TestSpecific";
|
||||
public const string TEST_SPECIFIC_STREAM_OUT_SERIAL = "TSS_TestSpecific";
|
||||
public const string TEST_SPECIFIC_STREAM_IN_SERIAL = "TSN_TestSpecific";
|
||||
public const string VOLTAGE_INPUT = "Voltage input";
|
||||
public const string TEST_SPECIFIC_THERMOCOUPLER = "TST_TestSpecific";
|
||||
|
||||
public static bool IsTestSpecificDigitalOut(string sn)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sn.StartsWith(TEST_SPECIFIC_DOUT)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsTestSpecificSquib(string sn)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sn.StartsWith(TEST_SPECIFIC_SQUIB)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns true if the serial number belongs to a test specific digital input
|
||||
/// </summary>
|
||||
public static bool IsTestSpecificDigitalIn(string sn)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!sn.StartsWith(TEST_SPECIFIC_DIN)) return false;
|
||||
return true;
|
||||
}
|
||||
public static bool IsTestSpecificEmbedded(string sn)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!sn.StartsWith(TEST_SPECIFIC_EMB)) return false;
|
||||
return true;
|
||||
}
|
||||
public static bool IsTestSpecificEmbeddedClock(string sn)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!sn.StartsWith(TEST_SPECIFIC_EMB_CLK)) return false;
|
||||
return true;
|
||||
}
|
||||
public static bool IsTestSpecificStreamOut(string sn)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sn.StartsWith(TEST_SPECIFIC_STREAM_OUT)) return false;
|
||||
return true;
|
||||
}
|
||||
public static bool IsTestSpecificStreamIn(string sn)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sn.StartsWith(TEST_SPECIFIC_STREAM_IN)) return false;
|
||||
return true;
|
||||
}
|
||||
public static bool IsTestSpecificUart(string sn)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sn.StartsWith(TEST_SPECIFIC_UART)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsTestSpecificThermocoupler(string sn)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sn.StartsWith(TEST_SPECIFIC_THERMOCOUPLER)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public const string EditObjectSensorChannelDragFormat = "EditObjectSensorsChannelTable.UserData []";
|
||||
public enum SensorSettings
|
||||
{
|
||||
Range,
|
||||
CFC,
|
||||
Polarity,
|
||||
Position,
|
||||
LimitDuration, //deprecated in 2.1
|
||||
Duration, //deprecated in 2.1
|
||||
Delay, //deprecated in 2.1
|
||||
OutputMode,
|
||||
SQMode,
|
||||
DIMode,
|
||||
DefaultValue,
|
||||
ActiveValue, //12 LAST value in V2.0 settings
|
||||
|
||||
//new in 2.1
|
||||
SquibLimitDuration,
|
||||
SquibDuration,
|
||||
SquibDelay,
|
||||
DigitalOutLimitDuration,
|
||||
DigitalOutDuration,
|
||||
DigitalOutDelay,
|
||||
SquibCurrent,
|
||||
//new in 3.0
|
||||
ZeroMethod,
|
||||
ZeroMethodStart,
|
||||
ZeroMethodEnd,
|
||||
UserValue1,
|
||||
UserValue2,
|
||||
UserValue3,
|
||||
InitialOffset,
|
||||
//FB 13120 added filter class
|
||||
FilterClass,
|
||||
//new in 4.0
|
||||
//18363 Uart Channels
|
||||
UartBaudRate,
|
||||
UartDataBits,
|
||||
UartStopBits,
|
||||
UartParity,
|
||||
UartFlowControl,
|
||||
UartDataFormat,
|
||||
//18364 Stream Out Channels
|
||||
StreamOutUDPProfile,
|
||||
StreamOutUDPAddress,
|
||||
StreamOutUDPTimeChannelId,
|
||||
StreamOutUDPDataChannelId,
|
||||
StreamOutUDPTmNSConfig,
|
||||
StreamOutIRIGTimeDataPacketIntervalMs,
|
||||
//26828 Stream In Channels
|
||||
StreamInUDPAddress,
|
||||
//29760 Implement ACCoupleEnable
|
||||
ACCouplingEnabled,
|
||||
//33145 Voltage insertion channel should be half-bridge
|
||||
BridgeType
|
||||
}
|
||||
|
||||
public enum SensorType
|
||||
{
|
||||
Analog,
|
||||
DigitalIn,
|
||||
DigitalOut,
|
||||
Squib,
|
||||
Clock,
|
||||
UART,
|
||||
StreamOut,
|
||||
StreamIn,
|
||||
Thermocoupler
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Separator for encoding an added linear calibration with a non-linear calibrated sensor
|
||||
/// </summary>
|
||||
public const string LinearValuesSeparator = "||";
|
||||
|
||||
/// <summary>
|
||||
/// used to convert between different formats and SensivityUnits
|
||||
/// 14448 Error when trying to import sensors.
|
||||
/// </summary>
|
||||
public abstract class SensUnitStringConverter
|
||||
{
|
||||
public static SensUnits ConvertFromString(string s)
|
||||
{
|
||||
s = s.Trim().ToLower();
|
||||
switch (s)
|
||||
{
|
||||
case "none": return SensUnits.NONE;
|
||||
case "mv": return SensUnits.mV;
|
||||
case "mv/v":
|
||||
case "mvperv":
|
||||
return SensUnits.mVperV;
|
||||
case "mv/v/eu":
|
||||
case "mvpervpereu":
|
||||
return SensUnits.mVperVperEU;
|
||||
case "mv/eu":
|
||||
case "mvpereu":
|
||||
return SensUnits.mVperEU;
|
||||
default: throw new InvalidCastException($"Can't convert {s} to SensUnits");
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// All available Sensitivity Unit types.
|
||||
/// </summary>
|
||||
public enum SensUnits
|
||||
{
|
||||
/// <summary>
|
||||
/// No Sensitivity Units (Polynomial Sensor)
|
||||
/// </summary>
|
||||
[Description("NONE")] NONE = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Sensitivity expressed in mV with output at Capacity EU
|
||||
/// </summary>
|
||||
[Description("mV")] mV = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Excitation proportional sensitivity expressed in mV/V with output at Capacity EU
|
||||
/// </summary>
|
||||
[Description("mV/V")] mVperV = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Excitation proportional sensitivity expressed in mV/V/EU
|
||||
/// </summary>
|
||||
[Description("mV/V/EU")] mVperVperEU = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Sensitivity expressed in mV/EU
|
||||
/// </summary>
|
||||
[Description("mV/EU")] mVperEU = 4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// All available bridge types.
|
||||
/// </summary>
|
||||
public enum BridgeType
|
||||
{
|
||||
/// <summary>
|
||||
/// sensor uses IEPE setup
|
||||
/// </summary>
|
||||
[Description("IEPE")] IEPE = 1 << 0,
|
||||
|
||||
/// <summary>
|
||||
/// sensor uses quarter bridge setup
|
||||
/// </summary>
|
||||
[Description("Quarter")] QuarterBridge = 1 << 1,
|
||||
|
||||
/// <summary>
|
||||
/// sensor uses half bridge setup
|
||||
/// </summary>
|
||||
[Description("Bridge-Half")] HalfBridge = 1 << 2,
|
||||
|
||||
/// <summary>
|
||||
/// sensor has a full bridge setup
|
||||
/// </summary>
|
||||
[Description("Bridge-Full")] FullBridge = 1 << 3,
|
||||
|
||||
/// <summary>
|
||||
/// digital input setup
|
||||
/// </summary>
|
||||
[Description("DigitalInput")] DigitalInput = 1 << 4,
|
||||
|
||||
/// <summary>
|
||||
/// squib output setup
|
||||
/// </summary>
|
||||
[Description("SQUIB")] SQUIB = 1 << 5,
|
||||
|
||||
/// <summary>
|
||||
/// digital output setup
|
||||
/// </summary>
|
||||
[Description("TOMDigital")] TOMDigital = 1 << 6,
|
||||
|
||||
/// <summary>
|
||||
/// sensor uses a G5 (signal plus) half bridge setup
|
||||
/// </summary>
|
||||
[Description("Bridge-Half SigPlus")] HalfBridge_SigPlus = 1 << 7,
|
||||
|
||||
/// <summary>
|
||||
/// not a "sensor" but encoding the RTC
|
||||
/// </summary>
|
||||
[Description("RTC")] RTC = 1 << 8,
|
||||
|
||||
/// <summary>
|
||||
/// not a "sensor" but values recorded on UART
|
||||
/// </summary>
|
||||
[Description("UART")] UART = 1 << 9,
|
||||
|
||||
/// <summary>
|
||||
/// not a "sensor" but values sent out via stream
|
||||
/// </summary>
|
||||
[Description("StreamOut")] StreamOut = 1 << 10,
|
||||
/// <summary>
|
||||
/// not a "sensor" but values received via stream
|
||||
/// </summary>
|
||||
[Description("StreamIn")] StreamIn = 1 << 11,
|
||||
///
|
||||
/// thermocoupler sensor
|
||||
///
|
||||
[Description("Thermocoupler")] Thermocoupler = 1 << 12
|
||||
}
|
||||
public static BridgeType ConvertIntToBridgeType(int bridge)
|
||||
{
|
||||
switch (bridge)
|
||||
{
|
||||
case 0: return BridgeType.IEPE;
|
||||
case 4: return BridgeType.HalfBridge_SigPlus;
|
||||
case 3: return BridgeType.FullBridge;
|
||||
case 2: return BridgeType.HalfBridge;
|
||||
case 1: return BridgeType.QuarterBridge;
|
||||
case 8: return BridgeType.RTC;
|
||||
default: return BridgeType.FullBridge;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// this is apparently needed for historical reasons
|
||||
/// as the sensor db apparently doesn't use the bitmask value for storage?
|
||||
/// </summary>
|
||||
/// <param name="bridge"></param>
|
||||
/// <returns></returns>
|
||||
public static int ConvertBridgeToInt(BridgeType bridge)
|
||||
{
|
||||
switch (bridge)
|
||||
{
|
||||
case BridgeType.IEPE: return 0;
|
||||
case BridgeType.QuarterBridge: return 1;
|
||||
case BridgeType.HalfBridge: return 2;
|
||||
case BridgeType.FullBridge: return 3;
|
||||
case BridgeType.HalfBridge_SigPlus: return 4;
|
||||
case BridgeType.RTC: return 8;
|
||||
default: return 3;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// how to handle sensor calibrations that are out of date
|
||||
/// 1) always allow sensors in a data collection, just warn
|
||||
/// 2) don't allow sensors which are out of date, warn if near out of date
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
|
||||
public enum SensorCalPolicy
|
||||
{
|
||||
[Description("SENSOR_CAL_POLICY_ALLOW_ALWAYS")]
|
||||
AllowAlways,
|
||||
[Description("SENSOR_CAL_POLICY_DONT_ALLOW")]
|
||||
DONT_ALLOW
|
||||
}
|
||||
/// <summary>
|
||||
/// allows for this field to be cached without having to be retrieved when processing a lot of channels
|
||||
/// </summary>
|
||||
public static int SensorCalOutOfDateWarningPeriodDays = 14;
|
||||
public static SensorCalPolicy SensorCalPolicyCurrent = SensorCalPolicy.DONT_ALLOW;
|
||||
/// <summary>
|
||||
/// the default policy for sensors is to not allow out of cal sensors
|
||||
/// </summary>
|
||||
public const SensorCalPolicy CAL_SENSOR_POLICY_DEFAULT = SensorCalPolicy.DONT_ALLOW;
|
||||
/// <summary>
|
||||
/// default warning period for sensors for calibration (in days)
|
||||
/// </summary>
|
||||
public const int CAL_SENSOR_POLICY_WARNING_DAYS_DEFAULT = 14;
|
||||
|
||||
public enum CouplingModes
|
||||
{
|
||||
AC = 0,
|
||||
DC
|
||||
}
|
||||
/// <summary>
|
||||
/// signifies whether autosense for IEPE/analog will be performed
|
||||
/// this variable only holds the value for the property, it does not
|
||||
/// serialize, deserialize, the property must be set by any using
|
||||
/// applications first
|
||||
/// </summary>
|
||||
public static bool DisableAutoSense { get; set; }
|
||||
|
||||
// FB16524: diagnostic result should include the resting voltage of an IEPE sensor
|
||||
// http://manuscript.dts.local/f/cases/16524/diagnostic-result-should-include-the-resting-voltage-of-an-IEPE-sensor
|
||||
public static double DefaultBridgeOffsetMVTolLow { get; set; } = -100;
|
||||
public static double DefaultBridgeOffsetMVTolHigh { get; set; } = 100;
|
||||
public static double DefaultIEPEOffsetMVTolLow { get; set; } = -2000;
|
||||
public static double DefaultIEPEOffsetMVTolHigh { get; set; } = 2000;
|
||||
|
||||
//ARS valid ranges for TSR AIR
|
||||
public const int ARS2000 = 2000;
|
||||
|
||||
//LowG valid ranges for TSR AIR
|
||||
public const int LowG64 = 64;
|
||||
|
||||
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
|
||||
public enum AvailableRangesLowG
|
||||
{
|
||||
[Description("TSRAIR_LOW_g_64")]
|
||||
LowG64D = LowG64
|
||||
};
|
||||
|
||||
public enum AvailableRangesARS
|
||||
{
|
||||
ARS2000D = ARS2000,
|
||||
};
|
||||
|
||||
public const string HighG = "-High g";
|
||||
public const string LowG = "-Low g";
|
||||
public const string ARS = "-ARS";
|
||||
public const string Atm = "-Atm";
|
||||
public const int TSRAirTemperatureChannel = 9;
|
||||
public const int TSRAirHumidityChannel = 10;
|
||||
public const int TSRAirPressureChannel = 11;
|
||||
public static bool IsTSRAirHighGChannel(string moduleSerialNumber)
|
||||
{
|
||||
if (moduleSerialNumber.EndsWith(HighG))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static bool IsTSRAirLowGChannel(string moduleSerialNumber)
|
||||
{
|
||||
if (moduleSerialNumber.EndsWith(LowG))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static bool IsTSRAirARSChannel(string moduleSerialNumber)
|
||||
{
|
||||
if (moduleSerialNumber.EndsWith(ARS))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static bool IsTSRAirAtmChannel(string moduleSerialNumber)
|
||||
{
|
||||
if (moduleSerialNumber.EndsWith(Atm))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static bool IsTSRAirHumidityChannel(string moduleSerialNumber, int channelNumber)
|
||||
{
|
||||
return IsTSRAirAtmChannel(moduleSerialNumber) && (channelNumber == TSRAirHumidityChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using Prism.Events;
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace DTS.Common.Events
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The Data Folder changed event.
|
||||
/// </summary>
|
||||
public class CursorShowChangedEvent : PubSubEvent<bool> { }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common.Interface.GroupTemplate
|
||||
{
|
||||
public interface IGroupTemplateListView : IBaseView { }
|
||||
}
|
||||
@@ -0,0 +1,513 @@
|
||||
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,
|
||||
}
|
||||
|
||||
[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
|
||||
}
|
||||
|
||||
[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;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
/// <param name="type">type of DAS</param>
|
||||
/// <param name="protocolVersion">protocol version of das</param>
|
||||
/// <returns>true if the device supports trigger inversion, false otherwise</returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
/// <param name="type">type of DAS</param>
|
||||
/// <param name="protocolVersion">protocol version of das</param>
|
||||
/// <returns>true if the device supports start inversion, false otherwise</returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// returns true if the hardware type is a type of ethernet recorder
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsEthernetRecorder(HardwareTypes type)
|
||||
{
|
||||
return type == HardwareTypes.S6A_EthernetRecorder;
|
||||
}
|
||||
public const int INVALID_IDASCOMMUNICATION_RECORD_ID = -1;
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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;
|
||||
/// <summary>
|
||||
/// returns true if the hardware in question uses embedded sensors
|
||||
/// </summary>
|
||||
/// <param name="hardware"></param>
|
||||
/// <returns></returns>
|
||||
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:
|
||||
return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
/// <param name="hardware"></param>
|
||||
/// <param name="channelType"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns true if the recording mode is supported on the given hardware and protocol version
|
||||
/// </summary>
|
||||
/// <param name="mode">recording mode to check</param>
|
||||
/// <param name="dasType">hardware type</param>
|
||||
/// <param name="protocolVersion">protocol version of hardware</param>
|
||||
/// <param name="includeNativeSupportOnly">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</param>
|
||||
/// <returns>true if the mode is supported, false otherwise</returns>
|
||||
public static bool IsRecordingModeSupported(RecordingModes mode, HardwareTypes dasType,
|
||||
int protocolVersion, bool includeNativeSupportOnly = false)
|
||||
{
|
||||
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(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;
|
||||
|
||||
//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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 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)
|
||||
/// </summary>
|
||||
/// <param name="h"></param>
|
||||
/// <param name="mode"></param>
|
||||
/// <param name="protocolVersion"></param>
|
||||
/// <param name="baudRate"></param>
|
||||
/// <returns></returns>
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns true if the streaming profile is supported on the given hardware and protocol version
|
||||
/// </summary>
|
||||
/// <param name="profile">streaming profile to check</param>
|
||||
/// <param name="dasType">hardware type</param>
|
||||
/// <param name="protocolVersion">protocol version of hardware</param>
|
||||
/// <returns>true if the profile is supported, false otherwise</returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns true if the clock sync profile is supported on the given hardware and protocol version
|
||||
/// </summary>
|
||||
/// <param name="profile">clock sync profile to check</param>
|
||||
/// <param name="dasType">hardware type</param>
|
||||
/// <param name="protocolVersion">protocol version of hardware</param>
|
||||
/// <returns>true if the profile is supported, false otherwise</returns>
|
||||
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_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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user