init
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace DTS.Common.Interface.DASFactory.Diagnostics.HardwareList
|
||||
{
|
||||
public interface ISLICE6TreeNode
|
||||
{
|
||||
int DASId { get; set; }
|
||||
string SerialNumber { get; set; }
|
||||
int Port { get; set; }
|
||||
string PortString { get; }
|
||||
int Number { get; set; }
|
||||
int PositionOnChain { get; set; }
|
||||
string PositionOnChainString { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using DTS.Common.Enums.Hardware;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DTS.Common.Classes.DSP
|
||||
{
|
||||
public class StreamingFilterProfile : IStreamingFilterProfile
|
||||
{
|
||||
public double Ratio { get; set; }
|
||||
public string DisplayString { get; set; }
|
||||
public string DescriptionString { get; set; }
|
||||
public int EnumValue { get; set; }
|
||||
private readonly List<DASRestriction> _restrictions = new List<DASRestriction>();
|
||||
public DASRestriction[] Restrictions { get => _restrictions.ToArray(); set { _restrictions.Clear(); _restrictions.AddRange(value); } }
|
||||
public StreamingFilterProfile() { }
|
||||
public StreamingFilterProfile(StreamingFilterProfileCollection.DefaultProfiles profile, DASRestriction[] restrictions)
|
||||
{
|
||||
GetProfileValues(profile, out var displayName, out var description, out var enumValue, out var ratio);
|
||||
Initialize(displayName, description, enumValue, ratio, restrictions);
|
||||
}
|
||||
public StreamingFilterProfile(string display, string description, int enumValue, double ratio, DASRestriction[] restrictions)
|
||||
{
|
||||
Initialize(display, description, enumValue, ratio, restrictions);
|
||||
}
|
||||
private void Initialize(string display, string description, int enumValue, double ratio, DASRestriction[] restrictions)
|
||||
{
|
||||
DisplayString = display;
|
||||
DescriptionString = description;
|
||||
EnumValue = enumValue;
|
||||
Restrictions = restrictions;
|
||||
Ratio = ratio;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return DisplayString;
|
||||
}
|
||||
public static void GetProfileValues(StreamingFilterProfileCollection.DefaultProfiles profile, out string displayName, out string description, out int enumValue,
|
||||
out double ratio)
|
||||
{
|
||||
displayName = string.Empty;
|
||||
description = string.Empty;
|
||||
enumValue = -1;
|
||||
ratio = -1;
|
||||
|
||||
var enumType = typeof(StreamingFilterProfileCollection.DefaultProfiles);
|
||||
var memberInfos = enumType.GetMember(profile.ToString());
|
||||
var enumValueMemberInfo = Array.Find(memberInfos, m => m.DeclaringType == enumType);
|
||||
var valueAttributes = enumValueMemberInfo.GetCustomAttributes(typeof(DisplayAttribute), false);
|
||||
|
||||
enumValue = (int)profile;
|
||||
description = ((DisplayAttribute)valueAttributes[0]).GetDescription();
|
||||
displayName = ((DisplayAttribute)valueAttributes[0]).GetName();
|
||||
|
||||
valueAttributes = enumValueMemberInfo.GetCustomAttributes(typeof(ScalerAttribute), false);
|
||||
ratio = ((ScalerAttribute)valueAttributes[0]).Scaler;
|
||||
}
|
||||
|
||||
public double GetDSPFilterRate(double sps, string hwType)
|
||||
{
|
||||
//if we have legacy then we need the sample rate, if it's >8k s6abr then Fc
|
||||
if (hwType == HardwareTypes.SLICE6_AIR.ToString() && sps >= DSPFilterType.S6A_CAP) { return double.NaN; }
|
||||
|
||||
if (!Array.Exists(Restrictions, x => x.DASType == hwType || string.IsNullOrEmpty(x.DASType))) { return double.NaN; }
|
||||
|
||||
if (EnumValue == StreamingFilterProfileCollection.DEFAULT_VALUE)
|
||||
{
|
||||
return DSPFilterType.GetLegacytDSPFilterRate(sps, hwType);
|
||||
}
|
||||
else if (double.IsNaN(Ratio)) { return double.NaN; }
|
||||
|
||||
|
||||
var array = DSPFilterType.Get6PButterWorthLegacyTable();
|
||||
Array.Sort(array, (x, y) => { return y.Item1.CompareTo(x.Item1); });
|
||||
foreach (var entry in array)
|
||||
{
|
||||
if (sps >= entry.Item1) { return sps / Ratio; }
|
||||
}
|
||||
return double.NaN;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 741 B |
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Enums.DASFactory;
|
||||
|
||||
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 && values[2] is double preTrigger && values[3] is double postTrigger &&
|
||||
values[4] is RecordingModes recordingMode)
|
||||
{
|
||||
if (RecordingModeExtensions.IsAHybridRecorderMode((RecordingModes)values[4]) &&
|
||||
values[0] is double d && d == double.MinValue)
|
||||
{
|
||||
return double.NegativeInfinity;
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common.Interface
|
||||
{
|
||||
public interface IMainView : IBaseView { }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Prism.Events;
|
||||
|
||||
namespace DTS.Common.Events
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The TTSImportSavedChangesStatusEvent event.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// This event is used to communicate whether changes have been saved or not.
|
||||
/// </remarks>
|
||||
///
|
||||
public class TTSImportSavedChangesStatusEvent : PubSubEvent<bool> { }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common.Interface.TestSetups.Diagnostics
|
||||
{
|
||||
public interface IDiagnosticsViewModel : IBaseViewModel
|
||||
{
|
||||
IDiagnosticsTreeView View { get; set; }
|
||||
void Unset();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user