init
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace DatabaseExport
|
||||
{
|
||||
public class DigitalOutputSetting : SensorData
|
||||
{
|
||||
public string ChannelDescription
|
||||
{
|
||||
get => SerialNumber;
|
||||
set
|
||||
{
|
||||
SerialNumber = value;
|
||||
OnPropertyChanged("ChannelDescription");
|
||||
}
|
||||
}
|
||||
|
||||
// public DigitalOutputSetting(DigitalOutputSetting copy) : base(copy)
|
||||
// {
|
||||
// SetDefaults(this);
|
||||
// }
|
||||
|
||||
public DigitalOutputSetting()
|
||||
{
|
||||
SetDefaults(this);
|
||||
}
|
||||
|
||||
public static void SetDefaults(SensorData sd)
|
||||
{
|
||||
sd.SupportedExcitation = new Test.Module.Channel.Sensor.ExcitationVoltageOption[]
|
||||
{Test.Module.Channel.Sensor.ExcitationVoltageOption.Volt5};
|
||||
sd.Bridge = Test.Module.Channel.Sensor.BridgeType.TOMDigital;
|
||||
sd.AxisNumber = 0;
|
||||
sd.NumberOfAxes = 1;
|
||||
sd.Capacity = 1;
|
||||
sd.DisplayUnit = "V";
|
||||
sd.BridgeResistance = double.NaN;
|
||||
sd.CheckOffset = false;
|
||||
sd.Manufacturer = "Generic";
|
||||
sd.OffsetToleranceHigh = 2500;
|
||||
sd.OffsetToleranceLow = 2500;
|
||||
sd.Model = "Digital Output Setting";
|
||||
sd.Shunt = ShuntMode.None;
|
||||
sd.MeasureExcitation = false;
|
||||
sd.MeasureNoise = false;
|
||||
}
|
||||
|
||||
public DigitalOutputSetting(System.Data.DataRow dr)
|
||||
{
|
||||
Bridge = Test.Module.Channel.Sensor.BridgeType.TOMDigital;
|
||||
|
||||
var fields = Enum.GetValues(typeof(DbOperations.DigitalOutputSettings.Fields))
|
||||
.Cast<DbOperations.DigitalOutputSettings.Fields>().ToArray();
|
||||
|
||||
foreach (var field in fields)
|
||||
{
|
||||
try
|
||||
{
|
||||
var o = dr[field.ToString()];
|
||||
if (DBNull.Value.Equals(o))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
switch (field)
|
||||
{
|
||||
case DbOperations.DigitalOutputSettings.Fields.Version:
|
||||
Version = Convert.ToInt32(o);
|
||||
break;
|
||||
case DbOperations.DigitalOutputSettings.Fields.OutputMode:
|
||||
DigitalOutputMode = (OutputTOMDigitalChannel.DigitalOutputMode)Convert.ToInt16(o);
|
||||
break;
|
||||
case DbOperations.DigitalOutputSettings.Fields.LocalOnly:
|
||||
_localOnly = Convert.ToBoolean(o);
|
||||
break;
|
||||
case DbOperations.DigitalOutputSettings.Fields.LimitDuration:
|
||||
DigitalOutputLimitDuration = Convert.ToBoolean(o);
|
||||
break;
|
||||
case DbOperations.DigitalOutputSettings.Fields.LastModifiedBy:
|
||||
LastUpdatedBy = Convert.ToString(o);
|
||||
break;
|
||||
case DbOperations.DigitalOutputSettings.Fields.LastModified:
|
||||
LastModified = Convert.ToDateTime(o);
|
||||
break;
|
||||
case DbOperations.DigitalOutputSettings.Fields.DurationMS: //obsolete, but non-null, field
|
||||
//DigitalOutputDurationMS = Convert.ToDouble(o);
|
||||
break;
|
||||
case DbOperations.DigitalOutputSettings.Fields.DurationMSFloat:
|
||||
DigitalOutputDurationMS = Convert.ToDouble(o);
|
||||
break;
|
||||
case DbOperations.DigitalOutputSettings.Fields.DelayMS:
|
||||
DigitalOutputDelayMS = Convert.ToDouble(o);
|
||||
break;
|
||||
case DbOperations.DigitalOutputSettings.Fields.ChannelDescription:
|
||||
ChannelDescription = Convert.ToString(o);
|
||||
break;
|
||||
case DbOperations.DigitalOutputSettings.Fields.UserTags:
|
||||
TagsBlobBytes = (byte[])o;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//DTS.Utilities.Logging.APILogger.Log("Failed to process: ", field.ToString(), ex);
|
||||
}
|
||||
}
|
||||
SetDefaults(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
|
||||
namespace DatabaseExport
|
||||
{
|
||||
/// <summary>
|
||||
/// this is a lightweight version of test TestTemplate, holding just the essential information
|
||||
/// [updated]: this concept is already present in testtemplate,
|
||||
/// by default it only loads information in the tblTestSetup, and then uses the IsLoaded flag to
|
||||
/// check whether it's populated information from other tables or not.
|
||||
/// I'll leave the class here for now in case we want to expand on it in the future, also I cleaned up a few things in the process anyhow
|
||||
/// </summary>
|
||||
public class TestTemplateLite
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
public RecordingModes RecordingMode { get; set; }
|
||||
private double _preTriggerSeconds;
|
||||
public double PreTriggerSeconds
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (RecordingMode)
|
||||
{
|
||||
case RecordingModes.Recorder:
|
||||
case RecordingModes.HybridRecorder:
|
||||
return 0D;
|
||||
case RecordingModes.CircularBuffer:
|
||||
return _preTriggerSeconds;
|
||||
default:
|
||||
return _preTriggerSeconds;
|
||||
}
|
||||
}
|
||||
set => _preTriggerSeconds = value;
|
||||
}
|
||||
|
||||
public double PostTriggerSeconds { get; set; }
|
||||
public DateTime LastModified { get; set; }
|
||||
public string LastModifiedBy { get; set; }
|
||||
public bool IsComplete { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user