Files
DP44/Common/DTS.Common.Serialization/TestSetup.Graph.Channel.cs

136 lines
4.8 KiB
C#
Raw Permalink Normal View History

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