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

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1,853 @@
using DTS.Common.Interface.StatusAndProgressBar;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using DTS.Common.Utilities.Logging;
namespace DTS.Common.Utils
{
public class PingUtils
{
public static void EliminateBadHosts(ref List<HostInfo> list, string[] ips)
{
var hosts = list.ToArray();
foreach (var host in hosts)
{
if (!HostMatchesAnyIPs(host, ips))
{
APILogger.Log($"Removing host {host.HostIpAddress} as it can't reach any ips");
list.Remove(host);
}
}
}
/// <summary>
/// returns false if the host can not access any ips provided after looking at it's ip address and netmask
/// returns true if it can reach an ip or it can't be determined if it can reach an IP this might happen if someone used
/// a host name instead of a xxx.yyy.zzz.aaa style address or an empty string somewhere
/// </summary>
/// <param name="host"></param>
/// <param name="ips"></param>
/// <returns></returns>
protected static bool HostMatchesAnyIPs(HostInfo host, string[] ips)
{
if (ips.Length == 0) { return true; }
if (string.Empty.Equals(host.StartAddress) || string.Empty.Equals(host.EndAddress)) { return true; }
foreach (var ip in ips)
{
try
{
if (!IPAddress.TryParse(ip, out var ipToConnectTo))
{
//it's not a traditional format ip, give up trying to match it
return true;
}
if (!IPAddress.TryParse(host.StartAddress, out var startAddress))
{
//start address is not a traditional format, give up trying to match
return true;
}
if (!IPAddress.TryParse(host.EndAddress, out var endAddress))
{
//start address is not in traditional format, give up trying to match
return true;
}
var startBytes = startAddress.GetAddressBytes();
var endBytes = endAddress.GetAddressBytes();
var ipByte = ipToConnectTo.GetAddressBytes();
for (var i = 0; i < startBytes.Length && i < endBytes.Length && i < ipByte.Length; i++)
{
if (ipByte[i] < startBytes[i] || ipByte[i] > endBytes[i]) { return false; }
}
return true;
}
catch (Exception ex)
{
APILogger.Log(ex);
}
}
return false;
}
//FB 18152 & 25642 This dictionary keeps the host info for each DAS
public static ConcurrentDictionary<string, HostInfo> DasToHost { get; set; } = new ConcurrentDictionary<string, HostInfo>();
public class PingDevice
{
private const int MAX_PING_ATTEMPTS = 3;
private const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
#region Ping
public bool PingDevices(List<string> ipList)
{
//FB 18152 Get the avilable hosts
var hostInfos = NetworkUtils.GetAvailableHosts();
EliminateBadHosts(ref hostInfos, ipList?.ToArray());
return PingAllDevices(hostInfos, ipList);
}
#region Ping All Devices
/// <summary>
/// ICMP ping
/// </summary>
/// <param name="hostIpAddress">host IP address</param>
/// <param name="ipList">List of connected devices IP addresses </param>
/// <returns>false - if as least one device disconnected</returns>
private bool PingAllDevices(List<HostInfo> hostInfos, List<string> ipList)
{
var hostStringList = new List<string>();
foreach (var host in hostInfos)
{
hostStringList.Add(host.HostIpAddress);
}
APILogger.Log($"trying to ping {string.Join(", ", ipList.ToArray())} using hosts: {string.Join(", ", hostStringList.ToArray())}");
var allConnected = true;
Parallel.ForEach(ipList, (item, state) =>
{
var lastHost = hostInfos.Last();
//FB 18152 & 25642 Perform the ping on all the devices in all hosts
foreach (var hostInfo in hostInfos)
{
var eachConnected = PingOneDevice(item, hostInfo.HostIpAddress);
if (eachConnected)
{
//We found the host update the dictionary and break from the loop
DasToHost[item] = hostInfo;
allConnected = eachConnected;
APILogger.Log($"pinging {string.Join(", ", ipList.ToArray())} worked for {hostInfo.HostIpAddress}");
break;
}
if (hostInfo.Equals(lastHost))
{
//all the hosts are processed
allConnected = eachConnected;
}
}
if (!allConnected) state.Break();
});
if (allConnected) { APILogger.Log("An interface could ping"); }
else { APILogger.Log("no intefaces could ping"); }
return allConnected;
}
/// <summary>
/// TCP ping
/// </summary>
/// <param name="ipList">List of connected devices IP addresses </param>
/// <returns>false - if as least one device disconnected</returns>
private bool PingAllDevices(List<string> ipList)
{
var allConnected = true;
Parallel.ForEach(ipList, (item, state) =>
{
allConnected = PingOneDevice(item);
if (!allConnected) state.Break();
});
return allConnected;
}
#endregion Ping All Devices
#region Ping One Device
/// <summary>
/// TCP ping
/// </summary>
/// <param name="deviceIpAddress">device IP addresses </param>
/// <returns>false - if device disconnected</returns>
private bool PingOneDevice(string deviceIpAddress)
{
for (var i = 0; i < MAX_PING_ATTEMPTS; i++)
{
var pingSender = new Ping();
var reply = pingSender.Send(deviceIpAddress);
if (reply != null && reply.Status == IPStatus.Success) return true;
}
return false;
}
/// <summary>
/// ICMP ping
/// </summary>
/// <param name="deviceIp">device IP addresses </param>
/// <param name="hostIpAddress">host IP address</param>
/// <returns>false - if device disconnected</returns>
private bool PingOneDevice(string deviceIp, string hostIpAddress)
{
for (var i = 0; i < MAX_PING_ATTEMPTS; i++)
{
if (PingICMP(IPAddress.Parse(hostIpAddress), IPAddress.Parse(deviceIp), Constants.PING_ICMP_TIMEOUT, Encoding.ASCII.GetBytes(ALPHABET)).Status == IPStatus.Success)
return true;
}
return false;
}
#endregion Ping One Device
#region ICMP Ping
/// <summary>
/// ICMP ping
/// </summary>
/// <param name="srcAddress">host address</param>
/// <param name="destAddress">device address</param>
/// <param name="timeout">timeout</param>
/// <param name="buffer">Function will fail without buffer (used alphabet)</param>
/// <param name="po">Ping options - not been usexd</param>
/// <returns>PingReplyUtils class</returns>
private static PingReplyUtils PingICMP(IPAddress srcAddress, IPAddress destAddress, int timeout = 5000, byte[] buffer = null, PingOptions po = null)
{
var ipSrc = string.Empty;
var ipDest = string.Empty;
try
{
var ipSrcBytes = srcAddress?.GetAddressBytes() ?? new byte[0];
if (4 <= ipSrcBytes.Length) { ipSrc = $"{ipSrcBytes[0]}.{ipSrcBytes[1]}.{ipSrcBytes[2]}.{ipSrcBytes[3]}"; }
var destBytes = destAddress?.GetAddressBytes() ?? new byte[0];
if (4 <= destBytes.Length) { ipDest = $"{destBytes[0]}.{destBytes[1]}.{destBytes[2]}.{destBytes[3]}"; }
}
catch (Exception ex) { APILogger.Log(ex); }
if (destAddress == null || destAddress.AddressFamily != AddressFamily.InterNetwork ||
destAddress.Equals(IPAddress.Any))
{
APILogger.Log($"Ping -S {ipSrc} {ipDest} failed - Argument exception");
throw new ArgumentException(string.Format("PingAll failed on IP:{0}", srcAddress));
}
//Defining pinvoke args
var source = srcAddress == null ? 0 : BitConverter.ToUInt32(srcAddress.GetAddressBytes(), 0);
var destination = BitConverter.ToUInt32(destAddress.GetAddressBytes(), 0);
var sendbuffer = buffer ?? new byte[] { };
var options = new Interop.Option
{
Ttl = (po == null ? (byte)255 : (byte)po.Ttl),
Flags = (po == null ? (byte)0 : po.DontFragment ? (byte)0x02 : (byte)0) //0x02
};
var fullReplyBufferSize = Interop.ReplyMarshalLength + sendbuffer.Length;
//Size of Reply struct and the transmitted buffer length.
var allocSpace = Marshal.AllocHGlobal(fullReplyBufferSize);
// unmanaged allocation of reply size. TODO Maybe should be allocated on stack
try
{
var start = DateTime.Now;
var nativeCode = Interop.IcmpSendEcho2Ex(
/* _In_ HANDLE IcmpHandle, */
Interop.IcmpHandle,
/* _In_opt_ HANDLE Event, */
default(IntPtr),
/* _In_opt_ PIO_APC_ROUTINE ApcRoutine, */
default(IntPtr),
/* _In_opt_ PVOID ApcContext */
default(IntPtr),
/* _In_ IPAddr SourceAddress, */
source,
/* _In_ IPAddr DestinationAddress, */
destination,
/* _In_ LPVOID RequestData, */
sendbuffer,
/* _In_ WORD RequestSize, */
(short)sendbuffer.Length,
/* _In_opt_ PIP_OPTION_INFORMATION RequestOptions, */
ref options,
/* _Out_ LPVOID ReplyBuffer, */
allocSpace,
/* _In_ DWORD ReplySize, */
fullReplyBufferSize,
/* _In_ DWORD Timeout */
timeout);
var duration = DateTime.Now - start;
var reply = (Interop.Reply)Marshal.PtrToStructure(allocSpace, typeof(Interop.Reply));
// Parse the beginning of reply memory to reply struct
byte[] replyBuffer = null;
if (sendbuffer.Length != 0)
{
replyBuffer = new byte[sendbuffer.Length];
Marshal.Copy(allocSpace + Interop.ReplyMarshalLength, replyBuffer, 0, sendbuffer.Length);
//copy the rest of the reply memory to managed byte[]
}
var errorCode = 0;
if (0 != nativeCode)
{
errorCode = Marshal.GetLastWin32Error();
}
APILogger.Log($"Ping -S {ipSrc} {ipDest} result: {reply.Status} LastError: {errorCode}");
return nativeCode == 0
? new PingReplyUtils(nativeCode, reply.Status, new IPAddress(reply.Address), duration)
: new PingReplyUtils(nativeCode, reply.Status, new IPAddress(reply.Address), reply.RoundTripTime,
replyBuffer);
}
finally { Marshal.FreeHGlobal(allocSpace); /*free allocated space*/ }
}
#endregion ICMP Ping
#region Support ICMP Ping
/// <summary>Interoperability Helper
/// <see cref="http://msdn.microsoft.com/en-us/library/windows/desktop/bb309069(v=vs.85).aspx" />
/// </summary>
private static class Interop
{
private static IntPtr? _icmpHandle;
private static int? _replyStructLength;
/// <summary>Returns the application legal icmp handle. Should be close by IcmpCloseHandle
/// <see cref="http://msdn.microsoft.com/en-us/library/windows/desktop/aa366045(v=vs.85).aspx" />
/// </summary>
public static IntPtr IcmpHandle
{
get
{
if (_icmpHandle == null)
{
_icmpHandle = IcmpCreateFile();
//TODO Close Icmp Handle appropiate
}
return _icmpHandle.GetValueOrDefault();
}
}
/// <summary>Returns the the marshaled size of the reply struct.</summary>
public static int ReplyMarshalLength
{
get
{
if (_replyStructLength == null)
{
_replyStructLength = Marshal.SizeOf(typeof(Reply));
}
return _replyStructLength.GetValueOrDefault();
}
}
[DllImport("Iphlpapi.dll", SetLastError = true)]
private static extern IntPtr IcmpCreateFile();
[DllImport("Iphlpapi.dll", SetLastError = true)]
private static extern bool IcmpCloseHandle(IntPtr handle);
[DllImport("Iphlpapi.dll", SetLastError = true)]
public static extern uint IcmpSendEcho2Ex(IntPtr icmpHandle, IntPtr Event, IntPtr apcroutine,
IntPtr apccontext, uint sourceAddress, uint destinationAddress, byte[] requestData,
short requestSize, ref Option requestOptions, IntPtr replyBuffer, int replySize, int timeout);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct Option
{
public byte Ttl;
public readonly byte Tos;
public byte Flags;
public readonly byte OptionsSize;
public readonly IntPtr OptionsData;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct Reply
{
public readonly uint Address;
public readonly int Status;
public readonly int RoundTripTime;
public readonly short DataSize;
public readonly short Reserved;
public readonly IntPtr DataPtr;
public readonly Option Options;
}
}
#endregion Support ICMP Ping
#endregion Ping
private static readonly object LogLock = new object();
public static void PingLog(params string[] args)
{
var sb = new StringBuilder(200);
sb.AppendFormat("=== {0} ", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
foreach (var arg in args)
{
sb.Append(" ");
sb.Append(arg);
}
sb.Append(Environment.NewLine);
lock (LogLock)
{
try
{
File.AppendAllText("Logs/ping.log", sb.ToString());
}
catch (Exception ex)
{
Trace.WriteLine(ex);
}
}
}
#region OldPing
public void PingFunction(object o)
{
var td = o as PingThreadData;
if (td == null) return;
td.UpdateProgress(0D);
if (null == td.DoneEvent)
{
td.DoneEvent = new ManualResetEvent(false);
}
if (null == td.CancelEvent)
{
td.CancelEvent = new ManualResetEvent(false);
}
var sb = new StringBuilder();
sb.AppendFormat("PingFunction ");
foreach (var item in td.Entries)
{
sb.AppendFormat("{0}, ", item.IPAddress);
}
PingLog(sb.ToString());
if (0 == td.Entries.Length)
{
td.UpdateProgress(100D);
Thread.Sleep(100);
td.Complete();
return;
}
// Kick off the background thread while we monitor/simulate progress.
Task.Run(() => CheckOnline(td)).ConfigureAwait(false);
// FB 25642 Consider the number of hosts as well
var maxTime = Constants.PING_ICMP_TIMEOUT * td.Entries.Length * NetworkUtils.GetAvailableHosts().Count;
if (maxTime > 0 && maxTime < 1000)
{
maxTime = 1000; //minimum of 1 second
}
// Tick along progress as if it will take MAXPINGTIME. If we finish early, great.
var timeWaited = 0D;
while (!td.DoneEvent.WaitOne(150, false) && !td.CancelEvent.WaitOne(0, false) )
{
timeWaited += 150D;
if (timeWaited >= maxTime)
{
PingLog("WARNING timewaited >= maxpingtime: ", timeWaited.ToString(), ">=", maxTime.ToString());
}
}
if (td.CancelEvent.WaitOne(0, false))
{
td.Complete();
}
//else if (timeWaited >= Maxpingtime)
//{
// PingLog("WARNING timewaited >= maxpingtime: ", timeWaited.ToString(), ">=",
// Maxpingtime.ToString());
// //td.CancelEvent.Set();
// //td.Complete();
// //td.DoneEvent.WaitOne();
// Thread.Sleep(100);
//}
else
{
td.UpdateProgress(100D);
Thread.Sleep(100);
td.Complete();
}
}
//used to hold the number of ips pinged completed while actively pinging
private volatile int _pingsDone = 0;
/// <summary>
/// Pinging device from specific IP address function will use IMC protocol, TC Protocol will be used if host IP address is empty
/// </summary>
/// <param name="o">A <see cref="PingThreadData"/> object</param>
private void CheckOnline(object o)
{
var td = o as PingThreadData;
if (td != null && null == td.CancelEvent)
{
td.CancelEvent = new ManualResetEvent(false);
}
try
{
var maxPingTime = Convert.ToInt32(Constants.PING_ICMP_TIMEOUT);
if (td == null) return;
var ipList = new List<string>();
foreach( var entry in td.Entries)
{
ipList.Add(entry.IPAddress);
}
var hostInfos = NetworkUtils.GetAvailableHosts();
EliminateBadHosts(ref hostInfos, ipList.ToArray());
if (!hostInfos.Any()) { return; }
var lastHost = hostInfos.Last();
var alphabet = Encoding.ASCII.GetBytes(ALPHABET);
var toPing = td.Entries.Length;
_pingsDone = 0;
_ = Parallel.ForEach(td.Entries, item =>
{
if (td.CancelEvent.WaitOne(0, false))
{
td.UpdateEntry(item, PingProgressStates.Cancel, 0);
return;
}
td.UpdateEntry(item, PingProgressStates.Pinging, 0);
var succeded = false;
var attempt = 0;
//FB 25642 Get available hosts
//avoid having to re-parse the ip address x thousand of times
var lookup = new Dictionary<HostInfo, IPAddress>();
foreach (var hostInfo in hostInfos)
{
lookup[hostInfo] = IPAddress.Parse(hostInfo.HostIpAddress);
}
while (!succeded && attempt < MAX_PING_ATTEMPTS && !td.CancelEvent.WaitOne(0, false))
{
if (td.CancelEvent.WaitOne(0, false))
{
td.UpdateEntry(item, PingProgressStates.Cancel, 0);
return;
}
try
{
PingReplyUtils allReply = null;
//FB 25642 we need to go through all the hosts
foreach (var hostInfo in hostInfos)
{
if (!IPAddress.TryParse(item.IPAddress, out var ip))
{
attempt = MAX_PING_ATTEMPTS;
continue;
}
//won't wpork if buffer is empty
var eachReply = PingICMP(lookup[hostInfo], ip, Constants.PING_ICMP_TIMEOUT, alphabet);
if ((eachReply.Status == IPStatus.Success) && (eachReply.NativeCode != 0))
{
//we found the host, update the dictionary & break
DasToHost[item.IPAddress] = hostInfo;
allReply = eachReply;
break;
}
if (hostInfo.Equals(lastHost))
{
//if it's the last host update the overall reply
allReply = eachReply;
}
}
//If the default gateway of the network interface isn't set appropriately, the call to PingICMP will
//return with a Status of IPStatus.Success. So, to differentiate this from a valid successful ping, we check NativeCode
if (allReply != null)
{
//FB 25642 allReply shows the ping was successfull or not
if ((allReply.Status == IPStatus.Success) && (allReply.NativeCode != 0))
{
succeded = true;
td.UpdateEntry(item, PingProgressStates.Ping_Good, allReply.RoundTripTime.Milliseconds);
PingLog("ping succeeded: ", DasToHost[item.IPAddress]?.HostIpAddress, " -> ", item.IPAddress);
}
else
{
attempt++;
}
}
else
{
PingLog("couldn't parse ip: ", item.IPAddress);
attempt++;
}
}
catch (Exception)
{
td.UpdateEntry(item, PingProgressStates.InvalidIPAddress, 0);
break;
}
}
if (succeded)
{
_pingsDone++;
td.UpdateProgress(100D * _pingsDone / toPing);
}
else if (MAX_PING_ATTEMPTS <= attempt)
{
_pingsDone++;
td.UpdateEntry(item, PingProgressStates.NoReply, 0);
td.UpdateProgress(100D * _pingsDone / toPing);
PingLog("failed (maxpings <= attempt: ", item.IPAddress, " - ", MAX_PING_ATTEMPTS.ToString(), "<=", attempt.ToString());
}
if (td.CancelEvent.WaitOne(0, false))
{
td.UpdateEntry(item, PingProgressStates.Cancel, 0);
}
});
}
catch (Exception ex)
{
APILogger.Log(ex);
throw;
}
finally
{
_ = td.DoneEvent.Set();
}
}
#endregion OldPing
}
}
#region PingReply
[Serializable]
public class PingReplyUtils
{
private Win32Exception _exception;
public PingReplyUtils()
{
}
internal PingReplyUtils(uint nativeCode, int replystatus, IPAddress ipAddress, TimeSpan duration)
{
NativeCode = nativeCode;
IpAddress = ipAddress;
if (Enum.IsDefined(typeof(IPStatus), replystatus))
{
Status = (IPStatus)replystatus;
}
}
internal PingReplyUtils(uint nativeCode, int replystatus, IPAddress ipAddress, int roundTripTime,
byte[] buffer)
{
NativeCode = nativeCode;
IpAddress = ipAddress;
RoundTripTime = TimeSpan.FromMilliseconds(roundTripTime);
Buffer = buffer;
if (Enum.IsDefined(typeof(IPStatus), replystatus))
{
Status = (IPStatus)replystatus;
}
}
/// <summary>Native result from <code>IcmpSendEcho2Ex</code>.</summary>
public uint NativeCode { get; } = 0;
public IPStatus Status { get; } = IPStatus.Unknown;
/// <summary>The source address of the reply.</summary>
public IPAddress IpAddress { get; } = null;
public byte[] Buffer { get; } = null;
public TimeSpan RoundTripTime { get; } = TimeSpan.Zero;
/// <summary>Resolves the <code>Win32Exception</code> from native code</summary>
public Win32Exception Exception
{
get
{
if (Status != IPStatus.Success)
{
return _exception ?? (_exception = new Win32Exception((int)NativeCode, Status.ToString()));
}
return null;
}
}
public override string ToString()
{
if (Status == IPStatus.Success)
{
return Status + " from " + IpAddress + " in " + RoundTripTime + " ms with " + Buffer.Length +
" bytes";
}
if (Status != IPStatus.Unknown)
{
return Status + " from " + IpAddress;
}
return Exception.Message + " from " + IpAddress;
}
}
#endregion PingReply
#region Entry
/// <summary>
/// Trivial class to represent an IP address entry, its type, and a visual representation
/// </summary>
public class Entry
{
public string IPAddress { get; set; }
public int DasType { get; set; }
public DataRow DR { get; set; }
public object UserData { get; set; }
}
#endregion Entry
#region HostInfo
//FB 25642 & 25590 & 18152 This class encapsulate information for the host in one place
public class HostInfo
{
public string HostIpAddress { get; set; } = string.Empty;
public string HostMacAddress { get; set; } = string.Empty;
public string HostNetworkId { get; set; } = string.Empty;
public string StartAddress { get; set; } = string.Empty;
public string EndAddress { get; set; } = string.Empty;
}
#endregion
#region PingProgressStates
/// <summary>
/// The possible states for a given <see cref="Entry"/>.
/// </summary>
public enum PingProgressStates
{
Pinging,
Connecting,
Querying,
Added,
Updated,
InvalidIPAddress,
NoReply,
Ping_Good,
Online,
Connected,
NoConnection,
Cancel,
Ready,
Armed,
QueryFailed,
QueryTimedOut,
QueryComplete,
UnexpectedMaxMemory,
UnexpectedFirmwareVersion,
Passed,
ExpiredCalDate,
ChannelCountMismatch,
MissingModules,
Canceled,
NoMemory,
AutoArmed,
Realtime,
ReadyToStream,
Streaming,
LostDock,
Rebooting,
UnexpectedFirstUseDate,
InvalidRecordingMode,
InvalidStreamingMode,
StreamingNotAvailable
}
#endregion PingProgressStates
#region PingThreadData
/// <summary>
/// A wrapper class to represent the progress and feedback for ping activity from background threads.
/// </summary>
public class PingThreadData
{
/// <summary>
/// <see cref="Entry"/> list to act on.
/// </summary>
public Entry[] Entries { get; set; }
/// <summary>
/// Optional <see cref="System.Threading.ManualResetEvent"/> to tell the process to cancel.
/// </summary>
public ManualResetEvent CancelEvent { get; set; }
/// <summary>
/// Optional <see cref="System.Threading.ManualResetEvent"/> to fire when the entire process is done.
/// </summary>
public ManualResetEvent DoneEvent { get; set; }
/// <summary>
/// An optional delgate to be called whenever status text has changed.
/// </summary>
public SetStatusTextDelegate setStatusTextCallback;
/// <summary>
/// An optional delgate to be called whenever progress has changed.
/// </summary>
public SetProgressValueDelegate progressCallback;
/// <summary>
/// A delegate type used for reporting progress on an individual entry
/// </summary>
/// <param name="entry"><see cref="Entry"/> that is being reported on</param>
/// <param name="state"><see cref="PingProgressStates"/> indicating the new state</param>
public delegate void EntryProgressCallback(Entry entry, PingProgressStates state, long msRoundTrip);
/// <summary>
/// An optional delegate to be called whenever an individual entry has changed.
/// </summary>
public EntryProgressCallback entryProgressCallback;
/// <summary>
/// An optional delegate to be called when the entire process is complete. Called before <seealso cref="DoneEvent"/> is fired.
/// </summary>
public ActionCompleteDelegate completeCallback;
/// <summary>
/// Wrapper for posting progress
/// </summary>
/// <param name="Percent">From 0 to 100 to indicate progress</param>
public void UpdateProgress(double Percent)
{
progressCallback?.Invoke(Percent);
}
/// <summary>
/// Wrapper for posting entry progress
/// </summary>
/// <param name="entry">The entry being updated</param>
/// <param name="state">The new state</param>
public void UpdateEntry(Entry entry, PingProgressStates state, long msResponseTime)
{
entryProgressCallback?.Invoke(entry, state, msResponseTime);
}
/// <summary>
/// Wrapper for posting complete
/// </summary>
public void Complete()
{
completeCallback?.Invoke();
DoneEvent?.Set();
}
public bool AvoidConnectPortion { get; set; } = false;
public bool PingFailed { get; set; } = false;
}
#endregion PingThreadData
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IAssemblyView : IBaseView { }
}

View File

@@ -0,0 +1,70 @@
using DTS.Common.Enums;
namespace DTS.Common.Constant.DASSpecific
{
public class SLICE6
{
public const uint MaxAAFilterRateHz = 20000;
public const int MIN_PROTOCOL_VER = 1;
public const int DIAGNOS_SHUNT_DAC = 2;
public const int START_REC_DELAY_IN_SECONDS = 3;
public const int IN_SLICE_TILT_SENSOR_ADC_PRE = 4;
public const int STACK_SENSORS = 5;
public const int START_REALTIME_STREAM = 11;
public const int UDP_REALTIME_STREAM = 14;
// Profiles as detailed in 29378
public const int CLOCKSYNCPROFILE = 21;
// minimum protocol version for PTP Domain ID per 30472
public const int PTP_DOMAIN_ID_VER = 21;
public static bool IsRecordingModeSupported(RecordingModes mode, int protocolVersion)
{
switch (mode)
{
case RecordingModes.CircularBuffer:
case RecordingModes.Recorder:
case RecordingModes.MultipleEventCircularBuffer:
case RecordingModes.MultipleEventRecorder:
case RecordingModes.HybridRecorder:
case RecordingModes.MultipleEventHybridRecorder:
case RecordingModes.ContinuousRecorder:
case RecordingModes.MultipleEventRAMActive:
case RecordingModes.RAMActive:
return true;
//RecordingModes.S6A_DeviceStreamingOnly:
//note: per Loc, S6 only supports udp streams in realtime, *not* as a streaming test mode (i.e. boot-and-stream)
//result = protocolVersion >= UDP_REALTIME_STREAM;
//break;
default:
return false;
}
}
public static bool IsStreamingProfileSupported(UDPStreamProfile profile, int protocolVersion)
{
switch (profile)
{
//note: per Loc, S6 only supports these in realtime, *not* as a streaming test mode (i.e. boot-and-stream)
case UDPStreamProfile.RTCStreaming:
case UDPStreamProfile.DTS_UDP:
return true;
default: return false;
}
}
public static bool IsClockSyncProfileSupported(ClockSyncProfile profile, int protocolVersion)
{
switch(profile)
{
case ClockSyncProfile.None:
return true;
case ClockSyncProfile.Manual:
return protocolVersion < CLOCKSYNCPROFILE;
case ClockSyncProfile.Slave_E2E:
return protocolVersion >= CLOCKSYNCPROFILE;
default: return false;
}
}
}
}

View File

@@ -0,0 +1,42 @@
using DTS.Common.Enums;
using DTS.Common.Enums.Sensors;
using System;
using System.ComponentModel.DataAnnotations;
namespace DTS.Common.Interface.Sensors
{
public interface IStreamOutputRecord
{
/// <summary>
/// the database id of the sensor
/// </summary>
[Key]
int Id { get; set; }
/// <summary>
/// Serial number of sensor
/// [required to be unique]
/// </summary>
[Required]
[StringLength(50)]
string SerialNumber { get; set; }
DateTime LastModified { get; set; }
string LastUpdatedBy { get; set; }
/// <summary>
/// bytes representing a delimited string of tag ids
/// </summary>
byte[] TagsBlobBytes { get; set; }
bool DoNotUse { get; set; }
bool Broken { get; set; }
UDPStreamProfile StreamOutUDPProfile { get; set; }
string StreamOutUDPAddress { get; set; }
ushort StreamOutUDPTimeChannelId { get; set; }
ushort StreamOutUDPDataChannelId { get; set; }
string StreamOutUDPTmNSConfig { get; set; }
ushort StreamOutIRIGTimeDataPacketIntervalMs { get; set; }
/// <summary>
/// amount of time between transmitting tmat
/// http://manuscript.dts.local/f/cases/29987/Add-CG-DP-TMATS-interval-UI-support
/// </summary>
ushort StreamOutTMATSIntervalMs { get; set; }
}
}

View File

@@ -0,0 +1,130 @@
using DTS.Common.Base.Classes;
using DTS.Common.Interface.TestMetaData;
using DTS.Common.Utilities.Logging;
using System;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
namespace DTS.Common.Classes.CustomerDetails
{
public class CustomerDetailsDbRecord : Base.BasePropertyChanged, ICustomerDetailsDbRecord
{
private int _customerId = -1;
[ReadOnly(true)]
[Browsable(false)]
public int CustomerId
{
get => _customerId;
set => SetProperty(ref _customerId, value, "CustomerId");
}
private string _name = "";
[ReadOnly(true)]
[Browsable(false)]
public string Name
{
get => _name;
set => SetProperty(ref _name, value, "Name");
}
private string _customerName = "";
[DisplayResource("CustomerName")]
public string CustomerName
{
get => _customerName;
set => SetProperty(ref _customerName, value, "CustomerName");
}
private string _customerTestRefNumber = "";
[DisplayResource("CustomerTestRefNumber")]
public string CustomerTestRefNumber
{
get => _customerTestRefNumber;
set => SetProperty(ref _customerTestRefNumber, value, "CustomerTestRefNumber");
}
private string _projectRefNumber = "NOVALUE";
[DisplayResource("ProjectRefNumber")]
public string ProjectRefNumber
{
get => _projectRefNumber;
set => SetProperty(ref _projectRefNumber, value, "ProjectRefNumber");
}
private string _customerOrderNumber = "NOVALUE";
[DisplayResource("CustomerOrderNumber")]
public string CustomerOrderNumber
{
get => _customerOrderNumber;
set => SetProperty(ref _customerOrderNumber, value, "CustomerOrderNumber");
}
private string _customerCostUnit = "NOVALUE";
[DisplayResource("CustomerCostUnit")]
public string CustomerCostUnit
{
get => _customerCostUnit;
set => SetProperty(ref _customerCostUnit, value, "CustomerCostUnit");
}
private bool _localOnly = false;
[Browsable(false)]
[ReadOnly(true)]
public bool LocalOnly
{
get => _localOnly;
set => SetProperty(ref _localOnly, value, "LocalOnly");
}
private DateTime _lastModified = DateTime.MinValue;
[Browsable(false)]
[ReadOnly(true)]
public DateTime LastModified
{
get => _lastModified;
set => SetProperty(ref _lastModified, value, "LastModified");
}
private string _lastModifiedBy = "";
[Browsable(false)]
[ReadOnly(true)]
public string LastModifiedBy
{
get => _lastModifiedBy;
set => SetProperty(ref _lastModifiedBy, value, "LastModifiedBy");
}
private int _version = -1;
[Browsable(false)]
[ReadOnly(true)]
public int Version
{
get => _version;
set => SetProperty(ref _version, value, "Version");
}
public CustomerDetailsDbRecord(ICustomerDetailsDbRecord customerDetailsDbRecord)
{
Name = customerDetailsDbRecord.Name;
CustomerName = customerDetailsDbRecord.CustomerName;
CustomerTestRefNumber = customerDetailsDbRecord.CustomerTestRefNumber;
ProjectRefNumber = customerDetailsDbRecord.ProjectRefNumber;
CustomerOrderNumber = customerDetailsDbRecord.CustomerOrderNumber;
CustomerCostUnit = customerDetailsDbRecord.CustomerCostUnit;
LocalOnly = customerDetailsDbRecord.LocalOnly;
LastModified = customerDetailsDbRecord.LastModified;
LastModifiedBy = customerDetailsDbRecord.LastModifiedBy;
Version = customerDetailsDbRecord.Version;
}
public CustomerDetailsDbRecord() { }
public CustomerDetailsDbRecord(IDataReader reader)
{
Name = Utility.GetString(reader, "Name");
CustomerName = Utility.GetString(reader, "CustomerName");
CustomerTestRefNumber = Utility.GetString(reader, "CustomerTestRefNumber");
ProjectRefNumber = Utility.GetString(reader, "ProjectRefNumber");
CustomerOrderNumber = Utility.GetString(reader, "CustomerOrderNumber");
CustomerCostUnit = Utility.GetString(reader, "CustomerCostUnit");
LocalOnly = Utility.GetBool(reader, "LocalOnly");
LastModified = Utility.GetDateTime(reader, "LastModified", DateTime.MinValue);
LastModifiedBy = Utility.GetString(reader, "LastModifiedBy");
Version = Utility.GetInt(reader, "Version");
}
public bool IsInvalidBlank()
{
return string.IsNullOrWhiteSpace(Name);
}
}
}

View File

@@ -0,0 +1,8 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IGenericModuleViewModel : IBaseViewModel
{
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.TestSetups.Imports.TTS.DOChannels
{
public interface IDigitalOutputChannelsView : IBaseView { }
}

View File

@@ -0,0 +1,28 @@
using System;
using DTS.Common.Interface.GroupTemplate;
namespace DTS.Common.Interface.Groups
{
/// <summary>
/// represents a channel in a group (logical channel)
/// can be associated with a physical hardware channel and/or a sensor
/// [THIS IS FOR THE OLD (PRE 2.0) TESTOBJECT CHANNELS]
/// </summary>
public interface IGroupChannel : IGroupTemplateChannel, IComparable<IGroupChannel>
{
/// <summary>
/// controls whether channel should be used when collecting data or not
/// Disabled channels are not used in run test
/// </summary>
bool Disabled { get; set; }
int ChannelIdx { get; set; }
/// <summary>
/// the serial number of the sensor associated with this channel (if any)
/// </summary>
string SensorSerialNumber { get; set; }
/// <summary>
/// the hardware channel associated with this channel
/// </summary>
string HardwareId { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
namespace DTS.Common.RibbonControl
{
public class MenuItemData : SplitButtonData
{
public MenuItemData()
: this(false)
{
}
public MenuItemData(bool isApplicationMenu)
: base(isApplicationMenu)
{
}
}
}

View File

@@ -0,0 +1,97 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
namespace DTS.Common.RibbonControl
{
public class TabData : INotifyPropertyChanged
{
public TabData()
: this(null)
{
}
public TabData(string header)
{
Header = header;
}
public string Header
{
get => _header;
set
{
if (_header == value) return;
_header = value;
OnPropertyChanged(new PropertyChangedEventArgs("Header"));
}
}
private string _header;
public string ContextualTabGroupHeader
{
get => _contextualTabGroupHeader;
set
{
if (_contextualTabGroupHeader == value) return;
_contextualTabGroupHeader = value;
OnPropertyChanged(new PropertyChangedEventArgs("ContextualTabGroupHeader"));
}
}
private string _contextualTabGroupHeader;
public bool IsSelected
{
get => _isSelected;
set
{
if (_isSelected == value) return;
_isSelected = value;
OnPropertyChanged(new PropertyChangedEventArgs("IsSelected"));
}
}
private bool _isSelected;
public ObservableCollection<GroupData> GroupDataCollection
{
get
{
if (_groupDataCollection == null)
{
var smallImage = new Uri("/Common;component/RibbonControl/Images/Paste_16x16.png", UriKind.Relative);
var largeImage = new Uri("/Common;component/RibbonControl/Images/Paste_32x32.png", UriKind.Relative);
_groupDataCollection = new ObservableCollection<GroupData>();
for (var i = 0; i < ViewModelData.GroupCount; i++)
{
_groupDataCollection.Add(new GroupData("Group " + i)
{
LargeImage = largeImage,
SmallImage = smallImage
});
}
}
return _groupDataCollection;
}
}
private ObservableCollection<GroupData> _groupDataCollection;
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (PropertyChanged != null)
{
PropertyChanged(this, e);
}
}
#endregion
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.CustomChannels
{
public interface ICustomChannelsImportView : IBaseView { }
}

View File

@@ -0,0 +1,10 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface ITRLReportViewModel : IBaseViewModel
{
ITRLReportInputView InputView { get; set; }
ITRLReportOutputView OutputView { get; set; }
}
}

View File

@@ -0,0 +1,82 @@
using System.Collections.Generic;
using System.Xml.Serialization;
namespace DTS.DASLib.Utility
{
public class XmlDictionary
{
public SerializableDictionary<string, object> Dictionary { get; set; } = new SerializableDictionary<string, object>();
}
[XmlRoot("dictionary")]
public class SerializableDictionary<TKey, TValue>
: Dictionary<TKey, TValue>, IXmlSerializable
{
#region IXmlSerializable Members
public System.Xml.Schema.XmlSchema GetSchema()
{
return null;
}
public void ReadXml(System.Xml.XmlReader reader)
{
var keySerializer = new XmlSerializer(typeof(TKey));
var valueSerializer = new XmlSerializer(typeof(TValue));
var wasEmpty = reader.IsEmptyElement;
reader.Read();
if (wasEmpty)
return;
reader.ReadStartElement("items");
while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
{
reader.ReadStartElement("item");
reader.ReadStartElement("key");
var key = (TKey)keySerializer.Deserialize(reader);
reader.ReadEndElement();
reader.ReadStartElement("value");
var value = (TValue)valueSerializer.Deserialize(reader);
reader.ReadEndElement();
Add(key, value);
reader.ReadEndElement();
reader.MoveToContent();
}
reader.ReadEndElement();
}
public void WriteXml(System.Xml.XmlWriter writer)
{
var keySerializer = new XmlSerializer(typeof(TKey));
var valueSerializer = new XmlSerializer(typeof(TValue));
writer.WriteStartElement("items");
foreach (var key in Keys)
{
writer.WriteStartElement("item");
writer.WriteStartElement("key");
keySerializer.Serialize(writer, key);
writer.WriteEndElement();
writer.WriteStartElement("value");
var value = this[key];
valueSerializer.Serialize(writer, value);
writer.WriteEndElement();
writer.WriteEndElement();
}
writer.WriteEndElement();
}
#endregion
}
}

View File

@@ -0,0 +1,10 @@
using Microsoft.Practices.Prism.Events;
// ReSharper disable ClassNeverInstantiated.Global
// ReSharper disable CheckNamespace
namespace DTS.Common.Events
{
/// <summary>
/// The selected Test Summary list changed event.
/// </summary>
public class ChannelSelectionCountNotification : CompositePresentationEvent<int> { }
}

View File

@@ -0,0 +1,76 @@
using DTS.Common.Interface.TestSetups;
using System.Data;
namespace DTS.Common.Classes.TestSetups
{
/// <summary>
/// implements a record for test setup hardware
/// <inheritdoc cref="ITestSetupHardwareRecord"/>
/// </summary>
public class TestSetupHardwareRecord : Base.BasePropertyChanged, ITestSetupHardwareRecord
{
private int _dasId = -1;
public int DASId
{
get => _dasId;
set => SetProperty(ref _dasId, value, "DASId");
}
private int _testSetupId;
public int TestSetupId
{
get => _testSetupId;
set => SetProperty(ref _testSetupId, value, "TestSetupId");
}
private bool _addDAS = true;
public bool AddDAS
{
get => _addDAS;
set => SetProperty(ref _addDAS, value, "AddDAS");
}
private int _samplesPerSecond;
public int SamplesPerSecond
{
get => _samplesPerSecond;
set => SetProperty(ref _samplesPerSecond, value, "SamplesPerSecond");
}
private bool _isClockMaster = false;
public bool IsClockMaster
{
get => _isClockMaster;
set => SetProperty(ref _isClockMaster, value, "IsClockMaster");
}
private byte _ptpDomainId = 0;
public byte PTPDomainId
{
get => _ptpDomainId;
set => SetProperty(ref _ptpDomainId, value, "PTPDomainId");
}
private int _antiAliasFilterRate;
public int AntiAliasFilterRate
{
get => _antiAliasFilterRate;
set => SetProperty(ref _antiAliasFilterRate, value, "AntiAliasFilterRate");
}
public TestSetupHardwareRecord() { }
public TestSetupHardwareRecord(IDataReader reader)
{
DASId = Utility.GetInt(reader, "DASId");
TestSetupId = Utility.GetInt(reader, "TestSetupId");
AddDAS = Utility.GetBool(reader, "AddOrRemove");
SamplesPerSecond = Utility.GetInt(reader, "SamplesPerSecond");
IsClockMaster = Utility.GetBool(reader, "IsClockMaster");
AntiAliasFilterRate = Utility.GetInt(reader, "AntiAliasFilterRate");
PTPDomainId = (byte)Utility.GetInt(reader, "PTPDomainID");
}
public TestSetupHardwareRecord(ITestSetupHardwareRecord copy)
{
DASId = copy.DASId;
TestSetupId = copy.TestSetupId;
AddDAS = copy.AddDAS;
SamplesPerSecond = copy.SamplesPerSecond;
IsClockMaster = copy.IsClockMaster;
AntiAliasFilterRate = copy.AntiAliasFilterRate;
PTPDomainId = copy.PTPDomainId;
}
}
}

View File

@@ -0,0 +1,43 @@
using System;
namespace DTS.Common.Interface.Communication
{
public interface ICommunication_DASInfo
{
/// <summary>
/// these are devices which are connected to the das
/// currently only used by SLICE6DB
/// </summary>
IDASConnectedDevice[] ConnectedDevices { get; }
/// <summary>
/// sets ConnectedDevices
/// </summary>
/// <param name="devices">devices connected to this das</param>
void SetConnectedDevices(IDASConnectedDevice[] devices);
string[] SerialNumbers { get; set; }
string[] FirmwareVersions { get; set; }
string StackSerialNumber(int devid);
/// <summary>
/// indicates date of first use
/// null indicates the hardware has not been used since calibration
/// only valid when IsFirstUseDateSupported is true
/// 15524 DAS "First Use Date"
/// </summary>
DateTime? FirstUseDate { get; set; }
/// <summary>
/// returns whether the hardware supports first use or not
/// for hardware to support first use the hardware must support
/// storage for user attributes in firmware and also have been
/// calibrated by software support hardware first use
/// 15524 DAS "First Use Date"
/// </summary>
bool IsFirstUseDateSupported { get; set; }
/// <summary>
/// indicates whether or not streaming is supported
/// 30429 TSR AIRs can enable/disable streaming via the DISABLE_STREAMING_FEATURE system attribute
/// </summary>
bool IsStreamingSupported { get; set; }
}
}

View File

@@ -0,0 +1,43 @@
using DTS.Common.Enums.Sensors;
using DTS.Common.Interface.Sensors;
using Microsoft.Practices.Prism.Events;
// ReSharper disable CheckNamespace
namespace DTS.Common.Events.Sensors
{
/// <summary>
/// this event is used to notify that the sensor filter ( or the iso code filter field) has changed
/// this is used to update the ISOCodes or filters
/// </summary>
public class SensorFilterTypeChangedEvent : CompositePresentationEvent<SensorFilterTypeChangedEventArgs> { }
public class SensorFilterTypeChangedEventArgs
{
public char ISOCodeChar { get; private set; }
public enum EventTypes { ISOCodeChar, FilterClass };
public EventTypes EventType { get; private set; }
public FilterClassType FilterClass{ get; private set; }
public ISensorCalibration Calibration { get; private set; }
public ISensorData Sensor { get; private set; }
public bool UseISOCodeFilterMapping{ get; private set; }
public bool UseZeroForUnfiltered { get; private set; }
public SensorFilterTypeChangedEventArgs(char code, ISensorData sensor, ISensorCalibration sensorCalibration, bool useISOCodeFilterMapping, bool bUseZeroForUnfiltered)
{
ISOCodeChar = code;
EventType = EventTypes.ISOCodeChar;
Sensor = sensor;
Calibration = sensorCalibration;
UseISOCodeFilterMapping = useISOCodeFilterMapping;
UseZeroForUnfiltered = bUseZeroForUnfiltered;
}
public SensorFilterTypeChangedEventArgs( FilterClassType filterClassType, ISensorData sensor, ISensorCalibration sensorCalibration, bool useISOCodeFilterMapping, bool bUseZeroForUnfiltered)
{
FilterClass = filterClassType;
Sensor = sensor;
Calibration = sensorCalibration;
EventType = EventTypes.FilterClass;
UseISOCodeFilterMapping = useISOCodeFilterMapping;
UseZeroForUnfiltered = bUseZeroForUnfiltered;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -0,0 +1,17 @@
using DTS.Common.Base;
using DTS.Common.Enums;
namespace DTS.Common.Interface
{
public interface IISOSettingsData : IBaseClass
{
bool UniqueISOCodesRequired { get; set; }
IsoViewMode ISOViewMode {get;set;}
bool ShowISOStringBuilder { get; set; }
bool ShowChannelCodeLookupHelper { get; set; }
bool UseISOCodeFilterMapping { get; set; }
bool ShowISOCodes { get; }
bool ShowUserCodes { get; }
bool ChannelNamesOnly { get; }
}
}

View File

@@ -0,0 +1,16 @@
using DTS.Common.Base;
using DTS.Common.Interface.Pagination;
namespace DTS.Common.Interface.TestSetups.TestSetupsList
{
public interface ITestSetupsListViewModel : IBaseViewModel, IFilterableListView
{
ITestSetupsListView View { get; set; }
ITestSetup [] TestSetups { get; set; }
void SetTestSetups(ITestSetup[] allTestSetups);
void Sort(object sortBy, bool bColumnClick);
void Unset();
void Filter(string currentFilter);
void MouseDoubleClick(int index);
}
}

View File

@@ -0,0 +1,12 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.Realtime
{
public interface IRealtimeChannelSelectViewModel : IBaseViewModel
{
IRealtimeChannelSelectView ChannelSelectView { get; set; }
void SetAvailableChannels(IRealtimeChannel[] channels);
void SetSearchText(string searchText);
void SetRealtimeChannel(IRealtimeChannel channel);
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IQASettingsViewModel : IBaseViewModel { }
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DTS.Common.XMLUtils
{
public class MetaDatasXMLClass
{
[XmlElement("MetaData")]
public List<MetaDataXMLClass> MetaDatas { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace DTS.Common.Interface.Pagination
{
public interface IFilterableListView
{
void Filter(object tag, string term);
void ClearAllFilters();
string ListViewId { get; }
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Practices.Prism.Events;
namespace DTS.Common.Events.GroupTemplates.CustomChannels
{
/// <summary>
/// Event to inform app that it should mark itself busy or available
/// </summary>
/// <remarks>
///
/// </remarks>
public class CustomChannelExportFileSetEvent : CompositePresentationEvent<string> { }
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Practices.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 : CompositePresentationEvent<string> { }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,102 @@
using DTS.Common.Enums.DASFactory;
using DTS.Common.Enums.Sensors;
using System;
using System.Xml;
using System.Xml.Schema;
namespace DTS.Common.Interface.DASFactory.Config
{
public interface IDASChannel
{
DFConstantsAndEnums.ConfigMode ConfigurationMode { get; set; }
/// <summary>
/// whether the channel should be put in Diagnostics mode or not
/// </summary>
bool DiagnosticsMode { get; set; }
/// <summary>
/// Channel number with respect to it's containing module <see cref="OwningModule"/>
/// </summary>
int ModuleChannelNumber { get; set; }
int AbsoluteDisplayOrder { get; set; }
double UnitConverision { get; set; }
bool AtCapacity { get; set; }
double CapacityOutputIsBasedOn { get; set; }
SensorConstants.SensUnits SensitivityUnits { get; set; }
/// <summary>
/// A link back to the Module that contains this channel.
/// </summary>
//public DASModule OwningModule { get; set; }
/// <summary>
/// The "stack channel number" of this channel with respect to the owning
/// DAS (0 based).
/// </summary>
byte Number { get; }
/// <summary>
/// Array of (string, byte[]) for EID
/// </summary>
IEID[] IDs { get; set; }
/// <summary>
/// time stamp of this event
/// </summary>
DateTime EventStartTime { get; set; }
/// <summary>
/// <see cref="bool"/> value indicating whether or not this channel has registered a level trigger.
/// </summary>
bool LevelTriggerSeen { get; set; }
string IsoChannelName { get; set; }
string ChannelGroupName { get; set; }
string UserCode { get; set; }
string UserChannelName { get; set; }
string LinearSensorCalibration { get; set; }
/// <summary>
/// the number of samples to qualify over
/// </summary>
int QualificationSamples { get; set; }
///// <summary>
///// Number of samples that T0 on DASes that did not directly experience the level trigger must be shifted
///// to time align with this channel's directly level triggered T0. A null value indicates that this channel
///// did not directly receive a level trigger.
///// </summary>
int? LevelTriggerT0AdjustmentSamples { get; set; }
/// <summary>
/// Is this channel configured? 'Configured' means a sensor is connected and/or there is
/// information in the containg device's ConfigData object, put there with a call to
/// ConfigureService.Configure(...) in the API.
/// </summary>
/// <returns>True if it is configured, False otherwise.</returns>
bool IsConfigured();
void WriteElementStart(XmlWriter writer);
void WriteElementEnd(XmlWriter writer);
void WriteXmlCRC32(XmlWriter writer);
void WriteXml(XmlWriter writer);
void ReadXml(XmlReader reader);
XmlSchema GetSchema();
int IdType { get; set; }
string UserValue1 { get; set; }
string UserValue2 { get; set; }
string UserValue3 { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
namespace DTS.Common.Interface.DASFactory.Config
{
/// <summary>
/// Information interface for an IDASCommunication object, providing DASInfo object.
/// </summary>
public interface IInformation
{
/// <summary>
/// DASInfo is populated with values from the hardware. It provides information
/// about the entire DAS as well as the functions necessary to covert between
/// Module, ModuleChannel, and DASChannel values.
/// </summary>
IInfoResult DASInfo { get; set; }
void SetDASInfo(IInfoResult dasInfo, bool bSetInDb = true);
void SetDASInfo();
}
}

View File

@@ -0,0 +1,13 @@
using System.ComponentModel;
using DTS.Common.Converters;
namespace DTS.Common.Enums
{
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum MigrationResult
{
OK,
ExceptionThrown,
WarningAllowStreamingModesWasNotMigrated
}
}

View File

@@ -0,0 +1,50 @@
using System;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Media;
namespace DTS.Common.Utils
{
public class MouseUtilities
{
[StructLayout(LayoutKind.Sequential)]
private struct Win32Point
{
public int X;
public int Y;
};
[DllImport("user32.dll")]
private static extern bool GetCursorPos(ref Win32Point pt);
[DllImport("user32.dll")]
private static extern bool GetPhysicalCursorPos(ref Win32Point pt);
[DllImport("user32.dll")]
private static extern bool ScreenToClient(IntPtr hwnd, ref Win32Point pt);
public static Point GetMousePosition(Visual relativeTo)
{
var mouse = new Win32Point();
GetCursorPos(ref mouse);
var presentationSource =
(System.Windows.Interop.HwndSource)PresentationSource.FromVisual(relativeTo);
var factor = 2D - presentationSource.CompositionTarget.TransformToDevice.M22;
ScreenToClient(presentationSource.Handle, ref mouse);
var transform = relativeTo.TransformToAncestor(presentationSource.RootVisual);
var offset = transform.Transform(new Point(0, 0));
if( factor > 0 )
{
offset.Y = offset.Y + offset.Y*(presentationSource.CompositionTarget.TransformToDevice.M22 - 1);
}
return new Point(mouse.X - offset.X, mouse.Y - offset.Y);
}
}
}

View File

@@ -0,0 +1,7 @@
using DTS.Common.Base;
// ReSharper disable CheckNamespace
namespace DTS.Common.Interface
{
public interface IViewerMainView : IBaseView { }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IPowerAndBatteryView : IBaseView { }
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Windows.Data;
namespace DTS.Common.Converters
{
/// <summary>
/// converts between two values and a bool (a >= b)
/// currently only handles two ints or two doubles
/// </summary>
public class GreaterEqualThanToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if ( value is int a && parameter is int b)
{
return a >= b;
}
if (value is double dA && parameter is double dB)
{
return dA >= dB;
}
if (value is ushort uShortA && parameter is ushort uShortB)
{
return uShortA >= uShortB;
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return false;
}
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Practices.Prism.Events;
namespace DTS.Common.Events.GroupTemplates.GroupTemplateList
{
/// <summary>
/// The GroupTemplateListGroupTemplateSelectedEvent event.
/// </summary>
///
/// <remarks>called when a template is selected.</remarks>
///
public class GroupTemplateListGroupDoubleClickEvent : CompositePresentationEvent<string> { }
}

View File

@@ -0,0 +1,12 @@
using Microsoft.Practices.Prism.Events;
namespace DTS.Common.RibbonControl
{
/// <summary>
/// The TabControlSelectionChanged event.
/// </summary>
///
/// <remarks>This event has to be used by the TabControl to indicate that its tab has been changed.</remarks>
///
public class RibbonControlSelectionChanged : CompositePresentationEvent<RibbonControlSelectionEventArgs> { }
}

View File

@@ -0,0 +1,9 @@
namespace DTS.Common.Enums
{
public enum NetworkSelection
{
Default,
NetworkId,
NetworkDesc
}
}

View File

@@ -0,0 +1,45 @@
using DTS.Common.Enums.Hardware;
using System.Net.NetworkInformation;
namespace DTS.Common.Interface.Communication
{
/// <summary>
/// part of 10582 Implement auto-discover and monitor DAS status.
/// this describes a device connected to a DAS, in particular S6 connected to a S6DB
/// </summary>
public interface IDASConnectedDevice
{
/// <summary>
/// the device type of the connected device
/// </summary>
HardwareTypes DeviceType { get; }
/// <summary>
/// the port on the DAS which the device is on (0 based)
/// </summary>
int Port { get; }
/// <summary>
/// the spot on the chain or port the device is on (0 based)
/// </summary>
int SpotOnPort { get; }
/// <summary>
/// MAC Address or physical address
/// </summary>
PhysicalAddress PhysicalAddress{ get; }
/// <summary>
/// the IPAddress of the device
/// </summary>
string IPAddress{ get; }
/// <summary>
/// the serial number of the device
/// </summary>
string SerialNumber { get; }
/// <summary>
/// the location of the device
/// </summary>
string Location { get; }
/// <summary>
/// the version of the device
/// </summary>
string Version { get; }
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.RegionOfInterest.RegionOfInterestChannels
{
public interface IRegionOfInterestChannelsView : IBaseView { }
}

View File

@@ -0,0 +1,320 @@
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);
}
}

View File

@@ -0,0 +1,19 @@
using DTS.Common.Base;
using Microsoft.Practices.Prism.Commands;
using System.Collections.ObjectModel;
namespace DTS.Common.Interface
{
public interface IPSDReportResultsViewModel : IBaseViewModel
{
/// <summary>
/// Gets the Results View.
/// </summary>
IBaseView View { get; set; }
IBaseViewModel Parent { get; set; }
DelegateCommand ExportToPDFCommand { get; }
DelegateCommand ExportToCSVCommand { get; }
ObservableCollection<IChannelGRMSSummary> Results { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DTS.Common.XMLUtils
{
public class LevelTriggersXMLClass
{
[XmlElement("LevelTrigger")]
public List<LevelTriggerXMLClass> LevelTriggers { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IPSDReportSettingsView : IBaseView
{
}
}

View File

@@ -0,0 +1,16 @@
using System.Collections.Generic;
using DTS.Common.Interface.DataRecorders;
using Microsoft.Practices.Prism.Events;
namespace DTS.Common.Events.TTSImport
{
/// <summary>
/// The EIDMappingEvent event.
/// this event is published whenever we have determined a hardware channel to sensor id mapping
/// </summary>
/// <remarks>
/// published value is a mapping of sensorId to hardwareChannelId
/// </remarks>
public class EIDMappingEvent : CompositePresentationEvent<IDictionary<string,string>> { }
}

View File

@@ -0,0 +1,8 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IViewDataViewModel : IBaseViewModel
{
}
}

View File

@@ -0,0 +1,14 @@
namespace DTS.Common.Interface
{
/// <summary>
/// All plug-in modules implement IPluginComponent interface
/// </summary>
public interface IPluginComponent
{
/// <summary>
/// Program ID used to instantiate object
/// </summary>
string ProgId { get; }
}
}

View File

@@ -0,0 +1,23 @@
using Microsoft.Practices.Prism.Events;
// ReSharper disable CheckNamespace
namespace DTS.Common.Events
{
/// <summary>
/// this event is called currently whenever a test is modified by the viewer
/// it's used currently by datapro to regenerate an roi when an event is modified
/// </summary>
public class TestModificationEvent : CompositePresentationEvent<TestModificationArgs> { }
public class TestModificationArgs
{
public string DataSetDirectory{ get; private set; }
public string TestId{get; private set;}
public TestModificationArgs(string dtsFilePath, string testId)
{
DataSetDirectory = dtsFilePath;
TestId = testId;
}
}
}

View File

@@ -0,0 +1,14 @@
using System.Windows.Controls;
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IMainLiteView : IBaseView
{
StackPanel MainShell { get; set; }
ContentControl MainRegion { get; set; }
ContentControl NavigationRegion { get; set; }
ContentControl HorizontalTabRegion { get; set; }
ContentControl VerticalTabRegion { get; set; }
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IDockPanelHorizontalView : IBaseView { }
}

View File

@@ -0,0 +1,7 @@
using DTS.Common.Base;
// ReSharper disable CheckNamespace
namespace DTS.Common.Interface
{
public interface IViewerMainViewGrid : IBaseView { }
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Enums.Sensors.SensorsList
{
public enum StreamInSettingFields
{
Included,
SerialNumber,
Description,
LastModifiedBy,
LastModified,
UDPAddress,
}
}

View File

@@ -0,0 +1,25 @@
using DTS.Common.Interface.Communication;
namespace DTS.Common.Enums.Communication
{
public static class CommunicationConstantsAndEnums
{
public enum CommunicationResult
{
ConnectOK,
ConnectFailed,
ConnectTimeout,
DisconnectOK,
DisconnectFailed,
DisconnectTimeout,
SendOK,
SendFailed,
SendTimeout,
ReceiveOK,
ReceiveFailed,
ReceiveTimeout,
Canceled
}
public delegate bool CommunicationCallback(ICommunicationReport report);
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.Realtime
{
public interface IRealtimeChannelSelectView : IBaseView { }
}

View File

@@ -0,0 +1,6 @@
namespace DTS.Common.Interface.Sensors
{
public interface IZeroMethods
{
}
}

View File

@@ -0,0 +1,13 @@
using System;
namespace DTS.Common.Exceptions
{
public class OutOfDataException : Exception
{
public long Index{ get; private set; }
public OutOfDataException(string ex, long index) : base( ex)
{
Index = index;
}
}
}

View File

@@ -0,0 +1,18 @@
using static DTS.Common.Enums.DASFactory.DFConstantsAndEnums;
namespace DTS.Common.Interface.TestSetups
{
/// <summary>
/// Interface describing records for test setup hardware
/// </summary>
public interface ITestSetupHardwareRecord
{
int DASId { get; set; }
int TestSetupId { get; set; }
bool AddDAS { get; set; }
int SamplesPerSecond { get; set; }
bool IsClockMaster { get; set; }
int AntiAliasFilterRate { get; set; }
byte PTPDomainId { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Windows.Data;
using System.Windows.Media;
namespace DTS.Common.Converters
{
public class BooleanToBorderBrushConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value != null && (bool)value ? BrushesAndColors.Brush_Warning : Brushes.Transparent;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface ICheckTriggerViewModel : IBaseViewModel { }
}

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 });
}
}
}

View File

@@ -0,0 +1,60 @@
using DTS.Common.Enums;
using DTS.Common.Enums.Sensors;
using System;
namespace DTS.Common.Interface.Sensors
{
public interface ISensorBase
{
bool IsDigitalInput();
bool IsDigitalOutput();
bool IsSquib();
bool IsUart();
bool IsStreamOutput();
bool CheckOffset { get; set; }
bool MeasureNoise { get; set; }
bool MeasureExcitation { get; set; }
bool Invert { get; set; }
string Model { get; set; }
string Manufacturer { get; set; }
string UserPartNumber { get; set; }
double Capacity { get; set; }
double FullScaleCapacity { get; }
SensorConstants.CouplingModes CouplingMode { get; set; }
double OffsetToleranceLow { get; set; }
double OffsetToleranceHigh { get; set; }
string DisplayUnit { get; set; }
void SetDisplayUnitNoNotify(string unit);
double RangeLow { get; set; }
double RangeMedium { get; set; }
double RangeHigh { get; set; }
ExcitationVoltageOptions.ExcitationVoltageOption[] SupportedExcitation { get; set; }
void SetExcitationsNoNotify(ExcitationVoltageOptions.ExcitationVoltageOption[] excitations);
ISensorCalibration Calibration { get; set; }
SensorConstants.BridgeType Bridge { get; set; }
double BridgeResistance { get; set; }
string FilterClassIso { get; set; }
bool UniPolar { get; set; }
bool IgnoreRange { get; set; }
string LastUpdatedBy { get; set; }
int Version { get; set; }
bool LocalOnly { get; }
void SetLocalOnly(bool bLocalOnly);
short AxisNumber { get; set; }
short NumberOfAxes { get; set; }
int CalInterval { get; set; }
string Polarity { get; set; }
DateTime LastModified { get; set; }
string UserChannelName { get; set; }
string UserCode { get; set; }
string ISOChannelName { get; set; }
string ISOCode { get; set; }
string PhysicalDimension { get; set; }
string Direction { get; set; }
bool DoNotUse { get; set; }
bool Broken { get; set; }
bool OutOfDate { get; set; }
bool InWarningPeriod { get; set; }
void CopyValues(ISensorBase copy, bool copyCalibration = true);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

View File

@@ -0,0 +1,14 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IDasSummary : IBaseClass
{
string DASSerial { get; set; }
string EIDFound { get; set; }
string BatteryVoltageStatus { get; set; }
System.Windows.Media.SolidColorBrush BatteryVoltageColor { get; set; }
string InputVoltageStatus { get; set; }
System.Windows.Media.SolidColorBrush InputVoltageColor { get; set; }
}
}

View File

@@ -0,0 +1,42 @@
using DTS.Common.Base;
namespace DTS.Common.Classes.Groups
{
// ReSharper disable once InconsistentNaming
/// <summary>
/// this class encapsulates a group, or basically a .grp file
/// </summary>
public class GroupGRPImportGroup : BasePropertyChanged
{
public bool Included { get; set; } = true;
public bool Overwrite { get; set; } = true;
public string GroupName { get; set; }
public string GroupTags { get; set; }
public string ImportingUserTags { get; set; }
public string SourceFile { get; set; }
/// <summary>
/// all channels in the gGRP file
/// </summary>
public GroupGRPImportChannel [] Channels { get; set; } = { };
/// <summary>
/// all errors discovered while GRP file
/// this would include things like an empty file, a file with garbage only
/// </summary>
public GroupGRPImportError[] GroupErrors { get; set; } = null;
private bool _groupNameHasError;
/// <summary>
/// indicates whether the group name specifically has an error
/// the group name is exposed in a textbox, the design of this field was to
/// control a red box around that textbox
/// </summary>
public bool GroupNameHasError
{
get => _groupNameHasError;
set => SetProperty(ref _groupNameHasError, value, "GroupNameHasError");
}
}
}

View File

@@ -0,0 +1,7 @@
namespace DTS.Common.Constant
{
public partial class XamlConstants
{
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using DTS.Common.Base;
using DTS.Common.Enums.Sensors;
// ReSharper disable CheckNamespace
namespace DTS.Common.Interface.TestDefinition
{
public interface ITestSummary : IBaseClass
{
string Id { get; set; }
string SetupName { get; set; }
string Description { get; set; }
int ChannelCount { get; set; }
DateTime FileDate { get; set; }
DateTime TimeStamp { get; set; }
string DataType { get; set; }
bool IsSelected { get; set; }
List<ITestGraphs> Graphs { get; set; }
List<ITestChannel> Channels { get; set; }
List<ITestChannel> CalculatedChannels { get; set; }
IBaseViewModel Parent { get; set; }
ITestMetadata TestMetadata { get; set; }
CalibrationBehaviors CalibrationBehavior { get; set; }
}
}

View File

@@ -0,0 +1,112 @@
using DTS.Common.Enums;
namespace DTS.Common.Constant.DASSpecific
{
public class TSRAIR
{
public const uint MaxAAFilterRateHz = 200000;
public const byte MIN_PROTOCOL_VER = 1;
public const int VOLTAGE_INSERTION = 2;
public const int START_REC_DELAY_IN_SECONDS = 3;
public const int STACK_SENSORS = 5;
public const int WAKEUP_MOTION_TIMEOUT = 10;
//public const int START_REALTIME_STREAM = 11;
//public const int UDP_REALTIME_STREAM = 14;
public const int IRIG_GPS_PPSIN_SYNC = 25;
public const int DISABLE_STREAMING_FEATURE = 25;
public static bool IsRecordingModeSupported(RecordingModes mode, int protocolVersion)
{
var result = false;
switch (mode)
{
case RecordingModes.Active:
case RecordingModes.MultipleEventActive:
case RecordingModes.Streaming:
case RecordingModes.S6A_DeviceStreamingOnly:
//26783: Since the "Set DAS to Streaming" checkbox is used for both
//TSR AIR and SLICE6Air, the recording mode may correspond to the
//"other" hardware if the DAS is switched from one to the other
case RecordingModes.Scheduled:
case RecordingModes.Interval:
result = true;
break;
//case RecordingModes.S6A_DeviceStreamingOnly:
// result = protocolVersion >= UDP_REALTIME_STREAM;
// break;
default:
result = false;
break;
}
return result;
}
public static bool IsStreamingProfileSupported(UDPStreamProfile profile, int protocolVersion)
{
var result = false;
switch (profile)
{
case UDPStreamProfile.DTS_UDP:
case UDPStreamProfile.CH10_ANALOG_2HDR:
//FB 30035 Added other supported profiles for TSRAIR
case UDPStreamProfile.CH10_ANALOG:
case UDPStreamProfile.CH10_PCM_128BIT_2HDR:
case UDPStreamProfile.CH10_PCM128_MM:
result = true;
break;
}
return result;
}
public static bool IsClockSyncProfileSupported(ClockSyncProfile profile, int protocolVersion, bool master)
{
var result = false;
switch (profile)
{
case ClockSyncProfile.IRIG_EXT_PPS:
return false;
case ClockSyncProfile.EXT_PPS:
//master EXT_PPS not supported at this time for TSR AIR
//http://manuscript.dts.local/f/cases/34280/
if (protocolVersion >= IRIG_GPS_PPSIN_SYNC && !master)
{
result = true;
}
break;
case ClockSyncProfile.None:
result = true;
break;
case ClockSyncProfile.Master_E2E:
case ClockSyncProfile.Slave_E2E:
result = true;
break;
case ClockSyncProfile.GPS_EXT_PPS:
case ClockSyncProfile.Master_E2E_GPS_EXT_PPS:
case ClockSyncProfile.Master_E2E_EXT_PPS:
case ClockSyncProfile.IRIG:
case ClockSyncProfile.Master_E2E_IRIG:
case ClockSyncProfile.Master_E2E_IRIG_EXT_PPS:
// 30430 per EF and LP / 30704: everything but 1PPS out is legal with protocol 25
if (protocolVersion >= IRIG_GPS_PPSIN_SYNC)
{
result = true;
}
break;
case ClockSyncProfile.GPS:
case ClockSyncProfile.Master_E2E_GPS:
result = false;
// 30487: Leave this alone, GPS only clock sync option should be removed
break;
}
return result;
}
/* 39151 Leaving a note here in TSRAIR for when it inevitably gets UART recording
* copy/paste the implemented MaxSampleRateHz_UART dictionary and MaxSampleRateHzForRecordingMode function from SLICE6AIR
*/
}
}

View File

@@ -0,0 +1,25 @@
using DTS.Common.Converters;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Enums
{
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum VelocityUnit
{
/// <summary>
/// kilometer per hour
/// </summary>
[Description("EditTestSetupObjectMeta_VelocityUnit_KilometerPerHour")]
KilometerPerHour = 0,
/// <summary>
/// meter per second
/// </summary>
[Description("EditTestSetupObjectMeta_VelocityUnit_MeterPerSecond")]
MeterPerSecond = 1
}
}

View File

@@ -0,0 +1,16 @@
using System.Collections.Generic;
using System.Windows;
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IShellViewModel : IBaseWindowModel
{
/// <summary>
/// Gets the Shell View.
/// </summary>
IShellView View { get; }
List<FrameworkElement> GetRegions();
object ContextMainRegion { get; set; }
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,36 @@
R-1\COM:--------------------- Subchannel_{CHANNEL_NUMBER} Description ---------------------;
R-1\AMCE-2-{CHANNEL_NUMBER}:T;
R-1\AMCN-2-{CHANNEL_NUMBER}:{CHANNEL_NUMBER};
R-1\AMN-2-{CHANNEL_NUMBER}:{CHANNEL_NAME};
R-1\ADL-2-{CHANNEL_NUMBER}:16;
R-1\AMSK-2-{CHANNEL_NUMBER}:FW;
R-1\AMTO-2-{CHANNEL_NUMBER}:M;
R-1\ASF-2-{CHANNEL_NUMBER}:0;
R-1\ASBW-2-{CHANNEL_NUMBER}:200;
R-1\ACP-2-{CHANNEL_NUMBER}:D;
R-1\AII-2-{CHANNEL_NUMBER}:50;
R-1\AGI-2-{CHANNEL_NUMBER}:100;
R-1\AFSI-2-{CHANNEL_NUMBER}:5000;
R-1\AOVI-2-{CHANNEL_NUMBER}:2500;
R-1\ALSV-2-{CHANNEL_NUMBER}:19;
R-1\AECU-2-{CHANNEL_NUMBER}:1;
R-1\AF-2-{CHANNEL_NUMBER}:U;
R-1\AIT-2-{CHANNEL_NUMBER}:S;
R-1\AV-2-{CHANNEL_NUMBER}:N;
R-1\AECO-2-{CHANNEL_NUMBER}:{CHANNEL_OFFSETEU};
R-1\AECS-2-{CHANNEL_NUMBER}:{CHANNEL_SCALEFACTOREU};
C-{CHANNEL_NUMBER}\DCN:{CHANNEL_NAME};
C-{CHANNEL_NUMBER}\MN1:{CHANNEL_NAME};
C-{CHANNEL_NUMBER}\BFM:UNS;
C-{CHANNEL_NUMBER}\DCT:COE;
C-{CHANNEL_NUMBER}\CO\N:1;
C-{CHANNEL_NUMBER}\MN3:{CHANNEL_EU};
C-{CHANNEL_NUMBER}\MOT1:{CHANNEL_MAXRANGEEU};
C-{CHANNEL_NUMBER}\MOT3:{CHANNEL_MAXRANGEEU};
C-{CHANNEL_NUMBER}\MOT5:{CHANNEL_MAXRANGEEU};
C-{CHANNEL_NUMBER}\MOT2:{CHANNEL_MINRANGEEU};
C-{CHANNEL_NUMBER}\MOT4:{CHANNEL_MINRANGEEU};
C-{CHANNEL_NUMBER}\MOT6:{CHANNEL_MINRANGEEU};
C-{CHANNEL_NUMBER}\CO:{CHANNEL_OFFSETEU};
C-{CHANNEL_NUMBER}\CO-1:{CHANNEL_SCALEFACTOREU};
R-1\COM:--------------------- Subchannel_{CHANNEL_NUMBER} End ---------------------;

View File

@@ -0,0 +1,51 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.Sensors.SensorSettingsModule
{
public interface ISensorSettingsViewModel : IBaseViewModel
{
/// <summary>
/// used when saving/reading defaults from db
/// </summary>
string User{ get; set; }
/// <summary>
/// used when saving/reading defaults from db
/// </summary>
int UserID { get; set; }
/// <summary>
/// restores settings to their original values
/// </summary>
void RestoreOriginalSettings();
/// <summary>
/// the view for the vm
/// </summary>
ISensorSettingsView View { get; set; }
/// <summary>
/// the defaults for squib
/// </summary>
ISquibSettingDefaults SquibSettings{ get; set; }
/// <summary>
/// the defaults for digital outputs
/// </summary>
IDigitalOutDefaults DigitalOutSettings { get; set; }
IDigitalInputDefaults DigitalInputDefaults { get; set; }
IIEPESensorDefaults IEPESensorDefaults { get; set; }
ICalibrationPolicy SensorCalibrationDefaults { get; set; }
//Fb 13120 default filter class setting
IAnalogDefaults AnalogDefaults { get; set; }
/// <summary>
/// un initializes display and frees memory
/// </summary>
void Unset();
/// <summary>
/// initializes display
/// </summary>
void OnSetActive();
/// <summary>
/// returns whether settings are valid, saves if they are
/// does not save if they are invalid
/// </summary>
/// <returns></returns>
bool ValidateAndSave();
}
}

View File

@@ -0,0 +1,33 @@
using DTS.Common.Base;
using DTS.Common.Enums.Viewer.Reports;
using Microsoft.Practices.Prism.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Interface
{
public interface IPSDReportSettingsModel : IBaseModel
{
IPSDReportSettingsViewModel Parent { get; set; }
bool LowPassFilterEnabled { get; set; }
double LowPassFilterFrequency { get; set; }
PassFilterType LowPassFilterType { get; set; }
int LowPassFilterOrder { get; set; }
bool HighPassFilterEnabled { get; set; }
double HighPassFilterFrequency { get; set; }
PassFilterType HighPassFilterType { get; set; }
int HighPassFilterOrder { get; set; }
WindowWidth WindowWidth { get; set; }
WindowType WindowType { get; set; }
WindowAveragingType WindowAveragingType { get; set; }
double WindowOverlappingPercent { get; set; }
bool ShowEnvelope { get; set; }
bool CanPublishChanges { get; set; }
bool ReadData { get; set; }
double DataStart { get; set; }
double DataEnd { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
using DTS.Common.Base;
using DTS.Common.Interface.Channels;
using System.Data;
namespace DTS.Common.Classes.Groups.ChannelSettings
{
public class GroupChannelSettingRecord: BasePropertyChanged, IGroupChannelSettingRecord
{
private long _channelId;
public long ChannelId
{
get => _channelId;
set => SetProperty(ref _channelId, value, "ChannelId");
}
private int _settingId;
public int SettingId
{
get => _settingId;
set => SetProperty(ref _settingId, value, "SettingId");
}
private string _settingValue;
public string SettingValue
{
get => _settingValue;
set => SetProperty(ref _settingValue, value, "SettingValue");
}
public GroupChannelSettingRecord() { }
public GroupChannelSettingRecord(IDataReader reader, int storedProcedureVersionUsed)
{
if (storedProcedureVersionUsed >= Constants.BULK_GROUPCHANNELSETTINGS_GET_DB_VERSION)
{
ChannelId = Utility.GetLong(reader, "ChannelId");
}
else
{
ChannelId = 0;
}
SettingId = Utility.GetInt(reader, "SettingId");
SettingValue = Utility.GetString(reader, "SettingValue");
}
public GroupChannelSettingRecord(long channelId, int settingId, string settingValue)
{
ChannelId = channelId;
SettingId = settingId;
SettingValue = settingValue;
}
}
}

View File

@@ -0,0 +1,65 @@
using System;
using System.ComponentModel;
using System.Windows.Input;
using DTS.Common.Enums;
using DTS.Common.Interface.ISO.ExtraProperties;
namespace DTS.Common.Classes.TestSetups
{
[Serializable]
public class ExtraProperty : IExtraProperty
{
public ExtraProperty(IExtraProperty iep)
: this()
{
_key = iep.Key;
_value = iep.Value;
}
public ExtraProperty(string key, string value)
: this()
{
_key = key;
_value = value;
}
public ExtraProperty()
{
_key = string.Empty;
_value = string.Empty;
}
private string _key;
public string Key
{
get => _key;
set { _key = value; OnPropertyChanged("Key"); }
}
private string _value;
public string Value
{
get => _value;
set { _value = value; OnPropertyChanged("Value"); }
}
private ICommand _pasteCommand;
public ICommand PasteCommand
{
get => _pasteCommand;
set { _pasteCommand = value; OnPropertyChanged("PasteCommand"); }
}
private UIItemStatus _itemStatus;
public UIItemStatus ItemStatus
{
get => _itemStatus;
set { _itemStatus = value; OnPropertyChanged("ItemStatus"); }
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IShellView : IBaseWindow { }
}

View File

@@ -0,0 +1,25 @@
using DTS.Common.Base;
using Microsoft.Practices.Prism.Events;
// ReSharper disable CheckNamespace
namespace DTS.Common.Events
{
/// <summary>
/// The Data Folder changed event.
/// </summary>
public class DataFolderChangedEvent : CompositePresentationEvent<DataFolderSelectionArg> { }
public class DataFolderSelectionArg
{
public string Path{ get; set; }
public string File { get; set; }
/// <summary>
/// whether to set the given test as selected in ui and viewer
/// 16158 Browse button on View Data tab not functiona
/// </summary>
public bool SetSelected { get; set; } = false;
/// <summary>
/// 24417 start pulling apart viewer to allow reuse for PSD reports
/// </summary>
public IBaseViewModel ParentVM { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using DTS.Common.Events;
using DTS.Common.Interface.Channels.ChannelCodes;
namespace DTS.Common.Classes.ChannelCodes
{
public class TextPastedArgs : ITextPastedEventArgs
{
public string Text { get; }
public object Sender { get; }
public string Id { get; }
public object Tag { get; }
public TextPastedArgs(string text, IChannelCode channelCode, string id, object tag)
{
Text = text;
Sender = channelCode;
Id = id;
Tag = tag;
}
}
}

View File

@@ -0,0 +1,12 @@
using System.Collections.Generic;
// ReSharper disable CheckNamespace
namespace DTS.Common.Interface
{
public interface ITestGraphs
{
string Name { get; set; }
string HardwareChannelName { get; set; }
List<string> ChannelId { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Interface.DASFactory.Download
{
public interface IUARTDownloadRequest
{
/// <summary>
/// From which event do we want to download data?
/// </summary>
ushort EventNumber { get; set; }
/// <summary>
/// How much data is there?
/// </summary>
ulong TotalByteCount { get; set; }
/// <summary>
/// Where in the data did the trigger occur?
/// </summary>
ulong TriggerByteCount { get; set; }
/// <summary>
/// Where in the data did the trigger occur?
/// </summary>
ulong FaultByteCount { get; set; }
/// <summary>
/// When did the UART stream start?
/// </summary>
ulong StartTimestamp { get; set; }
/// <summary>
/// When did the UART stream end?
/// </summary>
ulong EndTimestamp { get; set; }
/// <summary>
/// What was the baud rate during recording?
/// </summary>
int BaudRate { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
using DTS.Common.Interface.Sensors.SoftwareFilters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Interface.Sensors
{
//FB 13120 new interface to support filter class mapping settings
public interface IAnalogDefaults
{
/// <summary>
/// the current selected default filter
/// </summary>
IFilterClass SelectedFilterOption { get; set; }
/// <summary>
/// all available filters
/// </summary>
List<IFilterClass> FilterOptions { get; }
//FB 18727 Setting to use MeasuredExcitation or not
bool UseMeasuredExcitation { get; set; }
/// <summary>
/// indicates whether the setting is valid or not
/// </summary>
/// <returns></returns>
bool Validate();
void Save();
/// <summary>
/// FB15758 Import/Export settings
/// </summary>
void ReadXML(System.Xml.XmlElement root);
void WriteXML(ref System.Xml.XmlWriter writer);
}
}

View File

@@ -0,0 +1,107 @@
using System;
using Microsoft.Practices.Prism.Events;
namespace DTS.Common.Events
{
/// <summary>
/// The ShowStatus event.
/// </summary>
///
/// <remarks>This event is used by the services to display the current status.</remarks>
///
public class ShowStatus : CompositePresentationEvent<StatusInfo>
{
}
/// <summary>
/// The StatusInfo is used by <see cref="ShowStatus">ShowStatus</see> event to display the current status.
/// </summary>
public class StatusInfo
{
/// <summary>
/// the current state of a process
/// </summary>
public enum StatusState
{
Idle, //Ready state, no longer doing anything
Busy, //busy, currently doing something
DoneNoError, //no longer working, done, no errors
DoneFailed //no longer working, did not complete process
}
public StatusState CurrentState
{
get;
private set;
}
/// <summary>
/// Gets or sets a value indicating whether this object is busy.
/// </summary>
public bool IsBusy => CurrentState == StatusState.Busy;
/// <summary>
/// Gets or sets the IsOk flag.
/// </summary>
public bool IsOk
{
get;
set;
}
/// <summary>
/// Gets or sets the progress bar percentage.
/// </summary>
public decimal Percentage
{
get;
set;
}
/// <summary>
/// Gets or sets the status information.
/// </summary>
public string Text
{
get;
set;
}
/// <summary>
/// Gets or sets the id of the process.
/// </summary>
public int ProcessId
{
get;
set;
}
/// <summary>
/// creates a new status info, sets the text to the default for the state
/// note that consumers are free not to use the Text Property of the Status Info,
/// but we set it anyhow.
/// </summary>
/// <param name="state"></param>
/// <param name="percentage"></param>
/// <param name="processId"></param>
/// <param name="text"></param>
/// <param name="isOk"></param>
public StatusInfo(StatusState state, string text = null, decimal percentage = -1, int processId = -1,bool isOk = true)
{
CurrentState = state;
IsOk = isOk;
Percentage = percentage;
Text = text;
ProcessId = processId;
if (null == text)
{
Text = Strings.Strings.ResourceManager.GetString("StatusState_" + state) ?? state.ToString();
}
}
public void Unsubscribe(ShowStatus showStatus)
{
Text = String.Empty;
CurrentState = StatusState.Idle;
}
}
}

View File

@@ -0,0 +1,8 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IPaginationView : IBaseView
{
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,96 @@
using DTS.Common.Enums;
using System;
namespace DTS.Common.Interface.Sensors.SensorsList
{
/// <summary>
/// interface describes objects used in the UI to display digital inputs
/// </summary>
public interface IDigitalInputSetting
{
/// <summary>
/// ID in the database for the digital input setting
/// only positive numbers are valid database ids
/// </summary>
int DatabaseId { get; set; }
/// <summary>
/// whether the digital input is checked in a list with a checkbox
/// </summary>
bool Included { get; set; }
/// <summary>
/// the serial number / setting name
/// </summary>
string SerialNumber { get; set; }
/// <summary>
/// description or comment of setting
/// </summary>
string Description { get; set; }
/// <summary>
/// string representation of the Digital Input Mode of the setting
/// </summary>
string DIMode { get; set; }
/// <summary>
/// the user who last modified setting
/// </summary>
string ModifiedBy { get; set; }
/// <summary>
/// when the setting was last modified
/// </summary>
DateTime LastModified { get; set; }
/// <summary>
/// returns true if digital input matches filter criteria
/// </summary>
/// <param name="term"></param>
/// <returns></returns>
bool Filter(string term);
/// <summary>
/// whether the digital input is associated with a channel
/// </summary>
bool Assigned { get; set; }
/// <summary>
/// whether the digital input is online or not
/// </summary>
bool Online { get; set; }
/// <summary>
/// electronic id associated with the digital input
/// </summary>
string EID { get; set; }
/// <summary>
/// the isocode for the digital input
/// </summary>
string ISOCode { get; set; }
/// <summary>
/// the iso channel name for the digital input
/// </summary>
string ISOChannelName { get; set; }
/// <summary>
/// the user code for the digital input
/// </summary>
string UserCode { get; set; }
/// <summary>
/// the user channel name for the digital input
/// </summary>
string UserChannelName { get; set; }
/// <summary>
/// the active value of digital input as a string
/// this is the what to display when the digital input is in active state
/// </summary>
string ActiveValue{ get; set; }
/// <summary>
/// the string representation of the state of the digital input in it's default state
/// this is what to display when the digital input is in idle, inactive, or the default state
/// </summary>
string DefaultValue { get; set; }
DigitalInputModes Mode { get; set; }
/// <summary>
/// marks the digital input setting as broken or not
/// broken sensors do not appear in selectable lists of sensors in edit test setup or edit group
/// </summary>
bool Broken { get; set; }
/// <summary>
/// marks the digital input setting as donotuse
/// donotuse sensors do not appear in selectable lists of sensors in edit test setup or edit group
/// </summary>
bool DoNotUse { get; set; }
}
}

View File

@@ -0,0 +1,57 @@
G\PN:{NAME OF PROGRAM};
G\TA:{TEST ID};
G\106:17;
G\DSI\N:1;
G\DSI-1:PTP;
G\DSI-2:{TEST ID};
G\DST-1:DRS;
G\DSC-1:U;
G\SC:U;
G\COM:--- DTS Analog Time format 2 file export -----;
R-1\ID:{TEST ID};
R-1\RID:S6ACH6;
R-1\N:2;
R-1\NSB:0;
R-1\RI1:DTS;
R-1\RI2:S6A;
R-1\RI3:Y;
R-1\RI4:{CREATE DATE};
R-1\COM:Ver-17;
V-1\ID:{TEST ID};
V-1\VN:DTS;
V-1\DTS:STREAMCH10;
R-1\EV\E:F;
R-1\IDX\E:F;
R-1\IDX\IT:F;
R-1\RI6:N;
R-1\CRE:F;
R-1\RSS:R;
R-1\RML:E;
R-1\ERBS:AUTO;
R-1\COM:--- Channel '1', ID: 0x0001, TIME Data Packet Format ---------------;
R-1\TK1-1:1;
R-1\TK2-1:OTHER;
R-1\DSI-1:1;
R-1\TK3-1:FWD;
R-1\TK4-1:1;
R-1\CHE-1:T;
R-1\CDT-1:TIMEIN;
R-1\CDLN-1:1;
R-1\TTF-1:2;
R-1\TFMT-1:B;
R-1\TSRC-1:E;
R-1\SHTF-1:1;
R-1\COM:--------------------- Main Analog Channel Description --------------;
R-1\DSI-2:{UDP STREAM DATA CHANNEL ID};
R-1\TK1-2:{UDP STREAM DATA CHANNEL ID};
R-1\TK2-2:OTHER;
R-1\TK3-2:FWD;
R-1\TK4-2:{UDP STREAM DATA CHANNEL ID};
R-1\CHE-2:T;
R-1\CDLN-2:DTS_CH10_Export;
R-1\CDT-2:ANAIN;
R-1\ATF-2:1;
R-1\ACH\N-2:{NUMBER_OF_CHANNELS};
R-1\ADP-2:NO;
R-1\ASR-2:{DAS SAMPLE RATE};
R-1\SHTF-2:1;

View File

@@ -0,0 +1,26 @@
using System;
using System.Windows.Controls;
using System.Windows.Data;
using DTS.Common.Base;
namespace DTS.Common.Converters
{
public class ActiveContentConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is ContentControl)
return value;
return Binding.DoNothing;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is ContentControl)
return value;
return Binding.DoNothing;
}
}
}

View File

@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.XMLUtils
{
public class FieldsXMLClass
{
public string SetupName { get; set; }
public string SetupDescription { get; set; }
public string AutomaticTestProgression { get; set; }
public string AutomaticProgressionDelayMS { get; set; }
public string InvertTrigger { get; set; }
public string InvertStart { get; set; }
public string IgnoreShortedStart { get; set; }
public string IgnoreShortedTrigger { get; set; }
public string ViewDiagnostics { get; set; }
public string VerifyChannels { get; set; }
public string AutoVerifyChannels { get; set; }
public string VerifyChannelsDelayMS { get; set; }
public string RecordingMode { get; set; }
public string SamplesPerSecond { get; set; }
public string PreTriggerSeconds { get; set; }
public string PostTriggerSeconds { get; set; }
public string NumberOfEvents { get; set; }
public string WakeUpMotionTimeout { get; set; }
public string ScheduledStartDateTime { get; set; }
public string IntervalBetweenEventStartsMinutes { get; set; }
public string StartWithEvent { get; set; }
public string WakeUpWithMotion { get; set; }
public string StrictDiagnostics { get; set; }
public string RequireConfirmationOnErrors { get; set; }
public string ROIDownload { get; set; }
public string ViewROIDownload { get; set; }
public string DownloadAll { get; set; }
public string ViewRealtime { get; set; }
public string RealtimePlotCount { get; set; }
//public RegionsOfInterestXMLClass RegionsOfInterest { get; set; }
public string ROIStart { get; set; }
public string ROIEnd { get; set; }
public string ViewDownloadAll { get; set; }
public string Export { get; set; }
public string ExportFormat { get; set; }
public string LabDetails { get; set; }
public string UseLabDetails { get; set; }
public string CustomerDetails { get; set; }
public string UseCustomerDetails { get; set; }
public string AllowMissingSensors { get; set; }
public string AllowSensorIdToBlankChannel { get; set; }
public string ExcitationWarmupTimeMS { get; set; }
public string LocalOnly { get; set; }
public string LastModified { get; set; }
public string LastModifiedBy { get; set; }
public string TurnOffExcitation { get; set; }
public string TriggerCheckRealtime { get; set; }
public string TriggerCheckStep { get; set; }
public string PostTestDiagnostics { get; set; }
public string ExportFolder { get; set; }
public string DownloadFolder { get; set; }
public string CommonStatusLine { get; set; }
public string SameAsDownloadFolder { get; set; }
public string UploadData { get; set; }
public string UploadDataFolder { get; set; }
public string UploadExportsOnly { get; set; }
public string Settings { get; set; }
public string WarnOnBatteryFail { get; set; }
public string Dirty { get; set; }
public string Complete { get; set; }
public string ErrorMessage { get; set; }
public string TestEngineerDetails { get; set; }
public string UseTestEngineerDetails { get; set; }
public string UserTags { get; set; }
public string DoAutoArm { get; set; }
public string DoEnableRepeat { get; set; }
public string DoStreaming { get; set; }
public string CheckoutMode { get; set; }
public string QuitTestWithoutWarning { get; set; }
public string SuppressMissingSensorsWarning { get; set; }
public string ISFFile { get; set; }
public string NotAllChannelsRealTime { get; set; }
public string NotAllChannelsViewer { get; set; }
public string CalibrationBehavior { get; set; }
public string ClockSyncProfileMaster { get; set; }
public string ClockSyncProfileSlave { get; set; }
public string ExtraProperties { get; set; }
public string MeasureSquibResistancesStep { get; set; }
public string TestSetupUniqueId { get; set; }
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Some files were not shown because too many files have changed in this diff Show More