init
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.Interface.DASFactory.Diagnostics.HardwareList;
|
||||
|
||||
namespace DTS.Common.Interface.Hardware.AddEditHardware
|
||||
{
|
||||
public interface IAddEditHardwareView : IBaseView
|
||||
{
|
||||
/// <summary>
|
||||
/// used to notify the view that it has been activated and should handle any
|
||||
/// post activation work
|
||||
/// </summary>
|
||||
void Activated();
|
||||
|
||||
int ViewDbVersion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Interface.Sensors;
|
||||
using DTS.Common.Interface.Tags;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
||||
namespace DTS.Common.Classes.Sensors
|
||||
{
|
||||
public class StreamOutputRecord : TagAwareBase, IStreamOutputRecord
|
||||
{
|
||||
public override TagTypes TagType => TagTypes.Sensors;
|
||||
private int _id;
|
||||
public int Id
|
||||
{
|
||||
get => _id;
|
||||
set => SetProperty(ref _id, value, "Id");
|
||||
}
|
||||
private string _serialNumber;
|
||||
public string SerialNumber
|
||||
{
|
||||
get => _serialNumber;
|
||||
set => SetProperty(ref _serialNumber, value, "SerialNumber");
|
||||
}
|
||||
private DateTime _lastModified;
|
||||
public DateTime LastModified
|
||||
{
|
||||
get => _lastModified;
|
||||
set => SetProperty(ref _lastModified, value, "LastModified");
|
||||
}
|
||||
private string _lastUpdatedBy;
|
||||
public string LastUpdatedBy
|
||||
{
|
||||
get => _lastUpdatedBy;
|
||||
set => SetProperty(ref _lastUpdatedBy, value, "LastUpdatedBy");
|
||||
}
|
||||
|
||||
private bool _doNotUse;
|
||||
public bool DoNotUse
|
||||
{
|
||||
get => _doNotUse;
|
||||
set => SetProperty(ref _doNotUse, value, "DoNotUse");
|
||||
}
|
||||
private bool _broken;
|
||||
public bool Broken
|
||||
{
|
||||
get => _broken;
|
||||
set => SetProperty(ref _broken, value, "Broken");
|
||||
}
|
||||
protected UDPStreamProfile _udpProfile = DEFAULT_UDP_PROFILE;
|
||||
public const UDPStreamProfile DEFAULT_UDP_PROFILE = UDPStreamProfile.CH10_ANALOG_2HDR; //supported on both S6A & TSRAIR
|
||||
public UDPStreamProfile StreamOutUDPProfile
|
||||
{
|
||||
get => _udpProfile;
|
||||
set => SetProperty(ref _udpProfile, value, "StreamOutUDPProfile");
|
||||
}
|
||||
public const string DEFAULT_UDP_ADDRESS = "UDP://239.1.2.10:8400";
|
||||
protected string _udpAddress = DEFAULT_UDP_ADDRESS;
|
||||
public string StreamOutUDPAddress
|
||||
{
|
||||
get => _udpAddress;
|
||||
set => SetProperty(ref _udpAddress, value, "StreamOutUDPAddress");
|
||||
}
|
||||
public const ushort MINIMUM_STREAMOUT_TIMECHANNELID = 10;
|
||||
public const ushort MAXIMUM_STREAMOUT_TIMECHANNELID = 100;
|
||||
public const ushort DEFAULT_UDP_TIME_CHANNEL_ID = 1;
|
||||
protected ushort _udpTimeChannelId = DEFAULT_UDP_TIME_CHANNEL_ID;
|
||||
public ushort StreamOutUDPTimeChannelId
|
||||
{
|
||||
get => _udpTimeChannelId;
|
||||
set => SetProperty(ref _udpTimeChannelId, value, "StreamOutUDPTimeChannelId");
|
||||
}
|
||||
public const ushort MINIMUM_STREAMOUT_DATACHANNELID = 10;
|
||||
public const ushort MAXIMUM_STREAMOUT_DATACHANNELID = 100;
|
||||
public const ushort DEFAULT_UDP_DATA_CHANNEL_ID = 3;
|
||||
protected ushort _udpDataChannelId = DEFAULT_UDP_DATA_CHANNEL_ID;
|
||||
public ushort StreamOutUDPDataChannelId
|
||||
{
|
||||
get => _udpDataChannelId;
|
||||
set => SetProperty(ref _udpDataChannelId, value, "StreamOutUDPDataChannelId");
|
||||
}
|
||||
public const string DEFAULT_UDPTMNS_CONFIG = "(1,6,60,0,0,0,0,0)";
|
||||
protected string _udpTmNSConfig = DEFAULT_UDPTMNS_CONFIG;
|
||||
public string StreamOutUDPTmNSConfig
|
||||
{
|
||||
get => _udpTmNSConfig;
|
||||
set => SetProperty(ref _udpTmNSConfig, value, "StreamOutUDPTmNSConfig");
|
||||
}
|
||||
public const ushort MINIMUM_STREAMOUT_TDP_INTERVAL_MS = 10;
|
||||
public const ushort MAXIMUM_STREAMOUT_TDP_INTERVAL_MS = 1000;
|
||||
public const ushort DEFAULT_IRIG_TIME_DATA_PACKET_INTERVAL_MS = 500;
|
||||
protected ushort _irigTimeDataPacketIntervalMs = DEFAULT_IRIG_TIME_DATA_PACKET_INTERVAL_MS;
|
||||
|
||||
public const ushort MINIMUM_STREAMOUT_TMATS_INTERVAL_MS = ushort.MinValue;
|
||||
public const ushort MAXIMUM_STREAMOUT_TMATS_INTERVAL_MS = ushort.MaxValue;
|
||||
private ushort _streamOutTMATSIntervalMs = DEFAULT_TMATS_INTERVAL_MS;
|
||||
/// <summary>
|
||||
/// time in MS between sending tmats information while streaming
|
||||
/// http://manuscript.dts.local/f/cases/29987/Add-CG-DP-TMATS-interval-UI-support
|
||||
/// </summary>
|
||||
public ushort StreamOutTMATSIntervalMs
|
||||
{
|
||||
get => _streamOutTMATSIntervalMs;
|
||||
set => SetProperty(ref _streamOutTMATSIntervalMs, value, "StreamOutTMATSIntervalMs");
|
||||
}
|
||||
public ushort StreamOutIRIGTimeDataPacketIntervalMs
|
||||
{
|
||||
get => _irigTimeDataPacketIntervalMs;
|
||||
set => SetProperty(ref _irigTimeDataPacketIntervalMs, value, "StreamOutIRIGTimeDataPacketIntervalMs");
|
||||
}
|
||||
public StreamOutputRecord(ISensorData sd)
|
||||
{
|
||||
try
|
||||
{
|
||||
Id = sd.DatabaseId;
|
||||
SerialNumber = sd.SerialNumber;
|
||||
|
||||
StreamOutUDPProfile = sd.StreamOutUDPProfile;
|
||||
StreamOutUDPAddress = sd.StreamOutUDPAddress;
|
||||
StreamOutUDPTimeChannelId = sd.StreamOutUDPTimeChannelId;
|
||||
StreamOutUDPDataChannelId = sd.StreamOutUDPDataChannelId;
|
||||
StreamOutUDPTmNSConfig = sd.StreamOutUDPTmNSConfig;
|
||||
StreamOutIRIGTimeDataPacketIntervalMs = sd.StreamOutIRIGTimeDataPacketIntervalMs;
|
||||
StreamOutTMATSIntervalMs = sd.StreamOutTMATSIntervalMs;
|
||||
|
||||
Broken = sd.Broken;
|
||||
DoNotUse = sd.DoNotUse;
|
||||
LastModified = sd.LastModified;
|
||||
LastUpdatedBy = sd.LastUpdatedBy;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
APILogger.Log("Failed to process: ", ex);
|
||||
}
|
||||
}
|
||||
public StreamOutputRecord(IDataReader reader, int ClientDbVersion, int ConnectionDbVersion)
|
||||
{
|
||||
try
|
||||
{
|
||||
Id = Utility.GetInt(reader, "Id");
|
||||
SerialNumber = Utility.GetString(reader, "SerialNumber");
|
||||
|
||||
StreamOutUDPProfile = (UDPStreamProfile)Enum.Parse(typeof(UDPStreamProfile),
|
||||
Utility.GetString(reader, "StreamProfile"));
|
||||
StreamOutUDPAddress = Utility.GetString(reader, "UDPAddress");
|
||||
StreamOutUDPTimeChannelId = Utility.GetUShort(reader, "TimeChannelId");
|
||||
StreamOutUDPDataChannelId = Utility.GetUShort(reader, "DataChannelId");
|
||||
StreamOutUDPTmNSConfig = Utility.GetString(reader, "TmNSConfig");
|
||||
StreamOutIRIGTimeDataPacketIntervalMs = Utility.GetUShort(reader, "IRIGTimeDataPacketIntervalMs");
|
||||
|
||||
Broken = Utility.GetBool(reader, "Broken");
|
||||
DoNotUse = Utility.GetBool(reader, "DoNotUse");
|
||||
LastModified = Utility.GetDateTime(reader, "LastModified", DateTime.MinValue);
|
||||
LastUpdatedBy = Utility.GetString(reader, "LastModifiedBy");
|
||||
//only try to retrieve this field if both client and db are high enough level
|
||||
if (ClientDbVersion >= Constants.TMATS_INTERVAL_VERSION && ConnectionDbVersion >= Constants.TMATS_INTERVAL_VERSION)
|
||||
{
|
||||
StreamOutTMATSIntervalMs = Utility.GetUShort(reader, "TMATS_IntervalMS", StreamOutputRecord.DEFAULT_TMATS_INTERVAL_MS);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
APILogger.Log("Failed to process: ", ex);
|
||||
}
|
||||
}
|
||||
//28291 Reduce list of Stream profiles to choose from.
|
||||
//Define this here so that it only needs to be changed in one place, if a change needs to be made in the future.
|
||||
//30249 Add LTS behavior for case 30075 (ADC UART stream)
|
||||
public static UDPStreamProfile[] AvailableUDPStreamProfiles(int ConnectionDbVersion, bool UseAdvancedStreamingProfiles)
|
||||
{
|
||||
var profiles = new List<UDPStreamProfile>();
|
||||
if (UseAdvancedStreamingProfiles)
|
||||
{
|
||||
profiles.AddRange(
|
||||
new UDPStreamProfile[]
|
||||
{
|
||||
UDPStreamProfile.CH10_ANALOG,
|
||||
UDPStreamProfile.CH10_ANALOG_2HDR,
|
||||
UDPStreamProfile.CH10_PCM128_MM,
|
||||
UDPStreamProfile.CH10_PCM_128BIT_2HDR,
|
||||
UDPStreamProfile.TMNS_PCM_STANDARD,
|
||||
UDPStreamProfile.TMNS_PCM_SUPERCOM,
|
||||
UDPStreamProfile.IENA_PTYPE_STREAM,
|
||||
UDPStreamProfile.CH10_MANUAL_CONFIG
|
||||
});
|
||||
if (ConnectionDbVersion >= Constants.ADC_TO_UART_DB_VERSION)
|
||||
{
|
||||
profiles.Add(UDPStreamProfile.UART_STREAM);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 31840 Basic / Advanced Streaming profiles
|
||||
profiles.AddRange(
|
||||
new UDPStreamProfile[]
|
||||
{
|
||||
UDPStreamProfile.CH10_ANALOG_2HDR,
|
||||
UDPStreamProfile.CH10_PCM_128BIT_2HDR
|
||||
});
|
||||
}
|
||||
return profiles.ToArray();
|
||||
}
|
||||
/// <summary>
|
||||
/// the default interval between sending out tmats information while streaming
|
||||
/// this is used if the value is not set or is null
|
||||
/// http://manuscript.dts.local/f/cases/29987/Add-CG-DP-TMATS-interval-UI-support
|
||||
/// </summary>
|
||||
public const ushort DEFAULT_TMATS_INTERVAL_MS = 1000;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using Prism.Events;
|
||||
|
||||
namespace DTS.Common.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Event to inform app that com status has changed
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
public class TestEvent : PubSubEvent<TestEventArg> { }
|
||||
|
||||
public class TestEventArg
|
||||
{
|
||||
public TestEventStatus Status { get; private set; }
|
||||
|
||||
public TestEventArg(TestEventStatus status)
|
||||
{
|
||||
Status = status;
|
||||
}
|
||||
}
|
||||
public enum TestEventStatus
|
||||
{
|
||||
TestStarted,
|
||||
TestEnded
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common.Interface
|
||||
{
|
||||
public interface IExportDataView : IBaseView
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using DTS.Common.Base;
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace DTS.Common.Interface
|
||||
{
|
||||
public interface ITestModificationViewModel : IBaseViewModel
|
||||
{
|
||||
ITestModificationView View { get; set; }
|
||||
IBaseViewModel Parent { get; set; }
|
||||
void PublishChanges();
|
||||
// controls whether isocode should be modified when software filter is modified
|
||||
bool UseISOCodeFilterMapping { get; set; }
|
||||
// controls whether 0 or P is used when isocode is modified because a software filter was modified
|
||||
bool UseZeroForUnfiltered { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace DTS.Common.Converters
|
||||
{
|
||||
public class NumericStringFormatConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (null != values && values.Length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (values[0] is int i)
|
||||
{
|
||||
return i.ToString(values[1] as string, CultureInfo.InvariantCulture);
|
||||
}
|
||||
if (values[0] is double d)
|
||||
{
|
||||
return (d is double.NaN) ? Strings.Strings.Table_NA : d.ToString(values[1] as string, CultureInfo.InvariantCulture);
|
||||
}
|
||||
if (values[0] is float f)
|
||||
{
|
||||
return (f is float.NaN) ? Strings.Strings.Table_NA : f.ToString(values[1] as string, CultureInfo.InvariantCulture);
|
||||
}
|
||||
if (values[0] is decimal deci)
|
||||
{
|
||||
return deci.ToString(values[1] as string, CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.Interface.Graphs;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Data;
|
||||
|
||||
namespace DTS.Common.Classes.TestSetups
|
||||
{
|
||||
/// <summary>
|
||||
/// Implementation of a graph record in the database
|
||||
/// <inheritdoc cref="IGraphRecord"/>
|
||||
/// </summary>
|
||||
public class GraphRecord : BasePropertyChanged, IGraphRecord
|
||||
{
|
||||
private int _graphId;
|
||||
/// <summary>
|
||||
/// database key for graph
|
||||
/// </summary>
|
||||
public int GraphId
|
||||
{
|
||||
get => _graphId;
|
||||
set => SetProperty(ref _graphId, value, "GraphId");
|
||||
}
|
||||
private int _testSetupId;
|
||||
/// <summary>
|
||||
/// test setup key for graph
|
||||
/// </summary>
|
||||
public int TestSetupId
|
||||
{
|
||||
get => _testSetupId;
|
||||
set => SetProperty(ref _testSetupId, value, "TestSetupId");
|
||||
}
|
||||
private string _graphName;
|
||||
/// <summary>
|
||||
/// name of graph
|
||||
/// </summary>
|
||||
[MaxLength(50)]
|
||||
public string GraphName
|
||||
{
|
||||
get => _graphName;
|
||||
set => SetProperty(ref _graphName, value, "GraphName");
|
||||
}
|
||||
private string _graphDescription;
|
||||
/// <summary>
|
||||
/// description of graph
|
||||
/// </summary>
|
||||
[MaxLength(50)]
|
||||
public string GraphDescription
|
||||
{
|
||||
get => _graphDescription;
|
||||
set => SetProperty(ref _graphDescription, value, "GraphDescription");
|
||||
}
|
||||
private string _channelsString;
|
||||
/// <summary>
|
||||
/// all the channels in the graph
|
||||
/// </summary>
|
||||
[MaxLength(2048)]
|
||||
public string ChannelsString
|
||||
{
|
||||
get => _channelsString;
|
||||
set => SetProperty(ref _channelsString, value, "ChannelsString");
|
||||
}
|
||||
private bool _useDomainMin;
|
||||
/// <summary>
|
||||
/// whether to restrict domain axis to a min value
|
||||
/// </summary>
|
||||
public bool UseDomainMin
|
||||
{
|
||||
get => _useDomainMin;
|
||||
set => SetProperty(ref _useDomainMin, value, "UseDomainMin");
|
||||
}
|
||||
private double _domainMin = double.MinValue;
|
||||
/// <summary>
|
||||
/// the minimum value to show on domain axis
|
||||
/// (only valid when UseDomainMin is true)
|
||||
/// </summary>
|
||||
public double DomainMin
|
||||
{
|
||||
get => _domainMin;
|
||||
set => SetProperty(ref _domainMin, value, "DomainMin");
|
||||
}
|
||||
private bool _useDomainMax;
|
||||
/// <summary>
|
||||
/// whether to restrict domain axis to a max value
|
||||
/// </summary>
|
||||
public bool UseDomainMax
|
||||
{
|
||||
get => _useDomainMax;
|
||||
set => SetProperty(ref _useDomainMax, value, "UseDomainMax");
|
||||
}
|
||||
private double _domainMax = double.MaxValue;
|
||||
/// <summary>
|
||||
/// maximum value to show on domain axis
|
||||
/// (only valid when UseDomainMax is true)
|
||||
/// </summary>
|
||||
public double DomainMax
|
||||
{
|
||||
get => _domainMax;
|
||||
set => SetProperty(ref _domainMax, value, "DomainMax");
|
||||
}
|
||||
private bool _useRangeMin;
|
||||
/// <summary>
|
||||
/// whether to restrict range axis to a min value
|
||||
/// </summary>
|
||||
public bool UseRangeMin
|
||||
{
|
||||
get => _useRangeMin;
|
||||
set => SetProperty(ref _useRangeMin, value, "UseRangeMin");
|
||||
}
|
||||
private double _rangeMin = double.MinValue;
|
||||
/// <summary>
|
||||
/// minimum value to show on range axis
|
||||
/// (only valid when UseRangeMin is true)
|
||||
/// </summary>
|
||||
public double RangeMin
|
||||
{
|
||||
get => _rangeMin;
|
||||
set => SetProperty(ref _rangeMin, value, "RangeMin");
|
||||
}
|
||||
private bool _useRangeMax;
|
||||
/// <summary>
|
||||
/// whether to restrict range axis to a max value
|
||||
/// </summary>
|
||||
public bool UseRangeMax
|
||||
{
|
||||
get => _useRangeMax;
|
||||
set => SetProperty(ref _useRangeMax, value, "UseRangeMax");
|
||||
}
|
||||
private double _rangeMax = double.MaxValue;
|
||||
/// <summary>
|
||||
/// the maximum value to show on the range axis
|
||||
/// (only valid when UseRangeMax is true)
|
||||
/// </summary>
|
||||
public double RangeMax
|
||||
{
|
||||
get => _rangeMax;
|
||||
set => SetProperty(ref _rangeMax, value, "RangeMax");
|
||||
}
|
||||
private string _thresholdsString;
|
||||
/// <summary>
|
||||
/// any thresholds/lines to show on the graph
|
||||
/// </summary>
|
||||
[MaxLength(2048)]
|
||||
public string ThresholdsString
|
||||
{
|
||||
get => _thresholdsString;
|
||||
set => SetProperty(ref _thresholdsString, value, "ThresholdsString");
|
||||
}
|
||||
private bool _localOnly = false;
|
||||
/// <summary>
|
||||
/// whether to synchronize record with central db
|
||||
/// [deprecated]
|
||||
/// </summary>
|
||||
public bool LocalOnly
|
||||
{
|
||||
get => _localOnly;
|
||||
set => SetProperty(ref _localOnly, value, "LocalOnly");
|
||||
}
|
||||
public GraphRecord() { }
|
||||
public GraphRecord(IGraphRecord copy)
|
||||
{
|
||||
DomainMax = copy.DomainMax;
|
||||
DomainMin = copy.DomainMin;
|
||||
ChannelsString = copy.ChannelsString;
|
||||
ThresholdsString = copy.ThresholdsString;
|
||||
GraphDescription = copy.GraphDescription;
|
||||
GraphId = copy.GraphId;
|
||||
GraphName = copy.GraphName;
|
||||
RangeMax = copy.RangeMax;
|
||||
RangeMin = copy.RangeMin;
|
||||
TestSetupId = copy.TestSetupId;
|
||||
UseDomainMax = copy.UseDomainMax;
|
||||
UseDomainMin = copy.UseDomainMin;
|
||||
UseRangeMax = copy.UseRangeMax;
|
||||
UseRangeMin = copy.UseRangeMin;
|
||||
}
|
||||
public GraphRecord(IDataReader reader)
|
||||
{
|
||||
GraphId = Utility.GetInt(reader, "GraphId", -1);
|
||||
TestSetupId = Utility.GetInt(reader, "TestSetupId", -1);
|
||||
GraphName = Utility.GetString(reader, "GraphName");
|
||||
GraphDescription = Utility.GetString(reader, "GraphDescription");
|
||||
ChannelsString = Utility.GetString(reader, "Channels");
|
||||
DomainMax = Utility.GetDouble(reader, "DomainMax", double.MaxValue);
|
||||
DomainMin = Utility.GetDouble(reader, "DomainMin", double.MinValue);
|
||||
RangeMax = Utility.GetDouble(reader, "RangeMax", double.MaxValue);
|
||||
RangeMin = Utility.GetDouble(reader, "RangeMin", double.MinValue);
|
||||
ThresholdsString = Utility.GetString(reader, "Thresholds");
|
||||
UseDomainMax = Utility.GetBool(reader, "UseDomainMax");
|
||||
UseDomainMin = Utility.GetBool(reader, "UseDomainMin");
|
||||
UseRangeMax = Utility.GetBool(reader, "UseRangeMax");
|
||||
UseRangeMin = Utility.GetBool(reader, "UseRangeMin");
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Reference in New Issue
Block a user