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 @@
12

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1,14 @@
namespace DTS.Common.Interface.DASFactory.Diagnostics
{
public interface IModuleDiagnosticsResult
{
float TemperatureLocation1Pre { get; set; }
float TemperatureLocation2Pre { get; set; }
float TemperatureLocation3Pre { get; set; }
float TemperatureLocation4Pre { get; set; }
float TemperatureLocation1Post { get; set; }
float TemperatureLocation2Post { get; set; }
float TemperatureLocation3Post { get; set; }
float TemperatureLocation4Post { get; set; }
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IAssemblyView : IBaseView { }
}

View File

@@ -0,0 +1,37 @@
using DTS.Common.Base;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using DTS.Common.Interface.DataRecorders;
using DTS.Common.Interface.Groups;
using DTS.Common.Interface.GroupTemplate;
using DTS.Common.Interface.TestSetups.TestSetupsList;
using DTS.Common.Enums;
namespace DTS.Common.Interface.RegionOfInterest.RegionOfInterestChannels
{
public interface IRegionOfInterestChannelsViewModel : IBaseViewModel
{
void SetParent(object o);
IRegionOfInterestChannelsView View { get; set; }
BindingList<IRegionOfInterest> RegionsOfInterest { get; set; }
string[] AllChannelSSNs { get; }
List<DTS.Common.Classes.Groups.GroupChannel> AllChannelsUnfiltered { get; set; }
//void SetGroups(ITestObject[] groups, Dictionary<string, IDASHardware> hardwareLookup, ITestObjectTemplate[] groupTemplates);
void SetGroups(ITestSetup testSetup, Dictionary<string, IDASHardware> serialNumberToHardware, IsoViewMode viewMode);
void SetTest(string path, IsoViewMode viewMode);
void Filter(object tag, string term);
/// <summary>
/// filters in (search for) search term among all channels
/// </summary>
/// <param name="term"></param>
void Filter(string term);
void Sort(object o, bool columnClick);
void SelectAll(int roiIndex, bool selection);
bool Validate(ref List<string> errors);
IsoViewMode ISOViewMode { get; set; }
}
}

View File

@@ -0,0 +1,130 @@
using DTS.Common.Base.Classes;
using DTS.Common.Interface.TestMetaData;
using DTS.Common.Utilities.Logging;
using System;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
namespace DTS.Common.Classes.CustomerDetails
{
public class CustomerDetailsDbRecord : Base.BasePropertyChanged, ICustomerDetailsDbRecord
{
private int _customerId = -1;
[ReadOnly(true)]
[Browsable(false)]
public int CustomerId
{
get => _customerId;
set => SetProperty(ref _customerId, value, "CustomerId");
}
private string _name = "";
[ReadOnly(true)]
[Browsable(false)]
public string Name
{
get => _name;
set => SetProperty(ref _name, value, "Name");
}
private string _customerName = "";
[DisplayResource("CustomerName")]
public string CustomerName
{
get => _customerName;
set => SetProperty(ref _customerName, value, "CustomerName");
}
private string _customerTestRefNumber = "";
[DisplayResource("CustomerTestRefNumber")]
public string CustomerTestRefNumber
{
get => _customerTestRefNumber;
set => SetProperty(ref _customerTestRefNumber, value, "CustomerTestRefNumber");
}
private string _projectRefNumber = "NOVALUE";
[DisplayResource("ProjectRefNumber")]
public string ProjectRefNumber
{
get => _projectRefNumber;
set => SetProperty(ref _projectRefNumber, value, "ProjectRefNumber");
}
private string _customerOrderNumber = "NOVALUE";
[DisplayResource("CustomerOrderNumber")]
public string CustomerOrderNumber
{
get => _customerOrderNumber;
set => SetProperty(ref _customerOrderNumber, value, "CustomerOrderNumber");
}
private string _customerCostUnit = "NOVALUE";
[DisplayResource("CustomerCostUnit")]
public string CustomerCostUnit
{
get => _customerCostUnit;
set => SetProperty(ref _customerCostUnit, value, "CustomerCostUnit");
}
private bool _localOnly = false;
[Browsable(false)]
[ReadOnly(true)]
public bool LocalOnly
{
get => _localOnly;
set => SetProperty(ref _localOnly, value, "LocalOnly");
}
private DateTime _lastModified = DateTime.MinValue;
[Browsable(false)]
[ReadOnly(true)]
public DateTime LastModified
{
get => _lastModified;
set => SetProperty(ref _lastModified, value, "LastModified");
}
private string _lastModifiedBy = "";
[Browsable(false)]
[ReadOnly(true)]
public string LastModifiedBy
{
get => _lastModifiedBy;
set => SetProperty(ref _lastModifiedBy, value, "LastModifiedBy");
}
private int _version = -1;
[Browsable(false)]
[ReadOnly(true)]
public int Version
{
get => _version;
set => SetProperty(ref _version, value, "Version");
}
public CustomerDetailsDbRecord(ICustomerDetailsDbRecord customerDetailsDbRecord)
{
Name = customerDetailsDbRecord.Name;
CustomerName = customerDetailsDbRecord.CustomerName;
CustomerTestRefNumber = customerDetailsDbRecord.CustomerTestRefNumber;
ProjectRefNumber = customerDetailsDbRecord.ProjectRefNumber;
CustomerOrderNumber = customerDetailsDbRecord.CustomerOrderNumber;
CustomerCostUnit = customerDetailsDbRecord.CustomerCostUnit;
LocalOnly = customerDetailsDbRecord.LocalOnly;
LastModified = customerDetailsDbRecord.LastModified;
LastModifiedBy = customerDetailsDbRecord.LastModifiedBy;
Version = customerDetailsDbRecord.Version;
}
public CustomerDetailsDbRecord() { }
public CustomerDetailsDbRecord(IDataReader reader)
{
Name = Utility.GetString(reader, "Name");
CustomerName = Utility.GetString(reader, "CustomerName");
CustomerTestRefNumber = Utility.GetString(reader, "CustomerTestRefNumber");
ProjectRefNumber = Utility.GetString(reader, "ProjectRefNumber");
CustomerOrderNumber = Utility.GetString(reader, "CustomerOrderNumber");
CustomerCostUnit = Utility.GetString(reader, "CustomerCostUnit");
LocalOnly = Utility.GetBool(reader, "LocalOnly");
LastModified = Utility.GetDateTime(reader, "LastModified", DateTime.MinValue);
LastModifiedBy = Utility.GetString(reader, "LastModifiedBy");
Version = Utility.GetInt(reader, "Version");
}
public bool IsInvalidBlank()
{
return string.IsNullOrWhiteSpace(Name);
}
}
}

View File

@@ -0,0 +1,30 @@
namespace DTS.Common.Interface.Sensors
{
/// <summary>
/// this interface describes the default properties
/// for digital inputs
/// </summary>
public interface IDigitalInputDefaults
{
/// <summary>
/// the default value in ADC for Constant Current digital input where default state switches active or vice versa
/// (CCNO or CCNC)
/// </summary>
double ConstantCurrentBreakpointADC { get; set; }
/// <summary>
/// the default value in ADC for Voltage digital input modes where default state switches to active or vice vera
/// (Transition High To Low [THL] or [TLH])
/// </summary>
double VoltageBreakpointADC { get; set; }
/// <summary>
/// whether to display analog SLICE PRO DIGITAL ADC data
/// </summary>
bool DisplaySPDADC { get; set; }
/// <summary>
/// indicates whether the setting is valid or not
/// </summary>
/// <returns></returns>
bool Validate();
}
}

View File

@@ -0,0 +1,8 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IGenericModuleViewModel : IBaseViewModel
{
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.TestSetups.Imports.TTS.DOChannels
{
public interface IDigitalOutputChannelsView : IBaseView { }
}

View File

@@ -0,0 +1,15 @@
namespace DTS.Common.RibbonControl
{
public class MenuItemData : SplitButtonData
{
public MenuItemData()
: this(false)
{
}
public MenuItemData(bool isApplicationMenu)
: base(isApplicationMenu)
{
}
}
}

View File

@@ -0,0 +1,27 @@
using Prism.Events;
namespace DTS.Common.Events.GroupTemplates.CustomChannels
{
/// <summary>
/// Event to inform of custom channel import status
/// </summary>
/// <remarks>
///
/// </remarks>
public class CustomChannelImportEvent : PubSubEvent<CustomChannelImportEventArgs> { }
public class CustomChannelImportEventArgs
{
public enum Status
{
Done
}
public Status ImportStatus { get; }
public CustomChannelImportEventArgs(Status status)
{
ImportStatus = status;
}
}
}

View File

@@ -0,0 +1,97 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
namespace DTS.Common.RibbonControl
{
public class TabData : INotifyPropertyChanged
{
public TabData()
: this(null)
{
}
public TabData(string header)
{
Header = header;
}
public string Header
{
get => _header;
set
{
if (_header == value) return;
_header = value;
OnPropertyChanged(new PropertyChangedEventArgs("Header"));
}
}
private string _header;
public string ContextualTabGroupHeader
{
get => _contextualTabGroupHeader;
set
{
if (_contextualTabGroupHeader == value) return;
_contextualTabGroupHeader = value;
OnPropertyChanged(new PropertyChangedEventArgs("ContextualTabGroupHeader"));
}
}
private string _contextualTabGroupHeader;
public bool IsSelected
{
get => _isSelected;
set
{
if (_isSelected == value) return;
_isSelected = value;
OnPropertyChanged(new PropertyChangedEventArgs("IsSelected"));
}
}
private bool _isSelected;
public ObservableCollection<GroupData> GroupDataCollection
{
get
{
if (_groupDataCollection == null)
{
var smallImage = new Uri("/Common;component/RibbonControl/Images/Paste_16x16.png", UriKind.Relative);
var largeImage = new Uri("/Common;component/RibbonControl/Images/Paste_32x32.png", UriKind.Relative);
_groupDataCollection = new ObservableCollection<GroupData>();
for (var i = 0; i < ViewModelData.GroupCount; i++)
{
_groupDataCollection.Add(new GroupData("Group " + i)
{
LargeImage = largeImage,
SmallImage = smallImage
});
}
}
return _groupDataCollection;
}
}
private ObservableCollection<GroupData> _groupDataCollection;
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (PropertyChanged != null)
{
PropertyChanged(this, e);
}
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
using Prism.Events;
namespace DTS.Common.Events.TSRAIRGo
{
public class TriggerEvent : PubSubEvent<TriggerArg> { }
public class TriggerArg
{
}
}

View File

@@ -0,0 +1,14 @@
using DTS.Common.Base;
using DTS.Common.Interface;
using Prism.Events;
namespace DTS.Common.Events
{
public class PSDReportGRMSValuesUpdatedEvent : PubSubEvent<PSDReportGRMSValuesUpdatedEventArg> { }
public class PSDReportGRMSValuesUpdatedEventArg
{
public IChannelGRMSSummary[] Values { get; set; }
public IBaseViewModel ParentVM { get; set; }
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.CustomChannels
{
public interface ICustomChannelsImportView : IBaseView { }
}

View File

@@ -0,0 +1,14 @@
using DTS.Common.Classes;
using Prism.Events;
namespace DTS.Common.Events
{
/// <summary>
/// The StatusAndProgressBarEvent event.
/// </summary>
///
/// <remarks>This event is used to update the Status and/or Progress bars.</remarks>
///
public class StatusAndProgressBarEvent : PubSubEvent<StatusAndProgressBarEventArgs> { }
}

View File

@@ -0,0 +1,16 @@
using DTS.Common.Base;
using DTS.Common.Interface.DataRecorders;
using DTS.Common.Interface.Sensors;
namespace DTS.Common.Interface.TestSetups.CachedItemsList
{
public interface ICachedItemsListViewModel : IBaseViewModel
{
ICachedItemsListView View { get; set; }
ICachedItem[] CachedItems { get; set; }
bool SetCachedItems(ISensorData[] sensors, ISensorCalibration[] sensorCalibrations, IDASHardware[] hardware,
IDASHardware[] allDAS);
bool HasOutofDateCachedItems { get; }
bool HasMissingSensors { get; }
}
}

View File

@@ -0,0 +1,8 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IManageUsersView : IBaseView
{
}
}

View File

@@ -0,0 +1,10 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface ITRLReportViewModel : IBaseViewModel
{
ITRLReportInputView InputView { get; set; }
ITRLReportOutputView OutputView { get; set; }
}
}

View File

@@ -0,0 +1,520 @@
using DTS.Common.Interface.Sensors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTS.Common.Enums;
using DTS.Common.Enums.Sensors;
using DTS.Common.Utilities.Logging;
using System.Globalization;
namespace DTS.Common.Classes.Sensors
{
public class CalibrationRecords : ICalibrationRecords
{
public ICalibrationRecord[] Records { get; set; } = new CalibrationRecord[] { new CalibrationRecord() };
public CalibrationRecords(ICalibrationRecords copy)
{
var records = new CalibrationRecord[copy.Records.Length];
for (var i = 0; i < copy.Records.Length; i++)
{
records[i] = new CalibrationRecord(copy.Records[i]);
}
Records = records;
}
public CalibrationRecords()
{
Records = new CalibrationRecord[] { new CalibrationRecord() };
}
public CalibrationRecords(string records)
{
FromSerializedString(records);
}
public bool IsEqual(object obj, ISensorCalibration sc)
{
if (obj is CalibrationRecords r)
{
if (r.Records.Length != Records.Length)
{
return false;
}
for (var i = 0; i < r.Records.Length; i++)
{
if (!r.Records[i].IsEqual(Records[i], sc))
{
return false;
}
}
return true;
}
return base.Equals(obj);
}
public void FromSerializedString(string s)
{
var tokens = s.Split(new string[] { MySeparator }, StringSplitOptions.None);
for (var i = 0; i < tokens.Length; i++)
{
tokens[i] = tokens[i].Replace(MySeparatorBackup, MySeparator);
}
var records = new List<CalibrationRecord>();
foreach (string token in tokens)
{
records.Add(new CalibrationRecord(token));
}
Records = records.ToArray();
}
private const string MySeparator = "__x__";
private const string MySeparatorBackup = "___xx___";
public string ToSerializedString(ISensorCalDbRecord sc)
{
var records = new List<string>();
foreach (var r in Records)
{
records.Add(r.ToSerializedString(sc));
}
for (var i = 0; i < records.Count; i++)
{
System.Diagnostics.Trace.Assert(!records[i].Contains(MySeparatorBackup));
records[i] = records[i].Replace(MySeparator, MySeparatorBackup);
}
return string.Join(MySeparator, records.ToArray());
}
public string ToDisplayString(ISensorCalibration sc, ISensorCalibration previous, string linearFormat, string nonlinearFormat)
{
var sb = new StringBuilder();
for (var i = 0; i < Records.Length; i++)
{
if (i > 0)
{
sb.AppendLine();
}
var r = Records[i];
ICalibrationRecord r2 = null;
if (null != previous)
{
if (i < previous.Records.Records.Length)
{
r2 = previous.Records.Records[i];
}
}
var s = r.ToDisplayString(sc, r2, previous, linearFormat, nonlinearFormat);
if (!string.IsNullOrEmpty(s))
{
sb.Append(s);
}
}
return sb.ToString();
}
}
public class CalibrationRecord : ICalibrationRecord
{
public double Sensitivity { get; set; }
/// <summary>
/// ZeroPoint is used to hold the calibration certificate field for 2D/3D IR-TRACC cal certs
/// it is used to zero the IR-TRACC and POT data prior to being fed into the 3D equations
/// </summary>
private double _zeroPoint = 0D;
public double ZeroPoint
{
get
{
if (false == Equals(Poly.CalibrationFactor, 0.0))
{
// This field is always calculated. Do not return stored value unless we are unable to calculate
return Poly.ZeroPositionIntercept / Poly.CalibrationFactor;
}
return _zeroPoint;
}
set => _zeroPoint = value;
}
public LinearizationFormula Poly { get; set; }
public bool AtCapacity { get; set; } = false;
public string EngineeringUnits { get; set; } = "g";
public SensorConstants.SensUnits SensitivityUnits { get; set; } = SensorConstants.SensUnits.NONE;
public ExcitationVoltageOptions.ExcitationVoltageOption Excitation { get; set; } = ExcitationVoltageOptions.ExcitationVoltageOption.Volt5;
public double CapacityOutputIsBasedOn { get; set; } = 1.000;
public InitialOffsetTypes InitialOffsetMethod { get; set; } = InitialOffsetTypes.EU;
public string ISOCode { get; set; } = String.Empty;
private enum Fields
{
Sensitivity,
Poly,
AtCapacity,
EngineeringUnits,
Excitation,
CapacityOutputIsBasedOn,
SensitivityUnits,
ZeroPoint,
ISOCode
};
public string ToSerializedString(ISensorCalDbRecord parentCal)
{
var tokens = new List<string>();
var fields = Enum.GetValues(typeof(Fields)).Cast<Fields>().ToArray();
foreach (var field in fields)
{
switch (field)
{
case Fields.AtCapacity:
tokens.Add(AtCapacity.ToString());
break;
case Fields.EngineeringUnits:
tokens.Add(EngineeringUnits);
break;
case Fields.Excitation:
tokens.Add(Excitation.ToString());
break;
case Fields.Poly:
Poly.MarkValid(parentCal.NonLinear);
if (parentCal.LinearAdded)
{
//We have a mixed-sensitivity sensor. Mark the first CR valid, kill the rest
for (var i = 0; i < parentCal.Records.Records.Length; i++)
{
parentCal.Records.Records[i].Poly.MarkValid(i == 0);
}
}
tokens.Add(Poly.ToSerializeString());
break;
case Fields.Sensitivity:
tokens.Add(Sensitivity.ToString(System.Globalization.CultureInfo.InvariantCulture));
break;
case Fields.CapacityOutputIsBasedOn:
tokens.Add(CapacityOutputIsBasedOn.ToString());
break;
case Fields.SensitivityUnits:
tokens.Add(SensitivityUnits.ToString());
break;
case Fields.ZeroPoint:
tokens.Add(ZeroPoint.ToString(System.Globalization.CultureInfo.InvariantCulture));
break;
case Fields.ISOCode:
if (!string.IsNullOrWhiteSpace(ISOCode)) tokens.Add(ISOCode);
break;
default: throw new NotSupportedException("unknown CalibrationRecord field: " + field.ToString());
}
}
for (var i = 0; i < tokens.Count; i++)
{
if (null == tokens[i])
{
tokens[i] = "";
}
tokens[i] = tokens[i].Replace(System.Globalization.CultureInfo.InvariantCulture.TextInfo.ListSeparator,
"x_Separator_x");
}
return string.Join(System.Globalization.CultureInfo.InvariantCulture.TextInfo.ListSeparator,
tokens.ToArray());
}
public string ToDisplayString(ISensorCalibration sc, ICalibrationRecord previous, ISensorCalibration sc2, string linearFormat, string nonlinearFormat)
{
var sb = new StringBuilder();
var fields = Enum.GetValues(typeof(Fields)).Cast<Fields>().ToArray();
foreach (var field in fields)
{
switch (field)
{
case Fields.AtCapacity:
if (null == previous || AtCapacity != previous.AtCapacity)
{
if (sb.Length > 1)
{
sb.AppendLine();
}
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_AtCapacity, AtCapacity);
}
break;
case Fields.EngineeringUnits:
if (null == previous || false == EngineeringUnits.Equals(previous.EngineeringUnits))
{
if (sb.Length > 1)
{
sb.AppendLine();
}
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_EngineeringUnits, EngineeringUnits);
}
break;
case Fields.Excitation:
if (null == previous || sc.IsProportional != sc2.IsProportional || Excitation != previous.Excitation)
{
if (sc.IsProportional)
{
if (sb.Length > 1)
{
sb.AppendLine();
}
sb.AppendFormat("{0}: {1:0.0}", Strings.Strings.SensorFields_Excitation,
GetExcitationVoltageMagnitudeFromEnum(Excitation));
}
}
break;
case Fields.Poly:
if (null == previous || sc.NonLinear || sc.NonLinear != sc2.NonLinear)
{
if (sc.NonLinear)
{
if (sb.Length > 1)
{
sb.AppendLine();
}
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_NonLinearFormat,
Poly.ToDisplayString(nonlinearFormat));
}
}
break;
case Fields.Sensitivity:
if (null == previous || Sensitivity != previous.Sensitivity)
{
if (sb.Length > 1)
{
sb.AppendLine();
}
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_Sensitivity,
Sensitivity.ToString(linearFormat));
}
break;
case Fields.CapacityOutputIsBasedOn:
if (false == AtCapacity)
{
if (null == previous || CapacityOutputIsBasedOn != previous.CapacityOutputIsBasedOn)
{
if (sb.Length > 1)
{
sb.AppendLine();
}
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_CapacityOutputIsBasedOn,
CapacityOutputIsBasedOn);
}
}
break;
case Fields.SensitivityUnits:
if (null == previous || false == SensitivityUnits.Equals(previous.SensitivityUnits))
{
if (sb.Length > 1)
{
sb.AppendLine();
}
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_SensitivityUnits, SensitivityUnits);
}
break;
case Fields.ZeroPoint:
if (null == previous || ZeroPoint != previous.ZeroPoint)
{
if (sb.Length > 1)
{
sb.AppendLine();
}
sb.AppendFormat("{0}: {1}", Strings.Strings.SensorFields_ZeroPoint, ZeroPoint);
}
break;
default:
break;
}
}
return sb.ToString();
}
public bool IsEqual(object obj, ISensorCalibration sc)
{
if (obj is CalibrationRecord r)
{
return r.ToSerializedString(sc) == ToSerializedString(sc);
}
return base.Equals(obj);
}
public void FromString(string s)
{
var tokens = s.Split(new string[] { CultureInfo.InvariantCulture.TextInfo.ListSeparator },
StringSplitOptions.None);
var fields = Enum.GetValues(typeof(Fields)).Cast<Fields>().ToArray();
for (var i = 0; i < tokens.Length && i < fields.Length; i++)
{
var token = tokens[i].Replace("x_Separator_x",
CultureInfo.InvariantCulture.TextInfo.ListSeparator);
switch (fields[i])
{
case Fields.AtCapacity:
AtCapacity = Convert.ToBoolean(token);
break;
case Fields.EngineeringUnits:
EngineeringUnits = token;
break;
case Fields.Excitation:
if (Enum.TryParse(token, out ExcitationVoltageOptions.ExcitationVoltageOption excitation))
{
Excitation = excitation;
}
else { APILogger.Log($"failed to parse excitation: {token} from {s}"); }
break;
case Fields.Poly:
Poly = new LinearizationFormula();
Poly.FromSerializeString(token);
break;
case Fields.Sensitivity:
Sensitivity = Convert.ToDouble(token, System.Globalization.CultureInfo.InvariantCulture);
break;
case Fields.CapacityOutputIsBasedOn:
CapacityOutputIsBasedOn = Convert.ToDouble(token);
break;
case Fields.SensitivityUnits:
if (Enum.TryParse(token, out SensorConstants.SensUnits unit))
{
SensitivityUnits = unit;
}
else { APILogger.Log($"failed to parse sensitivity units: {token} from {s}"); }
break;
case Fields.ZeroPoint:
ZeroPoint = Convert.ToDouble(token, System.Globalization.CultureInfo.InvariantCulture);
break;
case Fields.ISOCode:
ISOCode = token;
break;
default: throw new NotSupportedException("unknown CalibrationRecord field: " + fields.ToArray());
}
}
}
public CalibrationRecord(string s)
{
FromString(s);
}
public CalibrationRecord(ICalibrationRecord copy)
{
var fields = Enum.GetValues(typeof(Fields)).Cast<Fields>().ToArray();
foreach (var field in fields)
{
switch (field)
{
case Fields.AtCapacity:
AtCapacity = copy.AtCapacity;
break;
case Fields.EngineeringUnits:
EngineeringUnits = copy.EngineeringUnits;
break;
case Fields.Excitation:
Excitation = copy.Excitation;
break;
case Fields.Poly:
Poly = new LinearizationFormula(copy.Poly);
break;
case Fields.Sensitivity:
Sensitivity = copy.Sensitivity;
break;
case Fields.CapacityOutputIsBasedOn:
CapacityOutputIsBasedOn = copy.CapacityOutputIsBasedOn;
break;
case Fields.SensitivityUnits:
SensitivityUnits = copy.SensitivityUnits;
break;
case Fields.ZeroPoint:
ZeroPoint = copy.ZeroPoint;
break;
case Fields.ISOCode:
ISOCode = copy.ISOCode;
break;
default:
throw new NotSupportedException("unknown calibrationrecord field: " + field.ToString());
}
}
}
public CalibrationRecord()
{
Poly = new LinearizationFormula();
}
//helpers moved from DAS.Concepts
public static double GetExcitationVoltageMagnitudeFromEnum(ExcitationVoltageOptions.ExcitationVoltageOption target)
{
try
{
return new ExcitationVoltageOptions.VoltageMagnitudeAttributeCoder().DecodeAttributeValue(target);
}
catch (Exception ex)
{
throw new Exception("encountered problem attempting to get excitation voltage magnitude from enum", ex);
}
}
public static ExcitationVoltageOptions.ExcitationVoltageOption GetExcitationVoltageEnumFromMagnitude(double magnitude)
{
try
{
return new ExcitationVoltageOptions.VoltageMagnitudeAttributeCoder().EncodeAttributeValue(magnitude);
}
catch (Exception ex)
{
APILogger.Log("encountered problem attempting to get excitation voltage enum from magnitude", ex);
return ExcitationVoltageOptions.ExcitationVoltageOption.Undefined;
}
}
}
}

