init
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using System.Xml;
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
|
||||
namespace DTS.DASLib.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for SQUIB channels.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class OutputTOMDigitalChannel : DigitalOutputDASChannel
|
||||
{
|
||||
public DigitalOutputModes OutputMode { get; set; } = DigitalOutputModes.NONE;
|
||||
|
||||
public double DelayMS { get; set; } = 0D;
|
||||
|
||||
public bool LimitDuration { get; set; } = false;
|
||||
|
||||
public double DurationMS { get; set; } = 0D;
|
||||
|
||||
public string DigitalChannelDescription { get; set; } = "";
|
||||
|
||||
public string LastModifiedBy { get; set; } = "";
|
||||
|
||||
public DateTime LastModified { get; set; }
|
||||
|
||||
public bool LocalOnly { get; set; } = false;
|
||||
|
||||
public string HardwareChannelName { get; set; }
|
||||
|
||||
public OutputTOMDigitalChannel(XmlReader reader)
|
||||
{
|
||||
IDs = new[] { new EID() };
|
||||
ReadXml(reader);
|
||||
}
|
||||
|
||||
public OutputTOMDigitalChannel(DASModule owner, int channelNumber)
|
||||
: base(owner, channelNumber)
|
||||
{
|
||||
}
|
||||
|
||||
public OutputTOMDigitalChannel()
|
||||
{
|
||||
}
|
||||
|
||||
public override void WriteXml(XmlWriter writer)
|
||||
{
|
||||
base.WriteXml(writer);
|
||||
|
||||
XMLHelper.PutDouble(writer, "DelayMS", DelayMS);
|
||||
XMLHelper.PutString(writer, "ChannelDescription", DigitalChannelDescription);
|
||||
XMLHelper.PutDouble(writer, "DurationMS", DurationMS);
|
||||
XMLHelper.PutString(writer, "OutputMode", OutputMode.ToString());
|
||||
XMLHelper.PutBool(writer, "LimitDuration", LimitDuration);
|
||||
}
|
||||
public int Version { get; set; }
|
||||
|
||||
public DateTime Date { get; }
|
||||
|
||||
|
||||
public override void WriteXmlCRC32(XmlWriter writer)
|
||||
{
|
||||
base.WriteXmlCRC32(writer);
|
||||
|
||||
XMLHelper.PutDouble(writer, "DelayMS", DelayMS);
|
||||
XMLHelper.PutString(writer, "ChannelDescription", DigitalChannelDescription);
|
||||
XMLHelper.PutDouble(writer, "DurationMS", DurationMS);
|
||||
XMLHelper.PutString(writer, "OutputMode", OutputMode.ToString());
|
||||
XMLHelper.PutBool(writer, "LimitDuration", LimitDuration);
|
||||
}
|
||||
private const string OUTPUTMODE_TAG = "OutputMode";
|
||||
private const string CHANNELDESCRIPTION_TAG = "ChannelDescription";
|
||||
private const string DELAYMS_TAG = "DelayMS";
|
||||
private const string DURATIONMS_TAG = "DurationMS";
|
||||
private const string LIMITDURATION_TAG = "LimitDuration";
|
||||
protected override void HandleElement(XmlReader reader)
|
||||
{
|
||||
base.HandleElement(reader);
|
||||
if (reader.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
switch (reader.Name)
|
||||
{
|
||||
case OUTPUTMODE_TAG:
|
||||
OutputMode = (DigitalOutputModes)Enum.Parse(typeof(DigitalOutputModes), XMLHelper.GetString(reader));
|
||||
break;
|
||||
case CHANNELDESCRIPTION_TAG:
|
||||
DigitalChannelDescription = XMLHelper.GetString(reader);
|
||||
break;
|
||||
case DELAYMS_TAG:
|
||||
DelayMS = XMLHelper.GetDouble(reader);
|
||||
break;
|
||||
case DURATIONMS_TAG:
|
||||
DurationMS = XMLHelper.GetDouble(reader);
|
||||
break;
|
||||
case LIMITDURATION_TAG:
|
||||
LimitDuration = XMLHelper.GetBool(reader);
|
||||
break;
|
||||
default:
|
||||
// let child handle it
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsConfigured()
|
||||
{
|
||||
return OutputMode != DigitalOutputModes.NONE && !string.IsNullOrEmpty(DigitalChannelDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user