using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTS.Utilities; using DTS.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(DTS.Serialization.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 override string ToString() { if (null != TestChannel) { return TestChannel.ToString(); } else { 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 Property _channelId = new Property(typeof(Channel).Namespace + ".Channel.ChannelId", "", true); public string ChannelId { get { return _channelId.Value; } set { _channelId.Value = value; } } /// /// refers to the Group name for a logical channel in the test /// private Property _channelGroupName = new Property(typeof(Channel).Namespace + ".Channel.ChannelGroupName", "", true); public string ChannelGroupName { get { return _channelGroupName.Value; } set { _channelGroupName.Value = value; } } public string Name { get { if (null != TestChannel) { return TestChannel.ChannelDescriptionString; } else { return "Not Set"; } } } [System.Xml.Serialization.XmlIgnoreAttribute] public string SensorName { get { if (null != TestChannel) { return TestChannel.ChannelDescriptionString.ToString(); } else { return "Not Set"; } } } [System.Xml.Serialization.XmlIgnoreAttribute] public string AxisUnit { get { if (null != TestChannel) { if (TestChannel is DTS.Serialization.Test.Module.AnalogInputChannel) { return (TestChannel as DTS.Serialization.Test.Module.AnalogInputChannel).EngineeringUnits; } else { return "EU"; } } else { return "EU"; } } } [System.Xml.Serialization.XmlIgnoreAttribute] public string SerialNumber { get { if (null != TestChannel) { return ParentTestModule.SerialNumber; } else { return "Not Set"; } } } [System.Xml.Serialization.XmlIgnoreAttribute] public DTS.Serialization.Test.Module ParentTestModule; [System.Xml.Serialization.XmlIgnoreAttribute] public DTS.Serialization.Test.Module.Channel TestChannel; } } } }