init
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
namespace DTS.Common.Enums.Sensors.SensorsList
|
||||
{
|
||||
public enum DigitalOutFields
|
||||
{
|
||||
Included,
|
||||
SerialNumber,
|
||||
Description,
|
||||
Delay,
|
||||
Duration,
|
||||
ModifiedBy,
|
||||
LastModified
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Enums.DASFactory;
|
||||
using DTS.Common.Enums.Sensors;
|
||||
using DTS.Common.Enums.Viewer;
|
||||
using DTS.Common.Interface.ISO.ExtraProperties;
|
||||
using DTS.Common.Interface.RegionOfInterest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DTS.Common.Interface.TestSetups.TestSetupsList
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes a test setup record in the database
|
||||
/// </summary>
|
||||
public interface ITestSetupRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// does a deep copy of provided test setup
|
||||
/// </summary>
|
||||
/// <param name="copy">source record to copy</param>
|
||||
void Copy(ITestSetupRecord copy);
|
||||
/// <summary>
|
||||
/// Database Id of test setup
|
||||
/// </summary>
|
||||
int Id { get; set; }
|
||||
/// <summary>
|
||||
/// Name of test setup
|
||||
/// </summary>
|
||||
string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Description of test setup
|
||||
/// </summary>
|
||||
string Description { get; set; }
|
||||
/// <summary>
|
||||
/// whether test execution should progress automatically
|
||||
/// </summary>
|
||||
bool AutomaticProgression { get; set; }
|
||||
/// <summary>
|
||||
/// delay between steps when using automatic progression
|
||||
/// </summary>
|
||||
int AutomaticProgressionDelayMS { get; set; }
|
||||
/// <summary>
|
||||
/// whether the trigger polarity should be switched from close to open
|
||||
/// </summary>
|
||||
bool InvertTriggerCompletion { get; set; }
|
||||
/// <summary>
|
||||
/// whether the start polarity should be switched from close to open
|
||||
/// </summary>
|
||||
bool InvertStartRecordCompletion { get; set; }
|
||||
/// <summary>
|
||||
/// Whether or not a shorted start should be ignored
|
||||
/// </summary>
|
||||
bool IgnoreShortedStartCompletion { get; set; }
|
||||
/// <summary>
|
||||
/// Whether or not a shorted trigger should be ignored
|
||||
/// </summary>
|
||||
bool IgnoreShortedTriggerCompletion { get; set; }
|
||||
/// <summary>
|
||||
/// Whether diagnostics should be a viewable step when executing test
|
||||
/// </summary>
|
||||
bool ViewDiagnostics { get; set; }
|
||||
/// <summary>
|
||||
/// whether verify channels should be a viewable step when executing test
|
||||
/// </summary>
|
||||
bool VerifyChannels { get; set; }
|
||||
|
||||
bool AutoVerifyChannels { get; set; }
|
||||
double AutoVerifyDelaySeconds { get; set; }
|
||||
/// <summary>
|
||||
/// overall recording mode of test
|
||||
/// Some DAS may not support the actual recording mode but may support a related recording
|
||||
/// mode (example circular buffer + UART versus circular buffer)
|
||||
/// </summary>
|
||||
RecordingModes RecordingMode { get; set; }
|
||||
/// <summary>
|
||||
/// samples per second for test as overall value
|
||||
/// Each DAS can have it's own rate so this is mostly just to control the rate for new das added to a test
|
||||
/// </summary>
|
||||
double SamplesPerSecondAggregate { get; set; }
|
||||
/// <summary>
|
||||
/// amount of data pre trigger that is requested in seconds
|
||||
/// </summary>
|
||||
double PreTriggerSeconds { get; set; }
|
||||
/// <summary>
|
||||
/// amount of data post trigger that is requested in seconds
|
||||
/// </summary>
|
||||
double PostTriggerSeconds { get; set; }
|
||||
/// <summary>
|
||||
/// number of events to record if recording mode supports multiple events
|
||||
/// </summary>
|
||||
int NumberOfEvents { get; set; }
|
||||
/// <summary>
|
||||
/// whether all channels are required to pass diagnostics for test execution
|
||||
/// </summary>
|
||||
bool StrictDiagnostics { get; set; }
|
||||
/// <summary>
|
||||
/// whether user confirmation is required on diagnostic errors discovered before
|
||||
/// test execution continues
|
||||
/// </summary>
|
||||
bool RequireUserConfirmationOnErrors { get; set; }
|
||||
/// <summary>
|
||||
/// whether to perform a Region of Interest (ROI) download as a unique step of test execution
|
||||
/// </summary>
|
||||
bool DoROIDownload { get; set; }
|
||||
/// <summary>
|
||||
/// whether to include viewing region of interest (ROI) as a step of test execution
|
||||
/// </summary>
|
||||
bool ViewROIDownload { get; set; }
|
||||
/// <summary>
|
||||
/// whether to include downloading all available data as a step of test execution
|
||||
/// </summary>
|
||||
bool DownloadAll { get; set; }
|
||||
/// <summary>
|
||||
/// whether to include real time as a step of test execution
|
||||
/// </summary>
|
||||
bool ViewRealtime { get; set; }
|
||||
/// <summary>
|
||||
/// the number of plots to show in real time if viewing real time
|
||||
/// </summary>
|
||||
short DefaultNumberRealtimeGraphs { get; set; }
|
||||
BindingList<IRegionOfInterest> RegionsOfInterest { get; set; }
|
||||
/// <summary>
|
||||
/// the start of the region of interest (deprecated?)
|
||||
/// </summary>
|
||||
double ROIStart { get; set; }
|
||||
/// <summary>
|
||||
/// the end of the region of interest (deprecated?)
|
||||
/// </summary>
|
||||
double ROIEnd { get; set; }
|
||||
/// <summary>
|
||||
/// whether to include viewing of all download data as a step of test execution
|
||||
/// </summary>
|
||||
bool ViewDownloadAll { get; set; }
|
||||
/// <summary>
|
||||
/// whether to include export as a step of test execution
|
||||
/// </summary>
|
||||
bool ViewExport { get; set; }
|
||||
/// <summary>
|
||||
/// Bit mask of export formats to select in export step by default
|
||||
/// </summary>
|
||||
SupportedExportFormatBitFlags ExportFormats { get; set; }
|
||||
string LabDetails { get; set; }
|
||||
/// <summary>
|
||||
/// Whether lab details should be included as a part of test execution
|
||||
/// </summary>
|
||||
bool UseLabratoryDetails { get; set; }
|
||||
string CustomerDetails { get; set; }
|
||||
/// <summary>
|
||||
/// Whether customer details should be included as a part of test execution
|
||||
/// </summary>
|
||||
bool UseCustomerDetails { get; set; }
|
||||
/// <summary>
|
||||
/// Whether to allow test execution to continue when sensors in test are missing
|
||||
/// </summary>
|
||||
bool AllowMissingSensors { get; set; }
|
||||
/// <summary>
|
||||
/// whether a sensor with an ID is allowed to be assigned on a channel if the Id
|
||||
/// was not found on that channel
|
||||
/// </summary>
|
||||
bool AllowSensorIdToBlankChannel { get; set; }
|
||||
CalibrationBehaviors CalibrationBehavior { get; set; }
|
||||
/// <summary>
|
||||
/// whether test setup record should be synchronized with central server
|
||||
/// (deprecated)
|
||||
/// </summary>
|
||||
bool LocalOnly { get; set; }
|
||||
/// <summary>
|
||||
/// when test setup was last modified
|
||||
/// </summary>
|
||||
DateTime LastModified { get; set; }
|
||||
/// <summary>
|
||||
/// who last modified test setup
|
||||
/// </summary>
|
||||
string LastModifiedBy { get; set; }
|
||||
bool TurnOffExcitation { get; set; }
|
||||
/// <summary>
|
||||
/// whether to use EU levels to "trigger" channels in realtime viewer
|
||||
/// </summary>
|
||||
bool TriggerCheckRealtime { get; set; }
|
||||
/// <summary>
|
||||
/// Whether to include trigger check as a step in test execution
|
||||
/// </summary>
|
||||
bool TriggerCheckStep { get; set; }
|
||||
/// <summary>
|
||||
/// whether to include post test diagnostics as a step in test execution
|
||||
/// </summary>
|
||||
bool PostTestDiagnosticsLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// whether there's an expectation that there is a common status line between all DAS
|
||||
/// in test.
|
||||
/// </summary>
|
||||
bool CommonStatusLine { get; set; }
|
||||
bool SameAsDownloadFolder { get; set; }
|
||||
/// <summary>
|
||||
/// whether to include upload data as a step
|
||||
/// </summary>
|
||||
bool UploadData { get; set; }
|
||||
/// <summary>
|
||||
/// folder to upload data to
|
||||
/// [legacy, superseded by upload ini file]
|
||||
/// </summary>
|
||||
string UploadFolder { get; set; }
|
||||
/// <summary>
|
||||
/// whether to upload only export data files when uploading files
|
||||
/// </summary>
|
||||
bool UploadExportsOnly { get; set; }
|
||||
string Settings { get; set; }
|
||||
bool WarnOnFailedBattery { get; set; }
|
||||
/// <summary>
|
||||
/// whether test setup completion has been calculated yet or not
|
||||
/// If dirty is true it has not been calculated and needs to be
|
||||
/// </summary>
|
||||
bool Dirty { get; set; }
|
||||
/// <summary>
|
||||
/// whether the test setup is complete and ready to run
|
||||
/// [dependent on Dirty]
|
||||
/// </summary>
|
||||
bool IsComplete { get; set; }
|
||||
/// <summary>
|
||||
/// any warnings or errors known in test setup, stored to avoid needing to calculate when retrieving all setups
|
||||
/// </summary>
|
||||
string ErrorMessage { get; set; }
|
||||
string TestEngineerDetails { get; set; }
|
||||
/// <summary>
|
||||
/// whether to use test engineer details in test execution
|
||||
/// </summary>
|
||||
bool UseTestEngineerDetails { get; set; }
|
||||
byte[] TagsBlobBytes { get; set; }
|
||||
/// <summary>
|
||||
/// whether units in the test should be auto armed
|
||||
/// </summary>
|
||||
bool DoAutoArm { get; set; }
|
||||
bool DoEnableRepeat { get; set; }
|
||||
/// <summary>
|
||||
/// Whether test is a checkout test
|
||||
/// this has multiple internal meanings including whether strict diagnostics are used or not, whether data
|
||||
/// should be collected from sensors or not, etc
|
||||
/// this should generally be false
|
||||
/// </summary>
|
||||
bool CheckoutMode { get; set; }
|
||||
/// <summary>
|
||||
/// Instrumentation Setup File used to create test setup, if relevant
|
||||
/// </summary>
|
||||
string ISFFile { get; set; }
|
||||
bool QuitTestWithoutWarning { get; set; }
|
||||
bool NotAllChannelsRealTime { get; set; }
|
||||
bool NotAllChannelsViewer { get; set; }
|
||||
bool SuppressMissingSensorsWarning { get; set; }
|
||||
bool DoStreaming { get; set; }
|
||||
ClockSyncProfile ClockSyncProfileMaster { get; set; }
|
||||
ClockSyncProfile ClockSyncProfileSlave { get; set; }
|
||||
List<IExtraProperty> ExtraProperties { get; set; }
|
||||
bool MeasureSquibResistancesStep { get; set; }
|
||||
string TestSetupUniqueId { get; set; }
|
||||
|
||||
bool LowgLevelTriggerOn { get; set; }
|
||||
bool LowgLevelTriggerOnX { get; set; }
|
||||
bool LowgLevelTriggerOnY { get; set; }
|
||||
bool LowgLevelTriggerOnZ { get; set; }
|
||||
bool HighgLevelTriggerOn { get; set; }
|
||||
|
||||
bool HighgLevelTriggerOnX { get; set; }
|
||||
bool HighgLevelTriggerOnY { get; set; }
|
||||
bool HighgLevelTriggerOnZ { get; set; }
|
||||
bool AngularAccelLevelTriggerOn { get; set; }
|
||||
bool AngularAccelLevelTriggerOnX { get; set; }
|
||||
bool AngularAccelLevelTriggerOnY { get; set; }
|
||||
bool AngularAccelLevelTriggerOnZ { get; set; }
|
||||
bool AngularRateLevelTriggerOn { get; set; }
|
||||
bool AngularRateLevelTriggerOnX { get; set; }
|
||||
bool AngularRateLevelTriggerOnY { get; set; }
|
||||
bool AngularRateLevelTriggerOnZ { get; set; }
|
||||
double LowgLinearLevelTriggerX { get; set; }
|
||||
double LowgLinearLevelTriggerY { get; set; }
|
||||
double LowgLinearLevelTriggerZ { get; set; }
|
||||
double HighgLinearLevelTriggerX { get; set; }
|
||||
double HighgLinearLevelTriggerY { get; set; }
|
||||
double HighgLinearLevelTriggerZ { get; set; }
|
||||
double AngularRateLevelTriggerX { get; set; }
|
||||
double AngularRateLevelTriggerY { get; set; }
|
||||
double AngularRateLevelTriggerZ { get; set; }
|
||||
double AngularAccelLevelTriggerX { get; set; }
|
||||
double AngularAccelLevelTriggerY { get; set; }
|
||||
double AngularAccelLevelTriggerZ { get; set; }
|
||||
bool HumidityLevelTriggerOn { get; set; }
|
||||
bool PressureLevelTriggerOn { get; set; }
|
||||
bool TemperatureLevelTriggerOn { get; set; }
|
||||
double HumidityLevelTriggerBelow { get; set; }
|
||||
double HumidityLevelTriggerAbove { get; set; }
|
||||
double PressureLevelTriggerBelow { get; set; }
|
||||
double PressureLevelTriggerAbove { get; set; }
|
||||
double TemperatureLevelTriggerBelow { get; set; }
|
||||
double TemperatureLevelTriggerAbove { get; set; }
|
||||
double LowgLinearAccRate { get; set; }
|
||||
double HighgLinearAccRate { get; set; }
|
||||
double AngularRate { get; set; }
|
||||
double TemperatureHumidityPressureRate { get; set; }
|
||||
bool BatterySaverModeOn { get; set; }
|
||||
bool WakeUpAndArmTriggerOn { get; set; }
|
||||
WakeupTriggers WakeUpTrigger { get; set; }
|
||||
int WakeUpMagnetTimeout { get; set; }
|
||||
int WakeUpMotionTimeout { get; set; }
|
||||
DateTime WakeUpTimeSessionStart { get; set; }
|
||||
TimeSpan WakeUpTimeDuration { get; set; }
|
||||
bool TimedIntervalTriggerOn { get; set; }
|
||||
int IntervalBetweenEventStartsMinutes { get; set; }
|
||||
TimeUnitTypeEnum TimedIntervalUnits { get; set; }
|
||||
double TimedIntervalDuration { get; set; }
|
||||
double TimedIntervalEvents { get; set; }
|
||||
bool RTCScheduleTriggerOn { get; set; }
|
||||
DateTime RTCScheduleStartDateTime { get; set; }
|
||||
TimeSpan RTCScheduleDuration { get; set; }
|
||||
bool StartWithEvent { get; set; }
|
||||
void InitializeFromDefaults(CalibrationBehaviors calBehavior,
|
||||
RecordingModes recordingMode, double preTriggerSeconds, double postTriggerSeconds,
|
||||
int numEvents);
|
||||
bool AlignUDPToPPS { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace DTS.Common.Interface.Channels
|
||||
{
|
||||
public interface IChannelSettingRecord
|
||||
{
|
||||
int Id { get; set; }
|
||||
string SettingName { get; set; }
|
||||
string DefaultValue { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,404 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DTS.Common.Converters;
|
||||
using DTS.Common.Enums.Sensors;
|
||||
using DTS.Common.Interface.Sensors;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
|
||||
namespace DTS.Common.Classes.Sensors
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// InitialOffset is the replacement for InitialEU
|
||||
/// it encompasses the old InitialOffset specified in EU with a offset of specifying it in mV @EU
|
||||
/// Initial EU is a post data collection adjustment to engineering units recorded
|
||||
/// </summary>
|
||||
public class InitialOffset : Base.BasePropertyChanged
|
||||
{
|
||||
/// <summary>
|
||||
/// copy constructor
|
||||
/// </summary>
|
||||
/// <param name="copy"></param>
|
||||
public InitialOffset(InitialOffset copy)
|
||||
{
|
||||
if (null == copy) { return; }
|
||||
EU = copy.EU;
|
||||
MV = copy.MV;
|
||||
Form = copy.Form;
|
||||
}
|
||||
/// <summary>
|
||||
/// default constructor
|
||||
/// </summary>
|
||||
public InitialOffset()
|
||||
{
|
||||
Form = InitialOffsetTypes.None;
|
||||
EU = 0D;
|
||||
MV = 0D;
|
||||
}
|
||||
/// <summary>
|
||||
/// constructor for the old format Initial EU (a single double representing offset in EU)
|
||||
/// </summary>
|
||||
/// <param name="d"></param>
|
||||
public InitialOffset(double d)
|
||||
{
|
||||
Form = InitialOffsetTypes.EU;
|
||||
EU = d;
|
||||
MV = 0D;
|
||||
}
|
||||
/// <summary>
|
||||
/// constructor for string from db
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
public InitialOffset(string s)
|
||||
{
|
||||
FromDbSerializeString(s);
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
var converter = new EnumDescriptionTypeConverter(typeof(InitialOffsetTypes));
|
||||
return converter.ConvertToString(Form);
|
||||
}
|
||||
/// <summary>
|
||||
/// serializes to a db safe string
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string ToDbSerializeString()
|
||||
{
|
||||
var s = new List<string>
|
||||
{
|
||||
Form.ToString(),
|
||||
EU.ToString(System.Globalization.CultureInfo.InvariantCulture),
|
||||
MV.ToString(System.Globalization.CultureInfo.InvariantCulture)
|
||||
};
|
||||
return string.Join(System.Globalization.CultureInfo.InvariantCulture.TextInfo.ListSeparator, s.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// deserializes from a string suitable for db storage
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
public void FromDbSerializeString(string input)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(input))
|
||||
{
|
||||
Form = InitialOffsetTypes.None;
|
||||
EU = 0;
|
||||
MV = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (input == "EU")
|
||||
{
|
||||
Form = InitialOffsetTypes.EU;
|
||||
EU = 0;
|
||||
return;
|
||||
}
|
||||
if (input.Contains(InitialOffsets.MySeparator))
|
||||
{
|
||||
//we got an InputOffsets input. just take the first one
|
||||
input = input.Split(new[] { InitialOffsets.MySeparator }, StringSplitOptions.RemoveEmptyEntries)[0];
|
||||
}
|
||||
|
||||
var tokens = input.Split(new string[] { System.Globalization.CultureInfo.InvariantCulture.TextInfo.ListSeparator }, StringSplitOptions.None);
|
||||
|
||||
if (Enum.TryParse(tokens[0], out InitialOffsetTypes form))
|
||||
{
|
||||
Form = form;
|
||||
if (tokens.Length < 3)
|
||||
{
|
||||
throw new System.IO.InvalidDataException($"Invalid InitialOffset number of parameters: {input}");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (double.TryParse(tokens[1], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out var d))
|
||||
{
|
||||
EU = d;
|
||||
}
|
||||
else { throw new FormatException($"Invalid InitialOffset EU format: {tokens[1]}"); }
|
||||
if (double.TryParse(tokens[2], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
|
||||
{
|
||||
MV = d;
|
||||
}
|
||||
else { throw new FormatException($"Invalid InitialOffset MV format: {tokens[2]}"); }
|
||||
}
|
||||
}
|
||||
else { throw new System.IO.InvalidDataException("Invalid InitialOffset form: " + tokens[0]); }
|
||||
}
|
||||
|
||||
private InitialOffsetTypes _form;
|
||||
|
||||
/// <summary>
|
||||
/// the format this intial offset instance is in
|
||||
/// </summary>
|
||||
public InitialOffsetTypes Form
|
||||
{
|
||||
get => _form;
|
||||
set => SetProperty(ref _form, value, Fields.Form.ToString());
|
||||
}
|
||||
|
||||
//FB18158 Don't allow removal of None option
|
||||
public System.Windows.Visibility InitialOffsetVisibility
|
||||
{
|
||||
get => Form != InitialOffsetTypes.None ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
|
||||
}
|
||||
|
||||
private double _eu = 0D;
|
||||
|
||||
/// <summary>
|
||||
/// EU value. In the case of Form == EU, this is the offset in EU
|
||||
/// In. the form of EU@mV, this is the EU@mV value, and offset in EU still needs to be calculated
|
||||
/// GetInitialEUValue calculates the offset in eu
|
||||
/// this value is not used for InitialOffset format None
|
||||
/// </summary>
|
||||
public double EU
|
||||
{
|
||||
get => _eu;
|
||||
set => SetProperty(ref _eu, value, Fields.EU.ToString());
|
||||
}
|
||||
|
||||
private double _mv = 0D;
|
||||
|
||||
/// <summary>
|
||||
/// mV value, only applies for the format EU@mV
|
||||
/// this is the value in mV that The value in EU is observed at by a calibrated instrument
|
||||
/// </summary>
|
||||
public double MV
|
||||
{
|
||||
get => _mv;
|
||||
set => SetProperty(ref _mv, value, Fields.MV.ToString());
|
||||
}
|
||||
|
||||
private enum Fields
|
||||
{
|
||||
Form,
|
||||
EU,
|
||||
MV
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Displays initial offset structure to string
|
||||
/// created for FB5429
|
||||
/// </summary>
|
||||
/// <param name="NONEFormatString">string resource similar to "None"</param>
|
||||
/// <param name="EUFormatString">string resource similar to "EU"</param>
|
||||
/// <param name="mVFormatString">string resource similar to "mV"</param>
|
||||
/// <returns></returns>
|
||||
public string ToDisplayString(string NONEFormatString, string EUFormatString, string mVFormatString)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
switch (Form)
|
||||
{
|
||||
case InitialOffsetTypes.EU:
|
||||
case InitialOffsetTypes.LHS:
|
||||
case InitialOffsetTypes.RHS:
|
||||
case InitialOffsetTypes.FRONTAL:
|
||||
sb.AppendFormat("{0} {1}", EU, EUFormatString);
|
||||
break;
|
||||
case InitialOffsetTypes.EUAtMV:
|
||||
sb.AppendFormat("{0} {1} @ {2} {3}", EU, EUFormatString, MV, mVFormatString);
|
||||
break;
|
||||
case InitialOffsetTypes.None:
|
||||
sb.AppendFormat("{0}", NONEFormatString);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares attributes to another InitialOffset object
|
||||
/// created for FB5429
|
||||
/// </summary>
|
||||
/// <param name="obj">an InitialOffset object</param>
|
||||
/// <returns>if contents are equal</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is InitialOffset io)
|
||||
{
|
||||
var fields = Enum.GetValues(typeof(Fields)).Cast<Fields>().ToArray();
|
||||
foreach (var field in fields)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case Fields.Form: if (io.Form != Form) { return false; } break;
|
||||
case Fields.EU: if (io.EU != EU) { return false; } break;
|
||||
case Fields.MV: if (io.MV != MV) { return false; } break;
|
||||
default:
|
||||
throw new NotSupportedException("InitialOffset::Equals Unknown field " + field);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class InitialOffsets : IInitialOffsets
|
||||
{
|
||||
public InitialOffset[] Offsets { get; set; } = new InitialOffset[] { };
|
||||
//FB18158 Always add None option to InitialOffsets
|
||||
private void SeedNoneInInitialOffsets()
|
||||
{
|
||||
if (Offsets.Any(p => p.Form == InitialOffsetTypes.None))
|
||||
{
|
||||
return;
|
||||
}
|
||||
List<InitialOffset> initialOffsets = new List<InitialOffset>();
|
||||
initialOffsets.Add(new InitialOffset());
|
||||
foreach (var io in Offsets)
|
||||
{
|
||||
initialOffsets.Add(io);
|
||||
}
|
||||
Offsets = initialOffsets.ToArray();
|
||||
}
|
||||
|
||||
public InitialOffset DefaultOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
//30442 Don't default InitialOffset to None if other options exist
|
||||
if (null != Offsets && Offsets.Any())
|
||||
{
|
||||
if ((Offsets.Count() > 1) && (Offsets[0].Form == InitialOffsetTypes.None))
|
||||
{
|
||||
return Offsets[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
return Offsets[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return new InitialOffset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public InitialOffsets(InitialOffsets copy)
|
||||
{
|
||||
InitialOffset[] offsets = new InitialOffset[copy.Offsets.Length];
|
||||
for (int i = 0; i < copy.Offsets.Length; i++)
|
||||
{
|
||||
offsets[i] = new InitialOffset(copy.Offsets[i]);
|
||||
}
|
||||
Offsets = offsets;
|
||||
SeedNoneInInitialOffsets();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This produces an instance of the class based on an existing instance,
|
||||
/// but without the first Initial Offset, only additional Initial Offsets
|
||||
/// </summary>
|
||||
/// <param name="copy"></param>
|
||||
/// <param name="numAdditionalInitialOffsets"></param>
|
||||
public InitialOffsets(InitialOffsets copy, int numAdditionalInitialOffsets)
|
||||
{
|
||||
InitialOffset[] offsets = new InitialOffset[numAdditionalInitialOffsets];
|
||||
for (int i = 0; i < numAdditionalInitialOffsets; i++)
|
||||
{
|
||||
offsets[i] = new InitialOffset(copy.Offsets[i + 1]);
|
||||
}
|
||||
Offsets = offsets;
|
||||
SeedNoneInInitialOffsets();
|
||||
}
|
||||
|
||||
public InitialOffsets()
|
||||
{
|
||||
Offsets = new InitialOffset[] { new InitialOffset() };
|
||||
SeedNoneInInitialOffsets();
|
||||
}
|
||||
public InitialOffsets(string offsets)
|
||||
{
|
||||
FromSerializedString(offsets);
|
||||
SeedNoneInInitialOffsets();
|
||||
}
|
||||
|
||||
public InitialOffsets(InitialOffset startingOffset)
|
||||
{
|
||||
Offsets = new InitialOffset[] { startingOffset };
|
||||
SeedNoneInInitialOffsets();
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is InitialOffsets r)
|
||||
{
|
||||
if (r.Offsets.Length != Offsets.Length) { return false; }
|
||||
for (var i = 0; i < r.Offsets.Length; i++)
|
||||
{
|
||||
if (!r.Offsets[i].Equals(Offsets[i])) { return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return base.Equals(obj);
|
||||
}
|
||||
public void FromSerializedString(string s)
|
||||
{
|
||||
try
|
||||
{
|
||||
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 offsets = new List<InitialOffset>();
|
||||
foreach (string token in tokens)
|
||||
{
|
||||
try
|
||||
{
|
||||
offsets.Add(new InitialOffset(token));
|
||||
}
|
||||
catch (Exception ex) { APILogger.Log(ex); }
|
||||
}
|
||||
Offsets = offsets.ToArray();
|
||||
SeedNoneInInitialOffsets();
|
||||
}
|
||||
catch( Exception ex)
|
||||
{
|
||||
APILogger.Log(ex);
|
||||
}
|
||||
}
|
||||
internal const string MySeparator = "__x__";
|
||||
internal const string MySeparatorBackup = "___xx___";
|
||||
public string ToSerializedString()
|
||||
{
|
||||
var offsets = new List<string>();
|
||||
|
||||
foreach (var r in Offsets) { offsets.Add(r.ToDbSerializeString()); }
|
||||
|
||||
for (int i = 0; i < offsets.Count; i++)
|
||||
{
|
||||
Trace.Assert(!offsets[i].Contains(MySeparatorBackup));
|
||||
offsets[i] = offsets[i].Replace(MySeparator, MySeparatorBackup);
|
||||
}
|
||||
return string.Join(MySeparator, offsets.ToArray());
|
||||
}
|
||||
|
||||
public string ToDisplayString(string averageOverTimeFormatString, string diagnosticLevelFormatString, string absoluteZeroFormatString)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
for (var i = 0; i < Offsets.Length; i++)
|
||||
{
|
||||
if (i > 0) { sb.AppendLine(); }
|
||||
|
||||
var s = Offsets[i].ToDisplayString(averageOverTimeFormatString, diagnosticLevelFormatString, absoluteZeroFormatString);
|
||||
if (!string.IsNullOrEmpty(s))
|
||||
{
|
||||
sb.Append(s);
|
||||
}
|
||||
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return ToDisplayString(Strings.Strings.SensorFields_InitialOffset_AverageOverTimeFormat, Strings.Strings.SensorFields_InitialOffset_DiagnosticLevelFormat,
|
||||
Strings.Strings.SensorFields_InitialOffset_AbsoluteZeroFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 502 B |
@@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace DTS.Common.Enums
|
||||
{
|
||||
public static class HeaderLineExtension
|
||||
{
|
||||
public static string GetDescription(this Enum genericEnum)
|
||||
{
|
||||
Type genericEnumType = genericEnum.GetType();
|
||||
MemberInfo[] memberInfo = genericEnumType.GetMember(genericEnum.ToString());
|
||||
if ((memberInfo != null && memberInfo.Length > 0))
|
||||
{
|
||||
var attribs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
if (attribs != null && attribs.Any())
|
||||
{
|
||||
return ((DescriptionAttribute)attribs.ElementAt(0)).Description;
|
||||
}
|
||||
}
|
||||
return genericEnum.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The various header lines (and associated text) that appear in CSV file format.
|
||||
/// </summary>
|
||||
public enum FtssHeaderLine
|
||||
{
|
||||
[Description("Headers")] Headers = 0,
|
||||
|
||||
[Description("Test Date")] TestDate,
|
||||
|
||||
[Description("Test Time")] TestTime,
|
||||
|
||||
[Description("Test ID")] TestId,
|
||||
|
||||
[Description("Test Description")] TestDescription,
|
||||
|
||||
[Description("Sample Rate (Hz)")] SampleRate,
|
||||
|
||||
[Description("Hardware AA Filter (-3dB)")]
|
||||
HardwareAntiAliasFilter,
|
||||
|
||||
[Description("Data Channel Number")] DataChannelNumber,
|
||||
|
||||
[Description("ISO Channel Code")] IsoCode,
|
||||
|
||||
[Description("User Channel Code")] UserCode,
|
||||
|
||||
[Description("Channel Description")] ChannelDescription,
|
||||
|
||||
[Description("Channel Location")] ChannelLocation,
|
||||
|
||||
[Description("Sensor S/N")] SensorSerialNumber,
|
||||
|
||||
[Description("Sensor Calibration Date")] SensorCalDate, //17651: include sensor cal date in CSV exports
|
||||
|
||||
[Description("Software Filter (SAE Class)")]
|
||||
SoftwareFilter,
|
||||
|
||||
[Description("Software Filter (-3dB)")]
|
||||
SoftwareFilterDb,
|
||||
|
||||
[Description("Engineering Unit")] EngineeringUnits,
|
||||
|
||||
[Description("User Comment")] UserComment,
|
||||
|
||||
[Description("Number of Pre-Zero Data Pts")]
|
||||
PreZero,
|
||||
|
||||
[Description("Number of Post-Zero Data Pts")]
|
||||
PostZero,
|
||||
|
||||
[Description("Data Zero (CNTS)")] DataZero,
|
||||
|
||||
[Description("Scale Factor (EU/CNT)")] ScaleEu,
|
||||
|
||||
[Description("Scale Factor (mV/CNT)")] ScaleMv,
|
||||
|
||||
[Description("Channel Name")] ChannelName,
|
||||
|
||||
[Description("Display Name")] DisplayName,
|
||||
|
||||
[Description("DAS Serial Number")]
|
||||
HardwareLine,
|
||||
|
||||
[Description("Zero Method")] ZeroMethod,
|
||||
|
||||
[Description("Remove Offset")] RemoveOffset,
|
||||
|
||||
[Description("Group Name")] GroupName,
|
||||
|
||||
[Description("Time of T0 (UTC)")] Timestamp, // FB15333: Add PTP/RTC timestamp column for CSV exports
|
||||
|
||||
[Description("Data Starts Here")] DataStart,
|
||||
|
||||
[Description("Time")] Labels,
|
||||
}
|
||||
public enum UartHeaders
|
||||
{
|
||||
[Description("Latitude")] Latitude,
|
||||
[Description("Longitude")] Longitude,
|
||||
[Description("Altitude")] Altitude,
|
||||
[Description("Velocity")] Velocity,
|
||||
[Description("Direction")] Direction,
|
||||
[Description("Valid?")] Valid,
|
||||
[Description("GPRMC")] GPRMC,
|
||||
[Description("GPGGA")] GPGGA
|
||||
}
|
||||
/// <summary>
|
||||
/// The various header lines (and associated text) that appear in XLSX file format.
|
||||
/// </summary>
|
||||
public enum XLSXExportHeaderLine
|
||||
{
|
||||
[Description("Headers")] Headers = 0,
|
||||
|
||||
[Description("Test Date")] TestDate,
|
||||
|
||||
[Description("Test Time")] TestTime,
|
||||
|
||||
[Description("Test ID")] TestId,
|
||||
|
||||
[Description("Test Description")] TestDescription,
|
||||
|
||||
[Description("Sample Rate (Hz)")] SampleRate,
|
||||
|
||||
[Description("Hardware AA Filter (-3dB)")]
|
||||
HardwareAntiAliasFilter,
|
||||
|
||||
[Description("Data Channel Number")] DataChannelNumber,
|
||||
|
||||
[Description("ISO Channel Code")] IsoCode,
|
||||
|
||||
[Description("Channel Description")] ChannelDescription,
|
||||
|
||||
[Description("Channel Location")] ChannelLocation,
|
||||
|
||||
[Description("Sensor S/N")] SensorSerialNumber,
|
||||
|
||||
[Description("Software Filter (SAE Class)")]
|
||||
SoftwareFilter,
|
||||
|
||||
[Description("Software Filter (-3dB)")]
|
||||
SoftwareFilterDb,
|
||||
|
||||
[Description("Engineering Unit")] EngineeringUnits,
|
||||
|
||||
[Description("User Comment")] UserComment,
|
||||
|
||||
[Description("Number of Pre-Zero Data Pts")]
|
||||
PreZero,
|
||||
|
||||
[Description("Number of Post-Zero Data Pts")]
|
||||
PostZero,
|
||||
|
||||
[Description("Data Zero (CNTS)")] DataZero,
|
||||
|
||||
[Description("Scale Factor (EU/CNT)")] ScaleEu,
|
||||
|
||||
[Description("Scale Factor (mV/CNT)")] ScaleMv,
|
||||
|
||||
[Description("Data Starts Here")] DataStart,
|
||||
|
||||
[Description("Time")] Labels,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Prism.Events;
|
||||
|
||||
namespace DTS.Common.Events.GroupTemplates.GroupTemplateList
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The GroupTemplateListGroupTemplateSelectedEvent event.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>called when a template is selected.</remarks>
|
||||
///
|
||||
public class GroupTemplateListGroupTemplateSelectedEvent : PubSubEvent<string[]> { }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Prism.Events;
|
||||
|
||||
namespace DTS.Common.Events.TestSetups.TestSetupsList
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The CurrentTestChangedEvent event.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>This event is used to signal the current test setup has changed</remarks>
|
||||
///
|
||||
public class CurrentTestChangedEvent : PubSubEvent<string> { }
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Microsoft.Practices.Prism.Events;
|
||||
|
||||
namespace DTS.Common.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Event to inform app that a page name had been updated
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
public class PageNameEvent : CompositePresentationEvent<PageNameEventArg> { }
|
||||
|
||||
public class PageNameEventArg
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public object Page { get; private set; }
|
||||
public PageNameEventArg(object page, string name)
|
||||
{
|
||||
Page = page;
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 390 B |
Reference in New Issue
Block a user