init
This commit is contained in:
139
Common/DTS.Common.Serialization/TestSetup/Graph/Channel.cs
Normal file
139
Common/DTS.Common.Serialization/TestSetup/Graph/Channel.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using DTS.Common.Utilities;
|
||||
using DTS.Common.Utilities.DotNetProgrammingConstructs;
|
||||
|
||||
namespace DTS.Serialization
|
||||
{
|
||||
//[Serializable]
|
||||
public partial class TestSetup : Exceptional
|
||||
{
|
||||
public partial class Graph : Exceptional
|
||||
{
|
||||
public partial class Channel : Exceptional
|
||||
{
|
||||
private Channel()
|
||||
{
|
||||
ChannelId = "Not Set";
|
||||
}
|
||||
|
||||
public Channel(Test.Module.Channel channel)
|
||||
{
|
||||
ParentTestModule = channel.ParentModule;
|
||||
TestChannel = channel;
|
||||
ChannelId = channel.ChannelId;
|
||||
ChannelGroupName = channel.ChannelGroupName;
|
||||
//TODO use unique key
|
||||
//Identifier = channel.HardwareChannelName;
|
||||
}
|
||||
|
||||
public Channel(string channelId)
|
||||
{
|
||||
ParentTestModule = null;
|
||||
TestChannel = null;
|
||||
|
||||
ChannelId = channelId;
|
||||
}
|
||||
|
||||
public Channel(long groupChannelId)
|
||||
{
|
||||
ParentTestModule = null;
|
||||
TestChannel = null;
|
||||
ChannelId = groupChannelId.ToString();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (null != TestChannel)
|
||||
{
|
||||
return TestChannel.ToString();
|
||||
}
|
||||
return "Not Set";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// refers to a unique id for a logical channel in the test
|
||||
/// for now this is using TestObjectChannel.GetId()
|
||||
/// which is in the form of TestObjectSerial_ChannelType_ChannelId
|
||||
/// </summary>
|
||||
private readonly Property<string> _channelId
|
||||
= new Property<string>(typeof(Channel).Namespace + ".Channel.ChannelId", "", true);
|
||||
public string ChannelId
|
||||
{
|
||||
get => _channelId.Value;
|
||||
set => _channelId.Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// refers to the Group name for a logical channel in the test
|
||||
/// </summary>
|
||||
private readonly Property<string> _channelGroupName
|
||||
= new Property<string>(typeof(Channel).Namespace + ".Channel.ChannelGroupName", "", true);
|
||||
public string ChannelGroupName
|
||||
{
|
||||
get => _channelGroupName.Value;
|
||||
set => _channelGroupName.Value = value;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null != TestChannel)
|
||||
{
|
||||
return TestChannel.ChannelDescriptionString;
|
||||
}
|
||||
return "Not Set";
|
||||
}
|
||||
}
|
||||
|
||||
[System.Xml.Serialization.XmlIgnoreAttribute]
|
||||
public string SensorName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null != TestChannel)
|
||||
{
|
||||
return TestChannel.ChannelDescriptionString.ToString();
|
||||
}
|
||||
return "Not Set";
|
||||
}
|
||||
}
|
||||
|
||||
[System.Xml.Serialization.XmlIgnoreAttribute]
|
||||
public string AxisUnit
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null != TestChannel)
|
||||
{
|
||||
if (TestChannel is Test.Module.AnalogInputChannel)
|
||||
{
|
||||
return (TestChannel as Test.Module.AnalogInputChannel).EngineeringUnits;
|
||||
}
|
||||
return "EU";
|
||||
}
|
||||
return "EU";
|
||||
}
|
||||
}
|
||||
|
||||
[System.Xml.Serialization.XmlIgnoreAttribute]
|
||||
public string SerialNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null != TestChannel)
|
||||
{
|
||||
return ParentTestModule.SerialNumber;
|
||||
}
|
||||
return "Not Set";
|
||||
}
|
||||
}
|
||||
|
||||
[System.Xml.Serialization.XmlIgnoreAttribute]
|
||||
public Test.Module ParentTestModule;
|
||||
|
||||
[System.Xml.Serialization.XmlIgnoreAttribute]
|
||||
public Test.Module.Channel TestChannel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
79
Common/DTS.Common.Serialization/TestSetup/Graph/Graph.cs
Normal file
79
Common/DTS.Common.Serialization/TestSetup/Graph/Graph.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DTS.Common.Utilities;
|
||||
using DTS.Common.Utilities.DotNetProgrammingConstructs;
|
||||
|
||||
namespace DTS.Serialization
|
||||
{
|
||||
//[Serializable]
|
||||
public partial class TestSetup : Exceptional
|
||||
{
|
||||
public partial class Graph : Exceptional
|
||||
{
|
||||
public Graph()
|
||||
{
|
||||
_Name.Value = null;
|
||||
_Version.Value = "1.0.0.0";
|
||||
Identifier = Guid.NewGuid();
|
||||
}
|
||||
|
||||
public void UnSet()
|
||||
{
|
||||
}
|
||||
public List<Channel> Channels
|
||||
{
|
||||
get => _Channels.Value;
|
||||
set => _Channels.Value = value;
|
||||
}
|
||||
private readonly Property<List<Channel>> _Channels
|
||||
= new Property<List<Channel>>(typeof(Graph).Namespace + "Graph.Channels", new List<Channel>(), true);
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => _Name.Value;
|
||||
set => _Name.Value = value;
|
||||
}
|
||||
private readonly Property<string> _Name
|
||||
= new Property<string>(typeof(Graph).Namespace + ".Graph.Name", "", false);
|
||||
|
||||
public string HardwareChannelName
|
||||
{
|
||||
get => _HardwareChannelName.Value;
|
||||
set => _HardwareChannelName.Value = value;
|
||||
}
|
||||
private readonly Property<string> _HardwareChannelName
|
||||
= new Property<string>(typeof(Graph).Namespace + ".Graph.HardwareChannelName", "", true);
|
||||
|
||||
public string DisplayName => _Name.Value + "_" + _HardwareChannelName.Value;
|
||||
|
||||
public string Version
|
||||
{
|
||||
get => _Version.Value;
|
||||
set => _Version.Value = value;
|
||||
}
|
||||
private readonly Property<string> _Version
|
||||
= new Property<string>(typeof(Graph).Namespace + ".Graph.Version", "", false);
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
[System.Xml.Serialization.XmlIgnoreAttribute]
|
||||
public bool IsSingleChannelGraph => ((null != Channels) && (1 == Channels.Count));
|
||||
|
||||
[System.Xml.Serialization.XmlIgnoreAttribute]
|
||||
public Channel FirstChannel => Channels[0];
|
||||
|
||||
[System.Xml.Serialization.XmlIgnoreAttribute]
|
||||
public Test.Module.Channel FirstTestChannel => Channels[0].TestChannel;
|
||||
|
||||
[System.Xml.Serialization.XmlIgnoreAttribute]
|
||||
public Guid Identifier
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user