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"; } /// /// 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 /// private readonly Property _channelId = new Property(typeof(Channel).Namespace + ".Channel.ChannelId", "", true); public string ChannelId { get => _channelId.Value; set => _channelId.Value = value; } /// /// refers to the Group name for a logical channel in the test /// private readonly Property _channelGroupName = new Property(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; } } } }