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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,149 @@
using DTS.Common.Base;
using DTS.Common.Interface.TestSetups;
using System.Data;
using System.Globalization;
using System.Linq;
namespace DTS.Common.Classes.TestSetups
{
/// <summary>
/// describes Calculated Channel record in the db
/// <inheritdoc cref="ICalculatedChannelRecord"/>
/// </summary>
public class CalculatedChannelRecord : BasePropertyChanged, ICalculatedChannelRecord
{
private string _name = "";
public string Name
{
get => _name;
set => SetProperty(ref _name, value, "Name");
}
private string _testSetupName = "";
public string TestSetupName
{
get => _testSetupName;
set => SetProperty(ref _testSetupName, value, "TestSetupName");
}
private int _id = -1;
/// <summary>
/// Database Id for record
/// </summary>
public int Id
{
get => _id;
set => SetProperty(ref _id, value, "Id");
}
private Operations _operation = Operations.SUM;
/// <summary>
/// operation to apply to input channels
/// </summary>
public Operations Operation
{
get => _operation;
set => SetProperty(ref _operation, value, "Operation");
}
private string _calculatedChannelValueCode = "";
/// <summary>
/// Single code (ISO or user) to associate with calculated channel
/// </summary>
public string CalculatedValueCode
{
get => _calculatedChannelValueCode;
set => SetProperty(ref _calculatedChannelValueCode, value, "CalculatedValueCode");
}
protected string [] _inputChannelIds = new[] { "-1" };
/// <summary>
/// CSV separated list of channel ids that are inputs for the calculation
/// </summary>
public string [] InputChannelIds
{
get => _inputChannelIds;
set => SetProperty(ref _inputChannelIds, value, "InputChannelIds");
}
private string _cfcForInputChannels = "";
/// <summary>
/// CFC to apply to input channels prior to calculation
/// </summary>
public string CFCForInputChannels
{
get => _cfcForInputChannels;
set => SetProperty(ref _cfcForInputChannels, value, "CFCForInputChannels");
}
private string _cfcForOutput = "";
/// <summary>
/// CFC to apply to output of calculation
/// </summary>
public string ChannelFilterClassForOutput
{
get => _cfcForOutput;
set => SetProperty(ref _cfcForOutput, value, "ChannelFilterClassForOutput");
}
private int _testSetupId;
/// <summary>
/// Database Id for test setup record
/// </summary>
public int TestSetupId
{
get => _testSetupId;
set => SetProperty(ref _testSetupId, value, "TestSetupId");
}
private bool _viewInRealtime;
/// <summary>
/// Whether channel can be viewed in realtime or not
/// </summary>
public bool ViewInRealtime
{
get => _viewInRealtime;
set => SetProperty(ref _viewInRealtime, value, "ViewInRealtime");
}
private int _clipLength;
/// <summary>
/// Clip length to apply to calculation if relevant
/// some calculations are a max over an clip for example
/// </summary>
public int ClipLength
{
get => _clipLength;
set => SetProperty(ref _clipLength, value, "ClipLength");
}
public CalculatedChannelRecord() { }
public CalculatedChannelRecord(ICalculatedChannelRecord record)
{
TestSetupName = record.TestSetupName;
Operation = record.Operation;
InputChannelIds = new string[0];
if( null != record.InputChannelIds && record.InputChannelIds.Any())
{
InputChannelIds = new string[record.InputChannelIds.Length];
record.InputChannelIds.CopyTo(_inputChannelIds, 0);
}
Id = record.Id;
ChannelFilterClassForOutput = record.ChannelFilterClassForOutput;
CFCForInputChannels = record.CFCForInputChannels;
Name = record.Name;
CalculatedValueCode = record.CalculatedValueCode;
ViewInRealtime = record.ViewInRealtime;
ClipLength = record.ClipLength;
}
public CalculatedChannelRecord(IDataReader reader)
{
TestSetupName = Utility.GetString(reader, "TestSetupName");
Operation = (Operations)Utility.GetInt(reader, "Operation", 0);
InputChannelIds = Utility.GetStringArray(reader, "InputChannelIds",
new string [0],
CultureInfo.InvariantCulture.TextInfo.ListSeparator);
Id = Utility.GetInt(reader, "Id", -1);
ChannelFilterClassForOutput = Utility.GetString(reader, "CFCForOutput");
CFCForInputChannels = Utility.GetString(reader, "CFCForInputChannels");
Name = Utility.GetString(reader, "CCName");
CalculatedValueCode = Utility.GetString(reader, "CalculatedChannelValueCode");
ViewInRealtime = Utility.GetBool(reader, "ViewInRealtime");
ClipLength = Utility.GetInt(reader, "ClipLength", 0);
}
}
}

View File

@@ -0,0 +1,60 @@
using System;
using System.Globalization;
using System.Windows.Data;
using DTS.Common.Enums;
namespace DTS.Common.Converters
{
public class TestDataToRegionOfInterestMinimumConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
//values: DataStart, DataEnd, PreTrigger, PostTrigger, RecordingMode
if (values.Length == 5)
{
if (values[2] is double preTrigger && values[3] is double postTrigger &&
values[4] is RecordingModes recordingMode)
{
switch (recordingMode)
{
case RecordingModes.CircularBuffer:
case RecordingModes.RAMActive:
case RecordingModes.MultipleEventRAMActive:
case RecordingModes.MultipleEventCircularBuffer:
case RecordingModes.CircularBufferPlusUART:
case RecordingModes.MultipleEventCircularBufferPlusUART:
case RecordingModes.CircularBufferAndStreamSubSample:
case RecordingModes.MultipleEventCircularBufferAndStream:
//minimum is -PreTrigger
return -1D * preTrigger;
case RecordingModes.Recorder:
case RecordingModes.RecorderPlusUART:
case RecordingModes.HybridRecorder:
case RecordingModes.HybridAndStream:
case RecordingModes.MultipleEventHybridAndStream:
case RecordingModes.MultipleEventHybridRecorder:
case RecordingModes.MultipleEventRecorder:
case RecordingModes.MultipleEventRecorderPlusUART:
case RecordingModes.ContinuousRecorder:
case RecordingModes.ContinuousRecorderPlusUART:
case RecordingModes.RecordOnBoot:
case RecordingModes.RecordOnBootPlusUART:
case RecordingModes.RecorderAndStreamSubSample:
case RecordingModes.MultipleEventRecorderAndStream:
case RecordingModes.Active:
case RecordingModes.MultipleEventActive:
// FB16465: minimum is DataStart. if it's currently unknown, return -PostTrigger
// FB17991: could also be set to Min instead of unknown, same difference
return values[0] is double recStart ? recStart > double.MinValue ? recStart : -1D * postTrigger : -1D * postTrigger;
}
}
}
return double.NegativeInfinity;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using DTS.Common.Events;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Prism.Events;
namespace DTS.Common.Resources
{
public partial class MainTabControlResource
{
public void ToolTipEventHandler(object sender, System.Windows.Controls.ToolTipEventArgs e)
{
e.Handled = true;
var eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();
eventAggregator.GetEvent<HelpTextEvent>().Publish(new HelpTextEventArg()
{ Sender = sender, E = e });
}
}
}