You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
namespace OPCDA.NET
|
|
{
|
|
using System;
|
|
using System.Text;
|
|
using System.Xml.Serialization;
|
|
|
|
[Serializable]
|
|
public class OPCItemState
|
|
{
|
|
public object DataValue;
|
|
public int Error;
|
|
public int HandleClient;
|
|
public short Quality;
|
|
public long TimeStamp;
|
|
|
|
public override string ToString()
|
|
{
|
|
StringBuilder builder = new StringBuilder("OPCIST: ", 0x100);
|
|
builder.AppendFormat("error=0x{0:x} hclt=0x{1:x}", this.Error, this.HandleClient);
|
|
if (this.Error == 0)
|
|
{
|
|
builder.AppendFormat(" val={0} time={1} qual=", this.DataValue, this.TimeStamp);
|
|
builder.Append(OpcGroup.QualityToString(this.Quality));
|
|
}
|
|
return builder.ToString();
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public DateTime TimeStampNet
|
|
{
|
|
get
|
|
{
|
|
return DateTime.FromFileTime(this.TimeStamp);
|
|
}
|
|
set
|
|
{
|
|
this.TimeStamp = value.ToFileTime();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|