View File

@@ -0,0 +1,82 @@
using System;
using System.IO.Ports;
using DTS.Common.Enums;
namespace DTS.Common.Interface.Sensors.SensorsList
{
public interface ICanIOSetting
{
/// <summary>
/// ID in the database for the uart i/o setting
/// only positive numbers are valid database ids
/// </summary>
int DatabaseId { get; set; }
/// <summary>
/// whether the uart i/o is checked in a list with a checkbox
/// </summary>
bool Included { get; set; }
/// <summary>
/// the serial number / setting name
/// </summary>
string SerialNumber { get; set; }
/// <summary>
/// description or comment of setting
/// </summary>
string Description { get; set; }
/// <summary>
/// the user who last modified setting
/// </summary>
string LastModifiedBy { get; set; }
/// <summary>
/// when the setting was last modified
/// </summary>
DateTime LastModified { get; set; }
/// <summary>
/// returns true if uart i/o matches filter criteria
/// </summary>
/// <param name="term"></param>
/// <returns></returns>
bool Filter(string term);
/// <summary>
/// whether the uart i/o is associated with a channel
/// </summary>
bool Assigned { get; set; }
/// <summary>
/// whether the uart i/o is online or not
/// </summary>
bool Online { get; set; }
/// <summary>
/// the isocode for the uart i/o
/// </summary>
string ISOCode { get; set; }
/// <summary>
/// the iso channel name for the uart i/o
/// </summary>
string ISOChannelName { get; set; }
/// <summary>
/// the user code for the uart i/o
/// </summary>
string UserCode { get; set; }
/// <summary>
/// the user channel name for the uart i/o
/// </summary>
string UserChannelName { get; set; }
/// <summary>
/// marks the uart i/o setting as broken or not
/// broken sensors do not appear in selectable lists of sensors in edit test setup or edit group
/// </summary>
bool Broken { get; set; }
/// <summary>
/// marks the uart i/o setting as donotuse
/// donotuse sensors do not appear in selectable lists of sensors in edit test setup or edit group
/// </summary>
bool DoNotUse { get; set; }
bool CanIsFD { get; set; }
int CanArbBaseBitrate { get; set; }
int CanArbBaseSJW { get; set; }
int CanDataBitrate { get; set; }
int CanDataSJW { get; set; }
string CanFileType { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using DTS.Common.Interface.Sensors.AnalogDiagnostics;
using System;
using System.Data.SqlClient;
namespace DTS.Common.Classes.Sensors.AnalogDiagnostics
{
public class DiagnosticRun : IDiagnosticRun
{
private long? _Id = null;
public long? Id { get => _Id; set => _Id = value; }
private string _DataPROUser = string.Empty;
public string DataPROUser { get => _DataPROUser; set => _DataPROUser = value; }
private int? _TestId = null;
public int? TestId { get => _TestId; set => _TestId = value; }
private string _TestName = string.Empty;
public string TestName { get => _TestName; set => _TestName = value; }
private bool _PreTest = true;
public bool PreTest { get => _PreTest; set => _PreTest = value; }
public DiagnosticRun() { }
public DiagnosticRun(SqlDataReader reader)
{
if (!DBNull.Value.Equals(reader["Id"])){ Id = (long)reader["Id"]; }
if (!DBNull.Value.Equals(reader["DataPROUser"])) { DataPROUser = (string)reader["DataPROUser"]; }
if (!DBNull.Value.Equals(reader["TestId"])) { TestId = (int)reader["TestId"]; }
if (!DBNull.Value.Equals(reader["TestName"])) { TestName = (string)reader["TestName"]; }
if (!DBNull.Value.Equals(reader["PreTest"])) { PreTest = (bool)reader["PreTest"]; }
}
}
}

View File

@@ -0,0 +1,9 @@
namespace DTS.Common.Interactivity
{
public class Notification : INotification
{
public string Title { get; set; }
public object Content { get; set; }
}
}

View File

@@ -0,0 +1,37 @@
using System.Collections.Generic;
using System.Windows;
using DTS.Common.Base;
// ReSharper disable once CheckNamespace
namespace DTS.Common.Interface
{
public interface IExportMainViewModel : IBaseViewModel, ISelectedDataViewModel
{
/// <summary>
/// Gets the Main View.
/// </summary>
IBaseView View { get; set; }
bool Standalone { get; set; }
object ContextNavigationRegion { get; set; }
object ContextGraphRegion { get; set; }
object ContextGraphsRegion { get; set; }
object ContextPropertyRegion { get; set; }
List<FrameworkElement> GetRegions();
string ConfigPath { get; set; }
bool DoesUserHaveEditPermission { get; set; }
void ZoomReset();
//inform left arrow key was pressed
void LeftKeyPress();
//inform right arrow key was pressed
void RightKeyPress();
Common.Enums.IsoViewMode ChannelCodeViewMode { get; set; }
Common.Enums.Sensors.CalibrationBehaviors CalibrationBehaviorSetting { get; set; }
bool CalibrationBehaviorSettableInViewer { get; set; }
Visibility SettingsVisibility { get; }
string SelectedTest { get; set; }
string SelectedDTSFile { get; set; }
void AddSelectedEvents(string groupName, List<ITestEvent> events);
List<string> AvailableTestIds { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
using DTS.Common.Enums;
using DTS.Common.Enums.DASFactory;
using System;
using System.Windows;
using System.Windows.Data;
namespace DTS.Common.Converters
{
/// <summary>
/// This converter will returns a visibility based on whether pretrigger should be shown or not
/// it should be bound to RecordingMode an optional parameter allows inverting the return
/// </summary>
public class RecordingModePreTriggerVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var showPreTrigger = true;
if ((value is RecordingModes mode) &&
(RecordingModeExtensions.IsAnActiveMode(mode) || !RecordingModeExtensions.CanProgramPreTrigger(mode)))
{
showPreTrigger = false;
}
var invert = false;
if (bool.TrueString.Equals(parameter)) { invert = true; }
if (showPreTrigger)
{
return invert ? Visibility.Collapsed : Visibility.Visible;
}
else { return invert ? Visibility.Visible : Visibility.Collapsed; }
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null != value && value.Equals(Visibility.Visible) ? parameter : Binding.DoNothing;
}
}
}

View File

@@ -0,0 +1,67 @@
G\PN:{NAME OF PROGRAM};
G\TA:{TEST ID}_{DAS SERIAL NUMBER};
G\106:17;
G\DSI\N:1;
G\DSI-1:PTP;
G\DSI-2:{TEST ID};
G\DST-1:DRS;
G\DSC-1\U;
G\SC\U;
G\COM:-- SLICE TMATS File --;
R-1\ID:{TEST ID};
R-1\RID:S6ACH6;
R-1\N:2;
R-1\NSB:0;
R-1\RI1:DTS;
R-1\RI2:S6A;
R-1\RI3:Y;
R-1\RI4:{CREATE DATE};
R-1\COM:Ver-17;
V-1\ID:{TEST ID};
V-1\VN:DTS;
V-1\DTS\STREAMCH10;
R-1\EV\E:F;
R-1\IDX\E:F;
R-1\IDX\IT:F;
R-1\COM:-- Channel '1', ID: 0x0001, TIME Data Packet Format --;
R-1\TK1-1:{UDP STREAM TIME CHANNEL ID};
R-1\TK2-1:OTHER;
R-1\DSI-1:{UDP STREAM TIME CHANNEL ID};
R-1\TK3-1:FWD;
R-1\TK4-1:{UDP STREAM TIME CHANNEL ID};
R-1\CHE-1:T;
R-1\CDT-1:TIMEIN;
R-1\CDLN-1:1;
R-1\TTF-1:{STREAM TIME FORMAT};
R-1\TFMT-1:B;
R-1\TSRC-1:E;
R-1\SHTF-1:1;
R-1\COM:-- Main Analog Channel Description --;
R-1\DSI-2:{UDP STREAM DATA CHANNEL ID};
R-1\TK1-2:{UDP STREAM DATA CHANNEL ID};
R-1\TK2-2:OTHER;
R-1\TK3-2:FWD;
R-1\TK4-2:{UDP STREAM DATA CHANNEL ID};
R-1\CHE-2:T;
R-1\CDLN-2:{DAS SERIAL NUMBER};
R-1\CDT-2:ANAIN;
R-1\ATF-2:1;
R-1\ACH\N-2:{NUMBER OF STREAMED CHANNELS};
R-1\ADP-2:NO;
R-1\ASR-2:{DAS SAMPLE RATE};
R-1\SHTF-2:1;
R-1\COM:-- UART-01 Channel {UDP STREAM UART CHANNEL ID} --;
R-1\TK1-3:{UDP STREAM UART CHANNEL ID};
R-1\DSI-3:{UDP STREAM UART CHANNEL ID};
R-1\TK4-3:{UDP STREAM UART CHANNEL ID};
R-1\CHE-3:{UDP STREAM UART CHANNEL ID ENABLED};
R-1\CDT-3:UARTIN;
R-1\CDLN-3:UART-01;
R-1\UTF-3:0;
R-1\NUS\N-3:1;
R-1\USCN-3-1:1;
R-1\UCNM-3-1:UART-1;
R-1\UCR-3-1:9600;
R-1\UCB-3-1:8;
R-1\UCP-3-1:N;
R-1\UCS-3-1:0;

View File

@@ -0,0 +1,13 @@
using Prism.Events;
namespace DTS.Common.Events.TestSetups.TestSetupsList
{
/// <summary>
/// The CurrentTestIdChanged event.
/// </summary>
///
/// <remarks>This event is used to indicate that the CurrentTest Id changed.</remarks>
///
public class CurrentTestIdChangedEvent : PubSubEvent<string> { }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -0,0 +1,18 @@
using Prism.Events;
namespace DTS.Common.Events.TSRAIRGo
{
public class SystemStatusEvent : PubSubEvent<SystemStatusArg> { }
public class SystemStatusArg
{
public string Message { get; set; }
}
public class SystemErrorEvent : PubSubEvent<SystemErrorArg> { }
public class SystemErrorArg
{
public string Error { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IExportDataViewModel : IBaseViewModel
{
}
}

View File

@@ -0,0 +1,22 @@
namespace DTS.Common.Classes.DASFactory
{
/// <summary>
/// currently used to hold CAN BIST rows - we may expand this to other hardware in future
/// </summary>
public class DiagnosticMessageRow
{
public string Field { get; set; }
public string Value { get; set; }
public string Verdict { get; set; }
public DiagnosticMessageRow(string field, string value, string verdict)
{
Field = field;
Value = value;
Verdict = verdict;
}
public override string ToString()
{
return $"Field: {Field}, Value: {Value}, Verdict: {Verdict}";
}
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IQASettingsViewModel : IBaseViewModel { }
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DTS.Common.XMLUtils
{
public class MetaDatasXMLClass
{
[XmlElement("MetaData")]
public List<MetaDataXMLClass> MetaDatas { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace DTS.Common.Interface.Pagination
{
public interface IFilterableListView
{
void Filter(object tag, string term);
void ClearAllFilters();
string ListViewId { get; }
}
}

View File

@@ -0,0 +1,316 @@
using DTS.Common.Base;
using DTS.Common.Enums;
using DTS.Common.Interface.Sensors;
using DTS.Common.Utilities.Logging;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.Linq;
namespace DTS.Common.Classes.Sensors
{
public class SquibDbRecord : BasePropertyChanged, ISquibDbRecord
{
private string _serialNumber = "";
public string SerialNumber
{
get => _serialNumber;
set => SetProperty(ref _serialNumber, value, "SerialNumber");
}
private int _id = -1;
[Key]
public int Id
{
get => _id;
set => SetProperty(ref _id, value, "Id");
}
private bool _bypassCurrentFilter = false;
public bool BypassCurrentFilter
{
get => _bypassCurrentFilter;
set => SetProperty(ref _bypassCurrentFilter, value, "BypassCurrentFilter");
}
private bool _bypassVoltageFilter = false;
public bool BypassVoltageFilter
{
get => _bypassVoltageFilter;
set => SetProperty(ref _bypassVoltageFilter, value, "BypassVoltageFilter");
}
private double _delayMS = 0D;
[Column("DelayMS")]
public double DelayMs
{
get => _delayMS;
set => SetProperty(ref _delayMS, value, "DelayMs");
}
private double _durationMS = 10D;
[Column("DurationMS")]
public double DurationMs
{
get => _durationMS;
set => SetProperty(ref _durationMS, value, "DurationMs");
}
private SquibFireMode _fireMode = SquibFireMode.NONE;
public SquibFireMode FireMode
{
get => _fireMode;
set => SetProperty(ref _fireMode, value, "FireMode");
}
private string _isoCode = "";
[Required]
[StringLength(50)]
public string IsoCode
{
get => _isoCode;
set => SetProperty(ref _isoCode, value, "IsoCode");
}
private string _isoChannelName = "";
[Required]
[StringLength(255)]
public string IsoChannelName
{
get => _isoChannelName;
set => SetProperty(ref _isoChannelName, value, "IsoChannelName");
}
private string _userCode = "";
[Required]
[StringLength(50)]
public string UserCode
{
get => _userCode;
set => SetProperty(ref _userCode, value, "UserCode");
}
private string _userChannelName = "";
[Required]
[StringLength(255)]
public string UserChannelName
{
get => _userChannelName;
set => SetProperty(ref _userChannelName, value, "UserChannelName");
}
private SquibMeasurementType _squibMeasurementType = SquibMeasurementType.VOLTAGE;
public SquibMeasurementType MeasurementType
{
get => _squibMeasurementType;
set => SetProperty(ref _squibMeasurementType, value, "MeasurementType");
}
private double _squibOutputCurrent = 1.5D;
public double SquibOutputCurrent
{
get => _squibOutputCurrent;
set => SetProperty(ref _squibOutputCurrent, value, "SquibOutputCurrent");
}
private double _squibToleranceLow = 1D;
public double SquibToleranceLow
{
get => _squibToleranceLow;
set => SetProperty(ref _squibToleranceLow, value, "SquibToleranceLow");
}
private double _squibToleranceHigh = 8D;
public double SquibToleranceHigh
{
get => _squibToleranceHigh;
set => SetProperty(ref _squibToleranceHigh, value, "SquibToleranceHigh");
}
private bool _limitDuration = true;
public bool LimitDuration
{
get => _limitDuration;
set => SetProperty(ref _limitDuration, value, "LimitDuration");
}
private string _articleId = "";
[Required]
[StringLength(50)]
public string ArticleId
{
get => _articleId;
set => SetProperty(ref _articleId, value, "ArticleId");
}
private int _version = 1;
public int Version
{
get => _version;
set => SetProperty(ref _version, value, "Version");
}
private DateTime _lastModified = DateTime.MinValue;
[Column(TypeName = "datetime")]
public DateTime LastModified
{
get => _lastModified;
set => SetProperty(ref _lastModified, value, "LastModified");
}
private string _lastModifiedBy = "";
[Required]
[StringLength(50)]
public string LastModifiedBy
{
get => _lastModifiedBy;
set => SetProperty(ref _lastModifiedBy, value, "LastModifiedBy");
}
private string _userValue1 = "";
[StringLength(255)]
public string UserValue1
{
get => _userValue1;
set => SetProperty(ref _userValue1, value, "UserValue1");
}
private string _userValue2 = "";
[StringLength(255)]
public string UserValue2
{
get => _userValue2;
set => SetProperty(ref _userValue2, value, "UserValue2");
}
private string _userValue3 = "";
[StringLength(255)]
public string UserValue3
{
get => _userValue3;
set => SetProperty(ref _userValue3, value, "UserValue3");
}
private byte[] _userTags = new byte[0];
public byte[] UserTags
{
get => _userTags;
set => SetProperty(ref _userTags, value, "UserTags");
}
private bool _doNotUse = false;
public bool DoNotUse
{
get => _doNotUse;
set => SetProperty(ref _doNotUse, value, "DoNotUse");
}
private bool _broken = false;
public bool Broken
{
get => _broken;
set => SetProperty(ref _broken, value, "Broken");
}
private bool _defineDelayInTest = false;
public bool DefineDelayInTest
{
get => _defineDelayInTest;
set => SetProperty(ref _defineDelayInTest, value, "DefineDelayInTest");
}
public SquibDbRecord(ISensorData copy, bool defineDelayInTest, byte[] tags)
{
Id = copy.DatabaseId;
IsoChannelName = copy.ISOChannelName;
UserCode = copy.UserCode;
UserChannelName = copy.UserChannelName;
Broken = copy.Broken;
DoNotUse = copy.DoNotUse;
Version = copy.Version;
SquibToleranceLow = copy.SquibToleranceLow;
SquibToleranceHigh = copy.SquibToleranceHigh;
SquibOutputCurrent = copy.SquibOutputCurrent;
SerialNumber = copy.SerialNumber;
MeasurementType = copy.SquibMeasurementType;
LimitDuration = copy.LimitDuration;
DefineDelayInTest = defineDelayInTest;
LastModifiedBy = copy.LastUpdatedBy;
LastModified = copy.LastModified;
IsoCode = copy.ISOCode;
FireMode = copy.SquibFireMode;
DurationMs = copy.SquibFireDurationMS;
DelayMs = copy.SquibFireDelayMS;
BypassVoltageFilter = copy.BypassVoltageFilter;
BypassCurrentFilter = copy.BypassCurrentFilter;
ArticleId = copy.EID;
UserValue1 = copy.UserValue1;
UserValue2 = copy.UserValue2;
UserValue3 = copy.UserValue3;
if (null == tags) { UserTags = null; }
else if (tags.Any())
{
var userTags = new byte[tags.Length];
Array.Copy(tags, userTags, tags.Length);
UserTags = userTags;
}
else { UserTags = new byte[0]; }
}
public SquibDbRecord() { }
public SquibDbRecord(ISquibDbRecord copy)
{
Id = copy.Id;
IsoChannelName = copy.IsoChannelName;
UserCode = copy.UserCode;
UserChannelName = copy.UserChannelName;
Broken = copy.Broken;
DoNotUse = copy.DoNotUse;
Version = copy.Version;
SquibToleranceLow = copy.SquibToleranceLow;
SquibToleranceHigh = copy.SquibToleranceHigh;
SquibOutputCurrent = copy.SquibOutputCurrent;
SerialNumber = copy.SerialNumber;
MeasurementType = copy.MeasurementType;
LimitDuration = copy.LimitDuration;
DefineDelayInTest = copy.DefineDelayInTest;
LastModifiedBy = copy.LastModifiedBy;
LastModified = copy.LastModified;
IsoCode = copy.IsoCode;
FireMode = copy.FireMode;
DurationMs = copy.DurationMs;
DelayMs = copy.DelayMs;
BypassVoltageFilter = copy.BypassVoltageFilter;
BypassCurrentFilter = copy.BypassCurrentFilter;
ArticleId = copy.ArticleId;
UserValue1 = copy.UserValue1;
//Comment = UserValue1;
UserValue2 = copy.UserValue2;
UserValue3 = copy.UserValue3;
if (null == copy.UserTags) { UserTags = null; }
else if (copy.UserTags.Any())
{
var userTags = new byte[copy.UserTags.Length];
Array.Copy(copy.UserTags, userTags, copy.UserTags.Length);
UserTags = userTags;
}
else { UserTags = new byte[0]; }
}
public SquibDbRecord(IDataReader reader)
{
try
{
Id = Utility.GetInt(reader, "Id", -1);
IsoChannelName = Utility.GetString(reader, "ISOChannelName", string.Empty);
UserCode = Utility.GetString(reader, "UserCode", string.Empty);
UserChannelName = Utility.GetString(reader, "UserChannelName", string.Empty);
Broken = Utility.GetBool(reader, "Broken", false);
DoNotUse = Utility.GetBool(reader, "DoNotUse", false);
Version = Utility.GetInt(reader, "Version", -1);
SquibToleranceLow = Utility.GetDouble(reader, "SquibToleranceLow", 0D);
SquibToleranceHigh = Utility.GetDouble(reader, "SquibToleranceHigh", 8D);
SquibOutputCurrent = Utility.GetDouble(reader, "SquibOutputCurrent", 1.5D);
SerialNumber = Utility.GetString(reader, "SerialNumber", string.Empty);
MeasurementType = (SquibMeasurementType)Utility.GetShort(reader, "MeasurementType");
LimitDuration = Utility.GetBool(reader, "LimitDuration");
DefineDelayInTest = Utility.GetBool(reader, "DefineDelayInTest");
LastModifiedBy = Utility.GetString(reader, "LastModifiedBy", string.Empty);
LastModified = Utility.GetDateTime(reader, "LastModified", DateTime.MinValue);
IsoCode = Utility.GetString(reader, "ISOCode", string.Empty);
FireMode = (SquibFireMode)Utility.GetShort(reader, "FireMode");
DurationMs = Utility.GetDouble(reader, "DurationMS", 0D);
DelayMs = Utility.GetDouble(reader, "DelayMS", 0D);
BypassVoltageFilter = Utility.GetBool(reader, "BypassVoltageFilter", false);
BypassCurrentFilter = Utility.GetBool(reader, "BypassCurrentFilter", false);
ArticleId = Utility.GetString(reader, "ArticleId", string.Empty);
UserValue1 = Utility.GetString(reader, "UserValue1");
//Comment = UserValue1;
UserValue2 = Utility.GetString(reader, "UserValue2", string.Empty);
UserValue3 = Utility.GetString(reader, "UserValue3", string.Empty);
var o = reader["UserTags"];
UserTags = DBNull.Value.Equals(o)
? new byte[0]
: (byte[])o;
}
catch (Exception ex)
{
APILogger.Log("Failed to process: ", ex);
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,63 @@
using DTS.Common.Interface.Tags;
using System.Data;
namespace DTS.Common.Classes.Tags
{
/// <summary>
/// describes a database record for a tag
/// <inheritdoc cref="ITag"/>
/// </summary>
/// <summary>
/// represents a single tag, which is composed of an ID and a string of text
/// we don't currently let you obsolete, delete, or edit tags, just add
/// </summary>
public class Tag : Base.BasePropertyChanged, ITag
{
public Tag(string tagText, int tagId)
{
ID = tagId;
Text = tagText;
IsObsolete = false;
}
public const int INVALID_ID = -1;
private int _id;
public int ID
{
get => _id;
set => SetProperty(ref _id, value, "ID");
}
private string _text = "";
public string Text
{
get => _text;
set => SetProperty(ref _text, value, "Text");
}
private bool _isObsolete = false;
public bool IsObsolete
{
get => _isObsolete;
set => SetProperty(ref _isObsolete, value, "IsObsolete");
}
public Tag(Tag copy)
{
ID = copy.ID;
Text = copy.Text;
IsObsolete = copy.IsObsolete;
}
public Tag(IDataReader reader)
{
ID = Utility.GetInt(reader, "TagId");
IsObsolete = Utility.GetBool(reader, "Obsolete");
Text = Utility.GetString(reader, "TagText");
}
public Tag() { }
public object Clone()
{
return new Tag(this);
}
}
}

View File

@@ -0,0 +1,17 @@
namespace DTS.Common.Interface.DASFactory.Config
{
/// <summary>
/// Information interface for an IDASCommunication object, providing DASInfo object.
/// </summary>
public interface IInformation
{
/// <summary>
/// DASInfo is populated with values from the hardware. It provides information
/// about the entire DAS as well as the functions necessary to covert between
/// Module, ModuleChannel, and DASChannel values.
/// </summary>
IInfoResult DASInfo { get; set; }
void SetDASInfo(IInfoResult dasInfo, bool bSetInDb = true);
void SetDASInfo();
}
}

View File

@@ -0,0 +1,13 @@
using System.ComponentModel;
using DTS.Common.Converters;
namespace DTS.Common.Enums
{
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum MigrationResult
{
OK,
ExceptionThrown,
WarningAllowStreamingModesWasNotMigrated
}
}

View File

@@ -0,0 +1,7 @@
using DTS.Common.Base;
// ReSharper disable CheckNamespace
namespace DTS.Common.Interface
{
public interface IViewerMainView : IBaseView { }
}

View File

@@ -0,0 +1,81 @@
using DTS.Common.Enums;
using DTS.Common.Enums.Sensors;
using DTS.Common.Interface.DASFactory.Diagnostics;
namespace DTS.Common.Interface.DataRecorders
{
public interface IHardwareChannel
{
/// <summary>
/// diagnostic results for this channel if available (null otherwise)
/// </summary>
IDiagnosticResult Diagnostics { get; }
/// <summary>
/// returns whether the channel supports the given bridge type
/// </summary>
/// <param name="bridgeType"></param>
/// <returns></returns>
bool IsSupportedBridgeType(SensorConstants.BridgeType bridgeType);
int ChannelNumber { get; }
string GetId();
/// <summary>
/// returns true if the channel supports analog sensors
/// </summary>
bool IsAnalog { get; }
/// <summary>
/// returns true if chanel supports squibs
/// </summary>
bool IsSquib { get; }
/// <summary>
/// returns true if the channel supports digital outputs
/// </summary>
bool IsDigitalOut { get; }
/// <summary>
/// returns true if the channel supports digital inputs
/// </summary>
bool IsDigitalIn { get; }
/// <summary>
/// returns true if the channel supports uart i/o
/// </summary>
bool IsUart { get; }
/// <summary>
/// returns true if the channel supports stream input
/// </summary>
bool IsStreamIn { get; }
/// <summary>
/// returns true if the channel supports stream output
/// </summary>
bool IsStreamOut { get; }
/// <summary>
/// Returns true if the channel supports thermocoupler
/// </summary>
bool IsThermocoupler { get; }
/// <summary>
/// returns true if the channel supports clocks
/// </summary>
bool IsClock { get; }
bool IsTSRAIR { get; }
bool IsSLICETC { get; }
bool IsTSRAIRModule { get; }
/// <summary>
/// returns the DAS this channel belongs to
/// </summary>
/// <returns></returns>
IDASHardware GetParentDAS();
/// <summary>
/// returns the module serial number this channel belongs to
/// </summary>
string ModuleSerialNumber { get; set; }
/// <summary>
/// returns whether or not a given excitation is supported by the hardware channel
/// </summary>
bool IsSupportedExcitation(ExcitationVoltageOptions.ExcitationVoltageOption excitation);
/// <summary>
/// returns true if the serial number starts with "5M"
/// </summary>
/// <returns></returns>
bool IsG5();
string ToString(IDASHardware[] hardwares);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IPowerAndBatteryView : IBaseView { }
}

View File

@@ -0,0 +1,25 @@
using Prism.Events;
namespace DTS.Common.Events.Hardware.HardwareList
{
/// <summary>
/// The HardwareListHardwareTestPTPDomainIDEvent event.
/// </summary>
///
/// <remarks>This event is used to indicate the hardware's ptp domain id in this test was changed.</remarks>
///
public class HardwareListHardwareTestPTPDomainIDEvent : PubSubEvent<HardwareListHardwareTestPTPDomainIDEventArgs> { }
public class HardwareListHardwareTestPTPDomainIDEventArgs
{
public string SerialNumber { get; private set; }
public int DASId { get; private set; }
public byte PTPDomainId { get; private set; }
public HardwareListHardwareTestPTPDomainIDEventArgs(string serial, int dasId, byte ptpDomainId)
{
SerialNumber = serial;
DASId = dasId;
PTPDomainId = ptpDomainId;
}
}
}

View File

@@ -0,0 +1,9 @@
namespace DTS.Common.Enums
{
public enum NetworkSelection
{
Default,
NetworkId,
NetworkDesc
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.ComponentModel;
using System.Windows.Controls;
namespace DTS.Common.Base.Classes
{
public abstract class BaseUserControl : UserControl
{
public event PropertyChangedEventHandler PropertyChanged;
protected bool SetProperty<T>(ref T storage, T value, String propertyName = null)
{
if (Equals(storage, value)) return false;
storage = value;
OnPropertyChanged(propertyName);
return true;
}
protected void OnPropertyChanged(string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -0,0 +1,50 @@
using System.Windows.Media;
using DTS.Common.Base;
using DTS.Common.Enums.Database;
namespace DTS.Common.Interface.Database
{
/// <summary>
/// this viewmodel handles the logic for database status in a UI
/// it handles the current connection and status
/// </summary>
public interface IDatabaseStatusBarViewModel : IBaseViewModel
{
/// <summary>
/// the associated view for the model
/// </summary>
IDatabaseStatusBarView View { get; set; }
//frees up any memory associated with viewmodel
void Unset();
/// <summary>
/// gets the database type
/// use initializevalues to populate
/// </summary>
DbType DatabaseType { get; }
/// <summary>
/// gets whether the remote database is connected
/// use initializevalues to populate
/// </summary>
bool RemoteConnected { get; }
/// <summary>
/// the server (not db) name
/// use initialize values to populate
/// </summary>
string ServerName { get; }
/// <summary>
/// sets the initial values for db type, server name, and remote connection status
/// </summary>
/// <param name="dbType"></param>
/// <param name="serverName"></param>
/// <param name="remoteConnected"></param>
void InitializeValues(DbType dbType, string serverName, bool remoteConnected);
/// <summary>
/// returns the current active db name (either server name or local depending on db type and remote connection status)
/// </summary>
string ActiveDbName { get; }
/// <summary>
/// returns the background brush for the active db name
/// </summary>
Brush BackgroundBrush { get; }
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.RegionOfInterest.RegionOfInterestChannels
{
public interface IRegionOfInterestChannelsView : IBaseView { }
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DTS.Common.XMLUtils
{
public class LevelTriggersXMLClass
{
[XmlElement("LevelTrigger")]
public List<LevelTriggerXMLClass> LevelTriggers { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IPSDReportSettingsView : IBaseView
{
}
}

View File

@@ -0,0 +1,23 @@
using DTS.Common.Enums.Sensors;
namespace DTS.Common.Classes.Sensors
{
public static class ChannelSerialNumber
{
public static string SerialNumberFromChannel(bool isTestSpecificEmbedded, string testSpecificEmbeddedSensor, string sensorDataSerialNumber)
{
var serialNumber = string.Empty;
if (isTestSpecificEmbedded)
{
serialNumber = testSpecificEmbeddedSensor;
}
else
{
serialNumber = sensorDataSerialNumber;
}
return serialNumber;
}
}
}

View File

@@ -0,0 +1,8 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IViewDataViewModel : IBaseViewModel
{
}
}

View File

@@ -0,0 +1,14 @@
namespace DTS.Common.Interface
{
/// <summary>
/// All plug-in modules implement IPluginComponent interface
/// </summary>
public interface IPluginComponent
{
/// <summary>
/// Program ID used to instantiate object
/// </summary>
string ProgId { get; }
}
}

View File

@@ -0,0 +1,8 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IRunTestViewModel : IBaseViewModel
{
}
}

View File

@@ -0,0 +1,14 @@
using System.Windows.Controls;
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IMainLiteView : IBaseView
{
StackPanel MainShell { get; set; }
ContentControl MainRegion { get; set; }
ContentControl NavigationRegion { get; set; }
ContentControl HorizontalTabRegion { get; set; }
ContentControl VerticalTabRegion { get; set; }
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IDockPanelHorizontalView : IBaseView { }
}

View File

@@ -0,0 +1,7 @@
using DTS.Common.Base;
// ReSharper disable CheckNamespace
namespace DTS.Common.Interface
{
public interface IViewerMainViewGrid : IBaseView { }
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Enums.Sensors.SensorsList
{
public enum StreamInSettingFields
{
Included,
SerialNumber,
Description,
LastModifiedBy,
LastModified,
UDPAddress,
}
}

View File

@@ -0,0 +1,25 @@
using DTS.Common.Interface.Communication;
namespace DTS.Common.Enums.Communication
{
public static class CommunicationConstantsAndEnums
{
public enum CommunicationResult
{
ConnectOK,
ConnectFailed,
ConnectTimeout,
DisconnectOK,
DisconnectFailed,
DisconnectTimeout,
SendOK,
SendFailed,
SendTimeout,
ReceiveOK,
ReceiveFailed,
ReceiveTimeout,
Canceled
}
public delegate bool CommunicationCallback(ICommunicationReport report);
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.Realtime
{
public interface IRealtimeChannelSelectView : IBaseView { }
}

View File

@@ -0,0 +1,6 @@
namespace DTS.Common.Interface.Sensors
{
public interface IZeroMethods
{
}
}

View File

@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
namespace DTS.Common.Enums.TSRAIRGo
{
public class ArmStateMachineStates
{
public enum States
{
[Description("Checking Arm State")]
CheckingArmState,
[Description("Checking For DAS")]
CheckingForDAS,
[Description("Checking For Data")]
CheckingForData,
[Description("Clearing Flash")]
ClearingFlash,
[Description("Disarmed")]
Disarmed,
[Description("Downloading")]
Downloading,
[Description("Download cleaning up")]
DownloadCleaningUp,
[Description("Download finished")]
DownloadFinished,
[Description("Failed")]
Failed,
[Description("Faulted")]
Faulted,
[Description("Getting Event Info")]
GettingEventInfo,
[Description("Waiting for user")]
IDLE,
[Description("Post Test Processing")]
PostTestProcessing,
[Description("Preparing For Arming")]
PreparingForArming,
[Description("Ready For Download")]
ReadyForDownload,
[Description("Rearming")]
Rearming,
[Description("Recording")]
Recording,
[Description("Waiting For Interval")]
WaitingForInterval,
[Description("Waiting for schedule start")]
WaitingForSchedule,
[Description("Waiting For Trigger")]
WaitingForTrigger,
[Description("Streaming")]
Streaming,
}
}
}

View File

@@ -0,0 +1,20 @@
using DTS.Common.Base;
using Prism.Events;
// ReSharper disable CheckNamespace
namespace DTS.Common.Events
{
/// <summary>
/// The number of loaded Tests changed event.
/// </summary>
public class TestLoadedCountNotification : PubSubEvent<TestLoadedCountNotificationArg> { }
public class TestLoadedCountNotificationArg
{
public int LoadedCount { get; set; }
/// <summary>
/// 24417 start pulling apart viewer to allow reuse for PSD reports
/// </summary>
public IBaseViewModel ParentVM { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using DTS.Common.Base;
using Prism.Events;
namespace DTS.Common.Events
{
//A datafile was selected, but don't want to trip all of the DataFolderChangedEvent subscriptions
public class DataFileSelectedEvent : PubSubEvent<DataFileSelectionArg> { }
public class DataFileSelectionArg
{
public string File { get; set; }
/// <summary>
/// 24417 start pulling apart viewer to allow reuse for PSD reports
/// </summary>
public IBaseViewModel ParentVM { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using DTS.Common.Base;
using Prism.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Events
{
public class SaveReportToPDFRequestedEvent : PubSubEvent<SaveReportToPDFRequestedEventArgs> { }
public class SaveReportToPDFRequestedEventArgs
{
public string Directory { get; set; }
public IBaseViewModel ParentVM { get; set; }
}
}

View File

@@ -0,0 +1,201 @@
using DTS.Common.Base;
using DTS.Common.Enums.DASFactory;
using DTS.Common.Interface.DataRecorders;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.Linq;
using System.Text;
namespace DTS.Common.Classes.Hardware
{
[Table("DAS")]
/// <summary>
/// Implementation of <seealso cref="IDASDBRecord"/>
/// <inheritdoc cref="IDASDBRecord"/>
/// </summary>
public class DASDBRecord : BasePropertyChanged, IDASDBRecord
{
public static DateTime INVALID_DATE => new DateTime(1970, 1, 1);
public DASDBRecord()
{
}
public DASDBRecord(IDASDBRecord copy)
{
CalDate = copy.CalDate;
Connection = copy.Connection;
Channels = copy.Channels;
FirmwareVersion = copy.FirmwareVersion;
LastModified = copy.LastModified;
LastModifiedBy = copy.LastModifiedBy;
LastUsed = copy.LastUsed;
LastUsedBy = copy.LastUsedBy;
LocalOnly = copy.LocalOnly;
MaxMemory = copy.MaxMemory;
MaxModules = copy.MaxModules;
MaxSampleRate = copy.MaxSampleRate;
MinSampleRate = copy.MinSampleRate;
Position = copy.Position;
IsReconfigurable = copy.IsReconfigurable;
IsModule = copy.IsModule;
IsProgrammable = copy.IsProgrammable;
ProtocolVersion = copy.ProtocolVersion;
SerialNumber = copy.SerialNumber;
DASType = copy.DASType;
DASId = copy.DASId;
var channelTypes = new int[copy.ChannelTypes.Length];
Array.Copy(copy.ChannelTypes, channelTypes, copy.ChannelTypes.Length);
ChannelTypes = channelTypes;
Version = copy.Version;
ParentDAS = copy.ParentDAS;
Port = copy.Port;
PositionOnChain = copy.PositionOnChain;
PositionOnDistributor = copy.PositionOnDistributor;
FirstUseDate = copy.FirstUseDate;
IsFirstUseValid = copy.IsFirstUseValid;
StandIn = copy.StandIn;
TestId = copy.TestId;
GroupId = copy.GroupId;
MaxAAFRate = copy.MaxAAFRate;
}
public DASDBRecord(IDataReader reader)
{
CalDate = Utility.GetDateTime(reader, "CalDate", DateTime.MinValue);
Connection = Utility.GetString(reader, "Connection", string.Empty);
Channels = Utility.GetInt(reader, "Channels", 0);
FirmwareVersion = Utility.GetString(reader, "FirmwareVersion", string.Empty);
LastModified = Utility.GetDateTime(reader, "LastModified", DateTime.MinValue);
LastModifiedBy = Utility.GetString(reader, "LastModifiedBy", string.Empty);
LastUsed = Utility.GetDateTime(reader, "LastUsed", DateTime.MinValue);
LastUsedBy = Utility.GetString(reader, "LastUsedBy", string.Empty);
LocalOnly = Utility.GetBool(reader, "LocalOnly", false);
MaxMemory = Utility.GetLong(reader, "MaxMemory", 0);
MaxModules = Utility.GetInt(reader, "MaxModules", 0);
MaxSampleRate = Utility.GetDouble(reader, "MaxSampleRate", 0);
MinSampleRate = Utility.GetDouble(reader, "MinSampleRate", 0);
Position = Utility.GetString(reader, "Position", string.Empty);
IsReconfigurable = Utility.GetBool(reader, "Reconfigurable", false);
IsModule = Utility.GetBool(reader, "IsModule", false);
IsProgrammable = Utility.GetBool(reader, "Reprogramable", false);
ProtocolVersion = Utility.GetInt(reader, "ProtocolVersion", 0);
SerialNumber = Utility.GetString(reader, "SerialNumber", string.Empty);
DASType = Utility.GetInt(reader, "Type", -1);
DASId = Utility.GetInt(reader, "DASId", -1);
var o = reader["ChannelTypes"];
if (null != o && !DBNull.Value.Equals(o))
{
var s = Utility.GetString(reader, "ChannelTypes", string.Empty);
var tokens = s.Split(new char[] { ',' });
var itemp = 0;
ChannelTypes = (from token in tokens where int.TryParse(token, out itemp) select itemp).ToArray();
}
Version = Utility.GetInt(reader, "Version", 0);
ParentDAS = Utility.GetString(reader, "ParentDAS", string.Empty);
Port = Utility.GetInt(reader, "Port", 0);
PositionOnChain = Utility.GetInt(reader, "PositionOnChain", 0);
PositionOnDistributor = Utility.GetInt(reader, "PositionOnDistributor", 0);
o = reader["FirstUseDate"];
if (DBNull.Value.Equals(o))
{
FirstUseDate = null;
IsFirstUseValid = false;
}
else
{
var dt = Convert.ToDateTime(o);
if (dt.Year.Equals(DFConstantsAndEnums.FIRST_USE_DATE_NOT_SET.Year))
{
FirstUseDate = null;
}
else
{
FirstUseDate = dt;
}
IsFirstUseValid = true;
}
StandIn = Utility.GetBool(reader, "StandIn", false);
TestId = Utility.GetNullableInt(reader, "TestId");
GroupId = Utility.GetNullableInt(reader, "GroupId");
MaxAAFRate = Utility.GetDouble(reader, "MaxAAFRate", double.NaN);
}
[Key]
[Column("DASId")]
public int DASId { get; set; }
[Required]
[StringLength(50)]
public string SerialNumber { get; set; }
public int DASType { get; set; }
public int MaxModules { get; set; }
public long MaxMemory { get; set; }
[Column(TypeName = "decimal(18, 0)")]
public double MaxSampleRate { get; set; }
[Column(TypeName = "decimal(18, 0)")]
public double MinSampleRate { get; set; }
[StringLength(50)]
public string FirmwareVersion { get; set; } = "";
[Column(TypeName = "datetime")]
public DateTime CalDate { get; set; } = INVALID_DATE;
public int ProtocolVersion { get; set; }
[Column(TypeName = "datetime")]
public DateTime LastModified { get; set; }
[StringLength(50)]
public string LastModifiedBy { get; set; } = "";
public int Version { get; set; }
public bool LocalOnly { get; set; }
[Column(TypeName = "datetime")]
public DateTime LastUsed { get; set; } = INVALID_DATE;
[StringLength(50)]
public string LastUsedBy { get; set; } = "";
[StringLength(50)]
public string Connection { get; set; } = "";
public int Channels { get; set; }
[Required]
[StringLength(50)]
public string Position { get; set; } = "";
[StringLength(255)]
public int[] ChannelTypes { get; set; } = new int[0];
public bool IsProgrammable { get; set; } = false;
public bool IsReconfigurable { get; set; } = false;
public bool IsModule { get; set; }
public int PositionOnDistributor { get; set; }
public int PositionOnChain { get; set; }
public int Port { get; set; }
[Column("ParentDAS")]
[StringLength(50)]
public string ParentDAS { get; set; } = "";
[Column(TypeName = "datetime")]
public DateTime? FirstUseDate { get; set; }
public int? TestId { get; set; }
public int? GroupId { get; set; }
public bool StandIn { get; set; }
[Column("MaxAAFRate", TypeName = "decimal(18, 0)")]
public double MaxAAFRate { get; set; }
/// <summary>
/// whether hardware supports and is using first use date
/// 15524 DAS "First Use Date"
/// </summary>
public bool IsFirstUseValid { get; set; } = false;
}
}

View File

@@ -0,0 +1,18 @@
using static DTS.Common.Enums.DASFactory.DFConstantsAndEnums;
namespace DTS.Common.Interface.TestSetups
{
/// <summary>
/// Interface describing records for test setup hardware
/// </summary>
public interface ITestSetupHardwareRecord
{
int DASId { get; set; }
int TestSetupId { get; set; }
bool AddDAS { get; set; }
int SamplesPerSecond { get; set; }
bool IsClockMaster { get; set; }
int AntiAliasFilterRate { get; set; }
byte PTPDomainId { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using Prism.Events;
using System;
namespace DTS.Common.Events.Hardware.HardwareList
{
/// <summary>
/// The HardwareAddedEvent event.
/// </summary>
///
/// <remarks>This event is used to indicate hardware was added or updated
/// integer is database id of hardware, string is serial number of hardware
/// </remarks>
///
public class HardwareSavedEvent : PubSubEvent<Tuple<int, string>> { }
}

View File

@@ -0,0 +1,122 @@
using DTS.Common.Enums;
namespace DTS.Common.Constant.DASSpecific
{
public class TSRAIR
{
public const uint MaxAAFilterRateHz = 200000;
public const byte MIN_PROTOCOL_VER = 1;
public const int VOLTAGE_INSERTION = 2;
public const int START_REC_DELAY_IN_SECONDS = 3;
public const int STACK_SENSORS = 5;
public const int WAKEUP_MOTION_TIMEOUT = 10;
public const int IRIG_GPS_PPSIN_SYNC = 25;
public const int DISABLE_STREAMING_FEATURE = 25;
public const int TSRAIR_MIN_PRE_TRIGGER_SAMPLES = 256;
public const int TSRAIR_MAX_PRE_TRIGGER_SAMPLES = 512;
public const int EXTENDED_FAULTS_VER = 27;
public const int ADC_SAMPLES_PER_PACKET_VER = 29;
public const int PROTOCOL_VERSION_CIRCULAR_UART = 29;
public const int PROTOCOL_VERSION_CIRCULAR = int.MaxValue;
public const int PROTOCOL_VERSION_RECORDER_UART = 30;
public const int PROTOCOL_VERSION_RECORDER = int.MaxValue;
public const int PROTOCOL_VERSION_SCHEDULED_EVENTCOUNT = 35;
public static bool IsRecordingModeSupported(RecordingModes mode, int protocolVersion)
{
switch (mode)
{
case RecordingModes.CircularBufferPlusUART:
case RecordingModes.MultipleEventCircularBufferPlusUART:
return protocolVersion >= PROTOCOL_VERSION_CIRCULAR_UART;
case RecordingModes.CircularBuffer:
case RecordingModes.MultipleEventCircularBuffer:
return protocolVersion >= PROTOCOL_VERSION_CIRCULAR;
case RecordingModes.Recorder:
case RecordingModes.MultipleEventRecorder:
return protocolVersion >= PROTOCOL_VERSION_RECORDER;
case RecordingModes.MultipleEventRecorderPlusUART:
case RecordingModes.RecorderPlusUART:
return protocolVersion >= PROTOCOL_VERSION_RECORDER_UART;
case RecordingModes.Active:
case RecordingModes.MultipleEventActive:
case RecordingModes.Streaming:
case RecordingModes.S6A_DeviceStreamingOnly:
//26783: Since the "Set DAS to Streaming" checkbox is used for both
//TSR AIR and SLICE6Air, the recording mode may correspond to the
//"other" hardware if the DAS is switched from one to the other
case RecordingModes.Scheduled:
case RecordingModes.Interval:
return true;
default:
return false;
}
}
public static bool IsStreamingProfileSupported(UDPStreamProfile profile, int protocolVersion)
{
var result = false;
switch (profile)
{
case UDPStreamProfile.DTS_UDP:
case UDPStreamProfile.CH10_ANALOG_2HDR:
//FB 30035 Added other supported profiles for TSRAIR
case UDPStreamProfile.CH10_ANALOG:
case UDPStreamProfile.CH10_PCM_128BIT_2HDR:
case UDPStreamProfile.CH10_PCM128_MM:
result = true;
break;
}
return result;
}
public static bool IsClockSyncProfileSupported(ClockSyncProfile profile, int protocolVersion, bool master)
{
var result = false;
switch (profile)
{
case ClockSyncProfile.IRIG_EXT_PPS:
return false;
case ClockSyncProfile.EXT_PPS:
//master EXT_PPS not supported at this time for TSR AIR
//http://manuscript.dts.local/f/cases/34280/
if (protocolVersion >= IRIG_GPS_PPSIN_SYNC && !master)
{
result = true;
}
break;
case ClockSyncProfile.None:
result = true;
break;
case ClockSyncProfile.Master_E2E:
case ClockSyncProfile.Slave_E2E:
result = true;
break;
case ClockSyncProfile.GPS_EXT_PPS:
case ClockSyncProfile.Master_E2E_GPS_EXT_PPS:
case ClockSyncProfile.Master_E2E_EXT_PPS:
case ClockSyncProfile.IRIG:
case ClockSyncProfile.Master_E2E_IRIG:
case ClockSyncProfile.Master_E2E_IRIG_EXT_PPS:
// 30430 per EF and LP / 30704: everything but 1PPS out is legal with protocol 25
if (protocolVersion >= IRIG_GPS_PPSIN_SYNC)
{
result = true;
}
break;
case ClockSyncProfile.GPS:
case ClockSyncProfile.Master_E2E_GPS:
result = false;
// 30487: Leave this alone, GPS only clock sync option should be removed
break;
}
return result;
}
/* 39151 Leaving a note here in TSRAIR for when it inevitably gets UART recording
* copy/paste the implemented MaxSampleRateHz_UART dictionary and MaxSampleRateHzForRecordingMode function from SLICE6AIR
*/
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Windows.Data;
using System.Windows.Media;
namespace DTS.Common.Converters
{
public class BooleanToBorderBrushConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value != null && (bool)value ? BrushesAndColors.Brush_Warning : Brushes.Transparent;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
}

View File

@@ -0,0 +1,72 @@
<Window x:Class="DTS.Common.Dialogs.NotificationWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
Title="{Binding Title}" Icon="{Binding ImageUri, ElementName=notificationWindow}" WindowStyle="ToolWindow" ResizeMode="NoResize"
SizeToContent="WidthAndHeight" MinWidth="300" MaxWidth="500" MinHeight="150" MaxHeight="500"
x:Name="notificationWindow">
<Window.Resources>
<Style x:Key="ReadOnlyTextBox" TargetType="TextBox">
<Setter Property="IsReadOnly" Value="True" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="Height" Value="Auto"/>
<Setter Property="Width" Value="Auto"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="TextAlignment" Value="Left"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
</Style>
<Style x:Key="LinkButton" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<TextBlock TextDecorations="Underline">
<ContentPresenter />
</TextBlock>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="Blue" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Foreground" Value="Red" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid x:Name="LayoutRoot" Margin="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="48"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Source="{Binding ImageUri, ElementName=notificationWindow}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,5,0,5"/>
<ContentControl Grid.Row="0" Grid.Column="1" ContentTemplate="{Binding NotificationTemplate, ElementName=notificationWindow}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,10,10,5">
<TextBox Text="{Binding Content.Message, Mode=OneWay}" Style="{StaticResource ReadOnlyTextBox}"/>
</ContentControl>
<StackPanel Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="5,5,10,5">
<Button Style="{StaticResource LinkButton}" Content="Copy to clipboard" Margin="0,5,20,0" HorizontalAlignment="Center" Click="CoppyToClibord_Click"/>
<Button x:Name="OKButton" Content="OK" Width="70" Height="25" Cursor="Hand" HorizontalAlignment="Right">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:CallMethodAction TargetObject="{Binding ElementName=notificationWindow}" MethodName="Close"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
</Grid>
</Window>

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface ICheckTriggerViewModel : IBaseViewModel { }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,9 @@
namespace DTS.Common.Interface.DASFactory
{
public interface IConnectedEthernetDevice
{
string MACAddress { get; }
int Port { get; }
string SerialNumber { get; set; }
}
}

View File

@@ -0,0 +1,238 @@
using DTS.Common.Utilities.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Utils
{
//FB 18512 This calss contains utility methods, they are moved from Netwroking module
public static class NetworkUtils
{
/// <summary>
/// returns true if the network interface is up, false otherwise
/// stolen from FWTU
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public static bool IsNetworkInterfaceUp(IPAddress ip)
{
foreach (var a in NetworkInterface.GetAllNetworkInterfaces())
{
try
{
var ipp = a.GetIPProperties();
if (ipp.MulticastAddresses.Count == 0)
continue; // most of VPN adapters will be skipped
if (!a.SupportsMulticast)
continue; // multicast is meaningless for this type of connection
if (OperationalStatus.Up != a.OperationalStatus)
continue; // this adapter is off or not connected
if (null == ipp.GetIPv4Properties())
continue; // IPv4 is not configured on this adapter
if (a.NetworkInterfaceType == NetworkInterfaceType.Loopback)
continue;
var addressBytes = ip.GetAddressBytes();
if (!AllowInternalNICIPs && 4 == addressBytes.Length && addressBytes[0] == 169 && addressBytes[1] == 254) { continue; }
if (a.GetIPProperties().UnicastAddresses.Any(i => i.Address.AddressFamily == AddressFamily.InterNetwork && IPAddress.Equals(i.Address, ip)))
{
return true;
}
}
catch (Exception)
{
continue;
}
}
return false;
}
/// <summary>
/// Indicates whether any network connection is available.
/// Filter connections below a specified speed, as well as virtual network cards.
/// </summary>
/// <param name="minimumSpeed">The minimum speed required. Passing 0 will not filter connection using speed.</param>
/// <returns>
/// <c>true</c> if a network connection is available; otherwise, <c>false</c>.
/// </returns>
private static List<NetworkInterface> GetAvailableNetworkInterfaces(long minimumSpeed = 115200)
{
if (!NetworkInterface.GetIsNetworkAvailable())
return null;
var niList = new List<NetworkInterface>();
foreach (var ni in NetworkInterface.GetAllNetworkInterfaces())
{
// discard because of standard reasons
if ((ni.NetworkInterfaceType == NetworkInterfaceType.Loopback)
|| (ni.NetworkInterfaceType == NetworkInterfaceType.Tunnel))
continue;
// this allow to filter modems, serial, etc.
// use 10000000 as a minimum speed for most cases
if (ni.Speed < minimumSpeed)
continue;
// discard virtual cards (virtual box, virtual pc, etc.)
if (ni.Description.ToLower().Contains("virtual")
|| ni.Name.ToLower().Contains("virtual")
|| ni.Description.ToLower().Contains("bluethooth")
|| ni.Name.ToLower().Contains("bluethooth"))
continue;
// discard "Microsoft Loopback Adapter", it will not show as NetworkInterfaceType.Loopback but as Ethernet Card.
if (ni.Description.Equals("Microsoft Loopback Adapter", StringComparison.OrdinalIgnoreCase))
continue;
niList.Add(ni);
}
return niList;
}
private static string GetMACAddress(string id)
{
var macAddress = string.Empty;
var nics = GetAvailableNetworkInterfaces();
if (nics == null)
return macAddress;
foreach (var nic in nics)
{
if (nic.Id != id) continue;
var pa = BitConverter.ToString(nic.GetPhysicalAddress().GetAddressBytes());
pa = pa.Replace("-", ":");
if (string.IsNullOrEmpty(pa)) continue;
macAddress = pa;
break;
}
return macAddress;
}
private static bool InvalidNIC(NetworkInterface ni)
{
return OperationalStatus.Up != ni.OperationalStatus || !ni.SupportsMulticast;
}
public static bool AllowInternalNICIPs { get; set; } = false;
public static List<HostInfo> GetAvailableHosts(bool supportMulticastOnly = false)
{
var nics = GetAvailableNetworkInterfaces();
if (nics == null) { return new List<HostInfo>(); }
var hosts = new List<HostInfo>();
foreach (NetworkInterface ni in nics)
{
if (supportMulticastOnly && InvalidNIC(ni))
{
continue;
}
//exclude wireshark network interface, it claims it can ping ips lyingly
if (ni.Description.Contains("Npcap")) { continue; }
foreach (UnicastIPAddressInformation ip in ni.GetIPProperties().UnicastAddresses)
{
var addressBytes = ip.Address.GetAddressBytes();
if ( !AllowInternalNICIPs && 4 == addressBytes.Length && addressBytes[0] == 169 && addressBytes[1] == 254)
{
APILogger.Log($"skipping {ni.Name}\\{ni.Description} as it has a 169.254 address");
continue;//internal only
}
if (ip.Address.AddressFamily == AddressFamily.InterNetwork)
{
GetStartAndEndAddress(ip.Address, ip.IPv4Mask, out var startAddress, out var endAddress);
hosts.Add(new HostInfo
{
HostIpAddress = ip.Address.ToString(),
HostNetworkId = ni.Id,
HostMacAddress = GetMACAddress(ni.Id),
StartAddress = startAddress,
EndAddress = endAddress
});
}
}
}
return hosts;
}
/// <summary>
/// given an IP address and a mask returns a ip address as a string for the first address that is accessible and a string for the last address that is accessible
/// anything between the start address and end address after doing a byte-by-byte comparison should be addressable
/// will return empty strings if something bad happens. Is designed for 4 byte addresses but isn't necessarily limited.
/// </summary>
/// <param name="ip"></param>
/// <param name="mask"></param>
/// <param name="startAddress"></param>
/// <param name="endAddress"></param>
private static void GetStartAndEndAddress(IPAddress ip, IPAddress mask, out string startAddress, out string endAddress)
{
try
{
var ipByte = ip.GetAddressBytes();
var maskBytes = mask.GetAddressBytes();
var startBytes = new byte[ipByte.Length];
var endBytes = new byte[ipByte.Length];
for (var i = 0; i < ipByte.Length; i++)
{
startBytes[i] = (byte)(ipByte[i] & maskBytes[i]);
endBytes[i] = (byte)(ipByte[i] | ~maskBytes[i]);
}
var startIP = new IPAddress(startBytes);
var endIP = new IPAddress(endBytes);
startAddress = startIP.ToString();
endAddress = endIP.ToString();
}
catch (Exception ex)
{
startAddress = string.Empty;
endAddress = string.Empty;
APILogger.Log(ex);
}
}
//FB 25658 Changed the method signature to return bool to determine the connection string has IP in it and it's not USB
/// <summary>
/// Try to parse connectionString and retrieve the IP address.
/// </summary>
/// <param name="connectionString"> DAS connectionString which might include the IP address or might be a USB connection string</param>
/// <param name="ipAddress">Return the parsed IP address from connectionString</param>
/// <returns>Returns true if was able to parse and get the IP otherwise false including the valid USB connection string </returns>
public static bool TryParseConnectionString(string connectionString, out string ipAddress)
{
ipAddress = null;
if (string.IsNullOrEmpty(connectionString))
{
return false;
}
try
{
var uri = new Uri(connectionString);
if (IPAddress.TryParse(uri.Host, out _))
{
ipAddress = uri.Host;
return true;
}
}
catch
{
var ip = connectionString.Split(':')[0];
if (IPAddress.TryParse(ip, out _))
{
ipAddress = ip;
return true;
}
}
return false;
}
}
}

View File

@@ -0,0 +1,89 @@
//https://stackoverflow.com/questions/35324285/how-to-create-masked-textbox-like-windows-ip-address-fields
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace DTS.Common.Controls
{
/// <summary>
/// Interaction logic for IPTextBox.xaml
/// </summary>
public partial class TestIDTextBox : UserControl
{
private static readonly List<Key> OtherAllowedKeys = new List<Key> { Key.Delete };
private bool _suppressAddressUpdate = false;
public TestIDTextBox()
{
InitializeComponent();
}
//FB 43400 added Clear method to reset the segments
public void Clear()
{
tbTestId.Text = string.Empty;
}
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
"Text", typeof(string), typeof(TestIDTextBox), new FrameworkPropertyMetadata(default(string), TextChanged)
{
BindsTwoWayByDefault = true
});
private static void TextChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
var tb = dependencyObject as TestIDTextBox;
var text = e.NewValue as string;
if (text != null && tb != null)
{
tb._suppressAddressUpdate = true;
if (IsValidText(text))
{
tb.tbTestId.Text = text;
}
else
{
tb.tbTestId.Text = (string)e.OldValue;
}
tb._suppressAddressUpdate = false;
}
}
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
private static bool IsValidText(string text)
{
var invalidChars = new List<char>();
invalidChars.AddRange(Path.GetInvalidFileNameChars());
invalidChars.AddRange(Path.GetInvalidPathChars());
invalidChars.Add('.');
var charArray = text.ToCharArray();
return !Array.Exists(charArray, x => invalidChars.Contains(x));
}
private void tbTestId_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !IsValidText(e.Text);
}
private void TextBoxBase_OnTextChanged(object sender, TextChangedEventArgs e)
{
if ( !(sender is TextBox tb)) { return; }
e.Handled = !IsValidText(tb.Text);
}
}
}

View File

@@ -0,0 +1,34 @@
using Prism.Events;
// ReSharper disable CheckNamespace
namespace DTS.Common.Events
{
public class ShiftT0Event : PubSubEvent<ShiftT0EventArguments> { }
public class ShiftT0EventArguments
{
public double T0Time { get; }
public bool IsInitialization { get; }
/// <summary>
/// the steps/samples from T0 to shift
/// </summary>
public int T0Steps { get; }
/// <summary>
/// whether shift is caused by a keypress (left/right arrow)
/// </summary>
public bool IsKeyPress { get; }
public ShiftT0EventArguments(double t0, bool isInitialization)
{
T0Time = t0;
IsInitialization = isInitialization;
T0Steps = 0;
IsKeyPress = false;
}
public ShiftT0EventArguments(int steps, bool isInitialization, bool isKeyPress)
{
T0Time = 0D;
IsInitialization = isInitialization;
IsKeyPress = isKeyPress;
T0Steps = steps;
}
}
}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

View File

@@ -0,0 +1,14 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IDasSummary : IBaseClass
{
string DASSerial { get; set; }
string EIDFound { get; set; }
string BatteryVoltageStatus { get; set; }
System.Windows.Media.SolidColorBrush BatteryVoltageColor { get; set; }
string InputVoltageStatus { get; set; }
System.Windows.Media.SolidColorBrush InputVoltageColor { get; set; }
}
}

View File

@@ -0,0 +1,147 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace DTS.Common.Controls
{
public class TestIDViewModel : INotifyPropertyChanged
{
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected bool SetProperty<T>(ref T storage, T value, string propertyName = null)
{
if (Equals(storage, value)) return false;
storage = value;
OnPropertyChanged(propertyName);
return true;
}
protected void OnPropertyChanged(string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
private static readonly TestIdPreFixSuffixHelper TEST_ID_SUFFIX_VALUE_NONE_ITEM =
new TestIdPreFixSuffixHelper(TestIdFixedPrefixSuffixValues.None);
private static readonly TestIdPreFixSuffixHelper TEST_ID_SUFFIX_VALUE_TIME_STAMP_ITEM =
new TestIdPreFixSuffixHelper(TestIdFixedPrefixSuffixValues.TimeStamp);
private static readonly TestIdPreFixSuffixHelper TEST_ID_SUFFIX_VALUE_TEST_SETUP_ITEM =
new TestIdPreFixSuffixHelper(TestIdFixedPrefixSuffixValues.TestSetupName);
private string _testSetupLabel = string.Empty;
public string TestSetupLabel
{
get => _testSetupLabel;
set
{
_testSetupLabel = value;
OnPropertyChanged("TestSetupLabel");
OnPropertyChanged("TestSetupLabelVisibility");
}
}
public Visibility TestSetupLabelVisibility => string.IsNullOrEmpty(TestSetupLabel)
? Visibility.Collapsed
: Visibility.Visible;
private string _testIdEditableText = string.Empty;
public string TestIdEditableText
{
get => _testIdEditableText;
set => SetProperty(ref _testIdEditableText, value, "TestIdEditableText");
}
public void PopulateAllTestIdPrefixSuffixValues(string[] serializedValues)
{
_allTestIdPrefixSuffixValues = new List<TestIdPreFixSuffixHelper>
{
TEST_ID_SUFFIX_VALUE_NONE_ITEM,
TEST_ID_SUFFIX_VALUE_TIME_STAMP_ITEM,
TEST_ID_SUFFIX_VALUE_TEST_SETUP_ITEM
};
// Second, populate all values from the db
var dbList = new List<string>();
dbList.AddRange(serializedValues);
foreach (var s in dbList)
{
_allTestIdPrefixSuffixValues.Add(new TestIdPreFixSuffixHelper(s));
}
OnPropertyChanged("AllTestIDPrefixSuffixValues");
}
private List<TestIdPreFixSuffixHelper> _allTestIdPrefixSuffixValues;
public TestIdPreFixSuffixHelper[] AllTestIdPrefixSuffixValues => _allTestIdPrefixSuffixValues?.ToArray() ?? new TestIdPreFixSuffixHelper[0];
public TestIdPreFixSuffixHelper SelectedTestIdPrefixValueItem { get; set; } = TEST_ID_SUFFIX_VALUE_NONE_ITEM;
public TestIdPreFixSuffixHelper SelectedTestIdSuffixValueItem { get; set; } = TEST_ID_SUFFIX_VALUE_TIME_STAMP_ITEM;
public string TestName
{
get; set;
}
public string GetTestId()
{
var testIdList = new List<string>();
var prefix = GetRunTimeTestIdPrefixOrSuffix(SelectedTestIdPrefixValueItem);
if (prefix != string.Empty)
{
testIdList.Add(prefix);
}
if (!string.IsNullOrEmpty(TestSetupLabel))
{
testIdList.Add(TestSetupLabel);
}
if (TestIdEditableText != string.Empty)
{
testIdList.Add(TestIdEditableText);
}
var suffix = GetRunTimeTestIdPrefixOrSuffix(SelectedTestIdSuffixValueItem);
if (suffix != string.Empty)
{
testIdList.Add(suffix);
}
return string.Join("_", testIdList);
}
private string GetRunTimeTestIdPrefixOrSuffix(TestIdPreFixSuffixHelper prefixOrSuffix)
{
var rv = string.Empty;
if (prefixOrSuffix == null) { return rv; }
switch (prefixOrSuffix.TestIdPreFixSuffix.FixedValue)
{
case TestIdFixedPrefixSuffixValues.TestSetupName:
rv = TestName;
break;
case TestIdFixedPrefixSuffixValues.TimeStamp:
rv = GetTestIdTimestamp();
break;
case TestIdFixedPrefixSuffixValues.NotFixed:
rv = prefixOrSuffix.TestIdPreFixSuffix.ToString();
break;
case TestIdFixedPrefixSuffixValues.None:
default:
// do nothing
break;
}
return rv;
}
public string GetTestIdTimestamp()
{
return $"{DateTime.Now.Year:0000}_{DateTime.Now.Month:00}_{DateTime.Now.Day:00} {DateTime.Now.Hour:00}_{DateTime.Now.Minute:00}";
}
}
}

View File

@@ -0,0 +1,18 @@
using DTS.Common.Converters;
using System.ComponentModel;
namespace DTS.Common.Enums.Hardware
{
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum SLICEPROSIMConfigurations
{
[Description("SLICE_CONFIGURATION_MEGA")]
MEGA,
[Description("SLICE_CONFIGURATION_800K")]
EIGHT_HUNDRED,
[Description("SLICE_CONFIGURATION_700K")]
SEVEN_HUNDRED,
[Description("SLICE_CONFIGURATION_600K")]
SIX_HUNDRED
}
}

View File

@@ -0,0 +1,36 @@
using System.Collections.Generic;
using System.Windows;
using DTS.Common.Base;
// ReSharper disable once CheckNamespace
namespace DTS.Common.Interface
{
public interface IViewerMainViewModel : IBaseViewModel, ISelectedDataViewModel
{
/// <summary>
/// Gets the Main View.
/// </summary>
IBaseView View { get; set; }
object ContextNavigationRegion { get; set; }
object ContextGraphRegion { get; set; }
object ContextTestsRegion { get; set; }
object ContextGraphsRegion { get; set; }
object ContextLegendRegion { get; set; }
object ContextDiagRegion { get; set; }
object ContextStatsRegion { get; set; }
object ContextCursorRegion { get; set; }
object ContextPropertyRegion { get; set; }
List<FrameworkElement> GetRegions();
string ConfigPath { get; set; }
bool DoesUserHaveEditPermission { get; set; }
void ZoomReset();
//inform left arrow key was pressed
void LeftKeyPress();
//inform right arrow key was pressed
void RightKeyPress();
Common.Enums.IsoViewMode ChannelCodeViewMode { get; set; }
Common.Enums.Sensors.CalibrationBehaviors CalibrationBehaviorSetting { get; set; }
bool CalibrationBehaviorSettableInViewer { get; set; }
Visibility SettingsVisibility { get; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
namespace DTS.Common.Classes.Connection
{
public class NotConnectedException : ApplicationException
{
public NotConnectedException(string message)
: base(message)
{
}
}
}

View File

@@ -0,0 +1,60 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System;
namespace DTS.Common.Interface.Channels
{
/// <summary>
/// Interface describing a Channel in the Db
/// </summary>
public interface IChannelDbRecord
{
[Key]
[Column("Id")]
/// <summary>
/// The id/key of the Channel record in the db
/// </summary>
long Id { get; set; }
[Column("GroupId")]
int GroupId { get; set; }
[Column("IsoCode")]
string IsoCode { get; set; }
[Column("IsoChannelName")]
string IsoChannelName { get; set; }
[Column("UserCode")]
string UserCode { get; set; }
[Column("UserChannelName")]
string UserChannelName { get; set; }
[Column("DASId")]
int DASId { get; set; }
[Column("DASChannelIndex")]
/// <summary>
/// The physical channel index of the channel among channels on the DAS
/// </summary>
int DASChannelIndex { get; set; }
[Column("GroupChannelOrder")]
int GroupChannelOrder { get; set; }
[Column("TestSetupOrder")]
int TestSetupOrder { get; set; }
int SensorId { get; set; }
[Column("Disabled")]
bool Disabled { get; set; }
[Column("LastModified")]
DateTime LastModified { get; set; }
[Column("LastModifiedBy")]
string LastModifiedBy { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using DTS.Common.Base;
using DTS.Common.Enums.Sensors;
// ReSharper disable CheckNamespace
namespace DTS.Common.Interface.TestDefinition
{
public interface ITestSummary : IBaseClass
{
string Id { get; set; }
string SetupName { get; set; }
string Description { get; set; }
int ChannelCount { get; set; }
DateTime FileDate { get; set; }
DateTime TimeStamp { get; set; }
string DataType { get; set; }
bool IsSelected { get; set; }
List<ITestGraphs> Graphs { get; set; }
List<ITestChannel> Channels { get; set; }
List<ITestChannel> CalculatedChannels { get; set; }
IBaseViewModel Parent { get; set; }
ITestMetadata TestMetadata { get; set; }
CalibrationBehaviors CalibrationBehavior { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
using DTS.Common.Base;
using DTS.Common.Interface.Channels;
using System.Data;
namespace DTS.Common.Classes.Groups.ChannelSettings
{
public class GroupChannelSettingRecord : BasePropertyChanged, IGroupChannelSettingRecord
{
private long _channelId;
public long ChannelId
{
get => _channelId;
set => SetProperty(ref _channelId, value, "ChannelId");
}
private int _settingId;
public int SettingId
{
get => _settingId;
set => SetProperty(ref _settingId, value, "SettingId");
}
private string _settingValue;
public string SettingValue
{
get => _settingValue;
set => SetProperty(ref _settingValue, value, "SettingValue");
}
public GroupChannelSettingRecord() { }
public GroupChannelSettingRecord(IDataReader reader, int storedProcedureVersionUsed)
{
if (storedProcedureVersionUsed >= Constants.BULK_GROUPCHANNELSETTINGS_GET_DB_VERSION)
{
ChannelId = Utility.GetLong(reader, "ChannelId");
}
SettingId = Utility.GetInt(reader, "SettingId");
SettingValue = Utility.GetString(reader, "SettingValue");
}
public GroupChannelSettingRecord(long channelId, int settingId, string settingValue)
{
ChannelId = channelId;
SettingId = settingId;
SettingValue = settingValue;
}
}
}

View File

@@ -0,0 +1,25 @@
using DTS.Common.Converters;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Enums
{
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum VelocityUnit
{
/// <summary>
/// kilometer per hour
/// </summary>
[Description("EditTestSetupObjectMeta_VelocityUnit_KilometerPerHour")]
KilometerPerHour = 0,
/// <summary>
/// meter per second
/// </summary>
[Description("EditTestSetupObjectMeta_VelocityUnit_MeterPerSecond")]
MeterPerSecond = 1
}
}

View File

@@ -0,0 +1,16 @@
using System.Collections.Generic;
using System.Windows;
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IShellViewModel : IBaseWindowModel
{
/// <summary>
/// Gets the Shell View.
/// </summary>
IShellView View { get; }
List<FrameworkElement> GetRegions();
object ContextMainRegion { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using DTS.Common.Enums.DASFactory;
namespace DTS.Common.Interface.Hardware
{
public interface IDASMonitorInfo
{
string SerialNumber { get; }
double[] TiltSensorCals { get; }
short[] TiltSensorDataPre { get; }
DFConstantsAndEnums.TiltAxes TiltAxes { get; }
int AxisIgnored { get; }
double MountOffsetAxisOne { get; }
double MountOffsetAxisTwo { get; }
string GetChannelName(int index);
double GetOffsetTolerancemVLow(int index);
double GetOffsetTolerancemVHigh(int index);
void ReadFromFile(string path);
void WriteToFile(string path);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,18 @@
using Prism.Events;
namespace DTS.Common.Events
{
/// <summary>
/// Event to inform app that Automatic Mode status has changed
/// </summary>
/// <remarks>
///
/// </remarks>
public class AutomaticModeStatusEvent : PubSubEvent<AutomaticModeStatusEventArgs> { }
public class AutomaticModeStatusEventArgs
{
public bool TextSet { get; set; } = false;
public string Text { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IShellView : IBaseWindow { }
}

View File

@@ -0,0 +1,15 @@
using DTS.Common.Base;
using DTS.Common.Interface;
using Prism.Events;
namespace DTS.Common.Events
{
public class PSDReportSettingsChangedEvent : PubSubEvent<PSDReportSettingsChangedEventArg> { }
public class PSDReportSettingsChangedEventArg
{
public IPSDReportSettingsModel Model { get; set; }
public IBaseViewModel ParentVM { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using DTS.Common.Events;
using DTS.Common.Interface.Channels.ChannelCodes;
namespace DTS.Common.Classes.ChannelCodes
{
public class TextPastedArgs : ITextPastedEventArgs
{
public string Text { get; }
public object Sender { get; }
public string Id { get; }
public object Tag { get; }
public TextPastedArgs(string text, IChannelCode channelCode, string id, object tag)
{
Text = text;
Sender = channelCode;
Id = id;
Tag = tag;
}
}
}

View File

@@ -0,0 +1,201 @@
using DTS.Common.Enums.Sensors;
using System;
using DTS.Common.Enums;
using DTS.Common.Classes.Sensors;
using DTS.Common.Interface.Sensors.SoftwareFilters;
namespace DTS.Common.Interface.Sensors.SensorsList
{
/// <summary>
/// this interface is used to describe objects used to represents sensors for UI purposes
/// </summary>
public interface IAnalogSensor
{
/// <summary>
/// bridge mode of the sensor in question
/// </summary>
SensorConstants.BridgeType Bridge { get; set; }
/// <summary>
/// indicates if the sensor is Integrated Electronics Piezo-Electric (IEPE)
/// </summary>
bool IEPE { get; }
/// <summary>
/// id in the database if available
/// only positive values are valid
/// </summary>
int DatabaseId { get; set; }
/// <summary>
/// used to indicate that the sensor should be checked if in a list
/// with a checkbox
/// </summary>
bool Included { get; set; }
/// <summary>
/// serial number of the sensor
/// </summary>
string SerialNumber { get; set; }
/// <summary>
/// description or comment of the sensor
/// </summary>
string Description { get; set; }
/// <summary>
/// the maker of the sensor
/// </summary>
string Manufacturer { get; set; }
/// <summary>
/// the model of the sensor
/// </summary>
string Model { get; set; }
/// <summary>
/// the current capacity or desired range of the sensor in EU
/// in general this value refers to maximum capacity, however
/// in some contexts this can refer to desired range instead
/// </summary>
double Capacity { get; set; }
/// <summary>
/// an arbitrary EU value for range for the sensor
/// </summary>
double RangeHigh { get; set; }
/// <summary>
/// an arbitrary EU value for medium range for the sensor
/// </summary>
double RangeMedium { get; set; }
/// <summary>
/// an arbitrary EU value for the low range for the sensor
/// </summary>
double RangeLow { get; set; }
/// <summary>
/// a user display friendly string representation of the sensor's sensitivity
/// this is suitable for tables and user display
/// </summary>
string Sensitivity { get; set; }
/// <summary>
/// in the case of dual sensitivity sensors, this is a string
/// user friendly representation of the second calibration
/// </summary>
string AddedSensitivity { get; set; }
/// <summary>
/// resistance in ohms of the sensor
/// </summary>
double Resistance { get; set; }
/// <summary>
/// a user friendly representation of the supported excitations
/// of the sensor
/// </summary>
string Excitation { get; set; }
/// <summary>
/// the engineering units of the sensor
/// usually obtained from the most recent calibration
/// </summary>
string Units { get; set; }
/// <summary>
/// Electronic ID associated with the sensor, if any
/// </summary>
string EID { get; set; }
/// <summary>
/// the last (most recent) calibration date for the sensor
/// </summary>
DateTime CalDate { get; set; }
/// <summary>
/// the date the sensor is due for calibration
/// </summary>
DateTime CalDueDate { get; set; }
/// <summary>
/// the user that last modified the sensor or calibration
/// </summary>
string ModifiedBy { get; set; }
/// <summary>
/// the date the sensor or calibration was last modified
/// </summary>
DateTime LastModified { get; set; }
/// <summary>
/// returns true if the sensor matches the filter criteria
/// </summary>
/// <param name="term"></param>
/// <returns></returns>
bool Filter(string term);
/// <summary>
/// used to indicate if the sensor has been assigned to a channel
/// </summary>
bool Assigned { get; set; }
/// <summary>
/// used to indicate if the sensor is online or not
/// </summary>
bool Online { get; set; }
/// <summary>
/// the isocode associated with the sensor
/// this is the default isocode for the sensor when assigned to a new blank channel
/// </summary>
string ISOCode { get; set; }
/// <summary>
/// the isochannel name associated with the sensor
/// this is the default user channel name for the sensor when assigned to a new blank channel
/// </summary>
string ISOChannelName { get; set; }
/// <summary>
/// the user code associated with the sensor
/// this is the default user code for the sensor when assigned to a new blank channel
/// </summary>
string UserCode { get; set; }
/// <summary>
/// the user channel name associated with the sensor
/// this is the default user channel name for the sensor when assigned to a new blank channel
/// </summary>
string UserChannelName { get; set; }
/// <summary>
/// the channel filter class (CFC) associated with the sensor
/// this is the default CFC for the sensor when assigned to a new blank channel
/// </summary>
Enums.Sensors.FilterClassType CFC { get; set; }
/// <summary>
/// indicates whether the sensor output should be inverted or not
/// this is the default polarity for the sensor when assigned to a new blank channel
/// </summary>
bool Polarity { get; set; }
/// <summary>
/// indicates what the type of nonlinear calculation is used for this sensor as a string
/// </summary>
string NonLinearCalculationType { get; set; }
/// <summary>
/// indicates what the type of nonlinear calculation is used for this sensor, as an enum
/// </summary>
NonLinearStyles NonLinearCalculationTypeEnum { get; set; }
/// <summary>
/// indicates what the type of software zero method is used for this sensor
/// </summary>
Enums.Sensors.ZeroMethodType ZeroMethod { get; set; }
/// <summary>
/// If ZeroMethod is Average over Time, indicates the start time
/// </summary>
double ZeroMethodStart { get; set; }
/// <summary>
/// If ZeroMethod is Average over Time, indicates the end time
/// </summary>
double ZeroMethodEnd { get; set; }
string UserValue1 { get; set; }
string UserValue2 { get; set; }
string UserValue3 { get; set; }
UIItemStatus SensorCalibrationOrUsageStatus { get; }
InitialOffset[] InitialOffsets { get; set; }
//FB 13120 define filter class
IFilterClass FilterClass { get; set; }
/// <summary>
/// Date of first use (null value indicates not set)
/// only valid when using latest calibration (as indicated by UsingLatestCalibration and LatestCalibrationId)
/// 13065 Sensor "First Use" Date
/// </summary>
DateTime? FirstUseDate { get; set; }
/// <summary>
/// latest calibration id for sensor, null indicates not set
/// 13065 Sensor "First Use" Date
/// </summary>
int? LatestCalibrationId { get; set; }
/// <summary>
/// whether the sensor is using the latest calibration (as indicated by calibration id)
/// 13065 Sensor "First Use" Date
/// </summary>
bool UsingLatestCalibration { get; set; }
int SensorUsageCount { get; set; }
int MaximumUsage { get; set; }
string AssemblyName { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System.Collections.Generic;
// ReSharper disable CheckNamespace
namespace DTS.Common.Interface
{
public interface ITestGraphs
{
string Name { get; set; }
string HardwareChannelName { get; set; }
List<string> ChannelId { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Interface.DASFactory.Download
{
public interface IUARTDownloadRequest
{
/// <summary>
/// From which event do we want to download data?
/// </summary>
ushort EventNumber { get; set; }
/// <summary>
/// How much data is there?
/// </summary>
ulong TotalByteCount { get; set; }
/// <summary>
/// Where in the data did the trigger occur?
/// </summary>
ulong TriggerByteCount { get; set; }
/// <summary>
/// Where in the data did the trigger occur?
/// </summary>
ulong FaultByteCount { get; set; }
/// <summary>
/// When did the UART stream start?
/// </summary>
ulong StartTimestamp { get; set; }
/// <summary>
/// When did the UART stream end?
/// </summary>
ulong EndTimestamp { get; set; }
/// <summary>
/// What was the baud rate during recording?
/// </summary>
int BaudRate { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using DTS.Common.Base;
using DTS.Common.Interface;
using Prism.Events;
// ReSharper disable CheckNamespace
namespace DTS.Common.Events
{
/// <summary>
/// The Data Folder changed event.
/// </summary>
public class ChartOptionsChangedEvent : PubSubEvent<ChartOptionsChangedEventArg> { }
public class ChartOptionsChangedEventArg
{
public IBaseViewModel ParentVM { get; set; }
public IChartOptionsModel Model { get; set; }
public string ChartType { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More