This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IPSDReportSettingsViewModel : IBaseViewModel
{
/// <summary>
/// Gets the Settings View.
/// </summary>
IBaseView View { get; set; }
IBaseViewModel Parent { get; set; }
IPSDReportSettingsModel Model { get; set; }
void PublishChanges();
}
}

View File

@@ -0,0 +1,326 @@
using System;
using System.Text;
using System.Net.NetworkInformation;
using System.Data;
using DTS.Common.Utilities.Logging;
using System.Collections.Generic;
namespace DTS.Common.Classes
{
/// <summary>
/// The Utility class.
/// </summary>
///
public sealed class Utility
{
public static byte [] GetBytesFromStringArray(string [] array, string separator)
{
var text = string.Join(separator, array);
return Encoding.UTF8.GetBytes(text);
}
/// <summary>
/// Returns all error messages include inner exceptions' messages.
/// </summary>
/// <param name="ex">The System.Exception object.</param>
/// <returns>Returns all error messages as a string.</returns>
public static string GetAllErrorMessages(Exception ex)
{
if (ex == null)
return string.Empty;
// assign the current exception as first object
// and then loop through its inner exceptions till they are null
var sb = new StringBuilder();
sb.AppendLine("Error Message: " + ex.Message);
var innerEx = ex;
while (innerEx.InnerException != null)
{
innerEx = innerEx.InnerException;
sb.AppendLine("Inner Exception: " + innerEx.Message);
}
return sb.ToString();
}
/// <summary>
/// Check internet connection availability
/// </summary>
/// <param name="hostNameOrAddress">The host name ar address.</param>
/// <returns><c>true</c> if internet connection available; otherwise, <c>false</c>.</returns>
public static bool PingNetwork(string hostNameOrAddress)
{
bool pingStatus;
using (var p = new Ping())
{
var buffer = Encoding.ASCII.GetBytes("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
const int timeout = 4444; // 4s
try
{
var reply = p.Send(hostNameOrAddress, timeout, buffer);
pingStatus = (reply.Status == IPStatus.Success);
}
catch (Exception)
{
pingStatus = false;
}
}
return pingStatus;
}
public static ushort GetUShort(IDataReader reader, string column, ushort defaultValue = 0)
{
if (string.IsNullOrWhiteSpace(column)) { return defaultValue; }
var o = reader[column];
if (DBNull.Value.Equals(o))
{
return defaultValue;
}
try
{
return Convert.ToUInt16(o);
}
catch (Exception ex)
{
APILogger.Log($"Failed to parse string for field {column}", o, ex);
return defaultValue;
}
}
public static uint GetUInt(IDataReader reader, string column, uint defaultValue = 0)
{
if (string.IsNullOrWhiteSpace(column)) { return defaultValue; }
var o = reader[column];
if (DBNull.Value.Equals(o))
{
return defaultValue;
}
try
{
return Convert.ToUInt32(o);
}
catch (Exception ex)
{
APILogger.Log($"Failed to parse string for field {column}", o, ex);
return defaultValue;
}
}
public static string GetString(IDataReader reader, string column, string defaultValue="")
{
if(string.IsNullOrWhiteSpace(column)) { return defaultValue; }
var o = reader[column];
if(DBNull.Value.Equals(o))
{
return defaultValue;
}
try
{
return Convert.ToString(o);
}
catch(Exception ex)
{
APILogger.Log($"Failed to parse string for field {column}", o, ex);
return defaultValue;
}
}
public static string [] GetStringArray(IDataReader reader,
string column,
string [] defaultValue,
string separator)
{
try
{
var o = reader[column];
if(DBNull.Value.Equals(o)) { return defaultValue; }
var bytes = (byte[])o;
var text = Encoding.UTF8.GetString(bytes);
var values = text.Split(new[] { separator }, StringSplitOptions.None);
return values;
}
catch(Exception ex)
{
APILogger.Log(ex);
return defaultValue;
}
}
public static int GetInt(IDataReader reader, string column, int defaultValue = 0)
{
if (string.IsNullOrWhiteSpace(column))
{
return defaultValue;
}
var o = reader[column];
if (DBNull.Value.Equals(o))
{
return defaultValue;
}
try
{
return Convert.ToInt32(o);
}
catch (Exception ex)
{
APILogger.Log($"Failed to parse int for field {column}", o, ex);
return defaultValue;
}
}
public static double GetDouble(IDataReader reader, string column, double defaultValue = 0D)
{
if (string.IsNullOrWhiteSpace(column))
{
return defaultValue;
}
var o = reader[column];
if (DBNull.Value.Equals(o))
{
return defaultValue;
}
try
{
return Convert.ToDouble(o);
}
catch (Exception ex)
{
APILogger.Log($"Failed to parse double for field {column}", o, ex);
return defaultValue;
}
}
public static short GetShort(IDataReader reader, string column, short defaultValue = 0)
{
if (string.IsNullOrWhiteSpace(column))
{
return defaultValue;
}
var o = reader[column];
if (DBNull.Value.Equals(o))
{
return defaultValue;
}
try
{
return Convert.ToInt16(o);
}
catch (Exception ex)
{
APILogger.Log($"Failed to parse double for field {column}", o, ex);
return defaultValue;
}
}
public static DateTime? GetNullableDateTime(IDataReader reader, string column)
{
if (string.IsNullOrWhiteSpace(column)) { return null; }
var o = reader[column];
if (DBNull.Value.Equals(o))
{
return null;
}
return Convert.ToDateTime(o);
}
public static ulong GetUlong(IDataReader reader, string column, ulong defaultValue = 0)
{
if (string.IsNullOrWhiteSpace(column)) { return defaultValue; }
var o = reader[column];
if (DBNull.Value.Equals(o))
{
return defaultValue;
}
return Convert.ToUInt64(o);
}
public static int? GetNullableInt(IDataReader reader, string column)
{
if(string.IsNullOrWhiteSpace(column)) { return null; }
var o = reader[column];
if(DBNull.Value.Equals(o))
{
return null;
}
return Convert.ToInt32(o);
}
public static byte [] GetByteArray(IDataReader reader, string column)
{
if (string.IsNullOrWhiteSpace(column))
{
return new byte [0];
}
var o = reader[column];
if (DBNull.Value.Equals(o))
{
return new byte[0];
}
return (byte[])reader[column];
}
public static bool GetBool(IDataReader reader, string column, bool defaultValue = false)
{
if (string.IsNullOrWhiteSpace(column))
{
return defaultValue;
}
var o = reader[column];
if (DBNull.Value.Equals(o))
{
return defaultValue;
}
try
{
return Convert.ToBoolean(o);
}
catch (Exception ex)
{
APILogger.Log($"Failed to parse bool for field {column}", o, ex);
return defaultValue;
}
}
public static DateTime GetDateTime(IDataReader reader, string column, DateTime defaultValue)
{
if (string.IsNullOrWhiteSpace(column))
{
return defaultValue;
}
var o = reader[column];
if (DBNull.Value.Equals(o))
{
return defaultValue;
}
try
{
return Convert.ToDateTime(o);
}
catch (Exception ex)
{
APILogger.Log($"Failed to parse DateTime for field {column}", o, ex);
return defaultValue;
}
}
public static long GetLong(IDataReader reader, string column, long defaultValue = 0)
{
if (string.IsNullOrWhiteSpace(column))
{
return defaultValue;
}
var o = reader[column];
if (DBNull.Value.Equals(o))
{
return defaultValue;
}
try
{
return Convert.ToInt64(o);
}
catch (Exception ex)
{
APILogger.Log($"Failed to parse long for field {column}", o, ex);
return defaultValue;
}
}
}
}

View File

@@ -0,0 +1,10 @@
using Microsoft.Practices.Prism.Events;
namespace DTS.Common.Events
{
public class NavigateToDashboardEvent : CompositePresentationEvent<NavigateToDashboardArg> { }
public class NavigateToDashboardArg
{
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

View File

@@ -0,0 +1,262 @@
using DTS.Common.Enums.Hardware;
using DTS.Common.Enums.Sensors;
using DTS.Common.Interface.DASFactory.ARM;
using DTS.Common.Interface.DASFactory.Config;
using DTS.Common.Interface.DASFactory.Diagnostics;
using DTS.Common.Interface.DASFactory.Download;
using System;
using static DTS.Common.Enums.DASFactory.DFConstantsAndEnums;
namespace DTS.Common.Interface.DASFactory
{
/// <summary>
/// Interface to a DAS unit. The IDASCommunication interface for a DAS unit is the most used
/// data structure in the API. Nearly all services performed on the hardware will take a List
/// of these interfaces (representing a List of hardware units) as a parameter. Each DAS unit in
/// the real world will have an IDASCommunication interface in the API. In the case of Configuration, for
/// example, the local IDASCommunication corresponding to the hardware configuration target is edited, then
/// ConfigurationService.SetConfiguration(...) is called which basically synchronizes the local IDASCommunication
/// with the hardware, and vice versa with GetConfiguration(...).
/// </summary>
public interface IDASCommunication : IConfiguration,
IDiagnos,
ITriggerCheck,
IRealTime,
IArmStatus,
IDownload,
IInformation,
IComparable<IDASCommunication>,
IDisposable,
IAutoArmStatus,
IAutoArmed,
IRangeBandwidthLimited,
ITimeSynchronization
{
/// <summary>
/// The Excitation status for DAS
/// </summary>
ExcitationStatus ExcitationStatus { get; set; }
/// <summary>
/// populates IsFirstUseDateSupported and FirstUseDate properties
/// if unit supports first use date then requires communication with unit
/// (to retrieve attribute)
/// 15524 DAS "First Use Date"
/// this isn't really designed to be called externally, but as part of IDASCommunication initialization
/// </summary>
void ReadFirstUseDate();
/// <summary>
/// indicates date of first use
/// null indicates the hardware has not been used since calibration
/// only valid when IsFirstUseDateSupported is true
/// 15524 DAS "First Use Date"
/// </summary>
DateTime? FirstUseDate { get; set; }
/// <summary>
/// returns whether the hardware supports first use or not
/// for hardware to support first use the hardware must support
/// storage for user attributes in firmware and also have been
/// calibrated by software support hardware first use
/// 15524 DAS "First Use Date"
/// </summary>
bool IsFirstUseDateSupported { get; set; }
/// <summary>
///
/// </summary>
void SetIsStreamingSupported(bool supported = false);
/// <summary>
/// indicates whether or not streaming is supported
/// 30429 TSR AIRs can enable/disable streaming via the DISABLE_STREAMING_FEATURE system attribute
/// </summary>
bool IsStreamingSupported { get; set; }
/// <summary>
/// performs a quick connection check, returns true if unit can be communicated with
/// returns false otherwise
/// does not go through units busy service or check that unit is not being communicated with
/// this is an emergency check
/// </summary>
/// <returns></returns>
bool ConnectionCheck();
HardwareTypes GetHardwareType();
int RecordId { get; set; }
/// returns the nominal ranges for the das given a bridge type
double[] GetNominalRanges(SensorConstants.BridgeType bridge);
float InputLowVoltage { get; set; }
float InputMediumVoltage { get; set; }
float InputHighVoltage { get; set; }
float BatteryLowVoltage { get; set; }
float BatteryMediumVoltage { get; set; }
float BatteryHighVoltage { get; set; }
double MinimumValidInputVoltage { get; set; }
double MaximumValidInputVoltage { get; set; }
double MinimumValidBatteryVoltage { get; set; }
double MaximumValidBatteryVoltage { get; set; }
/// <summary>
/// The serial number of the base unit of this DAS.
/// </summary>
string SerialNumber { get; set; }
/// <summary>
/// The firmware version currently installed on this DAS.
/// </summary>
string FirmwareVersion { get; }
/// <summary>
/// This flag is used to tell if arm attributes should be defaulted when arming
/// or not. It also serves to let the user know that this DAS has not been
/// diagnosed.
/// </summary>
bool DiagnosticsHasBeenRun { get; set; }
/// <summary>
/// this flag is used to tell if configure has been run
/// this is used prior to when diagnostic results are needed, like the
/// diagnostics tab or the acquire tab [when running acquire]
/// </summary>
bool ConfigureHasBeenRun { get; set; }
/// <summary>
/// Count how many channels are configured.
/// </summary>
/// <returns>Number of configured channels.</returns>
int NumberOfConfiguredChannels();
/// <summary>
/// Count how many channels we have (regardless if they are configured or not).
/// </summary>
/// <returns>Total number of channels</returns>
int NumberOfChannels();
/// <summary>
/// max memory for the das
/// </summary>
/// <returns></returns>
long MaxMemory();
int MaxModules { get; set; }
/// <summary>
/// min sample rate for the das
/// </summary>
/// <returns></returns>
uint MinSampleRate();
/// <summary>
/// max sample rate for the das
/// </summary>
/// <returns></returns>
uint MaxSampleRate(int numberOfConfiguredChannels);
uint MaxAAFilterRate();
bool SupportsAutoArm();
bool SupportsLevelTrigger();
bool SupportsRealtime();
bool SupportsMultipleEvents();
/// <summary>
/// returns true if the device supports trigger completion inversion or not
/// </summary>
/// <returns>true if the device supports trigger completion inversion, false otherwise</returns>
bool SupportsTriggerInversion();
bool InvertTrigger { set; }
/// <summary>
/// returns true if the device supports start completion inversion or not
/// </summary>
/// <returns>returns true if the device supports start completion inversion, false otherwise</returns>
bool SupportsStartInversion();
bool InvertStart { get; set; }
bool IgnoreShortedStart { get; set; }
bool IgnoreShortedTrigger { get; set; }
/// <summary>
/// SLICE Base firmware supports checking the trigger and start lines as of protocol 7,
/// this function returns whether the hardware supports checking input status or not
/// </summary>
/// <returns></returns>
bool SupportsHardwareInputCheck();
/// <summary>
/// whether to use multiple sample real time or not
/// for sliceware there are times we need to turn off multiple sample realtime
/// (like when using a slicedb for instance)
/// </summary>
/// <returns></returns>
bool SupportsMultipleSampleRealtime();
/// <summary>
/// whether the DASbase actually controls the DAQ for modules
/// in the case of TDAS, the modules actually are responsible for the DAQ and the
/// rack is just a middleman
/// this is relevant because if the DAQ is controlled by the base then the sample numbers
/// should match for all modules.
/// </summary>
/// <returns></returns>
bool ControlsDAQ();
/// <summary>
/// returns if the new AAF rate is acceptible or not
/// right now this is only used to handle SLICE2 and it's multiple rate tables
/// it does this by comparing the AAF rate that the unit was configured with against the new rate
/// </summary>
/// <param name="rate">new AAF rate</param>
/// <returns></returns>
bool CheckAAF(float rate);
bool RequireDiagnosticRateMatchSampleRate();
/// <summary>
/// returns the phase delay in samples given a module index, a sample rate, and a
/// Hardware AAF
/// some DAS may have one phase delay across all modules, some may have separate phase delays for
/// individual module types.
///
/// for now most systems will just return 0 for the phase shift samples as the amount of delay
/// is only know for a very small number of DAS types
/// </summary>
/// <param name="ModuleIndex">module to query</param>
/// <param name="ActualSampleRate">actual sample rate of data collection</param>
/// <param name="HardwareAAF">actual rate of Hardware AAF, this is the sum of
/// fixed and variable AAFs
/// </param>
/// <returns></returns>
ulong GetPhaseShiftSamples(uint ModuleIndex, double ActualSampleRate, uint HardwareAAF, ulong originalT0);
/// <summary>
/// returns true if the devices is an ethernet distributor
/// for now that is SLICEDb, SLICE ECM, SLICE6DB
/// these are devices that we talk through, but not to for device communication
/// a rack we communicate with the modules by talking to the rack, so it's not a distributor
/// </summary>
/// <returns>returns true if the devices is an ethernet distributor</returns>
bool IsEthernetDistributor();
/// <summary>
/// returns true if the unit is capable of reading arm status
/// 17800 Trigger status is "waiting" but PPRO has indeed triggered
/// </summary>
/// <returns></returns>
bool GetCanCheckArmStatus();
/// <summary>
/// returns true if the device is a SLICE6DB, originally for the purpose
/// of knowing when we should download values from external temperature sensors
/// </summary>
/// <returns></returns>
bool IsSlice6Distributor();
bool IsBattery();
bool IsTSRAIR();
bool IsSlice6Air();
string MACAddress { get; set; }
string[] DownstreamMACAddresses { get; set; }
/// <summary>
/// Indicates that the unit supports selectable channels for realtime streaming
/// this is for 10572 implement SW side for single command streaming realtime
/// only SPS supports this currently
/// </summary>
bool SupportsIndividualChannelRealtimeStreaming { get; }
}
}

View File

@@ -0,0 +1,129 @@
using System.Windows;
using DTS.Common.Base;
using DTS.Common.Enums;
using DTS.Common.Enums.TTS;
using DTS.Common.Interface.DataRecorders;
namespace DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile
{
/// <summary>
/// represents a single record in a TTS Import
/// </summary>
public interface ITTSChannelRecord : IBaseClass
{
int ChannelNumber { get; set; }
string ChannelCode { get; set; }
string JCodeOrDescription { get; set; }
double ChannelRange { get; set; }
int ChannelFilterHz { get; set; }
string SensorEID { get; set; }
string SensorSerialNumber { get; set; }
double SensorSensitivity { get; set; }
double SensorExcitationVolts { get; set; }
double SensorCapacity { get; set; }
string SensorEU { get; set; }
bool SensorPolarity { get; set; }
ToyotaBridgeType ChannelType { get; set; }
string Description { get; set; }
bool ProportionalToExcitation { get; set; }
double BridgeResistance { get; set; }
double InitialOffsetVoltage { get; set; }
double InitialOffsetVoltageTolerance { get; set; }
bool RemoveOffset { get; set; }
ToyotaZeroMethods ZeroMethod { get; set; }
double CableMultiplier { get; set; }
double InitialEUInMV { get; set; }
double InitialEUInEU { get; set; }
double IRTraccExponent { get; set; }
double PolynomialConstant { get; set; }
double PolynomialCoefficientC { get; set; }
double PolynomialCoefficentB { get; set; }
double PolynomialCoefficientA { get; set; }
double PolynomialCoefficientAlpha { get; set; }
string ISOCode { get; set; }
string ISODescription { get; set; }
string ISOPolarity { get; set; }
bool IsSquib { get; set; }
bool IsDigitalInput { get; set; }
bool IsDigitalOutput { get; set; }
/// <summary>
/// returns true if the record is empty (no channel code and no sensor serial number)
/// </summary>
bool IsEmptyRecord { get; }
IHardwareChannel HardwareChannel { get; set; }
/// <summary>
/// returns whether the channelcode is valid or not
/// </summary>
bool IsChannelCodeValid { get; set; }
bool IsJCodeValid { get; set; }
bool IsRangeValid { get; set; }
bool IsFilterValid { get; set; }
/// <summary>
/// disabled channels are channels which are in the test setup, but aren't used during run test
/// </summary>
bool Disabled { get; set; }
/// <summary>
/// for squibs, what firemode to use
/// </summary>
SquibFireMode SquibFireMode { get; set; }
/// <summary>
/// the delay in ms between trigger and squib fire
/// </summary>
double SquibFireDelayMs { get; set; }
/// <summary>
/// whether to limit the duration or not of squib fire
/// </summary>
bool LimitDuration { get; set; }
/// <summary>
/// the duration of the squib fire in ms from the start of firing
/// (if limiting duration)
/// </summary>
double SquibFireDurationMs { get; set; }
/// <summary>
/// the limit for current (amps)
/// </summary>
double SquibFireCurrent { get; set; }
/// <summary>
/// the squib resistance tolerance low value (ohms)
/// </summary>
double SquibFireResistanceLowOhm { get; set; }
/// <summary>
/// the squib resistance tolerance high value (ohms)
/// </summary>
double SquibFireResistanceHighOhm { get; set; }
/// <summary>
/// the digital input mode (if relevant)
/// </summary>
DigitalInputModes DigitalInputMode { get; set; }
/// <summary>
/// the digital output mode (if relevant)
/// </summary>
DigitalOutputModes DigitalOutputMode { get; set; }
/// <summary>
/// the delay between trigger and output (if relevant)
/// </summary>
double DigitalOutputDelay { get; set; }
/// <summary>
/// the duration of output after output started (if relevant)
/// </summary>
double DigitalOutputDuration { get; set; }
IEditFileViewModel Parent { get; set; }
//bool ValidationNeeded { get; set; }
ITTSChannelRecord Copy();
Visibility RangeVisible { get; }
Visibility FilterVisible { get; }
bool OriginallyRequestedChannel { get; set; }
/// <summary>
/// controls whether the channel should be marked as diagnostics mode or not
/// note that diagnostics mode is only used when the configuration supports diagnostics mode
/// even if the sensor has diagnosticsmode set to true
/// </summary>
bool DiagnosticsMode { get; set; }
bool IsModified { get; set; }
/// <summary>
/// returns an array of bytes to represent the channel, for use in CRC and hashing
/// </summary>
/// <returns>array of bytes representing the channel</returns>
byte[] GetBytes();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

View File

@@ -0,0 +1,12 @@
using System.Collections.Generic;
using System.Reflection;
using DTS.Common.Base;
// ReSharper disable CheckNamespace
namespace DTS.Common.Interface
{
public interface ITestModuleViewModel : IBaseViewModel
{
List<Assembly> AssemblyList { get; set; }
}
}