This commit is contained in:
luosheng
2023-07-16 08:17:03 +08:00
parent 6d655b24d1
commit 2055c10c59
127 changed files with 7414 additions and 7470 deletions

View File

@@ -40,11 +40,11 @@ namespace Modbus.Net
{
Array.Reverse(data, pos, 4);
byte temp;
temp = data[pos]; data[pos] = data[pos+2]; data[pos+2] = temp;
temp = data[pos+1]; data[pos+1] = data[pos+3]; data[pos+3] = temp;
temp = data[pos]; data[pos] = data[pos + 2]; data[pos + 2] = temp;
temp = data[pos + 1]; data[pos + 1] = data[pos + 3]; data[pos + 3] = temp;
var t = BitConverter.ToSingle(data, pos);
temp = data[pos]; data[pos] = data[pos+2]; data[pos+2] = temp;
temp = data[pos+1]; data[pos+1] = data[pos+3]; data[pos+3] = temp;
temp = data[pos]; data[pos] = data[pos + 2]; data[pos + 2] = temp;
temp = data[pos + 1]; data[pos + 1] = data[pos + 3]; data[pos + 3] = temp;
Array.Reverse(data, pos, 4);
pos += 4;
return t;

View File

@@ -21,7 +21,7 @@ namespace Modbus.Net.Modbus
/// <param name="masterAddress">主站号</param>
/// <param name="endian">端格式</param>
public ModbusMachine(TKey id, ModbusType connectionType, string connectionString,
IEnumerable<AddressUnit<TUnitKey, int ,int>> getAddresses, bool keepConnect, byte slaveAddress, byte masterAddress,
IEnumerable<AddressUnit<TUnitKey, int, int>> getAddresses, bool keepConnect, byte slaveAddress, byte masterAddress,
Endian endian)
: base(id, getAddresses, keepConnect, slaveAddress, masterAddress)
{

View File

@@ -136,7 +136,7 @@ namespace Modbus.Net
else if (length == 0) return null;
else
{
duplicatedMessages = new List<(byte[],bool)>();
duplicatedMessages = new List<(byte[], bool)>();
var skipLength = 0;
while (receiveMessageCopy.Length >= length)
{

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Modbus.Net
{

View File

@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Modbus.Net
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Modbus.Net
namespace Modbus.Net
{
#if NET462
#pragma warning disable 1591

View File

@@ -313,7 +313,7 @@ namespace Modbus.Net
}
foreach (var assembly in AssemblyHelper.GetAllLibraryAssemblies())
{
var valueHelper = assembly.GetType("Modbus.Net."+endian.ToString() + "ValueHelper")?.GetProperty("Instance")?.GetValue(null, null) as ValueHelper;
var valueHelper = assembly.GetType("Modbus.Net." + endian.ToString() + "ValueHelper")?.GetProperty("Instance")?.GetValue(null, null) as ValueHelper;
if (valueHelper != null)
{
EndianInstanceCache[endian.ToString()] = valueHelper;

View File

@@ -1,8 +1,6 @@
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

View File

@@ -1,5 +1,4 @@
using Microsoft.Extensions.Logging;
using Quartz.Logging;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -3,9 +3,9 @@ using Microsoft.AspNetCore.Mvc;
using Modbus.Net;
using Modbus.Net.Modbus;
using System.Diagnostics;
using AddressUnit = Modbus.Net.AddressUnit<string, int, int>;
using MachineJobSchedulerCreator = Modbus.Net.MachineJobSchedulerCreator<Modbus.Net.IMachineMethodDatas, string, double>;
using ModbusMachine = Modbus.Net.Modbus.ModbusMachine<string, string>;
using AddressUnit = Modbus.Net.AddressUnit<string, int, int>;
namespace AnyType.Controllers
{

View File

@@ -1,5 +1,4 @@
using Quartz.Logging;
using System.Configuration;
namespace MachineJob
{

View File

@@ -32,20 +32,20 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
internal struct Result
{
/// <remarks/>
public const int S_ALREADYACKED = +0x00040200; // 0x00040200
public const int S_ALREADYACKED = +0x00040200; // 0x00040200
/// <remarks/>
public const int S_INVALIDBUFFERTIME = +0x00040201; // 0x00040201
public const int S_INVALIDBUFFERTIME = +0x00040201; // 0x00040201
/// <remarks/>
public const int S_INVALIDMAXSIZE = +0x00040202; // 0x00040202
public const int S_INVALIDMAXSIZE = +0x00040202; // 0x00040202
/// <remarks/>
public const int S_INVALIDKEEPALIVETIME = +0x00040203; // 0x00040203
/// <remarks/>
public const int E_INVALIDBRANCHNAME = -0x3FFBFDFD; // 0xC0040203
public const int E_INVALIDBRANCHNAME = -0x3FFBFDFD; // 0xC0040203
/// <remarks/>
public const int E_INVALIDTIME = -0x3FFBFDFC; // 0xC0040204
public const int E_INVALIDTIME = -0x3FFBFDFC; // 0xC0040204
/// <remarks/>
public const int E_BUSY = -0x3FFBFDFB; // 0xC0040205
public const int E_BUSY = -0x3FFBFDFB; // 0xC0040205
/// <remarks/>
public const int E_NOINFO = -0x3FFBFDFA; // 0xC0040206
public const int E_NOINFO = -0x3FFBFDFA; // 0xC0040206
}
}

View File

@@ -24,10 +24,9 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
using Technosoftware.DaAeHdaClient.Ae;
using Technosoftware.OpcRcw.Comn;
using Technosoftware.OpcRcw.Ae;
using Technosoftware.OpcRcw.Comn;
#endregion
#pragma warning disable 0618
@@ -44,7 +43,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
/// <summary>
/// Initializes the object with the specified OpcUrl and COM server.
/// </summary>
internal Server(OpcUrl url, object server) : base(url, server)
internal Server(OpcUrl url, object server) : base(url, server)
{
m_supportsAE11 = true;
@@ -177,19 +176,19 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
{
// verify state and arguments.
if (server_ == null) throw new NotConnectedException();
if (state == null) throw new ArgumentNullException(nameof(state));
if (state == null) throw new ArgumentNullException(nameof(state));
// initialize arguments.
object unknown = null;
var riid = typeof(IOPCEventSubscriptionMgt).GUID;
var bufferTime = 0;
var maxSize = 0;
object unknown = null;
var riid = typeof(IOPCEventSubscriptionMgt).GUID;
var bufferTime = 0;
var maxSize = 0;
// invoke COM method.
try
{
((IOPCEventServer)server_).CreateEventSubscription(
(state.Active)?1:0,
(state.Active) ? 1 : 0,
state.BufferTime,
state.MaxSize,
++m_handles,
@@ -205,7 +204,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
// save actual values.
state.BufferTime = bufferTime;
state.MaxSize = maxSize;
state.MaxSize = maxSize;
var subscription = new Subscription(state, unknown);
@@ -270,7 +269,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
// initialize arguments.
var count = 0;
var ppdwEventCategories = IntPtr.Zero;
var ppdwEventCategories = IntPtr.Zero;
var ppszEventCategoryDescs = IntPtr.Zero;
// invoke COM method.
@@ -294,7 +293,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
}
// unmarshal arguments.
var ids = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref ppdwEventCategories, count, true);
var ids = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref ppdwEventCategories, count, true);
var names = Technosoftware.DaAeHdaClient.Com.Interop.GetUnicodeStrings(ref ppszEventCategoryDescs, count, true);
// build results.
@@ -304,7 +303,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
{
categories[ii] = new TsCAeCategory();
categories[ii].ID = ids[ii];
categories[ii].ID = ids[ii];
categories[ii].Name = names[ii];
}
@@ -494,9 +493,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
}
// unmarshal arguments.
var ids = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref ppdwAttrIDs, count, true);
var ids = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref ppdwAttrIDs, count, true);
var names = Technosoftware.DaAeHdaClient.Com.Interop.GetUnicodeStrings(ref ppszAttrDescs, count, true);
var types = Technosoftware.DaAeHdaClient.Com.Interop.GetInt16s(ref ppvtAttrTypes, count, true);
var types = Technosoftware.DaAeHdaClient.Com.Interop.GetInt16s(ref ppvtAttrTypes, count, true);
// build results.
var attributes = new TsCAeAttribute[count];
@@ -505,8 +504,8 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
{
attributes[ii] = new TsCAeAttribute();
attributes[ii].ID = ids[ii];
attributes[ii].Name = names[ii];
attributes[ii].ID = ids[ii];
attributes[ii].Name = names[ii];
attributes[ii].DataType = Technosoftware.DaAeHdaClient.Com.Interop.GetType((VarEnum)types[ii]);
}
@@ -529,12 +528,12 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
/// <returns>A list of item urls for each specified attribute.</returns>
public TsCAeItemUrl[] TranslateToItemIDs(
string sourceName,
int eventCategory,
int eventCategory,
string conditionName,
string subConditionName,
int[] attributeIDs)
int[] attributeIDs)
{
lock (this)
lock (this)
{
// verify state and arguments.
if (server_ == null) throw new NotConnectedException();
@@ -544,18 +543,18 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
var ppszNodeNames = IntPtr.Zero;
var ppCLSIDs = IntPtr.Zero;
var count = (attributeIDs != null)?attributeIDs.Length:0;
var count = (attributeIDs != null) ? attributeIDs.Length : 0;
// call server.
try
{
((IOPCEventServer)server_).TranslateToItemIDs(
(sourceName != null)?sourceName:"",
(sourceName != null) ? sourceName : "",
eventCategory,
(conditionName != null)?conditionName:"",
(subConditionName != null)?subConditionName:"",
(conditionName != null) ? conditionName : "",
(subConditionName != null) ? subConditionName : "",
count,
(count > 0)?attributeIDs:new int[0],
(count > 0) ? attributeIDs : new int[0],
out ppszAttrItemIDs,
out ppszNodeNames,
out ppCLSIDs);
@@ -566,9 +565,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
}
// unmarshal results.
var itemIDs = Technosoftware.DaAeHdaClient.Com.Interop.GetUnicodeStrings(ref ppszAttrItemIDs, count, true);
var itemIDs = Technosoftware.DaAeHdaClient.Com.Interop.GetUnicodeStrings(ref ppszAttrItemIDs, count, true);
var nodeNames = Technosoftware.DaAeHdaClient.Com.Interop.GetUnicodeStrings(ref ppszNodeNames, count, true);
var clsids = Technosoftware.DaAeHdaClient.Com.Interop.GetGUIDs(ref ppCLSIDs, count, true);
var clsids = Technosoftware.DaAeHdaClient.Com.Interop.GetGUIDs(ref ppCLSIDs, count, true);
var itemUrls = new TsCAeItemUrl[count];
@@ -579,9 +578,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
itemUrls[ii].ItemName = itemIDs[ii];
itemUrls[ii].ItemPath = null;
itemUrls[ii].Url.Scheme = OpcUrlScheme.DA;
itemUrls[ii].Url.Scheme = OpcUrlScheme.DA;
itemUrls[ii].Url.HostName = nodeNames[ii];
itemUrls[ii].Url.Path = string.Format("{{{0}}}", clsids[ii]);
itemUrls[ii].Url.Path = string.Format("{{{0}}}", clsids[ii]);
}
// return results.
@@ -602,7 +601,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
public TsCAeCondition GetConditionState(
string sourceName,
string conditionName,
int[] attributeIDs)
int[] attributeIDs)
{
lock (this)
{
@@ -616,10 +615,10 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
try
{
((IOPCEventServer)server_).GetConditionState(
(sourceName != null)?sourceName:"",
(conditionName != null)?conditionName:"",
(attributeIDs != null)?attributeIDs.Length:0,
(attributeIDs != null)?attributeIDs:new int[0],
(sourceName != null) ? sourceName : "",
(conditionName != null) ? conditionName : "",
(attributeIDs != null) ? attributeIDs.Length : 0,
(attributeIDs != null) ? attributeIDs : new int[0],
out ppConditionState);
}
catch (Exception e)
@@ -628,7 +627,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
}
// unmarshal results.
var conditions = Interop.GetConditions(ref ppConditionState, 1, true);
var conditions = Interop.GetConditions(ref ppConditionState, 1, true);
// fill in attribute ids.
for (var ii = 0; ii < conditions[0].Attributes.Count; ii++)
@@ -962,18 +961,18 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
{
failures[ii] = new TsCAeEnabledStateResult();
failures[ii].Enabled = false;
failures[ii].Enabled = false;
failures[ii].EffectivelyEnabled = false;
failures[ii].Result = OpcResult.E_FAIL;
failures[ii].Result = OpcResult.E_FAIL;
}
return failures;
}
// initialize arguments.
var pbEnabled = IntPtr.Zero;
var pbEnabled = IntPtr.Zero;
var pbEffectivelyEnabled = IntPtr.Zero;
var ppErrors = IntPtr.Zero;
var ppErrors = IntPtr.Zero;
try
{
@@ -990,9 +989,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
}
// unmarshal arguments.
var enabled = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref pbEnabled, areas.Length, true);
var effectivelyEnabled = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref pbEffectivelyEnabled, areas.Length, true);
var errors = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref ppErrors, areas.Length, true);
var enabled = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref pbEnabled, areas.Length, true);
var effectivelyEnabled = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref pbEffectivelyEnabled, areas.Length, true);
var errors = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref ppErrors, areas.Length, true);
// build results.
@@ -1002,9 +1001,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
{
results[ii] = new TsCAeEnabledStateResult();
results[ii].Enabled = enabled[ii] != 0;
results[ii].Enabled = enabled[ii] != 0;
results[ii].EffectivelyEnabled = effectivelyEnabled[ii] != 0;
results[ii].Result = Interop.GetResultID(errors[ii]);
results[ii].Result = Interop.GetResultID(errors[ii]);
}
// return results
@@ -1041,18 +1040,18 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
{
failures[ii] = new TsCAeEnabledStateResult();
failures[ii].Enabled = false;
failures[ii].Enabled = false;
failures[ii].EffectivelyEnabled = false;
failures[ii].Result = OpcResult.E_FAIL;
failures[ii].Result = OpcResult.E_FAIL;
}
return failures;
}
// initialize arguments.
var pbEnabled = IntPtr.Zero;
var pbEnabled = IntPtr.Zero;
var pbEffectivelyEnabled = IntPtr.Zero;
var ppErrors = IntPtr.Zero;
var ppErrors = IntPtr.Zero;
try
{
@@ -1069,9 +1068,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
}
// unmarshal arguments.
var enabled = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref pbEnabled, sources.Length, true);
var effectivelyEnabled = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref pbEffectivelyEnabled, sources.Length, true);
var errors = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref ppErrors, sources.Length, true);
var enabled = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref pbEnabled, sources.Length, true);
var effectivelyEnabled = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref pbEffectivelyEnabled, sources.Length, true);
var errors = Technosoftware.DaAeHdaClient.Com.Interop.GetInt32s(ref ppErrors, sources.Length, true);
// build results.
@@ -1081,9 +1080,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
{
results[ii] = new TsCAeEnabledStateResult();
results[ii].Enabled = enabled[ii] != 0;
results[ii].Enabled = enabled[ii] != 0;
results[ii].EffectivelyEnabled = effectivelyEnabled[ii] != 0;
results[ii].Result = Interop.GetResultID(errors[ii]);
results[ii].Result = Interop.GetResultID(errors[ii]);
}
// return results
@@ -1102,8 +1101,8 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
/// <param name="conditions">The conditions being acknowledged.</param>
/// <returns>A list of result id indictaing whether each condition was successfully acknowledged.</returns>
public OpcResult[] AcknowledgeCondition(
string acknowledgerID,
string comment,
string acknowledgerID,
string comment,
TsCAeEventAcknowledgement[] conditions)
{
lock (this)
@@ -1120,17 +1119,17 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
// initialize arguments.
var count = conditions.Length;
var pszSource = new string[count];
var pszConditionName = new string[count];
var pszSource = new string[count];
var pszConditionName = new string[count];
var pftActiveTime = new OpcRcw.Ae.FILETIME[count];
var pdwCookie = new int[count];
var pdwCookie = new int[count];
for (var ii = 0; ii < count; ii ++)
for (var ii = 0; ii < count; ii++)
{
pszSource[ii] = conditions[ii].SourceName;
pszSource[ii] = conditions[ii].SourceName;
pszConditionName[ii] = conditions[ii].ConditionName;
pftActiveTime[ii] = Interop.Convert(Com.Interop.GetFILETIME(conditions[ii].ActiveTime));
pdwCookie[ii] = conditions[ii].Cookie;
pftActiveTime[ii] = Interop.Convert(Com.Interop.GetFILETIME(conditions[ii].ActiveTime));
pdwCookie[ii] = conditions[ii].Cookie;
}
var ppErrors = IntPtr.Zero;
@@ -1180,9 +1179,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
/// <param name="browseFilter">The expression used to filter the names of children returned.</param>
/// <returns>The set of elements that meet the filter criteria.</returns>
public TsCAeBrowseElement[] Browse(
string areaID,
string areaID,
TsCAeBrowseType browseType,
string browseFilter)
string browseFilter)
{
lock (this)
{
@@ -1213,10 +1212,10 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
/// <param name="position">The object used to continue the browse if the number nodes exceeds the maximum specified.</param>
/// <returns>The set of elements that meet the filter criteria.</returns>
public TsCAeBrowseElement[] Browse(
string areaID,
TsCAeBrowseType browseType,
string browseFilter,
int maxElements,
string areaID,
TsCAeBrowseType browseType,
string browseFilter,
int maxElements,
out IOpcBrowsePosition position)
{
position = null;
@@ -1333,7 +1332,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
// verify object.
if (unknown == null)
{
throw new OpcResultException(new OpcResult( (int)OpcResult.E_FAIL.Code, OpcResult.FuncCallType.SysFuncCall, null ),"The response from the server was invalid or incomplete");
throw new OpcResultException(new OpcResult((int)OpcResult.E_FAIL.Code, OpcResult.FuncCallType.SysFuncCall, null), "The response from the server was invalid or incomplete");
}
// save object.
@@ -1345,7 +1344,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
/// </summary>
private void ChangeBrowsePosition(string areaID)
{
var targetID = (areaID != null)?areaID:"";
var targetID = (areaID != null) ? areaID : "";
// invoke COM method.
try
@@ -1374,7 +1373,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
{
((IOPCEventAreaBrowser)m_browser).BrowseOPCAreas(
dwBrowseFilterType,
(browseFilter != null)?browseFilter:"",
(browseFilter != null) ? browseFilter : "",
out enumerator);
}
catch (Exception e)
@@ -1385,11 +1384,11 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
// verify object.
if (enumerator == null)
{
throw new OpcResultException(new OpcResult( (int)OpcResult.E_FAIL.Code, OpcResult.FuncCallType.SysFuncCall, null ),"The response from the server was invalid or incomplete");
throw new OpcResultException(new OpcResult((int)OpcResult.E_FAIL.Code, OpcResult.FuncCallType.SysFuncCall, null), "The response from the server was invalid or incomplete");
}
// return result.
return (System.Runtime.InteropServices.ComTypes.IEnumString)enumerator;
return (System.Runtime.InteropServices.ComTypes.IEnumString)enumerator;
}
/// <summary>
@@ -1438,7 +1437,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
var buffer = new string[1];
// re-calculate buffer length.
var bufferLength = (maxElements > 0 && maxElements-elements.Count < buffer.Length)?maxElements-elements.Count:buffer.Length;
var bufferLength = (maxElements > 0 && maxElements - elements.Count < buffer.Length) ? maxElements - elements.Count : buffer.Length;
// fetch first batch of names.
var pFetched = Marshal.AllocCoTaskMem(sizeof(int));
@@ -1447,38 +1446,38 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
{
var result = enumerator.Next(bufferLength, buffer, pFetched);
while (result == 0)
{
while (result == 0)
{
var fetched = Marshal.ReadInt32(pFetched);
// create elements.
for (var ii = 0; ii < fetched; ii++)
{
var element = new TsCAeBrowseElement();
// create elements.
for (var ii = 0; ii < fetched; ii++)
{
var element = new TsCAeBrowseElement();
element.Name = buffer[ii];
element.QualifiedName = GetQualifiedName(buffer[ii], browseType);
element.NodeType = browseType;
element.Name = buffer[ii];
element.QualifiedName = GetQualifiedName(buffer[ii], browseType);
element.NodeType = browseType;
elements.Add(element);
}
elements.Add(element);
}
// check for halt.
if (maxElements > 0 && elements.Count >= maxElements)
{
break;
}
// check for halt.
if (maxElements > 0 && elements.Count >= maxElements)
{
break;
}
// re-calculate buffer length.
bufferLength = (maxElements > 0 && maxElements-elements.Count < buffer.Length)?maxElements-elements.Count:buffer.Length;
// re-calculate buffer length.
bufferLength = (maxElements > 0 && maxElements - elements.Count < buffer.Length) ? maxElements - elements.Count : buffer.Length;
// fetch next block.
// fetch next block.
result = enumerator.Next(bufferLength, buffer, pFetched);
}
}
// return final result.
return result;
}
// return final result.
return result;
}
finally
{
if (pFetched != IntPtr.Zero)
@@ -1486,7 +1485,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
Marshal.FreeCoTaskMem(pFetched);
}
}
}
}
#endregion
#region Private Members
@@ -1509,14 +1508,14 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
/// Saves the parameters for an incomplete browse information.
/// </summary>
public BrowsePosition(
string areaID,
TsCAeBrowseType browseType,
string browseFilter,
System.Runtime.InteropServices.ComTypes.IEnumString enumerator)
string areaID,
TsCAeBrowseType browseType,
string browseFilter,
System.Runtime.InteropServices.ComTypes.IEnumString enumerator)
:
base (areaID, browseType, browseFilter)
base(areaID, browseType, browseFilter)
{
m_enumerator = enumerator;
m_enumerator = enumerator;
}
#endregion
@@ -1543,11 +1542,11 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
// Release unmanaged resources.
// Set large fields to null.
if (m_enumerator != null)
{
Technosoftware.DaAeHdaClient.Com.Interop.ReleaseServer(m_enumerator);
m_enumerator = null;
}
if (m_enumerator != null)
{
Technosoftware.DaAeHdaClient.Com.Interop.ReleaseServer(m_enumerator);
m_enumerator = null;
}
// Call Dispose on your base class.
m_disposed = true;
@@ -1568,7 +1567,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
#endregion
#region Private Members
System.Runtime.InteropServices.ComTypes.IEnumString m_enumerator = null;
System.Runtime.InteropServices.ComTypes.IEnumString m_enumerator = null;
#endregion
}
#endregion

View File

@@ -23,11 +23,9 @@
#region Using Directives
using System;
using System.Runtime.InteropServices;
using Technosoftware.DaAeHdaClient.Ae;
using Technosoftware.OpcRcw.Ae;
using Technosoftware.DaAeHdaClient.Utilities;
using Technosoftware.OpcRcw.Ae;
#endregion
@@ -333,7 +331,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Ae
// build results.
var filters = new TsCAeSubscriptionFilters
{
EventTypes = pdwEventType, LowSeverity = pdwLowSeverity, HighSeverity = pdwHighSeverity
EventTypes = pdwEventType,
LowSeverity = pdwLowSeverity,
HighSeverity = pdwHighSeverity
};

File diff suppressed because it is too large Load Diff

View File

@@ -45,7 +45,7 @@ namespace Technosoftware.DaAeHdaClient.Com
/// <summary>
/// The number of times Advise() has been called without a matching Unadvise().
/// </summary>
private int refs_;
private int refs_;
/// <summary>
/// Initializes the object by finding the specified connection point.

View File

@@ -32,7 +32,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
/// Implements an object that handles multi-step browse operations.
/// </summary>
[Serializable]
internal class BrowsePosition : TsCDaBrowsePosition
internal class BrowsePosition : TsCDaBrowsePosition
{
/// <summary>
/// The continuation point for a browse operation.
@@ -49,8 +49,8 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
/// </summary>
internal BrowsePosition(
OpcItem itemID,
TsCDaBrowseFilters filters,
string continuationPoint)
TsCDaBrowseFilters filters,
string continuationPoint)
:
base(itemID, filters)
{

View File

@@ -23,9 +23,8 @@
#region Using Directives
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Runtime.InteropServices;
using Technosoftware.DaAeHdaClient.Da;
#endregion
@@ -134,9 +133,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
output.ProductVersion = string.Format("{0}.{1}.{2}", status.wMajorVersion, status.wMinorVersion, status.wBuildNumber);
output.ServerState = (OpcServerState)status.dwServerState;
output.StatusInfo = null;
output.StartTime = Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(Convert(status.ftStartTime));
output.CurrentTime = Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(Convert(status.ftCurrentTime));
output.LastUpdateTime = Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(Convert(status.ftLastUpdateTime));
output.StartTime = Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(Convert(status.ftStartTime));
output.CurrentTime = Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(Convert(status.ftCurrentTime));
output.LastUpdateTime = Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(Convert(status.ftLastUpdateTime));
if (deallocate)
{
@@ -622,9 +621,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
case OpcRcw.Da.Constants.OPC_WRITEABLE: return TsDaAccessRights.Writable;
case OpcRcw.Da.Constants.OPC_READABLE | OpcRcw.Da.Constants.OPC_WRITEABLE:
{
return TsDaAccessRights.ReadWritable;
}
{
return TsDaAccessRights.ReadWritable;
}
}
return null;

View File

@@ -34,75 +34,75 @@ namespace Technosoftware.DaAeHdaClient.Com
internal struct Result
{
/// <remarks/>
public const int S_OK = +0x00000000; // 0x00000000
public const int S_OK = +0x00000000; // 0x00000000
/// <remarks/>
public const int S_FALSE = +0x00000001; // 0x00000001
public const int S_FALSE = +0x00000001; // 0x00000001
/// <remarks/>
public const int E_NOTIMPL = -0x7FFFBFFF; // 0x80004001
public const int E_NOTIMPL = -0x7FFFBFFF; // 0x80004001
/// <remarks/>
public const int E_OUTOFMEMORY = -0x7FF8FFF2; // 0x8007000E
public const int E_OUTOFMEMORY = -0x7FF8FFF2; // 0x8007000E
/// <remarks/>
public const int E_INVALIDARG = -0x7FF8FFA9; // 0x80070057
public const int E_INVALIDARG = -0x7FF8FFA9; // 0x80070057
/// <remarks/>
public const int E_NOINTERFACE = -0x7FFFBFFE; // 0x80004002
public const int E_NOINTERFACE = -0x7FFFBFFE; // 0x80004002
/// <remarks/>
public const int E_POINTER = -0x7FFFBFFD; // 0x80004003
public const int E_POINTER = -0x7FFFBFFD; // 0x80004003
/// <remarks/>
public const int E_FAIL = -0x7FFFBFFB; // 0x80004005
public const int E_FAIL = -0x7FFFBFFB; // 0x80004005
/// <remarks/>
public const int CONNECT_E_NOCONNECTION = -0x7FFBFE00; // 0x80040200
public const int CONNECT_E_NOCONNECTION = -0x7FFBFE00; // 0x80040200
/// <remarks/>
public const int CONNECT_E_ADVISELIMIT = -0x7FFBFDFF; // 0x80040201
public const int CONNECT_E_ADVISELIMIT = -0x7FFBFDFF; // 0x80040201
/// <remarks/>
public const int DISP_E_TYPEMISMATCH = -0x7FFDFFFB; // 0x80020005
public const int DISP_E_TYPEMISMATCH = -0x7FFDFFFB; // 0x80020005
/// <remarks/>
public const int DISP_E_OVERFLOW = -0x7FFDFFF6; // 0x8002000A
public const int DISP_E_OVERFLOW = -0x7FFDFFF6; // 0x8002000A
/// <remarks/>
public const int E_INVALIDHANDLE = -0x3FFBFFFF; // 0xC0040001
public const int E_INVALIDHANDLE = -0x3FFBFFFF; // 0xC0040001
/// <remarks/>
public const int E_BADTYPE = -0x3FFBFFFC; // 0xC0040004
public const int E_BADTYPE = -0x3FFBFFFC; // 0xC0040004
/// <remarks/>
public const int E_PUBLIC = -0x3FFBFFFB; // 0xC0040005
public const int E_PUBLIC = -0x3FFBFFFB; // 0xC0040005
/// <remarks/>
public const int E_BADRIGHTS = -0x3FFBFFFA; // 0xC0040006
public const int E_BADRIGHTS = -0x3FFBFFFA; // 0xC0040006
/// <remarks/>
public const int E_UNKNOWNITEMID = -0x3FFBFFF9; // 0xC0040007
public const int E_UNKNOWNITEMID = -0x3FFBFFF9; // 0xC0040007
/// <remarks/>
public const int E_INVALIDITEMID = -0x3FFBFFF8; // 0xC0040008
public const int E_INVALIDITEMID = -0x3FFBFFF8; // 0xC0040008
/// <remarks/>
public const int E_INVALIDFILTER = -0x3FFBFFF7; // 0xC0040009
public const int E_INVALIDFILTER = -0x3FFBFFF7; // 0xC0040009
/// <remarks/>
public const int E_UNKNOWNPATH = -0x3FFBFFF6; // 0xC004000A
public const int E_UNKNOWNPATH = -0x3FFBFFF6; // 0xC004000A
/// <remarks/>
public const int E_RANGE = -0x3FFBFFF5; // 0xC004000B
public const int E_RANGE = -0x3FFBFFF5; // 0xC004000B
/// <remarks/>
public const int E_DUPLICATENAME = -0x3FFBFFF4; // 0xC004000C
public const int E_DUPLICATENAME = -0x3FFBFFF4; // 0xC004000C
/// <remarks/>
public const int S_UNSUPPORTEDRATE = +0x0004000D; // 0x0004000D
public const int S_UNSUPPORTEDRATE = +0x0004000D; // 0x0004000D
/// <remarks/>
public const int S_CLAMP = +0x0004000E; // 0x0004000E
public const int S_CLAMP = +0x0004000E; // 0x0004000E
/// <remarks/>
public const int S_INUSE = +0x0004000F; // 0x0004000F
public const int S_INUSE = +0x0004000F; // 0x0004000F
/// <remarks/>
public const int E_INVALIDCONFIGFILE = -0x3FFBFFF0; // 0xC0040010
public const int E_INVALIDCONFIGFILE = -0x3FFBFFF0; // 0xC0040010
/// <remarks/>
public const int E_NOTFOUND = -0x3FFBFFEF; // 0xC0040011
public const int E_NOTFOUND = -0x3FFBFFEF; // 0xC0040011
/// <remarks/>
public const int E_INVALID_PID = -0x3FFBFDFD; // 0xC0040203
public const int E_INVALID_PID = -0x3FFBFDFD; // 0xC0040203
/// <remarks/>
public const int E_DEADBANDNOTSET = -0x3FFBFC00; // 0xC0040400
public const int E_DEADBANDNOTSET = -0x3FFBFC00; // 0xC0040400
/// <remarks/>
public const int E_DEADBANDNOTSUPPORTED = -0x3FFBFBFF; // 0xC0040401
public const int E_DEADBANDNOTSUPPORTED = -0x3FFBFBFF; // 0xC0040401
/// <remarks/>
public const int E_NOBUFFERING = -0x3FFBFBFE; // 0xC0040402
public const int E_NOBUFFERING = -0x3FFBFBFE; // 0xC0040402
/// <remarks/>
public const int E_INVALIDCONTINUATIONPOINT = -0x3FFBFBFD; // 0xC0040403
public const int E_INVALIDCONTINUATIONPOINT = -0x3FFBFBFD; // 0xC0040403
/// <remarks/>
public const int S_DATAQUEUEOVERFLOW = +0x00040404; // 0x00040404
public const int S_DATAQUEUEOVERFLOW = +0x00040404; // 0x00040404
/// <remarks/>
public const int E_RATENOTSET = -0x3FFBFBFB; // 0xC0040405
public const int E_RATENOTSET = -0x3FFBFBFB; // 0xC0040405
/// <remarks/>
public const int E_NOTSUPPORTED = -0x3FFBFBFA; // 0xC0040406
public const int E_NOTSUPPORTED = -0x3FFBFBFA; // 0xC0040406
}
}
@@ -114,15 +114,15 @@ namespace Technosoftware.DaAeHdaClient.Com
internal struct Result
{
/// <remarks/>
public const int E_TYPE_CHANGED = -0x3FFBFBF9; // 0xC0040407
public const int E_TYPE_CHANGED = -0x3FFBFBF9; // 0xC0040407
/// <remarks/>
public const int E_FILTER_DUPLICATE = -0x3FFBFBF8; // 0xC0040408
public const int E_FILTER_DUPLICATE = -0x3FFBFBF8; // 0xC0040408
/// <remarks/>
public const int E_FILTER_INVALID = -0x3FFBFBF7; // 0xC0040409
public const int E_FILTER_INVALID = -0x3FFBFBF7; // 0xC0040409
/// <remarks/>
public const int E_FILTER_ERROR = -0x3FFBFBF6; // 0xC004040A
public const int E_FILTER_ERROR = -0x3FFBFBF6; // 0xC004040A
/// <remarks/>
public const int S_FILTER_NO_DATA = +0x0004040B; // 0xC004040B
public const int S_FILTER_NO_DATA = +0x0004040B; // 0xC004040B
}
}
}

View File

@@ -22,16 +22,13 @@
#region Using Directives
using System;
using System.Threading;
using System.Collections;
using System.Globalization;
using System.Runtime.InteropServices;
using Technosoftware.DaAeHdaClient.Da;
using Technosoftware.DaAeHdaClient.Utilities;
using Technosoftware.OpcRcw.Da;
using System.Threading;
using Technosoftware.DaAeHdaClient.Com.Utilities;
using Technosoftware.DaAeHdaClient.Da;
using Technosoftware.OpcRcw.Da;
#endregion
@@ -100,7 +97,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
// release all groups.
foreach (Subscription subscription in subscriptions_.Values)
{
var methodName = "IOPCServer.RemoveGroup";
var methodName = "IOPCServer.RemoveGroup";
// remove subscription from server.
try

View File

@@ -23,14 +23,12 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
using Technosoftware.DaAeHdaClient.Da;
using Technosoftware.DaAeHdaClient.Com.Da;
using Technosoftware.DaAeHdaClient.Utilities;
using Technosoftware.OpcRcw.Da;
using Technosoftware.OpcRcw.Comn;
using Technosoftware.DaAeHdaClient.Com.Utilities;
using Technosoftware.DaAeHdaClient.Da;
using Technosoftware.DaAeHdaClient.Utilities;
using Technosoftware.OpcRcw.Comn;
using Technosoftware.OpcRcw.Da;
#endregion

View File

@@ -23,13 +23,10 @@
#region Using Directives
using System;
using System.Collections;
using Technosoftware.DaAeHdaClient.Da;
using Technosoftware.DaAeHdaClient.Com.Da;
using Technosoftware.DaAeHdaClient.Utilities;
using Technosoftware.OpcRcw.Da;
using Technosoftware.DaAeHdaClient.Com.Utilities;
using Technosoftware.DaAeHdaClient.Da;
using Technosoftware.OpcRcw.Da;
#endregion
namespace Technosoftware.DaAeHdaClient.Com.Da20

View File

@@ -66,7 +66,7 @@ namespace Technosoftware.DaAeHdaClient.Com
try
{
// create buffer.
var buffer = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(IntPtr))*count);
var buffer = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(IntPtr)) * count);
try
{

View File

@@ -22,14 +22,9 @@
#region Using Directives
using System;
using System.Xml;
using System.Net;
using System.Text;
using System.Collections;
using System.Globalization;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;
#endregion

View File

@@ -23,10 +23,9 @@
#region Using Directives
using System;
using System.Collections;
using Technosoftware.DaAeHdaClient.Hda;
using Technosoftware.OpcRcw.Hda;
using Technosoftware.OpcRcw.Comn;
using Technosoftware.OpcRcw.Hda;
#endregion
namespace Technosoftware.DaAeHdaClient.Com.Hda
@@ -34,7 +33,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
/// <summary>
/// An in-process wrapper an OPC HDA browser object.
/// </summary>
internal class Browser : ITsCHdaBrowser
internal class Browser : ITsCHdaBrowser
{
//======================================================================
// Construction
@@ -141,7 +140,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
lock (this)
{
var branchPath = (itemID != null && itemID.ItemName != null)?itemID.ItemName:"";
var branchPath = (itemID != null && itemID.ItemName != null) ? itemID.ItemName : "";
// move to the correct position in the server's address space.
try
@@ -171,7 +170,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
// browse for items
enumerator = GetEnumerator(false);
var items = FetchElements(enumerator, maxElements-elements.Count, false);
var items = FetchElements(enumerator, maxElements - elements.Count, false);
if (items != null)
{
@@ -252,7 +251,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
}
// fetch next set of items.
var items = FetchElements(pos.Enumerator, maxElements-elements.Count, false);
var items = FetchElements(pos.Enumerator, maxElements - elements.Count, false);
if (items != null)
{
@@ -282,7 +281,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
{
try
{
var browseType = (isBranch)?OPCHDA_BROWSETYPE.OPCHDA_BRANCH:OPCHDA_BROWSETYPE.OPCHDA_LEAF;
var browseType = (isBranch) ? OPCHDA_BROWSETYPE.OPCHDA_BRANCH : OPCHDA_BROWSETYPE.OPCHDA_LEAF;
IEnumString pEnumerator = null;
m_browser.GetEnum(browseType, out pEnumerator);
@@ -324,15 +323,15 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
{
var element = new TsCHdaBrowseElement();
element.Name = name;
element.Name = name;
// lookup item id for element.
try
{
string itemID = null;
m_browser.GetItemID(name, out itemID);
element.ItemName = itemID;
element.ItemPath = null;
element.ItemName = itemID;
element.ItemPath = null;
element.HasChildren = isBranch;
}
catch
@@ -384,8 +383,8 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
/// <param name="fetchingItems">Whether the enumerator is return branches or items.</param>
internal BrowsePosition(string branchPath, EnumString enumerator, bool fetchingItems)
{
m_branchPath = branchPath;
m_enumerator = enumerator;
m_branchPath = branchPath;
m_enumerator = enumerator;
m_fetchingItems = fetchingItems;
}

View File

@@ -34,20 +34,20 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
/// <summary>
/// A class that implements the HDA data callback interface.
/// </summary>
internal class DataCallback : IOPCHDA_DataCallback
internal class DataCallback : IOPCHDA_DataCallback
{
/// <summary>
/// Initializes the object with the containing subscription object.
/// </summary>
public DataCallback() {}
public DataCallback() { }
/// <summary>
/// Fired when an exception occurs during callback processing.
/// </summary>
public event TsCHdaCallbackExceptionEventHandler CallbackExceptionEvent
{
add {lock (this) { _callbackExceptionEvent += value; }}
remove {lock (this) { _callbackExceptionEvent -= value; }}
add { lock (this) { _callbackExceptionEvent += value; } }
remove { lock (this) { _callbackExceptionEvent -= value; } }
}
/// <summary>
@@ -103,11 +103,11 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
/// Called when new data arrives for a subscription.
/// </summary>
public void OnDataChange(
int dwTransactionID,
int hrStatus,
int dwNumItems,
int dwTransactionID,
int hrStatus,
int dwNumItems,
OPCHDA_ITEM[] pItemValues,
int[] phrErrors)
int[] phrErrors)
{
try
{
@@ -130,7 +130,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
results[ii].ServerHandle = results[ii].ClientHandle;
results[ii].ClientHandle = null;
results[ii].Result = Utilities.Interop.GetResultId(phrErrors[ii]);
results[ii].Result = Utilities.Interop.GetResultId(phrErrors[ii]);
}
// invoke callback - remove request if unexpected error occured.
@@ -150,11 +150,11 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
/// Called when an asynchronous read request completes.
/// </summary>
public void OnReadComplete(
int dwTransactionID,
int hrStatus,
int dwNumItems,
int dwTransactionID,
int hrStatus,
int dwNumItems,
OPCHDA_ITEM[] pItemValues,
int[] phrErrors)
int[] phrErrors)
{
try
{
@@ -176,7 +176,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
results[ii] = Interop.GetItemValueCollection(pItemValues[ii], false);
results[ii].ServerHandle = pItemValues[ii].hClient;
results[ii].Result = Utilities.Interop.GetResultId(phrErrors[ii]);
results[ii].Result = Utilities.Interop.GetResultId(phrErrors[ii]);
}
// invoke callback - remove request if all results arrived.
@@ -196,11 +196,11 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
/// Called when an asynchronous read modified request completes.
/// </summary>
public void OnReadModifiedComplete(
int dwTransactionID,
int hrStatus,
int dwNumItems,
int dwTransactionID,
int hrStatus,
int dwNumItems,
OPCHDA_MODIFIEDITEM[] pItemValues,
int[] phrErrors)
int[] phrErrors)
{
try
{
@@ -222,7 +222,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
results[ii] = Interop.GetModifiedValueCollection(pItemValues[ii], false);
results[ii].ServerHandle = pItemValues[ii].hClient;
results[ii].Result = Utilities.Interop.GetResultId(phrErrors[ii]);
results[ii].Result = Utilities.Interop.GetResultId(phrErrors[ii]);
}
// invoke callback - remove request if all results arrived.
@@ -242,12 +242,12 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
/// Called when an asynchronous read attributes request completes.
/// </summary>
public void OnReadAttributeComplete(
int dwTransactionID,
int hrStatus,
int hClient,
int dwNumItems,
int dwTransactionID,
int hrStatus,
int hClient,
int dwNumItems,
OPCHDA_ATTRIBUTE[] pAttributeValues,
int[] phrErrors)
int[] phrErrors)
{
try
{
@@ -294,11 +294,11 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
/// Called when an asynchronous read annotations request completes.
/// </summary>
public void OnReadAnnotations(
int dwTransactionID,
int hrStatus,
int dwNumItems,
int dwTransactionID,
int hrStatus,
int dwNumItems,
OPCHDA_ANNOTATION[] pAnnotationValues,
int[] phrErrors)
int[] phrErrors)
{
try
{
@@ -320,7 +320,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
results[ii] = Interop.GetAnnotationValueCollection(pAnnotationValues[ii], false);
results[ii].ServerHandle = pAnnotationValues[ii].hClient;
results[ii].Result = Utilities.Interop.GetResultId(phrErrors[ii]);
results[ii].Result = Utilities.Interop.GetResultId(phrErrors[ii]);
}
// invoke callback - remove request if all results arrived.
@@ -340,9 +340,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
/// Called when an asynchronous insert annotations request completes.
/// </summary>
public void OnInsertAnnotations(
int dwTransactionID,
int hrStatus,
int dwCount,
int dwTransactionID,
int hrStatus,
int dwCount,
int[] phClients,
int[] phrErrors)
{
@@ -407,11 +407,11 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
/// Called when a batch of data from playback request arrives.
/// </summary>
public void OnPlayback(
int dwTransactionID,
int hrStatus,
int dwNumItems,
int dwTransactionID,
int hrStatus,
int dwNumItems,
IntPtr ppItemValues,
int[] phrErrors)
int[] phrErrors)
{
try
{
@@ -442,10 +442,10 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
if (item != null && item.Length == 1)
{
results[ii] = item[0];
results[ii] = item[0];
results[ii].ServerHandle = results[ii].ClientHandle;
results[ii].ClientHandle = null;
results[ii].Result = Utilities.Interop.GetResultId(phrErrors[ii]);
results[ii].Result = Utilities.Interop.GetResultId(phrErrors[ii]);
}
}
@@ -466,9 +466,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
/// Called when an asynchronous update request completes.
/// </summary>
public void OnUpdateComplete(
int dwTransactionID,
int hrStatus,
int dwCount,
int dwTransactionID,
int hrStatus,
int dwCount,
int[] phClients,
int[] phrErrors)
{
@@ -583,9 +583,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
#endregion
#region Private Members
private int m_nextID;
private int m_nextID;
private Hashtable m_requests = new Hashtable();
private TsCHdaCallbackExceptionEventHandler _callbackExceptionEvent;
private TsCHdaCallbackExceptionEventHandler _callbackExceptionEvent;
#endregion
}
}

View File

@@ -32,410 +32,410 @@ using Technosoftware.DaAeHdaClient.Hda;
namespace Technosoftware.DaAeHdaClient.Com.Hda
{
/// <summary>
/// <summary>
/// Contains state information for a single asynchronous Technosoftware.DaAeHdaClient.Com.Hda.Interop.
/// </summary>
internal class Interop
{
/// <summary>
/// Converts a standard FILETIME to an OpcRcw.Da.FILETIME structure.
/// </summary>
internal static OpcRcw.Hda.OPCHDA_FILETIME Convert(FILETIME input)
{
var output = new OpcRcw.Hda.OPCHDA_FILETIME();
output.dwLowDateTime = input.dwLowDateTime;
output.dwHighDateTime = input.dwHighDateTime;
return output;
}
/// </summary>
internal class Interop
{
/// <summary>
/// Converts a standard FILETIME to an OpcRcw.Da.FILETIME structure.
/// </summary>
internal static OpcRcw.Hda.OPCHDA_FILETIME Convert(FILETIME input)
{
var output = new OpcRcw.Hda.OPCHDA_FILETIME();
output.dwLowDateTime = input.dwLowDateTime;
output.dwHighDateTime = input.dwHighDateTime;
return output;
}
/// <summary>
/// Converts an OpcRcw.Da.FILETIME to a standard FILETIME structure.
/// </summary>
internal static FILETIME Convert(OpcRcw.Hda.OPCHDA_FILETIME input)
{
var output = new FILETIME();
output.dwLowDateTime = input.dwLowDateTime;
output.dwHighDateTime = input.dwHighDateTime;
return output;
}
/// <summary>
/// Converts an OpcRcw.Da.FILETIME to a standard FILETIME structure.
/// </summary>
internal static FILETIME Convert(OpcRcw.Hda.OPCHDA_FILETIME input)
{
var output = new FILETIME();
output.dwLowDateTime = input.dwLowDateTime;
output.dwHighDateTime = input.dwHighDateTime;
return output;
}
/// <summary>
/// Converts a decimal value to a OpcRcw.Hda.OPCHDA_TIME structure.
/// </summary>
internal static OpcRcw.Hda.OPCHDA_FILETIME GetFILETIME(decimal input)
{
var output = new OpcRcw.Hda.OPCHDA_FILETIME();
/// <summary>
/// Converts a decimal value to a OpcRcw.Hda.OPCHDA_TIME structure.
/// </summary>
internal static OpcRcw.Hda.OPCHDA_FILETIME GetFILETIME(decimal input)
{
var output = new OpcRcw.Hda.OPCHDA_FILETIME();
output.dwHighDateTime = (int)((((ulong)(input*10000000)) & 0xFFFFFFFF00000000)>>32);
output.dwLowDateTime = (int)((((ulong)(input*10000000)) & 0x00000000FFFFFFFF));
output.dwHighDateTime = (int)((((ulong)(input * 10000000)) & 0xFFFFFFFF00000000) >> 32);
output.dwLowDateTime = (int)((((ulong)(input * 10000000)) & 0x00000000FFFFFFFF));
return output;
}
return output;
}
/// <summary>
/// Returns an array of FILETIMEs.
/// </summary>
internal static OpcRcw.Hda.OPCHDA_FILETIME[] GetFILETIMEs(DateTime[] input)
{
/// <summary>
/// Returns an array of FILETIMEs.
/// </summary>
internal static OpcRcw.Hda.OPCHDA_FILETIME[] GetFILETIMEs(DateTime[] input)
{
OpcRcw.Hda.OPCHDA_FILETIME[] output = null;
if (input != null)
{
output = new OpcRcw.Hda.OPCHDA_FILETIME[input.Length];
if (input != null)
{
output = new OpcRcw.Hda.OPCHDA_FILETIME[input.Length];
for (var ii = 0; ii < input.Length; ii++)
{
output[ii] = Convert(Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(input[ii]));
}
}
for (var ii = 0; ii < input.Length; ii++)
{
output[ii] = Convert(Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(input[ii]));
}
}
return output;
}
return output;
}
/// <summary>
/// Converts a Technosoftware.DaAeHdaClient.Time object to a Technosoftware.DaAeHdaClient.Com.Hda.OPCHDA_TIME structure.
/// </summary>
internal static OpcRcw.Hda.OPCHDA_TIME GetTime(TsCHdaTime input)
{
var output = new OpcRcw.Hda.OPCHDA_TIME();
/// <summary>
/// Converts a Technosoftware.DaAeHdaClient.Time object to a Technosoftware.DaAeHdaClient.Com.Hda.OPCHDA_TIME structure.
/// </summary>
internal static OpcRcw.Hda.OPCHDA_TIME GetTime(TsCHdaTime input)
{
var output = new OpcRcw.Hda.OPCHDA_TIME();
if (input != null)
{
output.ftTime = Convert(Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(input.AbsoluteTime));
output.szTime = (input.IsRelative)?input.ToString():"";
output.bString = (input.IsRelative)?1:0;
}
if (input != null)
{
output.ftTime = Convert(Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(input.AbsoluteTime));
output.szTime = (input.IsRelative) ? input.ToString() : "";
output.bString = (input.IsRelative) ? 1 : 0;
}
// create a null value for a time structure.
else
{
output.ftTime = Convert(Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(DateTime.MinValue));
output.szTime = "";
output.bString = 1;
}
// create a null value for a time structure.
else
{
output.ftTime = Convert(Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(DateTime.MinValue));
output.szTime = "";
output.bString = 1;
}
return output;
}
return output;
}
/// <summary>
/// Unmarshals and deallocates an array of OPCHDA_ITEM structures.
/// </summary>
internal static TsCHdaItemValueCollection[] GetItemValueCollections(ref IntPtr pInput, int count, bool deallocate)
{
TsCHdaItemValueCollection[] output = null;
/// <summary>
/// Unmarshals and deallocates an array of OPCHDA_ITEM structures.
/// </summary>
internal static TsCHdaItemValueCollection[] GetItemValueCollections(ref IntPtr pInput, int count, bool deallocate)
{
TsCHdaItemValueCollection[] output = null;
if (pInput != IntPtr.Zero && count > 0)
{
output = new TsCHdaItemValueCollection[count];
if (pInput != IntPtr.Zero && count > 0)
{
output = new TsCHdaItemValueCollection[count];
var pos = pInput;
var pos = pInput;
for (var ii = 0; ii < count; ii++)
{
output[ii] = GetItemValueCollection(pos, deallocate);
for (var ii = 0; ii < count; ii++)
{
output[ii] = GetItemValueCollection(pos, deallocate);
pos = (IntPtr)(pos.ToInt64() + Marshal.SizeOf(typeof(OpcRcw.Hda.OPCHDA_ITEM)));
}
}
if (deallocate)
{
Marshal.FreeCoTaskMem(pInput);
pInput = IntPtr.Zero;
}
}
if (deallocate)
{
Marshal.FreeCoTaskMem(pInput);
pInput = IntPtr.Zero;
}
}
return output;
}
return output;
}
/// <summary>
/// Unmarshals and deallocates an OPCHDA_ITEM structure.
/// </summary>
internal static TsCHdaItemValueCollection GetItemValueCollection(IntPtr pInput, bool deallocate)
{
TsCHdaItemValueCollection output = null;
/// <summary>
/// Unmarshals and deallocates an OPCHDA_ITEM structure.
/// </summary>
internal static TsCHdaItemValueCollection GetItemValueCollection(IntPtr pInput, bool deallocate)
{
TsCHdaItemValueCollection output = null;
if (pInput != IntPtr.Zero)
{
var item = Marshal.PtrToStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_ITEM));
if (pInput != IntPtr.Zero)
{
var item = Marshal.PtrToStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_ITEM));
output = GetItemValueCollection((OpcRcw.Hda.OPCHDA_ITEM)item, deallocate);
output = GetItemValueCollection((OpcRcw.Hda.OPCHDA_ITEM)item, deallocate);
if (deallocate)
{
Marshal.DestroyStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_ITEM));
}
}
if (deallocate)
{
Marshal.DestroyStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_ITEM));
}
}
return output;
}
return output;
}
/// <summary>
/// Unmarshals and deallocates an OPCHDA_ITEM structure.
/// </summary>
internal static TsCHdaItemValueCollection GetItemValueCollection(OpcRcw.Hda.OPCHDA_ITEM input, bool deallocate)
{
var output = new TsCHdaItemValueCollection();
/// <summary>
/// Unmarshals and deallocates an OPCHDA_ITEM structure.
/// </summary>
internal static TsCHdaItemValueCollection GetItemValueCollection(OpcRcw.Hda.OPCHDA_ITEM input, bool deallocate)
{
var output = new TsCHdaItemValueCollection();
output.ClientHandle = input.hClient;
output.Aggregate = input.haAggregate;
output.ClientHandle = input.hClient;
output.Aggregate = input.haAggregate;
var values = Com.Interop.GetVARIANTs(ref input.pvDataValues, input.dwCount, deallocate);
var timestamps = Utilities.Interop.GetDateTimes(ref input.pftTimeStamps, input.dwCount, deallocate);
var qualities = Utilities.Interop.GetInt32s(ref input.pdwQualities, input.dwCount, deallocate);
var timestamps = Utilities.Interop.GetDateTimes(ref input.pftTimeStamps, input.dwCount, deallocate);
var qualities = Utilities.Interop.GetInt32s(ref input.pdwQualities, input.dwCount, deallocate);
for (var ii = 0; ii < input.dwCount; ii++)
{
var value = new TsCHdaItemValue();
for (var ii = 0; ii < input.dwCount; ii++)
{
var value = new TsCHdaItemValue();
value.Value = values[ii];
value.Timestamp = timestamps[ii];
value.Value = values[ii];
value.Timestamp = timestamps[ii];
value.Quality = new TsCDaQuality((short)(qualities[ii] & 0x0000FFFF));
value.HistorianQuality = (TsCHdaQuality)((int)(qualities[ii] & 0xFFFF0000));
output.Add(value);
}
output.Add(value);
}
return output;
}
return output;
}
/// <summary>
/// Unmarshals and deallocates an array of OPCHDA_MODIFIEDITEM structures.
/// </summary>
internal static TsCHdaModifiedValueCollection[] GetModifiedValueCollections(ref IntPtr pInput, int count, bool deallocate)
{
TsCHdaModifiedValueCollection[] output = null;
/// <summary>
/// Unmarshals and deallocates an array of OPCHDA_MODIFIEDITEM structures.
/// </summary>
internal static TsCHdaModifiedValueCollection[] GetModifiedValueCollections(ref IntPtr pInput, int count, bool deallocate)
{
TsCHdaModifiedValueCollection[] output = null;
if (pInput != IntPtr.Zero && count > 0)
{
output = new TsCHdaModifiedValueCollection[count];
if (pInput != IntPtr.Zero && count > 0)
{
output = new TsCHdaModifiedValueCollection[count];
var pos = pInput;
var pos = pInput;
for (var ii = 0; ii < count; ii++)
{
output[ii] = GetModifiedValueCollection(pos, deallocate);
for (var ii = 0; ii < count; ii++)
{
output[ii] = GetModifiedValueCollection(pos, deallocate);
pos = (IntPtr)(pos.ToInt64() + Marshal.SizeOf(typeof(OpcRcw.Hda.OPCHDA_MODIFIEDITEM)));
}
}
if (deallocate)
{
Marshal.FreeCoTaskMem(pInput);
pInput = IntPtr.Zero;
}
}
if (deallocate)
{
Marshal.FreeCoTaskMem(pInput);
pInput = IntPtr.Zero;
}
}
return output;
}
return output;
}
/// <summary>
/// Unmarshals and deallocates an OPCHDA_MODIFIEDITEM structure.
/// </summary>
internal static TsCHdaModifiedValueCollection GetModifiedValueCollection(IntPtr pInput, bool deallocate)
{
TsCHdaModifiedValueCollection output = null;
/// <summary>
/// Unmarshals and deallocates an OPCHDA_MODIFIEDITEM structure.
/// </summary>
internal static TsCHdaModifiedValueCollection GetModifiedValueCollection(IntPtr pInput, bool deallocate)
{
TsCHdaModifiedValueCollection output = null;
if (pInput != IntPtr.Zero)
{
var item = Marshal.PtrToStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_MODIFIEDITEM));
if (pInput != IntPtr.Zero)
{
var item = Marshal.PtrToStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_MODIFIEDITEM));
output = GetModifiedValueCollection((OpcRcw.Hda.OPCHDA_MODIFIEDITEM)item, deallocate);
output = GetModifiedValueCollection((OpcRcw.Hda.OPCHDA_MODIFIEDITEM)item, deallocate);
if (deallocate)
{
Marshal.DestroyStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_MODIFIEDITEM));
}
}
if (deallocate)
{
Marshal.DestroyStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_MODIFIEDITEM));
}
}
return output;
}
return output;
}
/// <summary>
/// Unmarshals and deallocates an OPCHDA_MODIFIEDITEM structure.
/// </summary>
internal static TsCHdaModifiedValueCollection GetModifiedValueCollection(OpcRcw.Hda.OPCHDA_MODIFIEDITEM input, bool deallocate)
{
var output = new TsCHdaModifiedValueCollection();
/// <summary>
/// Unmarshals and deallocates an OPCHDA_MODIFIEDITEM structure.
/// </summary>
internal static TsCHdaModifiedValueCollection GetModifiedValueCollection(OpcRcw.Hda.OPCHDA_MODIFIEDITEM input, bool deallocate)
{
var output = new TsCHdaModifiedValueCollection();
output.ClientHandle = input.hClient;
output.ClientHandle = input.hClient;
var values = Com.Interop.GetVARIANTs(ref input.pvDataValues, input.dwCount, deallocate);
var timestamps = Utilities.Interop.GetDateTimes(ref input.pftTimeStamps, input.dwCount, deallocate);
var qualities = Utilities.Interop.GetInt32s(ref input.pdwQualities, input.dwCount, deallocate);
var modificationTimes = Utilities.Interop.GetDateTimes(ref input.pftModificationTime, input.dwCount, deallocate);
var editTypes = Utilities.Interop.GetInt32s(ref input.pEditType, input.dwCount, deallocate);
var users = Utilities.Interop.GetUnicodeStrings(ref input.szUser, input.dwCount, deallocate);
var timestamps = Utilities.Interop.GetDateTimes(ref input.pftTimeStamps, input.dwCount, deallocate);
var qualities = Utilities.Interop.GetInt32s(ref input.pdwQualities, input.dwCount, deallocate);
var modificationTimes = Utilities.Interop.GetDateTimes(ref input.pftModificationTime, input.dwCount, deallocate);
var editTypes = Utilities.Interop.GetInt32s(ref input.pEditType, input.dwCount, deallocate);
var users = Utilities.Interop.GetUnicodeStrings(ref input.szUser, input.dwCount, deallocate);
for (var ii = 0; ii < input.dwCount; ii++)
{
var value = new TsCHdaModifiedValue();
for (var ii = 0; ii < input.dwCount; ii++)
{
var value = new TsCHdaModifiedValue();
value.Value = values[ii];
value.Timestamp = timestamps[ii];
value.Value = values[ii];
value.Timestamp = timestamps[ii];
value.Quality = new TsCDaQuality((short)(qualities[ii] & 0x0000FFFF));
value.HistorianQuality = (TsCHdaQuality)((int)(qualities[ii] & 0xFFFF0000));
value.ModificationTime = modificationTimes[ii];
value.EditType = (TsCHdaEditType)editTypes[ii];
value.User = users[ii];
value.ModificationTime = modificationTimes[ii];
value.EditType = (TsCHdaEditType)editTypes[ii];
value.User = users[ii];
output.Add(value);
}
output.Add(value);
}
return output;
}
return output;
}
/// <summary>
/// Unmarshals and deallocates an array of OPCHDA_ATTRIBUTE structures.
/// </summary>
internal static TsCHdaAttributeValueCollection[] GetAttributeValueCollections(ref IntPtr pInput, int count, bool deallocate)
{
TsCHdaAttributeValueCollection[] output = null;
/// <summary>
/// Unmarshals and deallocates an array of OPCHDA_ATTRIBUTE structures.
/// </summary>
internal static TsCHdaAttributeValueCollection[] GetAttributeValueCollections(ref IntPtr pInput, int count, bool deallocate)
{
TsCHdaAttributeValueCollection[] output = null;
if (pInput != IntPtr.Zero && count > 0)
{
output = new TsCHdaAttributeValueCollection[count];
if (pInput != IntPtr.Zero && count > 0)
{
output = new TsCHdaAttributeValueCollection[count];
var pos = pInput;
var pos = pInput;
for (var ii = 0; ii < count; ii++)
{
output[ii] = GetAttributeValueCollection(pos, deallocate);
for (var ii = 0; ii < count; ii++)
{
output[ii] = GetAttributeValueCollection(pos, deallocate);
pos = (IntPtr)(pos.ToInt64() + Marshal.SizeOf(typeof(OpcRcw.Hda.OPCHDA_ATTRIBUTE)));
}
}
if (deallocate)
{
Marshal.FreeCoTaskMem(pInput);
pInput = IntPtr.Zero;
}
}
if (deallocate)
{
Marshal.FreeCoTaskMem(pInput);
pInput = IntPtr.Zero;
}
}
return output;
}
return output;
}
/// <summary>
/// Unmarshals and deallocates an OPCHDA_ATTRIBUTE structure.
/// </summary>
internal static TsCHdaAttributeValueCollection GetAttributeValueCollection(IntPtr pInput, bool deallocate)
{
TsCHdaAttributeValueCollection output = null;
/// <summary>
/// Unmarshals and deallocates an OPCHDA_ATTRIBUTE structure.
/// </summary>
internal static TsCHdaAttributeValueCollection GetAttributeValueCollection(IntPtr pInput, bool deallocate)
{
TsCHdaAttributeValueCollection output = null;
if (pInput != IntPtr.Zero)
{
var item = Marshal.PtrToStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_ATTRIBUTE));
if (pInput != IntPtr.Zero)
{
var item = Marshal.PtrToStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_ATTRIBUTE));
output = GetAttributeValueCollection((OpcRcw.Hda.OPCHDA_ATTRIBUTE)item, deallocate);
output = GetAttributeValueCollection((OpcRcw.Hda.OPCHDA_ATTRIBUTE)item, deallocate);
if (deallocate)
{
Marshal.DestroyStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_ATTRIBUTE));
}
}
if (deallocate)
{
Marshal.DestroyStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_ATTRIBUTE));
}
}
return output;
}
return output;
}
/// <summary>
/// Unmarshals and deallocates an OPCHDA_ATTRIBUTE structure.
/// </summary>
internal static TsCHdaAttributeValueCollection GetAttributeValueCollection(OpcRcw.Hda.OPCHDA_ATTRIBUTE input, bool deallocate)
{
var output = new TsCHdaAttributeValueCollection();
/// <summary>
/// Unmarshals and deallocates an OPCHDA_ATTRIBUTE structure.
/// </summary>
internal static TsCHdaAttributeValueCollection GetAttributeValueCollection(OpcRcw.Hda.OPCHDA_ATTRIBUTE input, bool deallocate)
{
var output = new TsCHdaAttributeValueCollection();
output.AttributeID = input.dwAttributeID;
output.AttributeID = input.dwAttributeID;
var values = Com.Interop.GetVARIANTs(ref input.vAttributeValues, input.dwNumValues, deallocate);
var timestamps = Utilities.Interop.GetDateTimes(ref input.ftTimeStamps, input.dwNumValues, deallocate);
var timestamps = Utilities.Interop.GetDateTimes(ref input.ftTimeStamps, input.dwNumValues, deallocate);
for (var ii = 0; ii < input.dwNumValues; ii++)
{
var value = new TsCHdaAttributeValue();
for (var ii = 0; ii < input.dwNumValues; ii++)
{
var value = new TsCHdaAttributeValue();
value.Value = values[ii];
value.Timestamp = timestamps[ii];
value.Value = values[ii];
value.Timestamp = timestamps[ii];
output.Add(value);
}
output.Add(value);
}
return output;
}
return output;
}
/// <summary>
/// Unmarshals and deallocates an array of OPCHDA_ANNOTATION structures.
/// </summary>
internal static TsCHdaAnnotationValueCollection[] GetAnnotationValueCollections(ref IntPtr pInput, int count, bool deallocate)
{
TsCHdaAnnotationValueCollection[] output = null;
/// <summary>
/// Unmarshals and deallocates an array of OPCHDA_ANNOTATION structures.
/// </summary>
internal static TsCHdaAnnotationValueCollection[] GetAnnotationValueCollections(ref IntPtr pInput, int count, bool deallocate)
{
TsCHdaAnnotationValueCollection[] output = null;
if (pInput != IntPtr.Zero && count > 0)
{
output = new TsCHdaAnnotationValueCollection[count];
if (pInput != IntPtr.Zero && count > 0)
{
output = new TsCHdaAnnotationValueCollection[count];
var pos = pInput;
var pos = pInput;
for (var ii = 0; ii < count; ii++)
{
output[ii] = GetAnnotationValueCollection(pos, deallocate);
for (var ii = 0; ii < count; ii++)
{
output[ii] = GetAnnotationValueCollection(pos, deallocate);
pos = (IntPtr)(pos.ToInt64() + Marshal.SizeOf(typeof(OpcRcw.Hda.OPCHDA_ANNOTATION)));
}
}
if (deallocate)
{
Marshal.FreeCoTaskMem(pInput);
pInput = IntPtr.Zero;
}
}
if (deallocate)
{
Marshal.FreeCoTaskMem(pInput);
pInput = IntPtr.Zero;
}
}
return output;
}
return output;
}
/// <summary>
/// Unmarshals and deallocates an OPCHDA_ANNOTATION structure.
/// </summary>
internal static TsCHdaAnnotationValueCollection GetAnnotationValueCollection(IntPtr pInput, bool deallocate)
{
TsCHdaAnnotationValueCollection output = null;
/// <summary>
/// Unmarshals and deallocates an OPCHDA_ANNOTATION structure.
/// </summary>
internal static TsCHdaAnnotationValueCollection GetAnnotationValueCollection(IntPtr pInput, bool deallocate)
{
TsCHdaAnnotationValueCollection output = null;
if (pInput != IntPtr.Zero)
{
var item = Marshal.PtrToStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_ANNOTATION));
if (pInput != IntPtr.Zero)
{
var item = Marshal.PtrToStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_ANNOTATION));
output = GetAnnotationValueCollection((OpcRcw.Hda.OPCHDA_ANNOTATION)item, deallocate);
output = GetAnnotationValueCollection((OpcRcw.Hda.OPCHDA_ANNOTATION)item, deallocate);
if (deallocate)
{
Marshal.DestroyStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_ANNOTATION));
}
}
if (deallocate)
{
Marshal.DestroyStructure(pInput, typeof(OpcRcw.Hda.OPCHDA_ANNOTATION));
}
}
return output;
}
return output;
}
/// <summary>
/// Unmarshals and deallocates an OPCHDA_ANNOTATION structure.
/// </summary>
internal static TsCHdaAnnotationValueCollection GetAnnotationValueCollection(OpcRcw.Hda.OPCHDA_ANNOTATION input, bool deallocate)
{
var output = new TsCHdaAnnotationValueCollection();
/// <summary>
/// Unmarshals and deallocates an OPCHDA_ANNOTATION structure.
/// </summary>
internal static TsCHdaAnnotationValueCollection GetAnnotationValueCollection(OpcRcw.Hda.OPCHDA_ANNOTATION input, bool deallocate)
{
var output = new TsCHdaAnnotationValueCollection();
output.ClientHandle = input.hClient;
output.ClientHandle = input.hClient;
var timestamps = Utilities.Interop.GetDateTimes(ref input.ftTimeStamps, input.dwNumValues, deallocate);
var annotations = Utilities.Interop.GetUnicodeStrings(ref input.szAnnotation, input.dwNumValues, deallocate);
var creationTimes = Utilities.Interop.GetDateTimes(ref input.ftAnnotationTime, input.dwNumValues, deallocate);
var users = Utilities.Interop.GetUnicodeStrings(ref input.szUser, input.dwNumValues, deallocate);
var timestamps = Utilities.Interop.GetDateTimes(ref input.ftTimeStamps, input.dwNumValues, deallocate);
var annotations = Utilities.Interop.GetUnicodeStrings(ref input.szAnnotation, input.dwNumValues, deallocate);
var creationTimes = Utilities.Interop.GetDateTimes(ref input.ftAnnotationTime, input.dwNumValues, deallocate);
var users = Utilities.Interop.GetUnicodeStrings(ref input.szUser, input.dwNumValues, deallocate);
for (var ii = 0; ii < input.dwNumValues; ii++)
{
var value = new TsCHdaAnnotationValue();
for (var ii = 0; ii < input.dwNumValues; ii++)
{
var value = new TsCHdaAnnotationValue();
value.Timestamp = timestamps[ii];
value.Annotation = annotations[ii];
value.CreationTime = creationTimes[ii];
value.User = users[ii];
value.Timestamp = timestamps[ii];
value.Annotation = annotations[ii];
value.CreationTime = creationTimes[ii];
value.User = users[ii];
output.Add(value);
}
output.Add(value);
}
return output;
}
}
return output;
}
}
}

View File

@@ -60,8 +60,8 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
public Request(object requestHandle, Delegate callback, int requestID)
{
m_requestHandle = requestHandle;
m_callback = callback;
m_requestID = requestID;
m_callback = callback;
m_requestID = requestID;
}
/// <summary>
@@ -372,7 +372,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
if (typeof(ITsCHdaActualTime).IsInstanceOfType(result))
{
((ITsCHdaActualTime)result).StartTime = StartTime;
((ITsCHdaActualTime)result).EndTime = EndTime;
((ITsCHdaActualTime)result).EndTime = EndTime;
}
// add item identifier to value collection.
@@ -380,8 +380,8 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
if (itemID != null)
{
result.ItemName = itemID.ItemName;
result.ItemPath = itemID.ItemPath;
result.ItemName = itemID.ItemName;
result.ItemPath = itemID.ItemPath;
result.ServerHandle = itemID.ServerHandle;
result.ClientHandle = itemID.ClientHandle;
}

View File

@@ -34,35 +34,35 @@ namespace Technosoftware.DaAeHdaClient.Com
internal struct Result
{
/// <remarks/>
public const int E_MAXEXCEEDED = -0X3FFBEFFF; // 0xC0041001
public const int E_MAXEXCEEDED = -0X3FFBEFFF; // 0xC0041001
/// <remarks/>
public const int S_NODATA = +0x40041002; // 0x40041002
public const int S_NODATA = +0x40041002; // 0x40041002
/// <remarks/>
public const int S_MOREDATA = +0x40041003; // 0x40041003
public const int S_MOREDATA = +0x40041003; // 0x40041003
/// <remarks/>
public const int E_INVALIDAGGREGATE = -0X3FFBEFFC; // 0xC0041004
/// <remarks/>
public const int S_CURRENTVALUE = +0x40041005; // 0x40041005
public const int S_CURRENTVALUE = +0x40041005; // 0x40041005
/// <remarks/>
public const int S_EXTRADATA = +0x40041006; // 0x40041006
public const int S_EXTRADATA = +0x40041006; // 0x40041006
/// <remarks/>
public const int W_NOFILTER = -0x7FFBEFF9; // 0x80041007
public const int W_NOFILTER = -0x7FFBEFF9; // 0x80041007
/// <remarks/>
public const int E_UNKNOWNATTRID = -0x3FFBEFF8; // 0xC0041008
public const int E_UNKNOWNATTRID = -0x3FFBEFF8; // 0xC0041008
/// <remarks/>
public const int E_NOT_AVAIL = -0x3FFBEFF7; // 0xC0041009
public const int E_NOT_AVAIL = -0x3FFBEFF7; // 0xC0041009
/// <remarks/>
public const int E_INVALIDDATATYPE = -0x3FFBEFF6; // 0xC004100A
public const int E_INVALIDDATATYPE = -0x3FFBEFF6; // 0xC004100A
/// <remarks/>
public const int E_DATAEXISTS = -0x3FFBEFF5; // 0xC004100B
public const int E_DATAEXISTS = -0x3FFBEFF5; // 0xC004100B
/// <remarks/>
public const int E_INVALIDATTRID = -0x3FFBEFF4; // 0xC004100C
public const int E_INVALIDATTRID = -0x3FFBEFF4; // 0xC004100C
/// <remarks/>
public const int E_NODATAEXISTS = -0x3FFBEFF3; // 0xC004100D
public const int E_NODATAEXISTS = -0x3FFBEFF3; // 0xC004100D
/// <remarks/>
public const int S_INSERTED = +0x4004100E; // 0x4004100E
public const int S_INSERTED = +0x4004100E; // 0x4004100E
/// <remarks/>
public const int S_REPLACED = +0x4004100F; // 0x4004100F
public const int S_REPLACED = +0x4004100F; // 0x4004100F
}
}
}

View File

@@ -3175,8 +3175,8 @@ namespace Technosoftware.DaAeHdaClient.Com.Hda
OPCHDA_TIME pEndTime)
{
// unmarshal actual times from input arguments.
var startTime = Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(Interop.Convert(pStartTime.ftTime));
var endTime = Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(Interop.Convert(pEndTime.ftTime));
var startTime = Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(Interop.Convert(pStartTime.ftTime));
var endTime = Technosoftware.DaAeHdaClient.Com.Interop.GetFILETIME(Interop.Convert(pEndTime.ftTime));
foreach (var result in results)
{

View File

@@ -22,12 +22,11 @@
#region Using Directives
using System;
using System.Net;
using System.Globalization;
using System.Net;
using System.Runtime.InteropServices;
using Technosoftware.DaAeHdaClient.Da;
using Technosoftware.DaAeHdaClient.Com.Utilities;
using Technosoftware.DaAeHdaClient.Da;
#endregion
#pragma warning disable 0618
@@ -859,7 +858,8 @@ namespace Technosoftware.DaAeHdaClient.Com
/// <summary>
/// This flag suppresses the conversion to local time done during marshalling.
/// </summary>
public static bool PreserveUtc {
public static bool PreserveUtc
{
get { lock (typeof(Interop)) { return DaAeHdaClient.ApplicationInstance.TimeAsUtc; } }
set { lock (typeof(Interop)) { DaAeHdaClient.ApplicationInstance.TimeAsUtc = value; } }
}
@@ -1387,22 +1387,22 @@ namespace Technosoftware.DaAeHdaClient.Com
case Ae.Result.E_NOINFO: return new OpcResult(OpcResult.Ae.E_NOINFO, input);
default:
{
// check for RPC error.
if ((input & 0x7FFF0000) == 0x00010000)
{
return new OpcResult(OpcResult.E_NETWORK_ERROR, input);
}
// check for RPC error.
if ((input & 0x7FFF0000) == 0x00010000)
{
return new OpcResult(OpcResult.E_NETWORK_ERROR, input);
}
// chekc for success code.
if (input >= 0)
{
return new OpcResult(OpcResult.S_FALSE, input);
}
// chekc for success code.
if (input >= 0)
{
return new OpcResult(OpcResult.S_FALSE, input);
}
// return generic error.
return new OpcResult(OpcResult.E_FAIL, input);
}
// return generic error.
return new OpcResult(OpcResult.E_FAIL, input);
}
}
}
@@ -1410,79 +1410,79 @@ namespace Technosoftware.DaAeHdaClient.Com
/// Converts a result id to an HRESULT.
/// </summary>
internal static int GetResultID(OpcResult input)
{
// data access.
if (input.Name != null && input.Name.Namespace == OpcNamespace.OPC_DATA_ACCESS)
{
if (input == OpcResult.S_OK) return Da.Result.S_OK;
if (input == OpcResult.E_FAIL) return Da.Result.E_FAIL;
if (input == OpcResult.E_INVALIDARG) return Da.Result.E_INVALIDARG;
if (input == OpcResult.Da.E_BADTYPE) return Da.Result.E_BADTYPE;
if (input == OpcResult.Da.E_READONLY) return Da.Result.E_BADRIGHTS;
if (input == OpcResult.Da.E_WRITEONLY) return Da.Result.E_BADRIGHTS;
if (input == OpcResult.Da.E_RANGE) return Da.Result.E_RANGE;
if (input == OpcResult.E_OUTOFMEMORY) return Da.Result.E_OUTOFMEMORY;
if (input == OpcResult.E_NOTSUPPORTED) return Da.Result.E_NOINTERFACE;
if (input == OpcResult.Da.E_INVALIDHANDLE) return Da.Result.E_INVALIDHANDLE;
if (input == OpcResult.Da.E_UNKNOWN_ITEM_NAME) return Da.Result.E_UNKNOWNITEMID;
if (input == OpcResult.Da.E_INVALID_ITEM_NAME) return Da.Result.E_INVALIDITEMID;
if (input == OpcResult.Da.E_INVALID_ITEM_PATH) return Da.Result.E_INVALIDITEMID;
if (input == OpcResult.Da.E_UNKNOWN_ITEM_PATH) return Da.Result.E_UNKNOWNPATH;
if (input == OpcResult.Da.E_INVALID_FILTER) return Da.Result.E_INVALIDFILTER;
if (input == OpcResult.Da.S_UNSUPPORTEDRATE) return Da.Result.S_UNSUPPORTEDRATE;
if (input == OpcResult.Da.S_CLAMP) return Da.Result.S_CLAMP;
if (input == OpcResult.Da.E_INVALID_PID) return Da.Result.E_INVALID_PID;
if (input == OpcResult.Da.E_NO_ITEM_DEADBAND) return Da.Result.E_DEADBANDNOTSUPPORTED;
if (input == OpcResult.Da.E_NO_ITEM_BUFFERING) return Da.Result.E_NOBUFFERING;
if (input == OpcResult.Da.E_NO_WRITEQT) return Da.Result.E_NOTSUPPORTED;
if (input == OpcResult.Da.E_INVALIDCONTINUATIONPOINT) return Da.Result.E_INVALIDCONTINUATIONPOINT;
if (input == OpcResult.Da.S_DATAQUEUEOVERFLOW) return Da.Result.S_DATAQUEUEOVERFLOW;
}
{
// data access.
if (input.Name != null && input.Name.Namespace == OpcNamespace.OPC_DATA_ACCESS)
{
if (input == OpcResult.S_OK) return Da.Result.S_OK;
if (input == OpcResult.E_FAIL) return Da.Result.E_FAIL;
if (input == OpcResult.E_INVALIDARG) return Da.Result.E_INVALIDARG;
if (input == OpcResult.Da.E_BADTYPE) return Da.Result.E_BADTYPE;
if (input == OpcResult.Da.E_READONLY) return Da.Result.E_BADRIGHTS;
if (input == OpcResult.Da.E_WRITEONLY) return Da.Result.E_BADRIGHTS;
if (input == OpcResult.Da.E_RANGE) return Da.Result.E_RANGE;
if (input == OpcResult.E_OUTOFMEMORY) return Da.Result.E_OUTOFMEMORY;
if (input == OpcResult.E_NOTSUPPORTED) return Da.Result.E_NOINTERFACE;
if (input == OpcResult.Da.E_INVALIDHANDLE) return Da.Result.E_INVALIDHANDLE;
if (input == OpcResult.Da.E_UNKNOWN_ITEM_NAME) return Da.Result.E_UNKNOWNITEMID;
if (input == OpcResult.Da.E_INVALID_ITEM_NAME) return Da.Result.E_INVALIDITEMID;
if (input == OpcResult.Da.E_INVALID_ITEM_PATH) return Da.Result.E_INVALIDITEMID;
if (input == OpcResult.Da.E_UNKNOWN_ITEM_PATH) return Da.Result.E_UNKNOWNPATH;
if (input == OpcResult.Da.E_INVALID_FILTER) return Da.Result.E_INVALIDFILTER;
if (input == OpcResult.Da.S_UNSUPPORTEDRATE) return Da.Result.S_UNSUPPORTEDRATE;
if (input == OpcResult.Da.S_CLAMP) return Da.Result.S_CLAMP;
if (input == OpcResult.Da.E_INVALID_PID) return Da.Result.E_INVALID_PID;
if (input == OpcResult.Da.E_NO_ITEM_DEADBAND) return Da.Result.E_DEADBANDNOTSUPPORTED;
if (input == OpcResult.Da.E_NO_ITEM_BUFFERING) return Da.Result.E_NOBUFFERING;
if (input == OpcResult.Da.E_NO_WRITEQT) return Da.Result.E_NOTSUPPORTED;
if (input == OpcResult.Da.E_INVALIDCONTINUATIONPOINT) return Da.Result.E_INVALIDCONTINUATIONPOINT;
if (input == OpcResult.Da.S_DATAQUEUEOVERFLOW) return Da.Result.S_DATAQUEUEOVERFLOW;
}
// complex data.
else if (input.Name != null && input.Name.Namespace == OpcNamespace.OPC_COMPLEX_DATA)
{
if (input == OpcResult.Cpx.E_TYPE_CHANGED) return Cpx.Result.E_TYPE_CHANGED;
if (input == OpcResult.Cpx.E_FILTER_DUPLICATE) return Cpx.Result.E_FILTER_DUPLICATE;
if (input == OpcResult.Cpx.E_FILTER_INVALID) return Cpx.Result.E_FILTER_INVALID;
if (input == OpcResult.Cpx.E_FILTER_ERROR) return Cpx.Result.E_FILTER_ERROR;
if (input == OpcResult.Cpx.S_FILTER_NO_DATA) return Cpx.Result.S_FILTER_NO_DATA;
}
// complex data.
else if (input.Name != null && input.Name.Namespace == OpcNamespace.OPC_COMPLEX_DATA)
{
if (input == OpcResult.Cpx.E_TYPE_CHANGED) return Cpx.Result.E_TYPE_CHANGED;
if (input == OpcResult.Cpx.E_FILTER_DUPLICATE) return Cpx.Result.E_FILTER_DUPLICATE;
if (input == OpcResult.Cpx.E_FILTER_INVALID) return Cpx.Result.E_FILTER_INVALID;
if (input == OpcResult.Cpx.E_FILTER_ERROR) return Cpx.Result.E_FILTER_ERROR;
if (input == OpcResult.Cpx.S_FILTER_NO_DATA) return Cpx.Result.S_FILTER_NO_DATA;
}
// historical data access.
else if (input.Name != null && input.Name.Namespace == OpcNamespace.OPC_HISTORICAL_DATA_ACCESS)
{
if (input == OpcResult.Hda.E_MAXEXCEEDED) return Hda.Result.E_MAXEXCEEDED;
if (input == OpcResult.Hda.S_NODATA) return Hda.Result.S_NODATA;
if (input == OpcResult.Hda.S_MOREDATA) return Hda.Result.S_MOREDATA;
if (input == OpcResult.Hda.E_INVALIDAGGREGATE) return Hda.Result.E_INVALIDAGGREGATE;
if (input == OpcResult.Hda.S_CURRENTVALUE) return Hda.Result.S_CURRENTVALUE;
if (input == OpcResult.Hda.S_EXTRADATA) return Hda.Result.S_EXTRADATA;
if (input == OpcResult.Hda.E_UNKNOWNATTRID) return Hda.Result.E_UNKNOWNATTRID;
if (input == OpcResult.Hda.E_NOT_AVAIL) return Hda.Result.E_NOT_AVAIL;
if (input == OpcResult.Hda.E_INVALIDDATATYPE) return Hda.Result.E_INVALIDDATATYPE;
if (input == OpcResult.Hda.E_DATAEXISTS) return Hda.Result.E_DATAEXISTS;
if (input == OpcResult.Hda.E_INVALIDATTRID) return Hda.Result.E_INVALIDATTRID;
if (input == OpcResult.Hda.E_NODATAEXISTS) return Hda.Result.E_NODATAEXISTS;
if (input == OpcResult.Hda.S_INSERTED) return Hda.Result.S_INSERTED;
if (input == OpcResult.Hda.S_REPLACED) return Hda.Result.S_REPLACED;
}
// historical data access.
else if (input.Name != null && input.Name.Namespace == OpcNamespace.OPC_HISTORICAL_DATA_ACCESS)
{
if (input == OpcResult.Hda.E_MAXEXCEEDED) return Hda.Result.E_MAXEXCEEDED;
if (input == OpcResult.Hda.S_NODATA) return Hda.Result.S_NODATA;
if (input == OpcResult.Hda.S_MOREDATA) return Hda.Result.S_MOREDATA;
if (input == OpcResult.Hda.E_INVALIDAGGREGATE) return Hda.Result.E_INVALIDAGGREGATE;
if (input == OpcResult.Hda.S_CURRENTVALUE) return Hda.Result.S_CURRENTVALUE;
if (input == OpcResult.Hda.S_EXTRADATA) return Hda.Result.S_EXTRADATA;
if (input == OpcResult.Hda.E_UNKNOWNATTRID) return Hda.Result.E_UNKNOWNATTRID;
if (input == OpcResult.Hda.E_NOT_AVAIL) return Hda.Result.E_NOT_AVAIL;
if (input == OpcResult.Hda.E_INVALIDDATATYPE) return Hda.Result.E_INVALIDDATATYPE;
if (input == OpcResult.Hda.E_DATAEXISTS) return Hda.Result.E_DATAEXISTS;
if (input == OpcResult.Hda.E_INVALIDATTRID) return Hda.Result.E_INVALIDATTRID;
if (input == OpcResult.Hda.E_NODATAEXISTS) return Hda.Result.E_NODATAEXISTS;
if (input == OpcResult.Hda.S_INSERTED) return Hda.Result.S_INSERTED;
if (input == OpcResult.Hda.S_REPLACED) return Hda.Result.S_REPLACED;
}
// check for custom code.
else if (input.Code == -1)
{
// default success code.
if (input.Succeeded())
{
return Da.Result.S_FALSE;
}
// check for custom code.
else if (input.Code == -1)
{
// default success code.
if (input.Succeeded())
{
return Da.Result.S_FALSE;
}
// default error code.
return Da.Result.E_FAIL;
}
// default error code.
return Da.Result.E_FAIL;
}
// return custom code.
return input.Code;
// return custom code.
return input.Code;
}
/// <summary>

View File

@@ -23,12 +23,11 @@
#region Using Directives
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Net;
using System.Globalization;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
using Technosoftware.DaAeHdaClient.Utilities;
#endregion
@@ -264,11 +263,11 @@ namespace Technosoftware.DaAeHdaClient.Com
[DllImport("ole32.dll")]
private static extern int CoQueryProxyBlanket(
[MarshalAs(UnmanagedType.IUnknown)]
object pProxy,
object pProxy,
ref uint pAuthnSvc,
ref uint pAuthzSvc,
[MarshalAs(UnmanagedType.LPWStr)]
ref string pServerPrincName,
ref string pServerPrincName,
ref uint pAuthnLevel,
ref uint pImpLevel,
ref IntPtr pAuthInfo,
@@ -277,7 +276,7 @@ namespace Technosoftware.DaAeHdaClient.Com
[DllImport("ole32.dll")]
private static extern int CoSetProxyBlanket(
[MarshalAs(UnmanagedType.IUnknown)]
object pProxy,
object pProxy,
uint pAuthnSvc,
uint pAuthzSvc,
IntPtr pServerPrincName,
@@ -347,13 +346,13 @@ namespace Technosoftware.DaAeHdaClient.Com
private static extern int CoCreateInstanceEx(
ref Guid clsid,
[MarshalAs(UnmanagedType.IUnknown)]
object punkOuter,
object punkOuter,
uint dwClsCtx,
[In]
ref COSERVERINFO pServerInfo,
ref COSERVERINFO pServerInfo,
uint dwCount,
[In, Out]
MULTI_QI[] pResults);
MULTI_QI[] pResults);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
private struct LICINFO
@@ -372,15 +371,15 @@ namespace Technosoftware.DaAeHdaClient.Com
{
void CreateInstance(
[MarshalAs(UnmanagedType.IUnknown)]
object punkOuter,
object punkOuter,
[MarshalAs(UnmanagedType.LPStruct)]
Guid riid,
Guid riid,
[MarshalAs(UnmanagedType.Interface)]
[Out] out object ppvObject);
[Out] out object ppvObject);
void LockServer(
[MarshalAs(UnmanagedType.Bool)]
bool fLock);
bool fLock);
}
[ComImport]
@@ -390,15 +389,15 @@ namespace Technosoftware.DaAeHdaClient.Com
{
void CreateInstance(
[MarshalAs(UnmanagedType.IUnknown)]
object punkOuter,
object punkOuter,
[MarshalAs(UnmanagedType.LPStruct)]
Guid riid,
Guid riid,
[MarshalAs(UnmanagedType.Interface)]
[Out] out object ppvObject);
[Out] out object ppvObject);
void LockServer(
[MarshalAs(UnmanagedType.Bool)]
bool fLock);
bool fLock);
void GetLicInfo(
[In, Out] ref LICINFO pLicInfo);
@@ -406,31 +405,31 @@ namespace Technosoftware.DaAeHdaClient.Com
void RequestLicKey(
int dwReserved,
[MarshalAs(UnmanagedType.BStr)]
string pbstrKey);
string pbstrKey);
void CreateInstanceLic(
[MarshalAs(UnmanagedType.IUnknown)]
object punkOuter,
object punkOuter,
[MarshalAs(UnmanagedType.IUnknown)]
object punkReserved,
object punkReserved,
[MarshalAs(UnmanagedType.LPStruct)]
Guid riid,
Guid riid,
[MarshalAs(UnmanagedType.BStr)]
string bstrKey,
string bstrKey,
[MarshalAs(UnmanagedType.IUnknown)]
[Out] out object ppvObject);
[Out] out object ppvObject);
}
[DllImport("ole32.dll")]
private static extern int CoGetClassObject(
[MarshalAs(UnmanagedType.LPStruct)]
Guid clsid,
Guid clsid,
uint dwClsContext,
[In] ref COSERVERINFO pServerInfo,
[MarshalAs(UnmanagedType.LPStruct)]
Guid riid,
Guid riid,
[MarshalAs(UnmanagedType.IUnknown)]
[Out] out object ppv);
[Out] out object ppv);
internal const int LOGON32_PROVIDER_DEFAULT = 0;
internal const int LOGON32_LOGON_INTERACTIVE = 2;

View File

@@ -22,14 +22,12 @@
#region Using Directives
using System;
using System.Net;
using System.Collections;
using System.Runtime.InteropServices;
using Technosoftware.OpcRcw.Comn;
using Technosoftware.DaAeHdaClient.Ae;
using Technosoftware.DaAeHdaClient.Da;
using Technosoftware.DaAeHdaClient.Hda;
using Technosoftware.OpcRcw.Comn;
#endregion
namespace Technosoftware.DaAeHdaClient.Com
@@ -38,192 +36,192 @@ namespace Technosoftware.DaAeHdaClient.Com
/// A unique identifier for the result of an operation of an item.
/// </summary>
public class ServerEnumerator : IOpcDiscovery
{
//======================================================================
// IDisposable
{
//======================================================================
// IDisposable
/// <summary>
/// Frees all unmanaged resources
/// </summary>
public void Dispose() {}
/// <summary>
/// Frees all unmanaged resources
/// </summary>
public void Dispose() { }
//======================================================================
// IDiscovery
//======================================================================
// IDiscovery
/// <summary>
/// Enumerates hosts that may be accessed for server discovery.
/// </summary>
public string[] EnumerateHosts()
{
return Interop.EnumComputers();
}
/// <summary>
/// Enumerates hosts that may be accessed for server discovery.
/// </summary>
public string[] EnumerateHosts()
{
return Interop.EnumComputers();
}
/// <summary>
/// Returns a list of servers that support the specified interface specification.
/// </summary>
public OpcServer[] GetAvailableServers(OpcSpecification specification)
{
return GetAvailableServers(specification, null, null);
}
/// <summary>
/// Returns a list of servers that support the specified interface specification.
/// </summary>
public OpcServer[] GetAvailableServers(OpcSpecification specification)
{
return GetAvailableServers(specification, null, null);
}
/// <summary>
/// Returns a list of servers that support the specified specification on the specified host.
/// </summary>
public OpcServer[] GetAvailableServers(OpcSpecification specification, string host, OpcConnectData connectData)
{
lock (this)
{
var credentials = (connectData != null)?connectData.GetCredential(null, null):null;
// connect to the server.
m_server = (IOPCServerList2)Interop.CreateInstance(CLSID, host, credentials, connectData?.UseConnectSecurity ?? false);
m_host = host;
try
{
var servers = new ArrayList();
// convert the interface version to a guid.
var catid = new Guid(specification.Id);
// get list of servers in the specified specification.
IOPCEnumGUID enumerator = null;
m_server.EnumClassesOfCategories(
1,
new Guid[] { catid },
0,
null,
out enumerator);
// read clsids.
var clsids = ReadClasses(enumerator);
// release enumerator object.
Interop.ReleaseServer(enumerator);
enumerator = null;
// fetch class descriptions.
foreach (var clsid in clsids)
{
var factory = new Factory();
try
{
var url = CreateUrl(specification, clsid);
OpcServer server = null;
if (specification == OpcSpecification.OPC_DA_30)
{
server = new TsCDaServer(factory, url);
}
else if (specification == OpcSpecification.OPC_DA_20)
{
server = new TsCDaServer(factory, url);
}
else if (specification == OpcSpecification.OPC_AE_10)
{
server = new TsCAeServer(factory, url);
}
else if (specification == OpcSpecification.OPC_HDA_10)
{
server = new TsCHdaServer(factory, url);
}
servers.Add(server);
}
catch (Exception)
{
// ignore bad clsids.
}
}
return (OpcServer[])servers.ToArray(typeof(OpcServer));
}
finally
{
// free the server.
Interop.ReleaseServer(m_server);
m_server = null;
}
}
}
/// <summary>
/// Looks up the CLSID for the specified prog id on a remote host.
/// </summary>
public Guid CLSIDFromProgID(string progID, string host, OpcConnectData connectData)
{
lock (this)
{
var credentials = (connectData != null)?connectData.GetCredential(null, null):null;
/// <summary>
/// Returns a list of servers that support the specified specification on the specified host.
/// </summary>
public OpcServer[] GetAvailableServers(OpcSpecification specification, string host, OpcConnectData connectData)
{
lock (this)
{
var credentials = (connectData != null) ? connectData.GetCredential(null, null) : null;
// connect to the server.
m_server = (IOPCServerList2)Interop.CreateInstance(CLSID, host, credentials, connectData?.UseConnectSecurity ?? false);
m_host = host;
m_host = host;
// lookup prog id.
Guid clsid;
try
{
var servers = new ArrayList();
try
{
m_server.CLSIDFromProgID(progID, out clsid);
}
catch
{
clsid = Guid.Empty;
}
finally
{
Interop.ReleaseServer(m_server);
m_server = null;
}
// convert the interface version to a guid.
var catid = new Guid(specification.Id);
// return empty guid if prog id not found.
return clsid;
}
}
// get list of servers in the specified specification.
IOPCEnumGUID enumerator = null;
//======================================================================
// Private Members
m_server.EnumClassesOfCategories(
1,
new Guid[] { catid },
0,
null,
out enumerator);
/// <summary>
/// The server enumerator COM server.
/// </summary>
private IOPCServerList2 m_server = null;
// read clsids.
var clsids = ReadClasses(enumerator);
/// <summary>
/// The host where the servers are being enumerated.
/// </summary>
private string m_host = null;
// release enumerator object.
Interop.ReleaseServer(enumerator);
enumerator = null;
/// <summary>
/// The ProgID for the OPC Server Enumerator.
/// </summary>
private const string ProgID = "OPC.ServerList.1";
// fetch class descriptions.
foreach (var clsid in clsids)
{
var factory = new Factory();
/// <summary>
/// The CLSID for the OPC Server Enumerator.
/// </summary>
private static readonly Guid CLSID = new Guid("13486D51-4821-11D2-A494-3CB306C10000");
try
{
var url = CreateUrl(specification, clsid);
//======================================================================
// Private Methods
OpcServer server = null;
/// <summary>
/// Reads the guids from the enumerator.
/// </summary>
private Guid[] ReadClasses(IOPCEnumGUID enumerator)
{
var guids = new ArrayList();
if (specification == OpcSpecification.OPC_DA_30)
{
server = new TsCDaServer(factory, url);
}
else if (specification == OpcSpecification.OPC_DA_20)
{
server = new TsCDaServer(factory, url);
}
else if (specification == OpcSpecification.OPC_AE_10)
{
server = new TsCAeServer(factory, url);
}
else if (specification == OpcSpecification.OPC_HDA_10)
{
server = new TsCHdaServer(factory, url);
}
servers.Add(server);
}
catch (Exception)
{
// ignore bad clsids.
}
}
return (OpcServer[])servers.ToArray(typeof(OpcServer));
}
finally
{
// free the server.
Interop.ReleaseServer(m_server);
m_server = null;
}
}
}
/// <summary>
/// Looks up the CLSID for the specified prog id on a remote host.
/// </summary>
public Guid CLSIDFromProgID(string progID, string host, OpcConnectData connectData)
{
lock (this)
{
var credentials = (connectData != null) ? connectData.GetCredential(null, null) : null;
// connect to the server.
m_server = (IOPCServerList2)Interop.CreateInstance(CLSID, host, credentials, connectData?.UseConnectSecurity ?? false);
m_host = host;
// lookup prog id.
Guid clsid;
try
{
m_server.CLSIDFromProgID(progID, out clsid);
}
catch
{
clsid = Guid.Empty;
}
finally
{
Interop.ReleaseServer(m_server);
m_server = null;
}
// return empty guid if prog id not found.
return clsid;
}
}
//======================================================================
// Private Members
/// <summary>
/// The server enumerator COM server.
/// </summary>
private IOPCServerList2 m_server = null;
/// <summary>
/// The host where the servers are being enumerated.
/// </summary>
private string m_host = null;
/// <summary>
/// The ProgID for the OPC Server Enumerator.
/// </summary>
private const string ProgID = "OPC.ServerList.1";
/// <summary>
/// The CLSID for the OPC Server Enumerator.
/// </summary>
private static readonly Guid CLSID = new Guid("13486D51-4821-11D2-A494-3CB306C10000");
//======================================================================
// Private Methods
/// <summary>
/// Reads the guids from the enumerator.
/// </summary>
private Guid[] ReadClasses(IOPCEnumGUID enumerator)
{
var guids = new ArrayList();
var count = 10;
// create buffer.
var buffer = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(Guid))*count);
var buffer = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(Guid)) * count);
try
{
@@ -257,64 +255,64 @@ namespace Technosoftware.DaAeHdaClient.Com
{
Marshal.FreeCoTaskMem(buffer);
}
}
}
/// <summary>
/// Reads the server details from the enumerator.
/// </summary>
OpcUrl CreateUrl(OpcSpecification specification, Guid clsid)
{
{
// initialize the server url.
var url = new OpcUrl();
url.HostName = m_host;
url.Port = 0;
url.Path = null;
url.HostName = m_host;
url.Port = 0;
url.Path = null;
if (specification == OpcSpecification.OPC_DA_30) { url.Scheme = OpcUrlScheme.DA; }
else if (specification == OpcSpecification.OPC_DA_20) { url.Scheme = OpcUrlScheme.DA; }
else if (specification == OpcSpecification.OPC_DA_10) { url.Scheme = OpcUrlScheme.DA; }
else if (specification == OpcSpecification.OPC_AE_10) { url.Scheme = OpcUrlScheme.AE; }
else if (specification == OpcSpecification.OPC_HDA_10) { url.Scheme = OpcUrlScheme.HDA; }
if (specification == OpcSpecification.OPC_DA_30) { url.Scheme = OpcUrlScheme.DA; }
else if (specification == OpcSpecification.OPC_DA_20) { url.Scheme = OpcUrlScheme.DA; }
else if (specification == OpcSpecification.OPC_DA_10) { url.Scheme = OpcUrlScheme.DA; }
else if (specification == OpcSpecification.OPC_AE_10) { url.Scheme = OpcUrlScheme.AE; }
else if (specification == OpcSpecification.OPC_HDA_10) { url.Scheme = OpcUrlScheme.HDA; }
try
{
// fetch class details from the enumerator.
string progID = null;
string description = null;
string verIndProgID = null;
try
{
// fetch class details from the enumerator.
string progID = null;
string description = null;
string verIndProgID = null;
m_server.GetClassDetails(
ref clsid,
out progID,
out description,
out verIndProgID);
m_server.GetClassDetails(
ref clsid,
out progID,
out description,
out verIndProgID);
// create the server URL path.
if (verIndProgID != null)
{
url.Path = string.Format("{0}/{1}", verIndProgID, "{" + clsid.ToString() + "}");
}
else if (progID != null)
{
url.Path = string.Format("{0}/{1}", progID, "{" + clsid.ToString() + "}");
}
}
catch (Exception)
{
// bad value in registry.
}
finally
{
// default to the clsid if the prog is not known.
if (url.Path == null)
{
url.Path = string.Format("{0}", "{" + clsid.ToString() + "}");
}
}
// create the server URL path.
if (verIndProgID != null)
{
url.Path = string.Format("{0}/{1}", verIndProgID, "{" + clsid.ToString() + "}");
}
else if (progID != null)
{
url.Path = string.Format("{0}/{1}", progID, "{" + clsid.ToString() + "}");
}
}
catch (Exception)
{
// bad value in registry.
}
finally
{
// default to the clsid if the prog is not known.
if (url.Path == null)
{
url.Path = string.Format("{0}", "{" + clsid.ToString() + "}");
}
}
// return the server url.
return url;
}
}
// return the server url.
return url;
}
}
}

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Technosoftware.DaAeHdaClient.Utilities;

View File

@@ -22,10 +22,9 @@
#region Using Directives
using System;
using System.Net;
using System.Globalization;
using System.Net;
using System.Runtime.InteropServices;
using Technosoftware.DaAeHdaClient.Da;
#pragma warning disable 618
#endregion

View File

@@ -26,37 +26,37 @@ using System;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// Contains a writable collection attribute ids.
/// </summary>
[Serializable]
public class TsCAeAttributeCollection : OpcWriteableCollection
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Contains a writable collection attribute ids.
/// </summary>
[Serializable]
public class TsCAeAttributeCollection : OpcWriteableCollection
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Creates an empty collection.
/// </summary>
internal TsCAeAttributeCollection() : base(null, typeof(int)) { }
/// Creates an empty collection.
/// </summary>
internal TsCAeAttributeCollection() : base(null, typeof(int)) { }
/// <summary>
/// Creates a collection from an array.
/// </summary>
internal TsCAeAttributeCollection(int[] attributeIDs) : base(attributeIDs, typeof(int)) { }
/// <summary>
/// Creates a collection from an array.
/// </summary>
internal TsCAeAttributeCollection(int[] attributeIDs) : base(attributeIDs, typeof(int)) { }
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// An indexer for the collection.
/// </summary>
public new int this[int index] => (int)Array[index];
/// An indexer for the collection.
/// </summary>
public new int this[int index] => (int)Array[index];
/// <summary>
/// Returns a copy of the collection as an array.
/// </summary>
public new int[] ToArray()
{
return (int[])Array.ToArray(typeof(int));
}
{
return (int[])Array.ToArray(typeof(int));
}
#endregion
}
}
}

View File

@@ -26,23 +26,23 @@ using System;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// Contains multiple lists of the attributes indexed by category.
/// </summary>
[Serializable]
public sealed class TsCAeAttributeDictionary : OpcWriteableDictionary
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Contains multiple lists of the attributes indexed by category.
/// </summary>
[Serializable]
public sealed class TsCAeAttributeDictionary : OpcWriteableDictionary
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Constructs an empty dictionary.
/// </summary>
public TsCAeAttributeDictionary() : base(null, typeof(int), typeof(TsCAeAttributeCollection)) { }
/// Constructs an empty dictionary.
/// </summary>
public TsCAeAttributeDictionary() : base(null, typeof(int), typeof(TsCAeAttributeCollection)) { }
/// <summary>
/// Constructs an dictionary from a set of category ids.
/// </summary>
public TsCAeAttributeDictionary(int[] categoryIds)
: base(null, typeof(int), typeof(TsCAeAttributeCollection))
/// <summary>
/// Constructs an dictionary from a set of category ids.
/// </summary>
public TsCAeAttributeDictionary(int[] categoryIds)
: base(null, typeof(int), typeof(TsCAeAttributeCollection))
{
foreach (var categoryId in categoryIds)
{
@@ -51,41 +51,41 @@ namespace Technosoftware.DaAeHdaClient.Ae
}
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Gets or sets the attribute collection for the specified category.
/// </summary>
public TsCAeAttributeCollection this[int categoryId]
{
get => (TsCAeAttributeCollection)base[categoryId];
/// Gets or sets the attribute collection for the specified category.
/// </summary>
public TsCAeAttributeCollection this[int categoryId]
{
get => (TsCAeAttributeCollection)base[categoryId];
set
{
if (value != null)
{
base[categoryId] = value;
}
else
{
base[categoryId] = new TsCAeAttributeCollection();
}
}
}
{
if (value != null)
{
base[categoryId] = value;
}
else
{
base[categoryId] = new TsCAeAttributeCollection();
}
}
}
/// <summary>
/// Adds an element with the provided key and value to the IDictionary.
/// </summary>
public void Add(int key, int[] value)
{
if (value != null)
{
base.Add(key, new TsCAeAttributeCollection(value));
}
else
{
base.Add(key, new TsCAeAttributeCollection());
}
}
/// <summary>
/// Adds an element with the provided key and value to the IDictionary.
/// </summary>
public void Add(int key, int[] value)
{
if (value != null)
{
base.Add(key, new TsCAeAttributeCollection(value));
}
else
{
base.Add(key, new TsCAeAttributeCollection());
}
}
#endregion
}
}
}

View File

@@ -26,54 +26,54 @@ using System;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// The value of an attribute for an event source.
/// </summary>
[Serializable]
public class TsCAeAttributeValue : ICloneable, IOpcResult
{
#region Fields
/// <summary>
/// The value of an attribute for an event source.
/// </summary>
[Serializable]
public class TsCAeAttributeValue : ICloneable, IOpcResult
{
#region Fields
private OpcResult result_ = OpcResult.S_OK;
#endregion
#region Properties
#region Properties
/// <summary>
/// A unique identifier for the attribute.
/// </summary>
public int ID { get; set; }
/// A unique identifier for the attribute.
/// </summary>
public int ID { get; set; }
/// <summary>
/// The attribute value.
/// </summary>
public object Value { get; set; }
/// <summary>
/// The attribute value.
/// </summary>
public object Value { get; set; }
#endregion
#region IOpcResult Members
#region IOpcResult Members
/// <summary>
/// The error id for the result of an operation on an property.
/// </summary>
public OpcResult Result
{
get => result_;
/// The error id for the result of an operation on an property.
/// </summary>
public OpcResult Result
{
get => result_;
set => result_ = value;
}
/// <summary>
/// Vendor specific diagnostic information (not the localized error text).
/// </summary>
public string DiagnosticInfo { get; set; }
/// <summary>
/// Vendor specific diagnostic information (not the localized error text).
/// </summary>
public string DiagnosticInfo { get; set; }
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var clone = (TsCAeAttributeValue)MemberwiseClone();
clone.Value = OpcConvert.Clone(Value);
return clone;
}
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var clone = (TsCAeAttributeValue)MemberwiseClone();
clone.Value = OpcConvert.Clone(Value);
return clone;
}
#endregion
}
}
}

View File

@@ -32,15 +32,15 @@ namespace Technosoftware.DaAeHdaClient.Ae
[Serializable]
public class TsCAeBrowseElement
{
#region Fields
#region Fields
private TsCAeBrowseType browseType_ = TsCAeBrowseType.Area;
#endregion
#region Properties
#region Properties
/// <summary>
/// A descriptive name for element that is unique within a branch.
/// </summary>
public string Name { get; set; }
public string Name { get; set; }
/// <summary>
/// The fully qualified name for the element.
@@ -57,7 +57,7 @@ namespace Technosoftware.DaAeHdaClient.Ae
}
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>

View File

@@ -29,81 +29,81 @@ namespace Technosoftware.DaAeHdaClient.Ae
/// Stores the state of a browse operation.
/// </summary>
[Serializable]
public class TsCAeBrowsePosition : IOpcBrowsePosition
{
#region Fields
public class TsCAeBrowsePosition : IOpcBrowsePosition
{
#region Fields
private bool disposed_;
private string areaId_;
private TsCAeBrowseType browseType_;
private string browseFilter_;
private string areaId_;
private TsCAeBrowseType browseType_;
private string browseFilter_;
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
/// <summary>
/// Saves the parameters for an incomplete browse information.
/// </summary>
public TsCAeBrowsePosition(
string areaId,
TsCAeBrowseType browseType,
string browseFilter)
{
areaId_ = areaId;
browseType_ = browseType;
browseFilter_ = browseFilter;
}
/// Saves the parameters for an incomplete browse information.
/// </summary>
public TsCAeBrowsePosition(
string areaId,
TsCAeBrowseType browseType,
string browseFilter)
{
areaId_ = areaId;
browseType_ = browseType;
browseFilter_ = browseFilter;
}
/// <summary>
/// The finalizer implementation.
/// </summary>
~TsCAeBrowsePosition()
{
Dispose(false);
}
{
Dispose(false);
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public virtual void Dispose()
{
Dispose(true);
// Take yourself off the Finalization queue
// to prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
{
Dispose(true);
// Take yourself off the Finalization queue
// to prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose(bool disposing) executes in two distinct scenarios.
/// If disposing equals true, the method has been called directly
/// or indirectly by a user's code. Managed and unmanaged resources
/// can be disposed.
/// If disposing equals false, the method has been called by the
/// runtime from inside the finalizer and you should not reference
/// other objects. Only unmanaged resources can be disposed.
/// </summary>
/// <param name="disposing">If true managed and unmanaged resources can be disposed. If false only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if(!disposed_)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if(disposing)
{
}
// Release unmanaged resources. If disposing is false,
// only the following code is executed.
}
disposed_ = true;
}
/// <summary>
/// Dispose(bool disposing) executes in two distinct scenarios.
/// If disposing equals true, the method has been called directly
/// or indirectly by a user's code. Managed and unmanaged resources
/// can be disposed.
/// If disposing equals false, the method has been called by the
/// runtime from inside the finalizer and you should not reference
/// other objects. Only unmanaged resources can be disposed.
/// </summary>
/// <param name="disposing">If true managed and unmanaged resources can be disposed. If false only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if (!disposed_)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if (disposing)
{
}
// Release unmanaged resources. If disposing is false,
// only the following code is executed.
}
disposed_ = true;
}
#endregion
#region Properties
#region Properties
/// <summary>
/// The fully qualified id for the area being browsed.
/// </summary>
public string AreaID => areaId_;
/// The fully qualified id for the area being browsed.
/// </summary>
public string AreaID => areaId_;
/// <summary>
/// The type of child element being returned with the browse.
@@ -116,14 +116,14 @@ namespace Technosoftware.DaAeHdaClient.Ae
public string BrowseFilter => browseFilter_;
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a shallow copy of the object.
/// </summary>
public virtual object Clone()
{
return (TsCAeBrowsePosition)MemberwiseClone();
}
/// Creates a shallow copy of the object.
/// </summary>
public virtual object Clone()
{
return (TsCAeBrowsePosition)MemberwiseClone();
}
#endregion
}
}
}

View File

@@ -26,19 +26,19 @@
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// The type of nodes to return during a browse.
/// </summary>
public enum TsCAeBrowseType
{
/// <summary>
/// Return only nodes that are process areas.
/// </summary>
Area,
/// <summary>
/// The type of nodes to return during a browse.
/// </summary>
public enum TsCAeBrowseType
{
/// <summary>
/// Return only nodes that are process areas.
/// </summary>
Area,
/// <summary>
/// Return only nodes that are event sources.
/// </summary>
Source
}
/// <summary>
/// Return only nodes that are event sources.
/// </summary>
Source
}
}

View File

@@ -32,11 +32,11 @@ namespace Technosoftware.DaAeHdaClient.Ae
[Serializable]
public class TsCAeCategory : ICloneable
{
#region Properties
#region Properties
/// <summary>
/// A unique identifier for the category.
/// </summary>
public int ID { get; set; }
public int ID { get; set; }
/// <summary>
/// The unique name for the category.
@@ -53,7 +53,7 @@ namespace Technosoftware.DaAeHdaClient.Ae
}
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a shallow copy of the object.
/// </summary>

View File

@@ -26,50 +26,50 @@ using System;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// The bits indicating what changes generated an event notification.
/// </summary>
[Flags]
public enum TsCAeChangeMask
{
/// <summary>
/// The conditions active state has changed.
/// </summary>
ActiveState = 0x0001,
/// <summary>
/// The bits indicating what changes generated an event notification.
/// </summary>
[Flags]
public enum TsCAeChangeMask
{
/// <summary>
/// The conditions active state has changed.
/// </summary>
ActiveState = 0x0001,
/// <summary>
/// The conditions acknowledgment state has changed.
/// </summary>
AcknowledgeState = 0x0002,
/// <summary>
/// The conditions acknowledgment state has changed.
/// </summary>
AcknowledgeState = 0x0002,
/// <summary>
/// The conditions enabled state has changed.
/// </summary>
EnableState = 0x0004,
/// <summary>
/// The conditions enabled state has changed.
/// </summary>
EnableState = 0x0004,
/// <summary>
/// The condition quality has changed.
/// </summary>
Quality = 0x0008,
/// <summary>
/// The condition quality has changed.
/// </summary>
Quality = 0x0008,
/// <summary>
/// The severity level has changed.
/// </summary>
Severity = 0x0010,
/// <summary>
/// The severity level has changed.
/// </summary>
Severity = 0x0010,
/// <summary>
/// The condition has transitioned into a new sub-condition.
/// </summary>
SubCondition = 0x0020,
/// <summary>
/// The condition has transitioned into a new sub-condition.
/// </summary>
SubCondition = 0x0020,
/// <summary>
/// The event message has changed.
/// </summary>
Message = 0x0040,
/// <summary>
/// The event message has changed.
/// </summary>
Message = 0x0040,
/// <summary>
/// One or more event attributes have changed.
/// </summary>
Attribute = 0x0080
}
/// <summary>
/// One or more event attributes have changed.
/// </summary>
Attribute = 0x0080
}
}

View File

@@ -117,8 +117,8 @@ namespace Technosoftware.DaAeHdaClient.Ae
/// The quality associated with the condition state.
/// </summary>
public TsCDaQuality Quality
{
get => _quality;
{
get => _quality;
set => _quality = value;
}

View File

@@ -26,25 +26,25 @@ using System;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// The possible states for a condition.
/// </summary>
[Flags]
public enum TsCAeConditionState
{
/// <summary>
/// The server is currently checking the state of the condition.
/// </summary>
Enabled = 0x0001,
/// <summary>
/// The possible states for a condition.
/// </summary>
[Flags]
public enum TsCAeConditionState
{
/// <summary>
/// The server is currently checking the state of the condition.
/// </summary>
Enabled = 0x0001,
/// <summary>
/// The associated object is in the state represented by the condition.
/// </summary>
Active = 0x0002,
/// <summary>
/// The associated object is in the state represented by the condition.
/// </summary>
Active = 0x0002,
/// <summary>
/// The condition has been acknowledged.
/// </summary>
Acknowledged = 0x0004
}
/// <summary>
/// The condition has been acknowledged.
/// </summary>
Acknowledged = 0x0004
}
}

View File

@@ -25,56 +25,56 @@
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// The current state of a process area or an event source.
/// </summary>
public class TsCAeEnabledStateResult : IOpcResult
{
#region Fields
/// <summary>
/// The current state of a process area or an event source.
/// </summary>
public class TsCAeEnabledStateResult : IOpcResult
{
#region Fields
private string qualifiedName_;
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes the object with default values.
/// </summary>
public TsCAeEnabledStateResult() { }
/// Initializes the object with default values.
/// </summary>
public TsCAeEnabledStateResult() { }
/// <summary>
/// Initializes the object with an qualified name.
/// </summary>
public TsCAeEnabledStateResult(string qualifiedName)
{
qualifiedName_ = qualifiedName;
}
/// <summary>
/// Initializes the object with an qualified name.
/// </summary>
public TsCAeEnabledStateResult(string qualifiedName)
{
qualifiedName_ = qualifiedName;
}
/// <summary>
/// Initializes the object with an qualified name and Result.
/// </summary>
public TsCAeEnabledStateResult(string qualifiedName, OpcResult result)
{
qualifiedName_ = qualifiedName;
Result = result;
}
/// <summary>
/// Initializes the object with an qualified name and Result.
/// </summary>
public TsCAeEnabledStateResult(string qualifiedName, OpcResult result)
{
qualifiedName_ = qualifiedName;
Result = result;
}
#endregion
#region Properties
#region Properties
/// <summary>
/// Whether if the area or source is enabled.
/// </summary>
public bool Enabled { get; set; }
/// Whether if the area or source is enabled.
/// </summary>
public bool Enabled { get; set; }
/// <summary>
/// Whether the area or source is enabled and all areas within the hierarchy of its containing areas are enabled.
/// </summary>
public bool EffectivelyEnabled { get; set; }
/// <summary>
/// Whether the area or source is enabled and all areas within the hierarchy of its containing areas are enabled.
/// </summary>
public bool EffectivelyEnabled { get; set; }
#endregion
#region IOpcResult Members
#region IOpcResult Members
/// <summary>
/// The error id for the result of an operation on an item.
/// </summary>
public OpcResult Result { get; set; } = OpcResult.S_OK;
/// The error id for the result of an operation on an item.
/// </summary>
public OpcResult Result { get; set; } = OpcResult.S_OK;
/// <summary>
/// Vendor specific diagnostic information (not the localized error text).
@@ -82,14 +82,14 @@ namespace Technosoftware.DaAeHdaClient.Ae
public string DiagnosticInfo { get; set; }
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
return MemberwiseClone();
}
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
return MemberwiseClone();
}
#endregion
}
}
}

View File

@@ -26,68 +26,68 @@ using System;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// Specifies the information required to acknowledge an event.
/// </summary>
[Serializable]
public class TsCAeEventAcknowledgement : ICloneable
{
#region Fields
/// <summary>
/// Specifies the information required to acknowledge an event.
/// </summary>
[Serializable]
public class TsCAeEventAcknowledgement : ICloneable
{
#region Fields
private DateTime activeTime_ = DateTime.MinValue;
#endregion
#region Properties
#region Properties
/// <summary>
/// The name of the source that generated the event.
/// </summary>
public string SourceName { get; set; }
/// The name of the source that generated the event.
/// </summary>
public string SourceName { get; set; }
/// <summary>
/// The name of the condition that is being acknowledged.
/// </summary>
public string ConditionName { get; set; }
/// <summary>
/// The name of the condition that is being acknowledged.
/// </summary>
public string ConditionName { get; set; }
/// <summary>
/// The time that the condition or sub-condition became active.
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
/// the time format (UTC or local time).
/// </summary>
public DateTime ActiveTime
{
get => activeTime_;
/// <summary>
/// The time that the condition or sub-condition became active.
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
/// the time format (UTC or local time).
/// </summary>
public DateTime ActiveTime
{
get => activeTime_;
set => activeTime_ = value;
}
/// <summary>
/// The cookie for the condition passed to client during the event notification.
/// </summary>
public int Cookie { get; set; }
/// <summary>
/// Constructs an acknowledgment with its default values.
/// </summary>
public TsCAeEventAcknowledgement() { }
/// <summary>
/// Constructs an acknowledgment from an event notification.
/// </summary>
public TsCAeEventAcknowledgement(TsCAeEventNotification notification)
{
SourceName = notification.SourceID;
ConditionName = notification.ConditionName;
activeTime_ = notification.ActiveTime;
Cookie = notification.Cookie;
}
#endregion
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
return MemberwiseClone();
}
/// The cookie for the condition passed to client during the event notification.
/// </summary>
public int Cookie { get; set; }
/// <summary>
/// Constructs an acknowledgment with its default values.
/// </summary>
public TsCAeEventAcknowledgement() { }
/// <summary>
/// Constructs an acknowledgment from an event notification.
/// </summary>
public TsCAeEventAcknowledgement(TsCAeEventNotification notification)
{
SourceName = notification.SourceID;
ConditionName = notification.ConditionName;
activeTime_ = notification.ActiveTime;
Cookie = notification.Cookie;
}
#endregion
}
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
return MemberwiseClone();
}
#endregion
}
}

View File

@@ -206,8 +206,8 @@ namespace Technosoftware.DaAeHdaClient.Ae
/// The quality associated with the condition state.
/// </summary>
public TsCDaQuality Quality
{
get => daQuality_;
{
get => daQuality_;
set => daQuality_ = value;
}

View File

@@ -25,30 +25,30 @@ using System;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// The types of events that could be generated by a server.
/// </summary>
[Flags]
public enum TsCAeEventType
{
/// <summary>
/// Events that are not tracking or condition events.
/// </summary>
Simple = 0x0001,
/// <summary>
/// The types of events that could be generated by a server.
/// </summary>
[Flags]
public enum TsCAeEventType
{
/// <summary>
/// Events that are not tracking or condition events.
/// </summary>
Simple = 0x0001,
/// <summary>
/// Events that represent occurrences which involve the interaction of the client with a target within the server.
/// </summary>
Tracking = 0x0002,
/// <summary>
/// Events that represent occurrences which involve the interaction of the client with a target within the server.
/// </summary>
Tracking = 0x0002,
/// <summary>
/// Events that are associated with transitions in and out states defined by the server.
/// </summary>
Condition = 0x0004,
/// <summary>
/// Events that are associated with transitions in and out states defined by the server.
/// </summary>
Condition = 0x0004,
/// <summary>
/// All events generated by the server.
/// </summary>
All = 0xFFFF
}
/// <summary>
/// All events generated by the server.
/// </summary>
All = 0xFFFF
}
}

View File

@@ -26,40 +26,40 @@ using System;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// The types of event filters that the server could support.
/// </summary>
[Flags]
public enum TsCAeFilterType
{
/// <summary>
/// The server supports filtering by event type.
/// </summary>
Event = 0x0001,
/// <summary>
/// The types of event filters that the server could support.
/// </summary>
[Flags]
public enum TsCAeFilterType
{
/// <summary>
/// The server supports filtering by event type.
/// </summary>
Event = 0x0001,
/// <summary>
/// The server supports filtering by event categories.
/// </summary>
Category = 0x0002,
/// <summary>
/// The server supports filtering by event categories.
/// </summary>
Category = 0x0002,
/// <summary>
/// The server supports filtering by severity levels.
/// </summary>
Severity = 0x0004,
/// <summary>
/// The server supports filtering by severity levels.
/// </summary>
Severity = 0x0004,
/// <summary>
/// The server supports filtering by process area.
/// </summary>
Area = 0x0008,
/// <summary>
/// The server supports filtering by process area.
/// </summary>
Area = 0x0008,
/// <summary>
/// The server supports filtering by event sources.
/// </summary>
Source = 0x0010,
/// <summary>
/// The server supports filtering by event sources.
/// </summary>
Source = 0x0010,
/// <summary>
/// All filters supported by the server.
/// </summary>
All = 0xFFFF
}
/// <summary>
/// All filters supported by the server.
/// </summary>
All = 0xFFFF
}
}

View File

@@ -24,179 +24,179 @@
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// Defines functionality that is common to all OPC Alarms and Events servers.
/// </summary>
/// <summary>
/// Defines functionality that is common to all OPC Alarms and Events servers.
/// </summary>
public interface ITsCAeServer : IOpcServer
{
{
/// <summary>
/// Returns the current server status.
/// </summary>
/// <returns>The current server status.</returns>
OpcServerStatus GetServerStatus();
/// <summary>
/// Creates a new event subscription.
/// </summary>
/// <param name="state">The initial state for the subscription.</param>
/// <returns>The new subscription object.</returns>
ITsCAeSubscription CreateSubscription(TsCAeSubscriptionState state);
/// <summary>
/// Creates a new event subscription.
/// </summary>
/// <param name="state">The initial state for the subscription.</param>
/// <returns>The new subscription object.</returns>
ITsCAeSubscription CreateSubscription(TsCAeSubscriptionState state);
/// <summary>
/// Returns the event filters supported by the server.
/// </summary>
/// <returns>A bit mask of all event filters supported by the server.</returns>
int QueryAvailableFilters();
/// <summary>
/// Returns the event filters supported by the server.
/// </summary>
/// <returns>A bit mask of all event filters supported by the server.</returns>
int QueryAvailableFilters();
/// <summary>
/// Returns the event categories supported by the server for the specified event types.
/// </summary>
/// <param name="eventType">A bit mask for the event types of interest.</param>
/// <returns>A collection of event categories.</returns>
TsCAeCategory[] QueryEventCategories(int eventType);
/// <summary>
/// Returns the event categories supported by the server for the specified event types.
/// </summary>
/// <param name="eventType">A bit mask for the event types of interest.</param>
/// <returns>A collection of event categories.</returns>
TsCAeCategory[] QueryEventCategories(int eventType);
/// <summary>
/// Returns the condition names supported by the server for the specified event categories.
/// </summary>
/// <param name="eventCategory">A bit mask for the event categories of interest.</param>
/// <returns>A list of condition names.</returns>
string[] QueryConditionNames(int eventCategory);
/// <summary>
/// Returns the condition names supported by the server for the specified event categories.
/// </summary>
/// <param name="eventCategory">A bit mask for the event categories of interest.</param>
/// <returns>A list of condition names.</returns>
string[] QueryConditionNames(int eventCategory);
/// <summary>
/// Returns the sub-condition names supported by the server for the specified event condition.
/// </summary>
/// <param name="conditionName">The name of the condition.</param>
/// <returns>A list of sub-condition names.</returns>
string[] QuerySubConditionNames(string conditionName);
/// <summary>
/// Returns the sub-condition names supported by the server for the specified event condition.
/// </summary>
/// <param name="conditionName">The name of the condition.</param>
/// <returns>A list of sub-condition names.</returns>
string[] QuerySubConditionNames(string conditionName);
/// <summary>
/// Returns the condition names supported by the server for the specified event source.
/// </summary>
/// <param name="sourceName">The name of the event source.</param>
/// <returns>A list of condition names.</returns>
string[] QueryConditionNames(string sourceName);
/// <summary>
/// Returns the condition names supported by the server for the specified event source.
/// </summary>
/// <param name="sourceName">The name of the event source.</param>
/// <returns>A list of condition names.</returns>
string[] QueryConditionNames(string sourceName);
/// <summary>
/// Returns the event attributes supported by the server for the specified event categories.
/// </summary>
/// <param name="eventCategory">The event category of interest.</param>
/// <returns>A collection of event attributes.</returns>
TsCAeAttribute[] QueryEventAttributes(int eventCategory);
/// <summary>
/// Returns the event attributes supported by the server for the specified event categories.
/// </summary>
/// <param name="eventCategory">The event category of interest.</param>
/// <returns>A collection of event attributes.</returns>
TsCAeAttribute[] QueryEventAttributes(int eventCategory);
/// <summary>
/// Returns the DA item ids for a set of attribute ids belonging to events which meet the specified filter criteria.
/// </summary>
/// <param name="sourceName">The event source of interest.</param>
/// <param name="eventCategory">The id of the event category for the events of interest.</param>
/// <param name="conditionName">The name of a condition within the event category.</param>
/// <param name="subConditionName">The name of a sub-condition within a multi-state condition.</param>
/// <param name="attributeIDs">The ids of the attributes to return item ids for.</param>
/// <returns>A list of item urls for each specified attribute.</returns>
TsCAeItemUrl[] TranslateToItemIDs(
string sourceName,
int eventCategory,
string conditionName,
string subConditionName,
int[] attributeIDs);
/// <summary>
/// Returns the DA item ids for a set of attribute ids belonging to events which meet the specified filter criteria.
/// </summary>
/// <param name="sourceName">The event source of interest.</param>
/// <param name="eventCategory">The id of the event category for the events of interest.</param>
/// <param name="conditionName">The name of a condition within the event category.</param>
/// <param name="subConditionName">The name of a sub-condition within a multi-state condition.</param>
/// <param name="attributeIDs">The ids of the attributes to return item ids for.</param>
/// <returns>A list of item urls for each specified attribute.</returns>
TsCAeItemUrl[] TranslateToItemIDs(
string sourceName,
int eventCategory,
string conditionName,
string subConditionName,
int[] attributeIDs);
/// <summary>
/// Returns the current state information for the condition instance corresponding to the source and condition name.
/// </summary>
/// <param name="sourceName">The source name</param>
/// <param name="conditionName">A condition name for the source.</param>
/// <param name="attributeIDs">The list of attributes to return with the condition state.</param>
/// <returns>The current state of the connection.</returns>
TsCAeCondition GetConditionState(
string sourceName,
string conditionName,
int[] attributeIDs);
/// <summary>
/// Returns the current state information for the condition instance corresponding to the source and condition name.
/// </summary>
/// <param name="sourceName">The source name</param>
/// <param name="conditionName">A condition name for the source.</param>
/// <param name="attributeIDs">The list of attributes to return with the condition state.</param>
/// <returns>The current state of the connection.</returns>
TsCAeCondition GetConditionState(
string sourceName,
string conditionName,
int[] attributeIDs);
/// <summary>
/// Places the specified process areas into the enabled state.
/// </summary>
/// <param name="areas">A list of fully qualified area names.</param>
/// <returns>The results of the operation for each area.</returns>
OpcResult[] EnableConditionByArea(string[] areas);
/// <summary>
/// Places the specified process areas into the enabled state.
/// </summary>
/// <param name="areas">A list of fully qualified area names.</param>
/// <returns>The results of the operation for each area.</returns>
OpcResult[] EnableConditionByArea(string[] areas);
/// <summary>
/// Places the specified process areas into the disabled state.
/// </summary>
/// <param name="areas">A list of fully qualified area names.</param>
/// <returns>The results of the operation for each area.</returns>
OpcResult[] DisableConditionByArea(string[] areas);
/// <summary>
/// Places the specified process areas into the disabled state.
/// </summary>
/// <param name="areas">A list of fully qualified area names.</param>
/// <returns>The results of the operation for each area.</returns>
OpcResult[] DisableConditionByArea(string[] areas);
/// <summary>
/// Places the specified process areas into the enabled state.
/// </summary>
/// <param name="sources">A list of fully qualified source names.</param>
/// <returns>The results of the operation for each area.</returns>
OpcResult[] EnableConditionBySource(string[] sources);
/// <summary>
/// Places the specified process areas into the enabled state.
/// </summary>
/// <param name="sources">A list of fully qualified source names.</param>
/// <returns>The results of the operation for each area.</returns>
OpcResult[] EnableConditionBySource(string[] sources);
/// <summary>
/// Places the specified process areas into the disabled state.
/// </summary>
/// <param name="sources">A list of fully qualified source names.</param>
/// <returns>The results of the operation for each area.</returns>
OpcResult[] DisableConditionBySource(string[] sources);
/// <summary>
/// Places the specified process areas into the disabled state.
/// </summary>
/// <param name="sources">A list of fully qualified source names.</param>
/// <returns>The results of the operation for each area.</returns>
OpcResult[] DisableConditionBySource(string[] sources);
/// <summary>
/// Returns the enabled state for the specified process areas.
/// </summary>
/// <param name="areas">A list of fully qualified area names.</param>
TsCAeEnabledStateResult[] GetEnableStateByArea(string[] areas);
/// <summary>
/// Returns the enabled state for the specified process areas.
/// </summary>
/// <param name="areas">A list of fully qualified area names.</param>
TsCAeEnabledStateResult[] GetEnableStateByArea(string[] areas);
/// <summary>
/// Returns the enabled state for the specified event sources.
/// </summary>
/// <param name="sources">A list of fully qualified source names.</param>
TsCAeEnabledStateResult[] GetEnableStateBySource(string[] sources);
/// <summary>
/// Returns the enabled state for the specified event sources.
/// </summary>
/// <param name="sources">A list of fully qualified source names.</param>
TsCAeEnabledStateResult[] GetEnableStateBySource(string[] sources);
/// <summary>
/// Used to acknowledge one or more conditions in the event server.
/// </summary>
/// <param name="acknowledgerID">The identifier for who is acknowledging the condition.</param>
/// <param name="comment">A comment associated with the acknowledgment.</param>
/// <param name="conditions">The conditions being acknowledged.</param>
/// <returns>A list of result id indictaing whether each condition was successfully acknowledged.</returns>
OpcResult[] AcknowledgeCondition(
string acknowledgerID,
string comment,
TsCAeEventAcknowledgement[] conditions);
/// <summary>
/// Used to acknowledge one or more conditions in the event server.
/// </summary>
/// <param name="acknowledgerID">The identifier for who is acknowledging the condition.</param>
/// <param name="comment">A comment associated with the acknowledgment.</param>
/// <param name="conditions">The conditions being acknowledged.</param>
/// <returns>A list of result id indictaing whether each condition was successfully acknowledged.</returns>
OpcResult[] AcknowledgeCondition(
string acknowledgerID,
string comment,
TsCAeEventAcknowledgement[] conditions);
/// <summary>
/// Browses for all children of the specified area that meet the filter criteria.
/// </summary>
/// <param name="areaID">The full-qualified id for the area.</param>
/// <param name="browseType">The type of children to return.</param>
/// <param name="browseFilter">The expression used to filter the names of children returned.</param>
/// <returns>The set of elements that meet the filter criteria.</returns>
TsCAeBrowseElement[] Browse(
string areaID,
TsCAeBrowseType browseType,
string browseFilter);
/// <summary>
/// Browses for all children of the specified area that meet the filter criteria.
/// </summary>
/// <param name="areaID">The full-qualified id for the area.</param>
/// <param name="browseType">The type of children to return.</param>
/// <param name="browseFilter">The expression used to filter the names of children returned.</param>
/// <returns>The set of elements that meet the filter criteria.</returns>
TsCAeBrowseElement[] Browse(
string areaID,
TsCAeBrowseType browseType,
string browseFilter);
/// <summary>
/// Browses for all children of the specified area that meet the filter criteria.
/// </summary>
/// <param name="areaID">The full-qualified id for the area.</param>
/// <param name="browseType">The type of children to return.</param>
/// <param name="browseFilter">The expression used to filter the names of children returned.</param>
/// <param name="maxElements">The maximum number of elements to return.</param>
/// <param name="position">The object used to continue the browse if the number nodes exceeds the maximum specified.</param>
/// <returns>The set of elements that meet the filter criteria.</returns>
TsCAeBrowseElement[] Browse(
string areaID,
TsCAeBrowseType browseType,
string browseFilter,
int maxElements,
out IOpcBrowsePosition position);
/// <summary>
/// Browses for all children of the specified area that meet the filter criteria.
/// </summary>
/// <param name="areaID">The full-qualified id for the area.</param>
/// <param name="browseType">The type of children to return.</param>
/// <param name="browseFilter">The expression used to filter the names of children returned.</param>
/// <param name="maxElements">The maximum number of elements to return.</param>
/// <param name="position">The object used to continue the browse if the number nodes exceeds the maximum specified.</param>
/// <returns>The set of elements that meet the filter criteria.</returns>
TsCAeBrowseElement[] Browse(
string areaID,
TsCAeBrowseType browseType,
string browseFilter,
int maxElements,
out IOpcBrowsePosition position);
/// <summary>
/// Continues browsing the server's address space at the specified position.
/// </summary>
/// <param name="maxElements">The maximum number of elements to return.</param>
/// <param name="position">The position object used to continue a browse operation.</param>
/// <returns>The set of elements that meet the filter criteria.</returns>
TsCAeBrowseElement[] BrowseNext(int maxElements, ref IOpcBrowsePosition position);
}
/// <summary>
/// Continues browsing the server's address space at the specified position.
/// </summary>
/// <param name="maxElements">The maximum number of elements to return.</param>
/// <param name="position">The position object used to continue a browse operation.</param>
/// <returns>The set of elements that meet the filter criteria.</returns>
TsCAeBrowseElement[] BrowseNext(int maxElements, ref IOpcBrowsePosition position);
}
}

View File

@@ -31,14 +31,14 @@ namespace Technosoftware.DaAeHdaClient.Ae
/// </summary>
public interface ITsCAeSubscription : IDisposable
{
#region Events
#region Events
/// <summary>
/// An event to receive event change updates.
/// </summary>
event TsCAeDataChangedEventHandler DataChangedEvent;
#endregion
#region State Management
#region State Management
/// <summary>
/// Returns the current state of the subscription.
/// </summary>
@@ -54,7 +54,7 @@ namespace Technosoftware.DaAeHdaClient.Ae
TsCAeSubscriptionState ModifyState(int masks, TsCAeSubscriptionState state);
#endregion
#region Filter Management
#region Filter Management
/// <summary>
/// Returns the current filters for the subscription.
/// </summary>
@@ -68,7 +68,7 @@ namespace Technosoftware.DaAeHdaClient.Ae
void SetFilters(TsCAeSubscriptionFilters filters);
#endregion
#region Attribute Management
#region Attribute Management
/// <summary>
/// Returns the set of attributes to return with event notifications.
/// </summary>
@@ -84,7 +84,7 @@ namespace Technosoftware.DaAeHdaClient.Ae
void SelectReturnedAttributes(int eventCategory, int[] attributeIDs);
#endregion
#region Refresh
#region Refresh
/// <summary>
/// Force a refresh for all active conditions and inactive, unacknowledged conditions whose event notifications match the filter of the event subscription.
/// </summary>
@@ -95,9 +95,9 @@ namespace Technosoftware.DaAeHdaClient.Ae
/// </summary>
void CancelRefresh();
#endregion
}
}
#region Delegate Declarations
#region Delegate Declarations
/// <summary>
/// A delegate to receive data change updates from the server.
/// </summary>

View File

@@ -32,29 +32,29 @@ namespace Technosoftware.DaAeHdaClient.Ae
[Serializable]
public class TsCAeItemUrl : OpcItem
{
#region Fields
#region Fields
private OpcUrl url_ = new OpcUrl();
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes the object with default values.
/// </summary>
public TsCAeItemUrl() {}
public TsCAeItemUrl() { }
/// <summary>
/// Initializes the object with an ItemIdentifier object.
/// </summary>
public TsCAeItemUrl(OpcItem item) : base(item) {}
public TsCAeItemUrl(OpcItem item) : base(item) { }
/// <summary>
/// Initializes the object with an ItemIdentifier object and url.
/// </summary>
public TsCAeItemUrl(OpcItem item, OpcUrl url)
: base(item)
{
Url = url;
}
public TsCAeItemUrl(OpcItem item, OpcUrl url)
: base(item)
{
Url = url;
}
/// <summary>
/// Initializes object with the specified ItemResult object.
@@ -65,21 +65,21 @@ namespace Technosoftware.DaAeHdaClient.Ae
{
Url = item.Url;
}
}
}
#endregion
#region Properties
#region Properties
/// <summary>
/// The url of the server that contains the item.
/// </summary>
public OpcUrl Url
{
get => url_;
/// The url of the server that contains the item.
/// </summary>
public OpcUrl Url
{
get => url_;
set => url_ = value;
}
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>

View File

@@ -25,36 +25,36 @@
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// Contains a collection of item urls.
/// </summary>
internal class TsCAeItemUrlCollection : OpcReadOnlyCollection
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Constructs an empty collection.
/// </summary>
public TsCAeItemUrlCollection() : base(new TsCAeItemUrl[0]) { }
/// <summary>
/// Contains a collection of item urls.
/// </summary>
internal class TsCAeItemUrlCollection : OpcReadOnlyCollection
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Constructs an empty collection.
/// </summary>
public TsCAeItemUrlCollection() : base(new TsCAeItemUrl[0]) { }
/// <summary>
/// Constructs a collection from an array of item urls.
/// </summary>
public TsCAeItemUrlCollection(TsCAeItemUrl[] itemUrls) : base(itemUrls) { }
/// <summary>
/// Constructs a collection from an array of item urls.
/// </summary>
public TsCAeItemUrlCollection(TsCAeItemUrl[] itemUrls) : base(itemUrls) { }
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// An indexer for the collection.
/// </summary>
public new TsCAeItemUrl this[int index] => (TsCAeItemUrl)Array.GetValue(index);
/// An indexer for the collection.
/// </summary>
public new TsCAeItemUrl this[int index] => (TsCAeItemUrl)Array.GetValue(index);
/// <summary>
/// Returns a copy of the collection as an array.
/// </summary>
public new TsCAeItemUrl[] ToArray()
{
return (TsCAeItemUrl[])OpcConvert.Clone(Array);
}
{
return (TsCAeItemUrl[])OpcConvert.Clone(Array);
}
#endregion
}
}
}

View File

@@ -23,7 +23,6 @@
#region Using Directives
using System;
using System.Collections;
using System.Runtime.Serialization;
#endregion

View File

@@ -25,44 +25,44 @@
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// Current Status of an OPC AE server
/// </summary>
public enum TsCAeServerState
{
/// <summary>
/// The server state is not known.
/// </summary>
Unknown,
/// <summary>
/// Current Status of an OPC AE server
/// </summary>
public enum TsCAeServerState
{
/// <summary>
/// The server state is not known.
/// </summary>
Unknown,
/// <summary>
/// The server is running normally. This is the usual state for a server
/// </summary>
Running,
/// <summary>
/// The server is running normally. This is the usual state for a server
/// </summary>
Running,
/// <summary>
/// A vendor specific fatal error has occurred within the server. The server is no longer functioning. The recovery procedure from this situation is vendor specific. An error code of E_FAIL should generally be returned from any other server method.
/// </summary>
Failed,
/// <summary>
/// A vendor specific fatal error has occurred within the server. The server is no longer functioning. The recovery procedure from this situation is vendor specific. An error code of E_FAIL should generally be returned from any other server method.
/// </summary>
Failed,
/// <summary>
/// The server is running but has no configuration information loaded and thus cannot function normally. Note this state implies that the server needs configuration information in order to function. Servers which do not require configuration information should not return this state.
/// </summary>
NoConfig,
/// <summary>
/// The server is running but has no configuration information loaded and thus cannot function normally. Note this state implies that the server needs configuration information in order to function. Servers which do not require configuration information should not return this state.
/// </summary>
NoConfig,
/// <summary>
/// The server has been temporarily suspended via some vendor specific method and is not getting or sending data. Note that Quality will be returned as OPC_QUALITY_OUT_OF_SERVICE.
/// </summary>
Suspended,
/// <summary>
/// The server has been temporarily suspended via some vendor specific method and is not getting or sending data. Note that Quality will be returned as OPC_QUALITY_OUT_OF_SERVICE.
/// </summary>
Suspended,
/// <summary>
/// The server is in Test Mode. The outputs are disconnected from the real hardware but the server will otherwise behave normally. Inputs may be real or may be simulated depending on the vendor implementation. Quality will generally be returned normally.
/// </summary>
Test,
/// <summary>
/// The server is in Test Mode. The outputs are disconnected from the real hardware but the server will otherwise behave normally. Inputs may be real or may be simulated depending on the vendor implementation. Quality will generally be returned normally.
/// </summary>
Test,
/// <summary>
/// The server is in Test Mode. The outputs are disconnected from the real hardware but the server will otherwise behave normally. Inputs may be real or may be simulated depending on the vendor implementation. Quality will generally be returned normally.
/// </summary>
CommFault
}
/// <summary>
/// The server is in Test Mode. The outputs are disconnected from the real hardware but the server will otherwise behave normally. Inputs may be real or may be simulated depending on the vendor implementation. Quality will generally be returned normally.
/// </summary>
CommFault
}
}

View File

@@ -26,45 +26,45 @@ using System;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// Defines masks to be used when modifying the subscription or item state.
/// </summary>
[Flags]
public enum TsCAeStateMask
{
/// <summary>
/// A name assigned to subscription.
/// </summary>
Name = 0x0001,
/// <summary>
/// Defines masks to be used when modifying the subscription or item state.
/// </summary>
[Flags]
public enum TsCAeStateMask
{
/// <summary>
/// A name assigned to subscription.
/// </summary>
Name = 0x0001,
/// <summary>
/// The client assigned handle for the item or subscription.
/// </summary>
ClientHandle = 0x0002,
/// <summary>
/// The client assigned handle for the item or subscription.
/// </summary>
ClientHandle = 0x0002,
/// <summary>
/// Whether the subscription is active.
/// </summary>
Active = 0x0004,
/// <summary>
/// Whether the subscription is active.
/// </summary>
Active = 0x0004,
/// <summary>
/// The maximum rate at which the server send event notifications.
/// </summary>
BufferTime = 0x0008,
/// <summary>
/// The maximum rate at which the server send event notifications.
/// </summary>
BufferTime = 0x0008,
/// <summary>
/// The requested maximum number of events that will be sent in a single callback.
/// </summary>
MaxSize = 0x0010,
/// <summary>
/// The requested maximum number of events that will be sent in a single callback.
/// </summary>
MaxSize = 0x0010,
/// <summary>
/// The maximum period between updates sent to the client.
/// </summary>
KeepAlive = 0x0020,
/// <summary>
/// The maximum period between updates sent to the client.
/// </summary>
KeepAlive = 0x0020,
/// <summary>
/// All fields are valid.
/// </summary>
All = 0xFFFF
}
/// <summary>
/// All fields are valid.
/// </summary>
All = 0xFFFF
}
}

View File

@@ -26,58 +26,58 @@ using System;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// The description of an item sub-condition supported by the server.
/// </summary>
[Serializable]
public class TsCAeSubCondition : ICloneable
{
#region Fields
/// <summary>
/// The description of an item sub-condition supported by the server.
/// </summary>
[Serializable]
public class TsCAeSubCondition : ICloneable
{
#region Fields
private int severity_ = 1;
#endregion
#region Properties
#region Properties
/// <summary>
/// The name assigned to the sub-condition.
/// </summary>
public string Name { get; set; }
/// The name assigned to the sub-condition.
/// </summary>
public string Name { get; set; }
/// <summary>
/// A server-specific expression which defines the sub-state represented by the sub-condition.
/// </summary>
public string Definition { get; set; }
/// <summary>
/// A server-specific expression which defines the sub-state represented by the sub-condition.
/// </summary>
public string Definition { get; set; }
/// <summary>
/// The severity of any event notifications generated on behalf of this sub-condition.
/// </summary>
public int Severity
{
get => severity_;
/// <summary>
/// The severity of any event notifications generated on behalf of this sub-condition.
/// </summary>
public int Severity
{
get => severity_;
set => severity_ = value;
}
/// <summary>
/// The text string to be included in any event notification generated on behalf of this sub-condition.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The text string to be included in any event notification generated on behalf of this sub-condition.
/// </summary>
public string Description { get; set; }
#endregion
#region Helper Methods
#region Helper Methods
/// <summary>
/// Returns a string that represents the current object.
/// </summary>
/// <returns></returns>
public override string ToString()
{
return Name;
}
/// Returns a string that represents the current object.
/// </summary>
/// <returns></returns>
public override string ToString()
{
return Name;
}
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a shallow copy of the object.
/// </summary>
public virtual object Clone() { return MemberwiseClone(); }
/// Creates a shallow copy of the object.
/// </summary>
public virtual object Clone() { return MemberwiseClone(); }
#endregion
}
}
}

View File

@@ -30,230 +30,230 @@ using System.Runtime.Serialization;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// An in-process object which provides access to AE subscription objects.
/// </summary>
[Serializable]
public class TsCAeSubscription : ITsCAeSubscription, ISerializable, ICloneable
{
#region CategoryCollection Class
/// <summary>
/// An in-process object which provides access to AE subscription objects.
/// </summary>
[Serializable]
public class TsCAeSubscription : ITsCAeSubscription, ISerializable, ICloneable
{
#region CategoryCollection Class
/// <summary>
/// Contains a read-only collection category ids.
/// </summary>
public class CategoryCollection : OpcReadOnlyCollection
{
#region Constructors, Destructor, Initialization
/// Contains a read-only collection category ids.
/// </summary>
public class CategoryCollection : OpcReadOnlyCollection
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Creates an empty collection.
/// </summary>
internal CategoryCollection() : base(new int[0]) { }
/// Creates an empty collection.
/// </summary>
internal CategoryCollection() : base(new int[0]) { }
/// <summary>
/// Creates a collection containing the list of category ids.
/// </summary>
internal CategoryCollection(int[] categoryIDs) : base(categoryIDs) { }
/// <summary>
/// Creates a collection containing the list of category ids.
/// </summary>
internal CategoryCollection(int[] categoryIDs) : base(categoryIDs) { }
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// An indexer for the collection.
/// </summary>
public new int this[int index] => (int)Array.GetValue(index);
/// An indexer for the collection.
/// </summary>
public new int this[int index] => (int)Array.GetValue(index);
/// <summary>
/// Returns a copy of the collection as an array.
/// </summary>
public new int[] ToArray()
{
return (int[])OpcConvert.Clone(Array);
}
{
return (int[])OpcConvert.Clone(Array);
}
#endregion
}
}
#endregion
#region StringCollection Class
#region StringCollection Class
/// <summary>
/// Contains a read-only collection of strings.
/// </summary>
public class StringCollection : OpcReadOnlyCollection
{
#region Constructors, Destructor, Initialization
/// Contains a read-only collection of strings.
/// </summary>
public class StringCollection : OpcReadOnlyCollection
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Creates an empty collection.
/// </summary>
internal StringCollection() : base(new string[0]) { }
/// Creates an empty collection.
/// </summary>
internal StringCollection() : base(new string[0]) { }
/// <summary>
/// Creates a collection containing the specified strings.
/// </summary>
internal StringCollection(string[] strings) : base(strings) { }
/// <summary>
/// Creates a collection containing the specified strings.
/// </summary>
internal StringCollection(string[] strings) : base(strings) { }
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// An indexer for the collection.
/// </summary>
public new string this[int index] => (string)Array.GetValue(index);
/// An indexer for the collection.
/// </summary>
public new string this[int index] => (string)Array.GetValue(index);
/// <summary>
/// Returns a copy of the collection as an array.
/// </summary>
public new string[] ToArray()
{
return (string[])OpcConvert.Clone(Array);
}
{
return (string[])OpcConvert.Clone(Array);
}
#endregion
}
}
#endregion
#region AttributeDictionary Class
#region AttributeDictionary Class
/// <summary>
/// Contains a read-only dictionary of attribute lists indexed by category id.
/// </summary>
[Serializable]
public class AttributeDictionary : OpcReadOnlyDictionary
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Creates an empty collection.
/// </summary>
internal AttributeDictionary() : base(null) { }
/// Contains a read-only dictionary of attribute lists indexed by category id.
/// </summary>
[Serializable]
public class AttributeDictionary : OpcReadOnlyDictionary
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Creates an empty collection.
/// </summary>
internal AttributeDictionary() : base(null) { }
/// <summary>
/// Constructs an dictionary from a set of category ids.
/// </summary>
internal AttributeDictionary(Hashtable dictionary) : base(dictionary) { }
/// <summary>
/// Constructs an dictionary from a set of category ids.
/// </summary>
internal AttributeDictionary(Hashtable dictionary) : base(dictionary) { }
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Gets or sets the attribute collection for the specified category.
/// </summary>
public AttributeCollection this[int categoryId] => (AttributeCollection)base[categoryId];
/// Gets or sets the attribute collection for the specified category.
/// </summary>
public AttributeCollection this[int categoryId] => (AttributeCollection)base[categoryId];
/// <summary>
/// Adds or replaces the set of attributes associated with the category.
/// </summary>
internal void Update(int categoryId, int[] attributeIDs)
{
Dictionary[categoryId] = new AttributeCollection(attributeIDs);
}
{
Dictionary[categoryId] = new AttributeCollection(attributeIDs);
}
#endregion
#region ISerializable Members
/// <summary>
/// Constructs an object by deserializing it from a stream.
/// </summary>
protected AttributeDictionary(SerializationInfo info, StreamingContext context) : base(info, context) { }
#endregion
}
#region ISerializable Members
/// <summary>
/// Constructs an object by deserializing it from a stream.
/// </summary>
protected AttributeDictionary(SerializationInfo info, StreamingContext context) : base(info, context) { }
#endregion
}
#endregion
#region AttributeCollection Class
#region AttributeCollection Class
/// <summary>
/// Contains a read-only collection attribute ids.
/// </summary>
[Serializable]
public class AttributeCollection : OpcReadOnlyCollection
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Creates an empty collection.
/// </summary>
internal AttributeCollection() : base(new int[0]) { }
/// Contains a read-only collection attribute ids.
/// </summary>
[Serializable]
public class AttributeCollection : OpcReadOnlyCollection
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Creates an empty collection.
/// </summary>
internal AttributeCollection() : base(new int[0]) { }
/// <summary>
/// Creates a collection containing the specified attribute ids.
/// </summary>
internal AttributeCollection(int[] attributeIDs) : base(attributeIDs) { }
/// <summary>
/// Creates a collection containing the specified attribute ids.
/// </summary>
internal AttributeCollection(int[] attributeIDs) : base(attributeIDs) { }
#endregion
#region Public Methods
/// <summary>
/// An indexer for the collection.
/// </summary>
public new int this[int index] => (int)Array.GetValue(index);
#region Public Methods
/// <summary>
/// An indexer for the collection.
/// </summary>
public new int this[int index] => (int)Array.GetValue(index);
/// <summary>
/// Returns a copy of the collection as an array.
/// </summary>
public new int[] ToArray()
{
return (int[])OpcConvert.Clone(Array);
}
{
return (int[])OpcConvert.Clone(Array);
}
#endregion
#region ISerializable Members
#region ISerializable Members
/// <summary>
/// Constructs an object by deserializing it from a stream.
/// </summary>
protected AttributeCollection(SerializationInfo info, StreamingContext context) : base(info, context) { }
/// Constructs an object by deserializing it from a stream.
/// </summary>
protected AttributeCollection(SerializationInfo info, StreamingContext context) : base(info, context) { }
#endregion
}
#endregion
#region Names Class
/// <summary>
/// A set of names for fields used in serialization.
/// </summary>
private class Names
{
internal const string State = "ST";
internal const string Filters = "FT";
internal const string Attributes = "AT";
}
}
#endregion
#region Fields
#region Names Class
/// <summary>
/// A set of names for fields used in serialization.
/// </summary>
private class Names
{
internal const string State = "ST";
internal const string Filters = "FT";
internal const string Attributes = "AT";
}
#endregion
#region Fields
private bool disposed_;
private TsCAeServer server_;
private ITsCAeSubscription subscription_;
private TsCAeServer server_;
private ITsCAeSubscription subscription_;
// state
private TsCAeSubscriptionState state_;
private string name_;
// state
private TsCAeSubscriptionState state_;
private string name_;
// filters
private TsCAeSubscriptionFilters subscriptionFilters_ = new TsCAeSubscriptionFilters();
private CategoryCollection categories_ = new CategoryCollection();
private StringCollection areas_ = new StringCollection();
private StringCollection sources_ = new StringCollection();
// filters
private TsCAeSubscriptionFilters subscriptionFilters_ = new TsCAeSubscriptionFilters();
private CategoryCollection categories_ = new CategoryCollection();
private StringCollection areas_ = new StringCollection();
private StringCollection sources_ = new StringCollection();
// returned attributes
private AttributeDictionary attributes_ = new AttributeDictionary();
// returned attributes
private AttributeDictionary attributes_ = new AttributeDictionary();
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes object with default values.
/// </summary>
public TsCAeSubscription(TsCAeServer server, ITsCAeSubscription subscription, TsCAeSubscriptionState state)
{
/// Initializes object with default values.
/// </summary>
public TsCAeSubscription(TsCAeServer server, ITsCAeSubscription subscription, TsCAeSubscriptionState state)
{
server_ = server ?? throw new ArgumentNullException(nameof(server));
subscription_ = subscription ?? throw new ArgumentNullException(nameof(subscription));
state_ = (TsCAeSubscriptionState)state.Clone();
name_ = state.Name;
}
subscription_ = subscription ?? throw new ArgumentNullException(nameof(subscription));
state_ = (TsCAeSubscriptionState)state.Clone();
name_ = state.Name;
}
/// <summary>
/// The finalizer implementation.
/// </summary>
~TsCAeSubscription()
{
Dispose(false);
}
{
Dispose(false);
}
/// <summary>
///
/// </summary>
public virtual void Dispose()
{
Dispose(true);
// Take yourself off the Finalization queue
// to prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
/// <summary>
///
/// </summary>
public virtual void Dispose()
{
Dispose(true);
// Take yourself off the Finalization queue
// to prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose(bool disposing) executes in two distinct scenarios.
@@ -266,34 +266,34 @@ namespace Technosoftware.DaAeHdaClient.Ae
/// </summary>
/// <param name="disposing">If true managed and unmanaged resources can be disposed. If false only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if(!disposed_)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if(disposing)
{
if (subscription_ != null)
{
server_.SubscriptionDisposed(this);
subscription_.Dispose();
}
}
// Release unmanaged resources. If disposing is false,
// only the following code is executed.
}
disposed_ = true;
}
{
// Check to see if Dispose has already been called.
if (!disposed_)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if (disposing)
{
if (subscription_ != null)
{
server_.SubscriptionDisposed(this);
subscription_.Dispose();
}
}
// Release unmanaged resources. If disposing is false,
// only the following code is executed.
}
disposed_ = true;
}
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// The server that the subscription object belongs to.
/// </summary>
public TsCAeServer Server => server_;
/// <summary>
/// The server that the subscription object belongs to.
/// </summary>
public TsCAeServer Server => server_;
/// <summary>
/// A descriptive name for the subscription.
@@ -365,19 +365,19 @@ namespace Technosoftware.DaAeHdaClient.Ae
public AttributeDictionary Attributes => attributes_;
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Returns a writable copy of the current attributes.
/// </summary>
public TsCAeAttributeDictionary GetAttributes()
{
/// Returns a writable copy of the current attributes.
/// </summary>
public TsCAeAttributeDictionary GetAttributes()
{
LicenseHandler.ValidateFeatures(LicenseHandler.ProductFeature.AlarmsConditions);
var attributes = new TsCAeAttributeDictionary();
var attributes = new TsCAeAttributeDictionary();
var enumerator = attributes_.GetEnumerator();
var enumerator = attributes_.GetEnumerator();
while (enumerator.MoveNext())
{
while (enumerator.MoveNext())
{
if (enumerator.Key != null)
{
var categoryId = (int)enumerator.Key;
@@ -387,48 +387,48 @@ namespace Technosoftware.DaAeHdaClient.Ae
}
}
return attributes;
}
return attributes;
}
#endregion
#region ISerializable Members
#region ISerializable Members
/// <summary>
/// Constructs a server by de-serializing its OpcUrl from the stream.
/// </summary>
protected TsCAeSubscription(SerializationInfo info, StreamingContext context)
{
state_ = (TsCAeSubscriptionState)info.GetValue(Names.State, typeof(TsCAeSubscriptionState));
subscriptionFilters_ = (TsCAeSubscriptionFilters)info.GetValue(Names.Filters, typeof(TsCAeSubscriptionFilters));
attributes_ = (AttributeDictionary)info.GetValue(Names.Attributes, typeof(AttributeDictionary));
/// Constructs a server by de-serializing its OpcUrl from the stream.
/// </summary>
protected TsCAeSubscription(SerializationInfo info, StreamingContext context)
{
state_ = (TsCAeSubscriptionState)info.GetValue(Names.State, typeof(TsCAeSubscriptionState));
subscriptionFilters_ = (TsCAeSubscriptionFilters)info.GetValue(Names.Filters, typeof(TsCAeSubscriptionFilters));
attributes_ = (AttributeDictionary)info.GetValue(Names.Attributes, typeof(AttributeDictionary));
name_ = state_.Name;
name_ = state_.Name;
categories_ = new CategoryCollection(subscriptionFilters_.Categories.ToArray());
areas_ = new StringCollection(subscriptionFilters_.Areas.ToArray());
sources_ = new StringCollection(subscriptionFilters_.Sources.ToArray());
}
categories_ = new CategoryCollection(subscriptionFilters_.Categories.ToArray());
areas_ = new StringCollection(subscriptionFilters_.Areas.ToArray());
sources_ = new StringCollection(subscriptionFilters_.Sources.ToArray());
}
/// <summary>
/// Serializes a server into a stream.
/// </summary>
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue(Names.State, state_);
info.AddValue(Names.Filters, subscriptionFilters_);
info.AddValue(Names.Attributes, attributes_);
}
/// <summary>
/// Serializes a server into a stream.
/// </summary>
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue(Names.State, state_);
info.AddValue(Names.Filters, subscriptionFilters_);
info.AddValue(Names.Attributes, attributes_);
}
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Returns an unconnected copy of the subscription with the same items.
/// </summary>
public virtual object Clone()
{
// do a memberwise clone.
var clone = (TsCAeSubscription)MemberwiseClone();
/// Returns an unconnected copy of the subscription with the same items.
/// </summary>
public virtual object Clone()
{
// do a memberwise clone.
var clone = (TsCAeSubscription)MemberwiseClone();
/*
/*
// place clone in disconnected state.
clone.server = null;
clone.subscription = null;
@@ -454,12 +454,12 @@ namespace Technosoftware.DaAeHdaClient.Ae
}
*/
// return clone.
return clone;
}
// return clone.
return clone;
}
#endregion
#region ISubscription Members
#region ISubscription Members
/// <summary>
/// An event to receive data change updates.
/// </summary>
@@ -469,136 +469,136 @@ namespace Technosoftware.DaAeHdaClient.Ae
remove => subscription_.DataChangedEvent -= value;
}
/// <summary>
/// Returns the current state of the subscription.
/// </summary>
/// <returns>The current state of the subscription.</returns>
public TsCAeSubscriptionState GetState()
{
/// <summary>
/// Returns the current state of the subscription.
/// </summary>
/// <returns>The current state of the subscription.</returns>
public TsCAeSubscriptionState GetState()
{
LicenseHandler.ValidateFeatures(LicenseHandler.ProductFeature.AlarmsConditions);
if (subscription_ == null) throw new NotConnectedException();
state_ = subscription_.GetState();
state_.Name = name_;
state_ = subscription_.GetState();
state_.Name = name_;
return (TsCAeSubscriptionState)state_.Clone();
}
return (TsCAeSubscriptionState)state_.Clone();
}
/// <summary>
/// Changes the state of a subscription.
/// </summary>
/// <param name="masks">A bit mask that indicates which elements of the subscription state are changing.</param>
/// <param name="state">The new subscription state.</param>
/// <returns>The actual subscription state after applying the changes.</returns>
public TsCAeSubscriptionState ModifyState(int masks, TsCAeSubscriptionState state)
{
/// <summary>
/// Changes the state of a subscription.
/// </summary>
/// <param name="masks">A bit mask that indicates which elements of the subscription state are changing.</param>
/// <param name="state">The new subscription state.</param>
/// <returns>The actual subscription state after applying the changes.</returns>
public TsCAeSubscriptionState ModifyState(int masks, TsCAeSubscriptionState state)
{
LicenseHandler.ValidateFeatures(LicenseHandler.ProductFeature.AlarmsConditions);
if (subscription_ == null) throw new NotConnectedException();
state_ = subscription_.ModifyState(masks, state);
if ((masks & (int)TsCAeStateMask.Name) != 0)
{
state_.Name = name_ = state.Name;
}
else
{
state_.Name = name_;
}
if ((masks & (int)TsCAeStateMask.Name) != 0)
{
state_.Name = name_ = state.Name;
}
else
{
state_.Name = name_;
}
return (TsCAeSubscriptionState)state_.Clone();
}
return (TsCAeSubscriptionState)state_.Clone();
}
/// <summary>
/// Returns the current filters for the subscription.
/// </summary>
/// <returns>The current filters for the subscription.</returns>
public TsCAeSubscriptionFilters GetFilters()
{
/// <summary>
/// Returns the current filters for the subscription.
/// </summary>
/// <returns>The current filters for the subscription.</returns>
public TsCAeSubscriptionFilters GetFilters()
{
LicenseHandler.ValidateFeatures(LicenseHandler.ProductFeature.AlarmsConditions);
if (subscription_ == null) throw new NotConnectedException();
subscriptionFilters_ = subscription_.GetFilters();
categories_ = new CategoryCollection(subscriptionFilters_.Categories.ToArray());
areas_ = new StringCollection(subscriptionFilters_.Areas.ToArray());
sources_ = new StringCollection(subscriptionFilters_.Sources.ToArray());
categories_ = new CategoryCollection(subscriptionFilters_.Categories.ToArray());
areas_ = new StringCollection(subscriptionFilters_.Areas.ToArray());
sources_ = new StringCollection(subscriptionFilters_.Sources.ToArray());
return (TsCAeSubscriptionFilters)subscriptionFilters_.Clone();
}
return (TsCAeSubscriptionFilters)subscriptionFilters_.Clone();
}
/// <summary>
/// Sets the current filters for the subscription.
/// </summary>
/// <param name="filters">The new filters to use for the subscription.</param>
public void SetFilters(TsCAeSubscriptionFilters filters)
{
/// <summary>
/// Sets the current filters for the subscription.
/// </summary>
/// <param name="filters">The new filters to use for the subscription.</param>
public void SetFilters(TsCAeSubscriptionFilters filters)
{
LicenseHandler.ValidateFeatures(LicenseHandler.ProductFeature.AlarmsConditions);
if (subscription_ == null) throw new NotConnectedException();
subscription_.SetFilters(filters);
GetFilters();
}
GetFilters();
}
/// <summary>
/// Returns the set of attributes to return with event notifications.
/// </summary>
/// <returns>The set of attributes to returned with event notifications.</returns>
public int[] GetReturnedAttributes(int eventCategory)
{
/// <summary>
/// Returns the set of attributes to return with event notifications.
/// </summary>
/// <returns>The set of attributes to returned with event notifications.</returns>
public int[] GetReturnedAttributes(int eventCategory)
{
LicenseHandler.ValidateFeatures(LicenseHandler.ProductFeature.AlarmsConditions);
if (subscription_ == null) throw new NotConnectedException();
var attributeIDs = subscription_.GetReturnedAttributes(eventCategory);
attributes_.Update(eventCategory, (int[])OpcConvert.Clone(attributeIDs));
attributes_.Update(eventCategory, (int[])OpcConvert.Clone(attributeIDs));
return attributeIDs;
}
return attributeIDs;
}
/// <summary>
/// Selects the set of attributes to return with event notifications.
/// </summary>
/// <param name="eventCategory">The specific event category for which the attributes apply.</param>
/// <param name="attributeIDs">The list of attribute ids to return.</param>
public void SelectReturnedAttributes(int eventCategory, int[] attributeIDs)
{
/// <summary>
/// Selects the set of attributes to return with event notifications.
/// </summary>
/// <param name="eventCategory">The specific event category for which the attributes apply.</param>
/// <param name="attributeIDs">The list of attribute ids to return.</param>
public void SelectReturnedAttributes(int eventCategory, int[] attributeIDs)
{
LicenseHandler.ValidateFeatures(LicenseHandler.ProductFeature.AlarmsConditions);
if (subscription_ == null) throw new NotConnectedException();
subscription_.SelectReturnedAttributes(eventCategory, attributeIDs);
attributes_.Update(eventCategory, (int[])OpcConvert.Clone(attributeIDs));
}
attributes_.Update(eventCategory, (int[])OpcConvert.Clone(attributeIDs));
}
/// <summary>
/// Force a refresh for all active conditions and inactive, unacknowledged conditions whose event notifications match the filter of the event subscription.
/// </summary>
public void Refresh()
{
/// <summary>
/// Force a refresh for all active conditions and inactive, unacknowledged conditions whose event notifications match the filter of the event subscription.
/// </summary>
public void Refresh()
{
LicenseHandler.ValidateFeatures(LicenseHandler.ProductFeature.AlarmsConditions);
if (subscription_ == null) throw new NotConnectedException();
subscription_.Refresh();
}
}
/// <summary>
/// Cancels an outstanding refresh request.
/// </summary>
public void CancelRefresh()
{
/// <summary>
/// Cancels an outstanding refresh request.
/// </summary>
public void CancelRefresh()
{
LicenseHandler.ValidateFeatures(LicenseHandler.ProductFeature.AlarmsConditions);
if (subscription_ == null) throw new NotConnectedException();
subscription_.CancelRefresh();
}
#endregion
}
#endregion
#region Internal Properties
#region Internal Properties
/// <summary>
/// The current state.
/// </summary>
internal TsCAeSubscriptionState State => state_;
/// The current state.
/// </summary>
internal TsCAeSubscriptionState State => state_;
/// <summary>
/// The current filters.
@@ -606,5 +606,5 @@ namespace Technosoftware.DaAeHdaClient.Ae
internal TsCAeSubscriptionFilters Filters => subscriptionFilters_;
#endregion
}
}
}

View File

@@ -27,165 +27,165 @@ using System.Runtime.Serialization;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// Describes the event filters for a subscription.
/// </summary>
[Serializable]
public class TsCAeSubscriptionFilters : ICloneable, ISerializable
{
#region CategoryCollection Class
/// <summary>
/// Describes the event filters for a subscription.
/// </summary>
[Serializable]
public class TsCAeSubscriptionFilters : ICloneable, ISerializable
{
#region CategoryCollection Class
/// <summary>
/// Contains a writable collection category ids.
/// </summary>
[Serializable]
public class CategoryCollection : OpcWriteableCollection
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Creates an empty collection.
/// </summary>
internal CategoryCollection() : base(null, typeof(int)) { }
#region ISerializable Members
/// Contains a writable collection category ids.
/// </summary>
[Serializable]
public class CategoryCollection : OpcWriteableCollection
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Constructs an object by deserializing it from a stream.
/// </summary>
protected CategoryCollection(SerializationInfo info, StreamingContext context) : base(info, context) { }
/// Creates an empty collection.
/// </summary>
internal CategoryCollection() : base(null, typeof(int)) { }
#region ISerializable Members
/// <summary>
/// Constructs an object by deserializing it from a stream.
/// </summary>
protected CategoryCollection(SerializationInfo info, StreamingContext context) : base(info, context) { }
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// An indexer for the collection.
/// </summary>
public new int this[int index] => (int)Array[index];
/// An indexer for the collection.
/// </summary>
public new int this[int index] => (int)Array[index];
/// <summary>
/// Returns a copy of the collection as an array.
/// </summary>
public new int[] ToArray()
{
return (int[])Array.ToArray(typeof(int));
}
{
return (int[])Array.ToArray(typeof(int));
}
#endregion
}
}
#endregion
#region StringCollection Class
#region StringCollection Class
/// <summary>
/// Contains a writable collection of strings.
/// </summary>
[Serializable]
public class StringCollection : OpcWriteableCollection
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Creates an empty collection.
/// </summary>
internal StringCollection() : base(null, typeof(string)) { }
/// Contains a writable collection of strings.
/// </summary>
[Serializable]
public class StringCollection : OpcWriteableCollection
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Creates an empty collection.
/// </summary>
internal StringCollection() : base(null, typeof(string)) { }
#endregion
#region Public Methods
/// <summary>
/// An indexer for the collection.
/// </summary>
public new string this[int index] => (string)Array[index];
#region Public Methods
/// <summary>
/// An indexer for the collection.
/// </summary>
public new string this[int index] => (string)Array[index];
/// <summary>
/// Returns a copy of the collection as an array.
/// </summary>
public new string[] ToArray()
{
return (string[])Array.ToArray(typeof(string));
}
{
return (string[])Array.ToArray(typeof(string));
}
#endregion
#region ISerializable Members
#region ISerializable Members
/// <summary>
/// Constructs an object by deserializing it from a stream.
/// </summary>
protected StringCollection(SerializationInfo info, StreamingContext context) : base(info, context) { }
/// Constructs an object by deserializing it from a stream.
/// </summary>
protected StringCollection(SerializationInfo info, StreamingContext context) : base(info, context) { }
#endregion
}
}
#endregion
#region Names Class
/// <summary>
/// A set of names for fields used in serialization.
/// </summary>
private class Names
{
internal const string EventTypes = "ET";
internal const string Categories = "CT";
internal const string HighSeverity = "HS";
internal const string LowSeverity = "LS";
internal const string Areas = "AR";
internal const string Sources = "SR";
}
#endregion
#region Fields
private int eventTypes_ = (int)TsCAeEventType.All;
private CategoryCollection categories_ = new CategoryCollection();
private int highSeverity_ = 1000;
private int lowSeverity_ = 1;
private StringCollection areas_ = new StringCollection();
private StringCollection sources_ = new StringCollection();
#endregion
#region Constructors, Destructor, Initialization
#region Names Class
/// <summary>
/// Initializes object with default values.
/// </summary>
public TsCAeSubscriptionFilters() { }
/// <summary>
/// Constructs a server by de-serializing its OpcUrl from the stream.
/// </summary>
protected TsCAeSubscriptionFilters(SerializationInfo info, StreamingContext context)
{
eventTypes_ = (int)info.GetValue(Names.EventTypes, typeof(int));
categories_ = (CategoryCollection)info.GetValue(Names.Categories, typeof(CategoryCollection));
highSeverity_ = (int)info.GetValue(Names.HighSeverity, typeof(int));
lowSeverity_ = (int)info.GetValue(Names.LowSeverity, typeof(int));
areas_ = (StringCollection)info.GetValue(Names.Areas, typeof(StringCollection));
sources_ = (StringCollection)info.GetValue(Names.Sources, typeof(StringCollection));
}
/// A set of names for fields used in serialization.
/// </summary>
private class Names
{
internal const string EventTypes = "ET";
internal const string Categories = "CT";
internal const string HighSeverity = "HS";
internal const string LowSeverity = "LS";
internal const string Areas = "AR";
internal const string Sources = "SR";
}
#endregion
#region Properties
/// <summary>
/// A mask indicating which event types should be sent to the client.
/// </summary>
public int EventTypes
{
get => eventTypes_;
#region Fields
private int eventTypes_ = (int)TsCAeEventType.All;
private CategoryCollection categories_ = new CategoryCollection();
private int highSeverity_ = 1000;
private int lowSeverity_ = 1;
private StringCollection areas_ = new StringCollection();
private StringCollection sources_ = new StringCollection();
#endregion
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes object with default values.
/// </summary>
public TsCAeSubscriptionFilters() { }
/// <summary>
/// Constructs a server by de-serializing its OpcUrl from the stream.
/// </summary>
protected TsCAeSubscriptionFilters(SerializationInfo info, StreamingContext context)
{
eventTypes_ = (int)info.GetValue(Names.EventTypes, typeof(int));
categories_ = (CategoryCollection)info.GetValue(Names.Categories, typeof(CategoryCollection));
highSeverity_ = (int)info.GetValue(Names.HighSeverity, typeof(int));
lowSeverity_ = (int)info.GetValue(Names.LowSeverity, typeof(int));
areas_ = (StringCollection)info.GetValue(Names.Areas, typeof(StringCollection));
sources_ = (StringCollection)info.GetValue(Names.Sources, typeof(StringCollection));
}
#endregion
#region Properties
/// <summary>
/// A mask indicating which event types should be sent to the client.
/// </summary>
public int EventTypes
{
get => eventTypes_;
set => eventTypes_ = value;
}
/// <summary>
/// The highest severity for the events that should be sent to the client.
/// </summary>
public int HighSeverity
{
get => highSeverity_;
/// <summary>
/// The highest severity for the events that should be sent to the client.
/// </summary>
public int HighSeverity
{
get => highSeverity_;
set => highSeverity_ = value;
}
/// <summary>
/// The lowest severity for the events that should be sent to the client.
/// </summary>
public int LowSeverity
{
get => lowSeverity_;
/// <summary>
/// The lowest severity for the events that should be sent to the client.
/// </summary>
public int LowSeverity
{
get => lowSeverity_;
set => lowSeverity_ = value;
}
/// <summary>
/// The category ids for the events that should be sent to the client.
/// </summary>
public CategoryCollection Categories => categories_;
/// <summary>
/// The category ids for the events that should be sent to the client.
/// </summary>
public CategoryCollection Categories => categories_;
/// <summary>
/// A list of full-qualified ids for process areas of interest - only events or conditions in these areas will be reported.
@@ -198,35 +198,35 @@ namespace Technosoftware.DaAeHdaClient.Ae
public StringCollection Sources => sources_;
#endregion
#region ISerializable Members
#region ISerializable Members
/// <summary>
/// Serializes a server into a stream.
/// </summary>
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue(Names.EventTypes, eventTypes_);
info.AddValue(Names.Categories, categories_);
info.AddValue(Names.HighSeverity, highSeverity_);
info.AddValue(Names.LowSeverity, lowSeverity_);
info.AddValue(Names.Areas, areas_);
info.AddValue(Names.Sources, sources_);
}
#endregion
/// Serializes a server into a stream.
/// </summary>
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue(Names.EventTypes, eventTypes_);
info.AddValue(Names.Categories, categories_);
info.AddValue(Names.HighSeverity, highSeverity_);
info.AddValue(Names.LowSeverity, lowSeverity_);
info.AddValue(Names.Areas, areas_);
info.AddValue(Names.Sources, sources_);
}
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var filters = (TsCAeSubscriptionFilters)MemberwiseClone();
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var filters = (TsCAeSubscriptionFilters)MemberwiseClone();
filters.categories_ = (CategoryCollection)categories_.Clone();
filters.areas_ = (StringCollection)areas_.Clone();
filters.sources_ = (StringCollection)sources_.Clone();
filters.categories_ = (CategoryCollection)categories_.Clone();
filters.areas_ = (StringCollection)areas_.Clone();
filters.sources_ = (StringCollection)sources_.Clone();
return filters;
}
#endregion
}
return filters;
}
#endregion
}
}

View File

@@ -26,63 +26,63 @@ using System;
namespace Technosoftware.DaAeHdaClient.Ae
{
/// <summary>
/// Describes the state of a subscription.
/// </summary>
[Serializable]
public class TsCAeSubscriptionState : ICloneable
{
#region Fields
/// <summary>
/// Describes the state of a subscription.
/// </summary>
[Serializable]
public class TsCAeSubscriptionState : ICloneable
{
#region Fields
private bool active_ = true;
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
#endregion
#region Properties
#region Properties
/// <summary>
/// A descriptive name for the subscription.
/// </summary>
public string Name { get; set; }
/// A descriptive name for the subscription.
/// </summary>
public string Name { get; set; }
/// <summary>
/// A unique identifier for the subscription assigned by the client.
/// </summary>
public object ClientHandle { get; set; }
/// <summary>
/// A unique identifier for the subscription assigned by the client.
/// </summary>
public object ClientHandle { get; set; }
/// <summary>
/// Whether the subscription is monitoring for events to send to the client.
/// </summary>
public bool Active
{
get => active_;
/// <summary>
/// Whether the subscription is monitoring for events to send to the client.
/// </summary>
public bool Active
{
get => active_;
set => active_ = value;
}
/// <summary>
/// The maximum rate at which the server send event notifications.
/// </summary>
public int BufferTime { get; set; }
/// <summary>
/// The requested maximum number of events that will be sent in a single callback.
/// </summary>
public int MaxSize { get; set; }
/// <summary>
/// The maximum period between updates sent to the client.
/// </summary>
public int KeepAlive { get; set; }
#endregion
#region ICloneable Members
/// <summary>
/// Creates a shallow copy of the object.
/// </summary>
public virtual object Clone()
{
return MemberwiseClone();
}
/// The maximum rate at which the server send event notifications.
/// </summary>
public int BufferTime { get; set; }
/// <summary>
/// The requested maximum number of events that will be sent in a single callback.
/// </summary>
public int MaxSize { get; set; }
/// <summary>
/// The maximum period between updates sent to the client.
/// </summary>
public int KeepAlive { get; set; }
#endregion
}
#region ICloneable Members
/// <summary>
/// Creates a shallow copy of the object.
/// </summary>
public virtual object Clone()
{
return MemberwiseClone();
}
#endregion
}
}

View File

@@ -21,7 +21,6 @@
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
#region Using Directives
using System;
using Technosoftware.DaAeHdaClient.Utilities;
#endregion

File diff suppressed because it is too large Load Diff

View File

@@ -29,179 +29,179 @@ using Technosoftware.DaAeHdaClient.Da;
namespace Technosoftware.DaAeHdaClient.Cpx
{
/// <summary>
/// A class that caches properties of complex data items.
/// </summary>
public class TsCCpxComplexTypeCache
{
/// <summary>
/// A class that caches properties of complex data items.
/// </summary>
public class TsCCpxComplexTypeCache
{
///////////////////////////////////////////////////////////////////////
#region Fields
///////////////////////////////////////////////////////////////////////
#region Fields
/// <summary>
/// The active server for the application.
/// </summary>
private static TsCDaServer _server;
/// <summary>
/// The active server for the application.
/// </summary>
private static TsCDaServer _server;
/// <summary>
/// A cache of item properties fetched from the active server.
/// </summary>
private static Hashtable _items = new Hashtable();
/// <summary>
/// A cache of item properties fetched from the active server.
/// </summary>
private static Hashtable _items = new Hashtable();
/// <summary>
/// A cache of type dictionaries fetched from the active server.
/// </summary>
private static Hashtable _dictionaries = new Hashtable();
/// <summary>
/// A cache of type dictionaries fetched from the active server.
/// </summary>
private static Hashtable _dictionaries = new Hashtable();
/// <summary>
/// A cache of type descriptions fetched from the active server.
/// </summary>
private static Hashtable _descriptions = new Hashtable();
/// <summary>
/// A cache of type descriptions fetched from the active server.
/// </summary>
private static Hashtable _descriptions = new Hashtable();
#endregion
#endregion
///////////////////////////////////////////////////////////////////////
#region Constructors, Destructor, Initialization
///////////////////////////////////////////////////////////////////////
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes the complex type cache with defaults.
/// </summary>
public TsCCpxComplexTypeCache() { }
/// <summary>
/// Initializes the complex type cache with defaults.
/// </summary>
public TsCCpxComplexTypeCache() { }
#endregion
#endregion
///////////////////////////////////////////////////////////////////////
#region Properties
///////////////////////////////////////////////////////////////////////
#region Properties
/// <summary>
/// Get or sets the server to use for the cache.
/// </summary>
public static TsCDaServer Server
{
get
{
lock (typeof(TsCCpxComplexTypeCache))
{
return _server;
}
}
/// <summary>
/// Get or sets the server to use for the cache.
/// </summary>
public static TsCDaServer Server
{
get
{
lock (typeof(TsCCpxComplexTypeCache))
{
return _server;
}
}
set
{
lock (typeof(TsCCpxComplexTypeCache))
{
_server = value;
_items.Clear();
_dictionaries.Clear();
_descriptions.Clear();
}
}
}
set
{
lock (typeof(TsCCpxComplexTypeCache))
{
_server = value;
_items.Clear();
_dictionaries.Clear();
_descriptions.Clear();
}
}
}
#endregion
#endregion
///////////////////////////////////////////////////////////////////////
#region Public Methods
///////////////////////////////////////////////////////////////////////
#region Public Methods
/// <summary>
/// Returns the complex item for the specified item id.
/// </summary>
/// <param name="itemID">The item id.</param>
public static TsCCpxComplexItem GetComplexItem(OpcItem itemID)
{
if (itemID == null) return null;
/// <summary>
/// Returns the complex item for the specified item id.
/// </summary>
/// <param name="itemID">The item id.</param>
public static TsCCpxComplexItem GetComplexItem(OpcItem itemID)
{
if (itemID == null) return null;
lock (typeof(TsCCpxComplexTypeCache))
{
var item = new TsCCpxComplexItem(itemID);
lock (typeof(TsCCpxComplexTypeCache))
{
var item = new TsCCpxComplexItem(itemID);
try
{
item.Update(_server);
}
catch
{
// item is not a valid complex data item.
item = null;
}
try
{
item.Update(_server);
}
catch
{
// item is not a valid complex data item.
item = null;
}
_items[itemID.Key] = item;
return item;
}
}
_items[itemID.Key] = item;
return item;
}
}
/// <summary>
/// Returns the complex item for the specified item browse element.
/// </summary>
/// <param name="element">The item browse element.</param>
public static TsCCpxComplexItem GetComplexItem(TsCDaBrowseElement element)
{
if (element == null) return null;
/// <summary>
/// Returns the complex item for the specified item browse element.
/// </summary>
/// <param name="element">The item browse element.</param>
public static TsCCpxComplexItem GetComplexItem(TsCDaBrowseElement element)
{
if (element == null) return null;
lock (typeof(TsCCpxComplexTypeCache))
{
return GetComplexItem(new OpcItem(element.ItemPath, element.ItemName));
}
}
lock (typeof(TsCCpxComplexTypeCache))
{
return GetComplexItem(new OpcItem(element.ItemPath, element.ItemName));
}
}
/// <summary>
/// Fetches the type dictionary for the item.
/// </summary>
/// <param name="itemID">The item id.</param>
public static string GetTypeDictionary(OpcItem itemID)
{
if (itemID == null) return null;
/// <summary>
/// Fetches the type dictionary for the item.
/// </summary>
/// <param name="itemID">The item id.</param>
public static string GetTypeDictionary(OpcItem itemID)
{
if (itemID == null) return null;
lock (typeof(TsCCpxComplexTypeCache))
{
var dictionary = (string)_dictionaries[itemID.Key];
lock (typeof(TsCCpxComplexTypeCache))
{
var dictionary = (string)_dictionaries[itemID.Key];
if (dictionary != null)
{
return dictionary;
}
if (dictionary != null)
{
return dictionary;
}
var item = GetComplexItem(itemID);
var item = GetComplexItem(itemID);
if (item != null)
{
dictionary = item.GetTypeDictionary(_server);
}
if (item != null)
{
dictionary = item.GetTypeDictionary(_server);
}
return dictionary;
}
}
return dictionary;
}
}
/// <summary>
/// Fetches the type description for the item.
/// </summary>
/// <param name="itemID">The item id.</param>
public static string GetTypeDescription(OpcItem itemID)
{
if (itemID == null) return null;
/// <summary>
/// Fetches the type description for the item.
/// </summary>
/// <param name="itemID">The item id.</param>
public static string GetTypeDescription(OpcItem itemID)
{
if (itemID == null) return null;
lock (typeof(TsCCpxComplexTypeCache))
{
string description = null;
lock (typeof(TsCCpxComplexTypeCache))
{
string description = null;
var item = GetComplexItem(itemID);
var item = GetComplexItem(itemID);
if (item != null)
{
description = (string)_descriptions[item.TypeItemID.Key];
if (item != null)
{
description = (string)_descriptions[item.TypeItemID.Key];
if (description != null)
{
return description;
}
if (description != null)
{
return description;
}
_descriptions[item.TypeItemID.Key] = description = item.GetTypeDescription(_server);
}
_descriptions[item.TypeItemID.Key] = description = item.GetTypeDescription(_server);
}
return description;
}
}
return description;
}
}
#endregion
}
#endregion
}
}

View File

@@ -26,24 +26,24 @@
namespace Technosoftware.DaAeHdaClient.Cpx
{
/// <summary>
/// Stores a value with an associated name and/or type.
/// </summary>
public class TsCCpxComplexValue
{
/// <summary>
/// The name of the value.
/// </summary>
public string Name;
/// <summary>
/// Stores a value with an associated name and/or type.
/// </summary>
public class TsCCpxComplexValue
{
/// <summary>
/// The name of the value.
/// </summary>
public string Name;
/// <summary>
/// The complex or simple data type of the value.
/// </summary>
public string Type;
/// <summary>
/// The complex or simple data type of the value.
/// </summary>
public string Type;
/// <summary>
/// The actual value.
/// </summary>
public object Value;
}
/// <summary>
/// The actual value.
/// </summary>
public object Value;
}
}

View File

@@ -26,46 +26,46 @@
namespace Technosoftware.DaAeHdaClient.Cpx
{
/// <summary>
/// Stores the current serialization context.
/// </summary>
internal struct TsCCpxContext
{
///////////////////////////////////////////////////////////////////////
#region Constructors, Destructor, Initialization
/// <summary>
/// Stores the current serialization context.
/// </summary>
internal struct TsCCpxContext
{
///////////////////////////////////////////////////////////////////////
#region Constructors, Destructor, Initialization
public TsCCpxContext(byte[] buffer)
{
Buffer = buffer;
Index = 0;
Dictionary = null;
Type = null;
BigEndian = false;
CharWidth = 2;
StringEncoding = STRING_ENCODING_UCS2;
FloatFormat = FLOAT_FORMAT_IEEE754;
}
public TsCCpxContext(byte[] buffer)
{
Buffer = buffer;
Index = 0;
Dictionary = null;
Type = null;
BigEndian = false;
CharWidth = 2;
StringEncoding = STRING_ENCODING_UCS2;
FloatFormat = FLOAT_FORMAT_IEEE754;
}
#endregion
#endregion
///////////////////////////////////////////////////////////////////////
#region Public Fields
///////////////////////////////////////////////////////////////////////
#region Public Fields
public byte[] Buffer;
public int Index;
public TypeDictionary Dictionary;
public TypeDescription Type;
public bool BigEndian;
public int CharWidth;
public string StringEncoding;
public string FloatFormat;
public byte[] Buffer;
public int Index;
public TypeDictionary Dictionary;
public TypeDescription Type;
public bool BigEndian;
public int CharWidth;
public string StringEncoding;
public string FloatFormat;
public const string STRING_ENCODING_ACSII = "ASCII";
public const string STRING_ENCODING_UCS2 = "UCS-2";
public const string FLOAT_FORMAT_IEEE754 = "IEEE-754";
public const string STRING_ENCODING_ACSII = "ASCII";
public const string STRING_ENCODING_UCS2 = "UCS-2";
public const string FLOAT_FORMAT_IEEE754 = "IEEE-754";
#endregion
#endregion
}
}
}

View File

@@ -27,22 +27,22 @@ using System.Runtime.Serialization;
namespace Technosoftware.DaAeHdaClient.Cpx
{
/// <summary>
/// Raised if the data in buffer is not consistent with the schema.
/// </summary>
[Serializable]
public class TsCCpxInvalidDataInBufferException : ApplicationException
{
private const string Default = "The data in the buffer cannot be read because it is not consistent with the schema.";
/// <remarks/>
public TsCCpxInvalidDataInBufferException() : base(Default) { }
/// <remarks/>
public TsCCpxInvalidDataInBufferException(string message) : base(Default + Environment.NewLine + message) { }
/// <remarks/>
public TsCCpxInvalidDataInBufferException(Exception e) : base(Default, e) { }
/// <remarks/>
public TsCCpxInvalidDataInBufferException(string message, Exception innerException) : base(Default + Environment.NewLine + message, innerException) { }
/// <remarks/>
protected TsCCpxInvalidDataInBufferException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
/// <summary>
/// Raised if the data in buffer is not consistent with the schema.
/// </summary>
[Serializable]
public class TsCCpxInvalidDataInBufferException : ApplicationException
{
private const string Default = "The data in the buffer cannot be read because it is not consistent with the schema.";
/// <remarks/>
public TsCCpxInvalidDataInBufferException() : base(Default) { }
/// <remarks/>
public TsCCpxInvalidDataInBufferException(string message) : base(Default + Environment.NewLine + message) { }
/// <remarks/>
public TsCCpxInvalidDataInBufferException(Exception e) : base(Default, e) { }
/// <remarks/>
public TsCCpxInvalidDataInBufferException(string message, Exception innerException) : base(Default + Environment.NewLine + message, innerException) { }
/// <remarks/>
protected TsCCpxInvalidDataInBufferException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}

View File

@@ -27,22 +27,22 @@ using System.Runtime.Serialization;
namespace Technosoftware.DaAeHdaClient.Cpx
{
/// <summary>
/// Raised if the data in buffer is not consistent with the schema.
/// </summary>
[Serializable]
public class TsCCpxInvalidDataToWriteException : ApplicationException
{
private const string Default = "The object cannot be written because it is not consistent with the schema.";
/// <remarks/>
public TsCCpxInvalidDataToWriteException() : base(Default) { }
/// <remarks/>
public TsCCpxInvalidDataToWriteException(string message) : base(Default + Environment.NewLine + message) { }
/// <remarks/>
public TsCCpxInvalidDataToWriteException(Exception e) : base(Default, e) { }
/// <remarks/>
public TsCCpxInvalidDataToWriteException(string message, Exception innerException) : base(Default + Environment.NewLine + message, innerException) { }
/// <remarks/>
protected TsCCpxInvalidDataToWriteException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
/// <summary>
/// Raised if the data in buffer is not consistent with the schema.
/// </summary>
[Serializable]
public class TsCCpxInvalidDataToWriteException : ApplicationException
{
private const string Default = "The object cannot be written because it is not consistent with the schema.";
/// <remarks/>
public TsCCpxInvalidDataToWriteException() : base(Default) { }
/// <remarks/>
public TsCCpxInvalidDataToWriteException(string message) : base(Default + Environment.NewLine + message) { }
/// <remarks/>
public TsCCpxInvalidDataToWriteException(Exception e) : base(Default, e) { }
/// <remarks/>
public TsCCpxInvalidDataToWriteException(string message, Exception innerException) : base(Default + Environment.NewLine + message, innerException) { }
/// <remarks/>
protected TsCCpxInvalidDataToWriteException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}

View File

@@ -27,22 +27,22 @@ using System.Runtime.Serialization;
namespace Technosoftware.DaAeHdaClient.Cpx
{
/// <summary>
/// Raised if the schema contains errors or inconsistencies.
/// </summary>
[Serializable]
public class TsCCpxInvalidSchemaException : ApplicationException
{
private const string Default = "The schema cannot be used because it contains errors or inconsitencies.";
/// <remarks/>
public TsCCpxInvalidSchemaException() : base(Default) { }
/// <remarks/>
public TsCCpxInvalidSchemaException(string message) : base(Default + Environment.NewLine + message) { }
/// <remarks/>
public TsCCpxInvalidSchemaException(Exception e) : base(Default, e) { }
/// <remarks/>
public TsCCpxInvalidSchemaException(string message, Exception innerException) : base(Default + Environment.NewLine + message, innerException) { }
/// <remarks/>
protected TsCCpxInvalidSchemaException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
/// <summary>
/// Raised if the schema contains errors or inconsistencies.
/// </summary>
[Serializable]
public class TsCCpxInvalidSchemaException : ApplicationException
{
private const string Default = "The schema cannot be used because it contains errors or inconsitencies.";
/// <remarks/>
public TsCCpxInvalidSchemaException() : base(Default) { }
/// <remarks/>
public TsCCpxInvalidSchemaException(string message) : base(Default + Environment.NewLine + message) { }
/// <remarks/>
public TsCCpxInvalidSchemaException(Exception e) : base(Default, e) { }
/// <remarks/>
public TsCCpxInvalidSchemaException(string message, Exception innerException) : base(Default + Environment.NewLine + message, innerException) { }
/// <remarks/>
protected TsCCpxInvalidSchemaException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}

View File

@@ -25,21 +25,21 @@
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// <para>Defines possible item access rights.</para>
/// <para align="left">Indicates if this item is read only, write only or read/write.
/// This is NOT related to security but rather to the nature of the underlying
/// hardware.</para>
/// </summary>
public enum TsDaAccessRights
/// <summary>
/// <para>Defines possible item access rights.</para>
/// <para align="left">Indicates if this item is read only, write only or read/write.
/// This is NOT related to security but rather to the nature of the underlying
/// hardware.</para>
/// </summary>
public enum TsDaAccessRights
{
/// <summary>The access rights for this item are server.</summary>
Unknown = 0x00,
/// <summary>The client can read the data item's value.</summary>
Readable = 0x01,
/// <summary>The client can change the data item's value.</summary>
Writable = 0x02,
/// <summary>The client can read and change the data item's value.</summary>
ReadWritable = 0x03
}
/// <summary>The access rights for this item are server.</summary>
Unknown = 0x00,
/// <summary>The client can read the data item's value.</summary>
Readable = 0x01,
/// <summary>The client can change the data item's value.</summary>
Writable = 0x02,
/// <summary>The client can read and change the data item's value.</summary>
ReadWritable = 0x03
}
}

View File

@@ -32,33 +32,33 @@ namespace Technosoftware.DaAeHdaClient.Da
[Serializable]
public class TsCDaBrowsePosition : IOpcBrowsePosition
{
#region Fields
#region Fields
private TsCDaBrowseFilters browseFilters_;
private OpcItem itemId_;
private OpcItem itemId_;
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
/// <summary>
/// Saves the parameters for an incomplete browse information.
/// </summary>
public TsCDaBrowsePosition(OpcItem itemId, TsCDaBrowseFilters filters)
{
if (filters == null) throw new ArgumentNullException(nameof(filters));
/// Saves the parameters for an incomplete browse information.
/// </summary>
public TsCDaBrowsePosition(OpcItem itemId, TsCDaBrowseFilters filters)
{
if (filters == null) throw new ArgumentNullException(nameof(filters));
itemId_ = (OpcItem)itemId?.Clone();
browseFilters_ = (TsCDaBrowseFilters)filters.Clone();
}
itemId_ = (OpcItem)itemId?.Clone();
browseFilters_ = (TsCDaBrowseFilters)filters.Clone();
}
/// <summary>
/// Releases unmanaged resources held by the object.
/// </summary>
public virtual void Dispose()
{
// does nothing.
}
/// <summary>
/// Releases unmanaged resources held by the object.
/// </summary>
public virtual void Dispose()
{
// does nothing.
}
#endregion
#region Properties
#region Properties
/// <summary>
/// The item identifier of the branch being browsed.
/// </summary>
@@ -80,7 +80,7 @@ namespace Technosoftware.DaAeHdaClient.Da
}
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
@@ -89,5 +89,5 @@ namespace Technosoftware.DaAeHdaClient.Da
return (TsCDaBrowsePosition)MemberwiseClone();
}
#endregion
}
}
}

View File

@@ -26,62 +26,62 @@ using System;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Contains a description of an element in the server address space.
/// </summary>
[Serializable]
public class TsCDaBrowseElement : ICloneable
{
#region Fields
/// <summary>
/// Contains a description of an element in the server address space.
/// </summary>
[Serializable]
public class TsCDaBrowseElement : ICloneable
{
#region Fields
private TsCDaItemProperty[] itemProperties_ = new TsCDaItemProperty[0];
#endregion
#region Properties
#region Properties
/// <summary>
/// A descriptive name for element that is unique within a branch.
/// </summary>
public string Name { get; set; }
/// A descriptive name for element that is unique within a branch.
/// </summary>
public string Name { get; set; }
/// <summary>
/// The primary identifier for the element within the server namespace.
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// The primary identifier for the element within the server namespace.
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// An secondary identifier for the element within the server namespace.
/// </summary>
public string ItemPath { get; set; }
/// <summary>
/// An secondary identifier for the element within the server namespace.
/// </summary>
public string ItemPath { get; set; }
/// <summary>
/// Whether the element refers to an item with data that can be accessed.
/// </summary>
public bool IsItem { get; set; }
/// <summary>
/// Whether the element refers to an item with data that can be accessed.
/// </summary>
public bool IsItem { get; set; }
/// <summary>
/// Whether the element has children.
/// </summary>
public bool HasChildren { get; set; }
/// <summary>
/// Whether the element has children.
/// </summary>
public bool HasChildren { get; set; }
/// <summary>
/// The set of properties for the element.
/// </summary>
public TsCDaItemProperty[] Properties
{
get => itemProperties_;
/// <summary>
/// The set of properties for the element.
/// </summary>
public TsCDaItemProperty[] Properties
{
get => itemProperties_;
set => itemProperties_ = value;
}
#endregion
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var clone = (TsCDaBrowseElement)MemberwiseClone();
clone.itemProperties_ = (TsCDaItemProperty[])OpcConvert.Clone(itemProperties_);
return clone;
}
#endregion
};
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var clone = (TsCDaBrowseElement)MemberwiseClone();
clone.itemProperties_ = (TsCDaItemProperty[])OpcConvert.Clone(itemProperties_);
return clone;
}
#endregion
};
}

View File

@@ -25,24 +25,24 @@
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// The type of browse elements to return during a browse.
/// </summary>
public enum TsCDaBrowseFilter
{
/// <summary>
/// Return all types of browse elements.
/// </summary>
All,
/// <summary>
/// The type of browse elements to return during a browse.
/// </summary>
public enum TsCDaBrowseFilter
{
/// <summary>
/// Return all types of browse elements.
/// </summary>
All,
/// <summary>
/// Return only elements that contain other elements.
/// </summary>
Branch,
/// <summary>
/// Return only elements that contain other elements.
/// </summary>
Branch,
/// <summary>
/// Return only elements that represent items.
/// </summary>
Item
}
/// <summary>
/// Return only elements that represent items.
/// </summary>
Item
}
}

View File

@@ -26,72 +26,72 @@ using System;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Defines a set of filters to apply when browsing.
/// </summary>
[Serializable]
public class TsCDaBrowseFilters : ICloneable
{
#region Fields
/// <summary>
/// Defines a set of filters to apply when browsing.
/// </summary>
[Serializable]
public class TsCDaBrowseFilters : ICloneable
{
#region Fields
private TsCDaBrowseFilter browseFilter_ = TsCDaBrowseFilter.All;
private TsDaPropertyID[] propertyIds_;
private TsDaPropertyID[] propertyIds_;
#endregion
#region Properties
#region Properties
/// <summary>
/// The maximum number of elements to return. Zero means no limit.
/// </summary>
public int MaxElementsReturned { get; set; }
/// The maximum number of elements to return. Zero means no limit.
/// </summary>
public int MaxElementsReturned { get; set; }
/// <summary>
/// The type of element to return.
/// </summary>
public TsCDaBrowseFilter BrowseFilter
{
get => browseFilter_;
/// <summary>
/// The type of element to return.
/// </summary>
public TsCDaBrowseFilter BrowseFilter
{
get => browseFilter_;
set => browseFilter_ = value;
}
/// <summary>
/// An expression used to match the name of the element.
/// </summary>
public string ElementNameFilter { get; set; }
/// <summary>
/// An expression used to match the name of the element.
/// </summary>
public string ElementNameFilter { get; set; }
/// <summary>
/// A filter which has semantics that defined by the server.
/// </summary>
public string VendorFilter { get; set; }
/// <summary>
/// A filter which has semantics that defined by the server.
/// </summary>
public string VendorFilter { get; set; }
/// <summary>
/// Whether all supported properties to return with each element.
/// </summary>
public bool ReturnAllProperties { get; set; }
/// <summary>
/// Whether all supported properties to return with each element.
/// </summary>
public bool ReturnAllProperties { get; set; }
/// <summary>
/// A list of names of the properties to return with each element.
/// </summary>
public TsDaPropertyID[] PropertyIDs
{
get => propertyIds_;
/// <summary>
/// A list of names of the properties to return with each element.
/// </summary>
public TsDaPropertyID[] PropertyIDs
{
get => propertyIds_;
set => propertyIds_ = value;
}
/// <summary>
/// Whether property values should be returned with the properties.
/// </summary>
public bool ReturnPropertyValues { get; set; }
/// <summary>
/// Whether property values should be returned with the properties.
/// </summary>
public bool ReturnPropertyValues { get; set; }
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var clone = (TsCDaBrowseFilters)MemberwiseClone();
clone.PropertyIDs = (TsDaPropertyID[])PropertyIDs?.Clone();
return clone;
}
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var clone = (TsCDaBrowseFilters)MemberwiseClone();
clone.PropertyIDs = (TsDaPropertyID[])PropertyIDs?.Clone();
return clone;
}
#endregion
}
}
}

View File

@@ -25,21 +25,21 @@
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary><para>Defines possible item engineering unit types</para></summary>
public enum TsDaEuType
/// <summary><para>Defines possible item engineering unit types</para></summary>
public enum TsDaEuType
{
/// <summary>No engineering unit information available</summary>
NoEnum = 0x01,
/// <summary>
/// Analog engineering unit - will contain a SAFE ARRAY of exactly two doubles
/// (VT_ARRAY | VT_R8) corresponding to the LOW and HI EU range.
/// </summary>
Analog = 0x02,
/// <summary>
/// Enumerated engineering unit - will contain a SAFE ARRAY of strings (VT_ARRAY |
/// VT_BSTR) which contains a list of strings (Example: “OPEN”, “CLOSE”, “IN TRANSIT”,
/// etc.) corresponding to sequential numeric values (0, 1, 2, etc.)
/// </summary>
Enumerated = 0x03
}
/// <summary>No engineering unit information available</summary>
NoEnum = 0x01,
/// <summary>
/// Analog engineering unit - will contain a SAFE ARRAY of exactly two doubles
/// (VT_ARRAY | VT_R8) corresponding to the LOW and HI EU range.
/// </summary>
Analog = 0x02,
/// <summary>
/// Enumerated engineering unit - will contain a SAFE ARRAY of strings (VT_ARRAY |
/// VT_BSTR) which contains a list of strings (Example: “OPEN”, “CLOSE”, “IN TRANSIT”,
/// etc.) corresponding to sequential numeric values (0, 1, 2, etc.)
/// </summary>
Enumerated = 0x03
}
}

View File

@@ -25,22 +25,22 @@
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Defines functionality that is common to all OPC Data Access servers.
/// </summary>
public interface ITsDaServer : IOpcServer
{
/// <summary>
/// Returns the filters applied by the server to any item results returned to the client.
/// </summary>
/// <returns>A bit mask indicating which fields should be returned in any item results.</returns>
int GetResultFilters();
/// <summary>
/// Defines functionality that is common to all OPC Data Access servers.
/// </summary>
public interface ITsDaServer : IOpcServer
{
/// <summary>
/// Returns the filters applied by the server to any item results returned to the client.
/// </summary>
/// <returns>A bit mask indicating which fields should be returned in any item results.</returns>
int GetResultFilters();
/// <summary>
/// Sets the filters applied by the server to any item results returned to the client.
/// </summary>
/// <param name="filters">A bit mask indicating which fields should be returned in any item results.</param>
void SetResultFilters(int filters);
/// <summary>
/// Sets the filters applied by the server to any item results returned to the client.
/// </summary>
/// <param name="filters">A bit mask indicating which fields should be returned in any item results.</param>
void SetResultFilters(int filters);
/// <summary>
/// Returns the current server status.
@@ -48,62 +48,62 @@ namespace Technosoftware.DaAeHdaClient.Da
/// <returns>The current server status.</returns>
OpcServerStatus GetServerStatus();
/// <summary>
/// Reads the current values for a set of items.
/// </summary>
/// <param name="items">The set of items to read.</param>
/// <returns>The results of the read operation for each item.</returns>
TsCDaItemValueResult[] Read(TsCDaItem[] items);
/// <summary>
/// Reads the current values for a set of items.
/// </summary>
/// <param name="items">The set of items to read.</param>
/// <returns>The results of the read operation for each item.</returns>
TsCDaItemValueResult[] Read(TsCDaItem[] items);
/// <summary>
/// Writes the value, quality and timestamp for a set of items.
/// </summary>
/// <param name="values">The set of item values to write.</param>
/// <returns>The results of the write operation for each item.</returns>
OpcItemResult[] Write(TsCDaItemValue[] values);
/// <summary>
/// Writes the value, quality and timestamp for a set of items.
/// </summary>
/// <param name="values">The set of item values to write.</param>
/// <returns>The results of the write operation for each item.</returns>
OpcItemResult[] Write(TsCDaItemValue[] values);
/// <summary>
/// Creates a new subscription.
/// </summary>
/// <param name="state">The initial state of the subscription.</param>
/// <returns>The new subscription object.</returns>
ITsCDaSubscription CreateSubscription(TsCDaSubscriptionState state);
/// <summary>
/// Creates a new subscription.
/// </summary>
/// <param name="state">The initial state of the subscription.</param>
/// <returns>The new subscription object.</returns>
ITsCDaSubscription CreateSubscription(TsCDaSubscriptionState state);
/// <summary>
/// Cancels a subscription and releases all resources allocated for it.
/// </summary>
/// <param name="subscription">The subscription to cancel.</param>
void CancelSubscription(ITsCDaSubscription subscription);
/// <summary>
/// Cancels a subscription and releases all resources allocated for it.
/// </summary>
/// <param name="subscription">The subscription to cancel.</param>
void CancelSubscription(ITsCDaSubscription subscription);
/// <summary>
/// Fetches the children of a branch that meet the filter criteria.
/// </summary>
/// <param name="itemId">The identifier of branch which is the target of the search.</param>
/// <param name="filters">The filters to use to limit the set of child elements returned.</param>
/// <param name="position">An object used to continue a browse that could not be completed.</param>
/// <returns>The set of elements found.</returns>
TsCDaBrowseElement[] Browse(
OpcItem itemId,
TsCDaBrowseFilters filters,
out TsCDaBrowsePosition position);
/// <summary>
/// Fetches the children of a branch that meet the filter criteria.
/// </summary>
/// <param name="itemId">The identifier of branch which is the target of the search.</param>
/// <param name="filters">The filters to use to limit the set of child elements returned.</param>
/// <param name="position">An object used to continue a browse that could not be completed.</param>
/// <returns>The set of elements found.</returns>
TsCDaBrowseElement[] Browse(
OpcItem itemId,
TsCDaBrowseFilters filters,
out TsCDaBrowsePosition position);
/// <summary>
/// Continues a browse operation with previously specified search criteria.
/// </summary>
/// <param name="position">An object containing the browse operation state information.</param>
/// <returns>The set of elements found.</returns>
TsCDaBrowseElement[] BrowseNext(ref TsCDaBrowsePosition position);
/// <summary>
/// Continues a browse operation with previously specified search criteria.
/// </summary>
/// <param name="position">An object containing the browse operation state information.</param>
/// <returns>The set of elements found.</returns>
TsCDaBrowseElement[] BrowseNext(ref TsCDaBrowsePosition position);
/// <summary>
/// Returns the item properties for a set of items.
/// </summary>
/// <param name="itemIds">A list of item identifiers.</param>
/// <param name="propertyIDs">A list of properties to fetch for each item.</param>
/// <param name="returnValues">Whether the property values should be returned with the properties.</param>
/// <returns>A list of properties for each item.</returns>
TsCDaItemPropertyCollection[] GetProperties(
OpcItem[] itemIds,
TsDaPropertyID[] propertyIDs,
bool returnValues);
}
/// <summary>
/// Returns the item properties for a set of items.
/// </summary>
/// <param name="itemIds">A list of item identifiers.</param>
/// <param name="propertyIDs">A list of properties to fetch for each item.</param>
/// <param name="returnValues">Whether the property values should be returned with the properties.</param>
/// <returns>A list of properties for each item.</returns>
TsCDaItemPropertyCollection[] GetProperties(
OpcItem[] itemIds,
TsDaPropertyID[] propertyIDs,
bool returnValues);
}
}

View File

@@ -27,89 +27,89 @@ using System;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// A subscription for a set of items on a single OPC server.
/// </summary>
public interface ITsCDaSubscription : IDisposable
{
#region Events
/// <summary>
/// A subscription for a set of items on a single OPC server.
/// </summary>
public interface ITsCDaSubscription : IDisposable
{
#region Events
/// <summary>
/// An event to receive data change updates.
/// </summary>
event TsCDaDataChangedEventHandler DataChangedEvent;
#endregion
#region Result Filters
#region Result Filters
/// <summary>
/// Returns the filters applied by the server to any item results returned to the client.
/// </summary>
/// <returns>A bit mask indicating which fields should be returned in any item results.</returns>
int GetResultFilters();
/// Returns the filters applied by the server to any item results returned to the client.
/// </summary>
/// <returns>A bit mask indicating which fields should be returned in any item results.</returns>
int GetResultFilters();
/// <summary>
/// Sets the filters applied by the server to any item results returned to the client.
/// </summary>
/// <param name="filters">A bit mask indicating which fields should be returned in any item results.</param>
void SetResultFilters(int filters);
/// <summary>
/// Sets the filters applied by the server to any item results returned to the client.
/// </summary>
/// <param name="filters">A bit mask indicating which fields should be returned in any item results.</param>
void SetResultFilters(int filters);
#endregion
#region State Management
#region State Management
/// <summary>
/// Returns the current state of the subscription.
/// </summary>
/// <returns>The current state of the subscription.</returns>
TsCDaSubscriptionState GetState();
/// Returns the current state of the subscription.
/// </summary>
/// <returns>The current state of the subscription.</returns>
TsCDaSubscriptionState GetState();
/// <summary>
/// Changes the state of a subscription.
/// </summary>
/// <param name="masks">A bit mask that indicates which elements of the subscription state are changing.</param>
/// <param name="state">The new subscription state.</param>
/// <returns>The actual subscription state after applying the changes.</returns>
TsCDaSubscriptionState ModifyState(int masks, TsCDaSubscriptionState state);
/// <summary>
/// Changes the state of a subscription.
/// </summary>
/// <param name="masks">A bit mask that indicates which elements of the subscription state are changing.</param>
/// <param name="state">The new subscription state.</param>
/// <returns>The actual subscription state after applying the changes.</returns>
TsCDaSubscriptionState ModifyState(int masks, TsCDaSubscriptionState state);
#endregion
#region Item Management
#region Item Management
/// <summary>
/// Adds items to the subscription.
/// </summary>
/// <param name="items">The set of items to add to the subscription.</param>
/// <returns>The results of the add item operation for each item.</returns>
TsCDaItemResult[] AddItems(TsCDaItem[] items);
/// Adds items to the subscription.
/// </summary>
/// <param name="items">The set of items to add to the subscription.</param>
/// <returns>The results of the add item operation for each item.</returns>
TsCDaItemResult[] AddItems(TsCDaItem[] items);
/// <summary>
/// Modifies the state of items in the subscription
/// </summary>
/// <param name="masks">Specifies which item state parameters are being modified.</param>
/// <param name="items">The new state for each item.</param>
/// <returns>The results of the modify item operation for each item.</returns>
TsCDaItemResult[] ModifyItems(int masks, TsCDaItem[] items);
/// <summary>
/// Modifies the state of items in the subscription
/// </summary>
/// <param name="masks">Specifies which item state parameters are being modified.</param>
/// <param name="items">The new state for each item.</param>
/// <returns>The results of the modify item operation for each item.</returns>
TsCDaItemResult[] ModifyItems(int masks, TsCDaItem[] items);
/// <summary>
/// Removes items from the subscription.
/// </summary>
/// <param name="items">The identifiers (i.e. server handles) for the items being removed.</param>
/// <returns>The results of the remove item operation for each item.</returns>
OpcItemResult[] RemoveItems(OpcItem[] items);
/// <summary>
/// Removes items from the subscription.
/// </summary>
/// <param name="items">The identifiers (i.e. server handles) for the items being removed.</param>
/// <returns>The results of the remove item operation for each item.</returns>
OpcItemResult[] RemoveItems(OpcItem[] items);
#endregion
#region Synchronous I/O
#region Synchronous I/O
/// <summary>
/// Reads the values for a set of items in the subscription.
/// </summary>
/// <param name="items">The identifiers (i.e. server handles) for the items being read.</param>
/// <returns>The value for each of items.</returns>
TsCDaItemValueResult[] Read(TsCDaItem[] items);
/// Reads the values for a set of items in the subscription.
/// </summary>
/// <param name="items">The identifiers (i.e. server handles) for the items being read.</param>
/// <returns>The value for each of items.</returns>
TsCDaItemValueResult[] Read(TsCDaItem[] items);
/// <summary>
/// Writes the value, quality and timestamp for a set of items in the subscription.
/// </summary>
/// <param name="items">The item values to write.</param>
/// <returns>The results of the write operation for each item.</returns>
OpcItemResult[] Write(TsCDaItemValue[] items);
/// <summary>
/// Writes the value, quality and timestamp for a set of items in the subscription.
/// </summary>
/// <param name="items">The item values to write.</param>
/// <returns>The results of the write operation for each item.</returns>
OpcItemResult[] Write(TsCDaItemValue[] items);
#endregion
#region Asynchronous I/O
#region Asynchronous I/O
/// <summary>
/// Begins an asynchronous read operation for a set of items.
/// </summary>
@@ -145,36 +145,36 @@ namespace Technosoftware.DaAeHdaClient.Da
/// <param name="callback">The function to invoke when the cancel completes.</param>
void Cancel(IOpcRequest request, TsCDaCancelCompleteEventHandler callback);
/// <summary>
/// Causes the server to send a data changed notification for all active items.
/// </summary>
void Refresh();
/// <summary>
/// Causes the server to send a data changed notification for all active items.
/// </summary>
void Refresh();
/// <summary>
/// Causes the server to send a data changed notification for all active items.
/// </summary>
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
void Refresh(
object requestHandle,
out IOpcRequest request);
/// <summary>
/// Causes the server to send a data changed notification for all active items.
/// </summary>
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
void Refresh(
object requestHandle,
out IOpcRequest request);
/// <summary>
/// Enables or disables data change notifications from the server.
/// </summary>
/// <param name="enabled">Whether data change notifications are enabled.</param>
void SetEnabled(bool enabled);
/// <summary>
/// Enables or disables data change notifications from the server.
/// </summary>
/// <param name="enabled">Whether data change notifications are enabled.</param>
void SetEnabled(bool enabled);
/// <summary>
/// Checks whether data change notifications from the server are enabled.
/// </summary>
/// <returns>Whether data change notifications are enabled.</returns>
bool GetEnabled();
/// <summary>
/// Checks whether data change notifications from the server are enabled.
/// </summary>
/// <returns>Whether data change notifications are enabled.</returns>
bool GetEnabled();
#endregion
}
}
#region Delegate Declarations
#region Delegate Declarations
/// <summary>
/// A delegate to receive data change updates from the server.
/// </summary>

View File

@@ -32,21 +32,21 @@ namespace Technosoftware.DaAeHdaClient.Da
[Serializable]
public class TsCDaItem : OpcItem
{
#region Fields
#region Fields
private bool active_ = true;
private float deadband_;
private float deadband_;
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes the object with default values.
/// </summary>
public TsCDaItem() { }
/// Initializes the object with default values.
/// </summary>
public TsCDaItem() { }
/// <summary>
/// Initializes object with the specified ItemIdentifier object.
/// </summary>
public TsCDaItem(OpcItem item)
/// <summary>
/// Initializes object with the specified ItemIdentifier object.
/// </summary>
public TsCDaItem(OpcItem item)
{
if (item == null)
{
@@ -58,11 +58,11 @@ namespace Technosoftware.DaAeHdaClient.Da
ServerHandle = item.ServerHandle;
}
/// <summary>
/// Initializes object with the specified Item object.
/// </summary>
public TsCDaItem(TsCDaItem item)
: base(item)
/// <summary>
/// Initializes object with the specified Item object.
/// </summary>
public TsCDaItem(TsCDaItem item)
: base(item)
{
if (item == null)
{
@@ -82,11 +82,11 @@ namespace Technosoftware.DaAeHdaClient.Da
}
#endregion
#region Properties
#region Properties
/// <summary>
/// The data type to use when returning the item value.
/// </summary>
public Type ReqType { get; set; }
public Type ReqType { get; set; }
/// <summary>
/// The oldest (in milliseconds) acceptable cached value when reading an item.

View File

@@ -27,26 +27,26 @@ using System.Collections;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// A collection of items.
/// </summary>
[Serializable]
public class TsCDaItemCollection : ICloneable, IList
{
#region Fields
/// <summary>
/// A collection of items.
/// </summary>
[Serializable]
public class TsCDaItemCollection : ICloneable, IList
{
#region Fields
private ArrayList items_ = new ArrayList();
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes object with the default values.
/// </summary>
public TsCDaItemCollection() { }
/// Initializes object with the default values.
/// </summary>
public TsCDaItemCollection() { }
/// <summary>
/// Initializes object with the specified ResultCollection object.
/// </summary>
public TsCDaItemCollection(TsCDaItemCollection items)
/// <summary>
/// Initializes object with the specified ResultCollection object.
/// </summary>
public TsCDaItemCollection(TsCDaItemCollection items)
{
if (items == null)
{
@@ -59,59 +59,59 @@ namespace Technosoftware.DaAeHdaClient.Da
}
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the item at the specified index.
/// </summary>
public TsCDaItem this[int index]
{
get => (TsCDaItem)items_[index];
/// Gets the item at the specified index.
/// </summary>
public TsCDaItem this[int index]
{
get => (TsCDaItem)items_[index];
set => items_[index] = value;
}
/// <summary>
/// Gets the first item with the specified item id.
/// </summary>
public TsCDaItem this[OpcItem itemId]
{
get
{
foreach (TsCDaItem item in items_)
{
if (itemId.Key == item.Key)
{
return item;
}
}
/// <summary>
/// Gets the first item with the specified item id.
/// </summary>
public TsCDaItem this[OpcItem itemId]
{
get
{
foreach (TsCDaItem item in items_)
{
if (itemId.Key == item.Key)
{
return item;
}
}
return null;
}
}
}
}
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var clone = (TsCDaItemCollection)MemberwiseClone();
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var clone = (TsCDaItemCollection)MemberwiseClone();
clone.items_ = new ArrayList();
clone.items_ = new ArrayList();
foreach (TsCDaItem item in items_)
{
clone.items_.Add(item.Clone());
}
foreach (TsCDaItem item in items_)
{
clone.items_.Add(item.Clone());
}
return clone;
}
return clone;
}
#endregion
#region ICollection Members
#region ICollection Members
/// <summary>
/// Indicates whether access to the ICollection is synchronized (thread-safe).
/// </summary>
public bool IsSynchronized => false;
/// Indicates whether access to the ICollection is synchronized (thread-safe).
/// </summary>
public bool IsSynchronized => false;
/// <summary>
/// Gets the number of objects in the collection.
@@ -128,137 +128,137 @@ namespace Technosoftware.DaAeHdaClient.Da
items_?.CopyTo(array, index);
}
/// <summary>
/// Copies the objects to an Array, starting at a the specified index.
/// </summary>
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
public void CopyTo(TsCDaItem[] array, int index)
{
CopyTo((Array)array, index);
}
/// <summary>
/// Copies the objects to an Array, starting at a the specified index.
/// </summary>
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
public void CopyTo(TsCDaItem[] array, int index)
{
CopyTo((Array)array, index);
}
/// <summary>
/// Indicates whether access to the ICollection is synchronized (thread-safe).
/// </summary>
public object SyncRoot => this;
/// <summary>
/// Indicates whether access to the ICollection is synchronized (thread-safe).
/// </summary>
public object SyncRoot => this;
#endregion
#region IEnumerable Members
#region IEnumerable Members
/// <summary>
/// Returns an enumerator that can iterate through a collection.
/// </summary>
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
public IEnumerator GetEnumerator()
{
return items_.GetEnumerator();
}
/// Returns an enumerator that can iterate through a collection.
/// </summary>
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
public IEnumerator GetEnumerator()
{
return items_.GetEnumerator();
}
#endregion
#region IList Members
#region IList Members
/// <summary>
/// Gets a value indicating whether the IList is read-only.
/// </summary>
public bool IsReadOnly => false;
/// Gets a value indicating whether the IList is read-only.
/// </summary>
public bool IsReadOnly => false;
/// <summary>
/// Gets or sets the element at the specified index.
/// </summary>
object IList.this[int index]
{
get => items_[index];
{
get => items_[index];
set
{
if (!typeof(TsCDaItem).IsInstanceOfType(value))
{
throw new ArgumentException("May only add Item objects into the collection.");
}
{
if (!typeof(TsCDaItem).IsInstanceOfType(value))
{
throw new ArgumentException("May only add Item objects into the collection.");
}
items_[index] = value;
}
}
items_[index] = value;
}
}
/// <summary>
/// Removes the IList item at the specified index.
/// </summary>
/// <param name="index">The zero-based index of the item to remove.</param>
public void RemoveAt(int index)
{
items_.RemoveAt(index);
}
/// <summary>
/// Removes the IList item at the specified index.
/// </summary>
/// <param name="index">The zero-based index of the item to remove.</param>
public void RemoveAt(int index)
{
items_.RemoveAt(index);
}
/// <summary>
/// Inserts an item to the IList at the specified position.
/// </summary>
/// <param name="index">The zero-based index at which value should be inserted.</param>
/// <param name="value">The Object to insert into the IList. </param>
public void Insert(int index, object value)
{
if (!typeof(TsCDaItem).IsInstanceOfType(value))
{
throw new ArgumentException("May only add Item objects into the collection.");
}
/// <summary>
/// Inserts an item to the IList at the specified position.
/// </summary>
/// <param name="index">The zero-based index at which value should be inserted.</param>
/// <param name="value">The Object to insert into the IList. </param>
public void Insert(int index, object value)
{
if (!typeof(TsCDaItem).IsInstanceOfType(value))
{
throw new ArgumentException("May only add Item objects into the collection.");
}
items_.Insert(index, value);
}
items_.Insert(index, value);
}
/// <summary>
/// Removes the first occurrence of a specific object from the IList.
/// </summary>
/// <param name="value">The Object to remove from the IList.</param>
public void Remove(object value)
{
items_.Remove(value);
}
/// <summary>
/// Removes the first occurrence of a specific object from the IList.
/// </summary>
/// <param name="value">The Object to remove from the IList.</param>
public void Remove(object value)
{
items_.Remove(value);
}
/// <summary>
/// Determines whether the IList contains a specific value.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
public bool Contains(object value)
{
return items_.Contains(value);
}
/// <summary>
/// Determines whether the IList contains a specific value.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
public bool Contains(object value)
{
return items_.Contains(value);
}
/// <summary>
/// Removes all items from the IList.
/// </summary>
public void Clear()
{
items_.Clear();
}
/// <summary>
/// Removes all items from the IList.
/// </summary>
public void Clear()
{
items_.Clear();
}
/// <summary>
/// Determines the index of a specific item in the IList.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
public int IndexOf(object value)
{
return items_.IndexOf(value);
}
/// <summary>
/// Determines the index of a specific item in the IList.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
public int IndexOf(object value)
{
return items_.IndexOf(value);
}
/// <summary>
/// Adds an item to the IList.
/// </summary>
/// <param name="value">The Object to add to the IList. </param>
/// <returns>The position into which the new element was inserted.</returns>
public int Add(object value)
{
if (!typeof(TsCDaItem).IsInstanceOfType(value))
{
throw new ArgumentException("May only add Item objects into the collection.");
}
/// <summary>
/// Adds an item to the IList.
/// </summary>
/// <param name="value">The Object to add to the IList. </param>
/// <returns>The position into which the new element was inserted.</returns>
public int Add(object value)
{
if (!typeof(TsCDaItem).IsInstanceOfType(value))
{
throw new ArgumentException("May only add Item objects into the collection.");
}
return items_.Add(value);
}
return items_.Add(value);
}
/// <summary>
/// Indicates whether the IList has a fixed size.
/// </summary>
public bool IsFixedSize => false;
/// <summary>
/// Indicates whether the IList has a fixed size.
/// </summary>
public bool IsFixedSize => false;
/// <summary>
/// Inserts an item to the IList at the specified position.
@@ -266,48 +266,48 @@ namespace Technosoftware.DaAeHdaClient.Da
/// <param name="index">The zero-based index at which value should be inserted.</param>
/// <param name="value">The Object to insert into the IList. </param>
public void Insert(int index, TsCDaItem value)
{
Insert(index, (object)value);
}
{
Insert(index, (object)value);
}
/// <summary>
/// Removes the first occurrence of a specific object from the IList.
/// </summary>
/// <param name="value">The Object to remove from the IList.</param>
public void Remove(TsCDaItem value)
{
Remove((object)value);
}
/// <summary>
/// Removes the first occurrence of a specific object from the IList.
/// </summary>
/// <param name="value">The Object to remove from the IList.</param>
public void Remove(TsCDaItem value)
{
Remove((object)value);
}
/// <summary>
/// Determines whether the IList contains a specific value.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
public bool Contains(TsCDaItem value)
{
return Contains((object)value);
}
/// <summary>
/// Determines whether the IList contains a specific value.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
public bool Contains(TsCDaItem value)
{
return Contains((object)value);
}
/// <summary>
/// Determines the index of a specific item in the IList.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
public int IndexOf(TsCDaItem value)
{
return IndexOf((object)value);
}
/// <summary>
/// Determines the index of a specific item in the IList.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
public int IndexOf(TsCDaItem value)
{
return IndexOf((object)value);
}
/// <summary>
/// Adds an item to the IList.
/// </summary>
/// <param name="value">The Object to add to the IList. </param>
/// <returns>The position into which the new element was inserted.</returns>
public int Add(TsCDaItem value)
{
return Add((object)value);
}
/// <summary>
/// Adds an item to the IList.
/// </summary>
/// <param name="value">The Object to add to the IList. </param>
/// <returns>The position into which the new element was inserted.</returns>
public int Add(TsCDaItem value)
{
return Add((object)value);
}
#endregion
}
}
}

View File

@@ -26,75 +26,75 @@ using System;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Contains a description of a single item property.
/// </summary>
[Serializable]
public class TsCDaItemProperty : ICloneable, IOpcResult
{
#region Fields
/// <summary>
/// Contains a description of a single item property.
/// </summary>
[Serializable]
public class TsCDaItemProperty : ICloneable, IOpcResult
{
#region Fields
private OpcResult result_ = OpcResult.S_OK;
#endregion
#region Properties
#region Properties
/// <summary>
/// The property identifier.
/// </summary>
public TsDaPropertyID ID { get; set; }
/// <summary>
/// The property identifier.
/// </summary>
public TsDaPropertyID ID { get; set; }
/// <summary>
/// A short description of the property.
/// </summary>
public string Description { get; set; }
/// <summary>
/// A short description of the property.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The data type of the property.
/// </summary>
public Type DataType { get; set; }
/// <summary>
/// The data type of the property.
/// </summary>
public Type DataType { get; set; }
/// <summary>
/// The value of the property.
/// </summary>
public object Value { get; set; }
/// <summary>
/// The value of the property.
/// </summary>
public object Value { get; set; }
/// <summary>
/// The primary identifier for the property if it is directly accessible as an item.
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// The primary identifier for the property if it is directly accessible as an item.
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// The secondary identifier for the property if it is directly accessible as an item.
/// </summary>
public string ItemPath { get; set; }
/// <summary>
/// The secondary identifier for the property if it is directly accessible as an item.
/// </summary>
public string ItemPath { get; set; }
#endregion
#region IOpcResult Members
#region IOpcResult Members
/// <summary>
/// The <see cref="OpcResult" /> object with the result of an operation on an property.
/// </summary>
public OpcResult Result
{
get => result_;
/// The <see cref="OpcResult" /> object with the result of an operation on an property.
/// </summary>
public OpcResult Result
{
get => result_;
set => result_ = value;
}
/// <summary>
/// Vendor specific diagnostic information (not the localized error text).
/// </summary>
public string DiagnosticInfo { get; set; }
/// <summary>
/// Vendor specific diagnostic information (not the localized error text).
/// </summary>
public string DiagnosticInfo { get; set; }
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var clone = (TsCDaItemProperty)MemberwiseClone();
clone.Value = OpcConvert.Clone(Value);
return clone;
}
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var clone = (TsCDaItemProperty)MemberwiseClone();
clone.Value = OpcConvert.Clone(Value);
return clone;
}
#endregion
}
}
}

View File

@@ -27,149 +27,149 @@ using System.Collections;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// A list of properties for a single item.
/// </summary>
[Serializable]
public class TsCDaItemPropertyCollection : ArrayList, IOpcResult
{
#region Fields
/// <summary>
/// A list of properties for a single item.
/// </summary>
[Serializable]
public class TsCDaItemPropertyCollection : ArrayList, IOpcResult
{
#region Fields
private OpcResult result_ = OpcResult.S_OK;
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes the object with its default values.
/// </summary>
public TsCDaItemPropertyCollection()
{
}
/// Initializes the object with its default values.
/// </summary>
public TsCDaItemPropertyCollection()
{
}
/// <summary>
/// Initializes the object with the specified item identifier.
/// </summary>
public TsCDaItemPropertyCollection(OpcItem itemId)
{
if (itemId != null)
{
ItemName = itemId.ItemName;
ItemPath = itemId.ItemPath;
}
}
/// <summary>
/// Initializes the object with the specified item identifier.
/// </summary>
public TsCDaItemPropertyCollection(OpcItem itemId)
{
if (itemId != null)
{
ItemName = itemId.ItemName;
ItemPath = itemId.ItemPath;
}
}
/// <summary>
/// Initializes the object with the specified item identifier and result.
/// </summary>
public TsCDaItemPropertyCollection(OpcItem itemId, OpcResult result)
{
if (itemId != null)
{
ItemName = itemId.ItemName;
ItemPath = itemId.ItemPath;
}
/// <summary>
/// Initializes the object with the specified item identifier and result.
/// </summary>
public TsCDaItemPropertyCollection(OpcItem itemId, OpcResult result)
{
if (itemId != null)
{
ItemName = itemId.ItemName;
ItemPath = itemId.ItemPath;
}
result_ = result;
}
result_ = result;
}
#endregion
#region Properties
#region Properties
/// <summary>
/// The primary identifier for the item within the server namespace.
/// </summary>
public string ItemName { get; set; }
/// The primary identifier for the item within the server namespace.
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// An secondary identifier for the item within the server namespace.
/// </summary>
public string ItemPath { get; set; }
/// <summary>
/// An secondary identifier for the item within the server namespace.
/// </summary>
public string ItemPath { get; set; }
/// <summary>
/// Accesses the items at the specified index.
/// </summary>
public new TsCDaItemProperty this[int index]
{
get => (TsCDaItemProperty)base[index];
/// <summary>
/// Accesses the items at the specified index.
/// </summary>
public new TsCDaItemProperty this[int index]
{
get => (TsCDaItemProperty)base[index];
set => base[index] = value;
}
#endregion
#region IOpcResult Members
#region IOpcResult Members
/// <summary>
/// The error id for the result of an operation on an item.
/// </summary>
public OpcResult Result
{
get => result_;
/// The error id for the result of an operation on an item.
/// </summary>
public OpcResult Result
{
get => result_;
set => result_ = value;
}
/// <summary>
/// Vendor specific diagnostic information (not the localized error text).
/// </summary>
public string DiagnosticInfo { get; set; }
#endregion
#region ICollection Members
/// <summary>
/// Copies the objects to an Array, starting at a the specified index.
/// </summary>
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
public void CopyTo(TsCDaItemProperty[] array, int index)
{
CopyTo((Array)array, index);
}
/// Vendor specific diagnostic information (not the localized error text).
/// </summary>
public string DiagnosticInfo { get; set; }
#endregion
#region IList Members
#region ICollection Members
/// <summary>
/// Inserts an item to the IList at the specified position.
/// </summary>
/// <param name="index">The zero-based index at which value should be inserted.</param>
/// <param name="value">The Object to insert into the IList. </param>
public void Insert(int index, TsCDaItemProperty value)
{
Insert(index, (object)value);
}
/// <summary>
/// Removes the first occurrence of a specific object from the IList.
/// </summary>
/// <param name="value">The Object to remove from the IList.</param>
public void Remove(TsCDaItemProperty value)
{
Remove((object)value);
}
/// <summary>
/// Determines whether the IList contains a specific value.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
public bool Contains(TsCDaItemProperty value)
{
return Contains((object)value);
}
/// <summary>
/// Determines the index of a specific item in the IList.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
public int IndexOf(TsCDaItemProperty value)
{
return IndexOf((object)value);
}
/// <summary>
/// Adds an item to the IList.
/// </summary>
/// <param name="value">The Object to add to the IList. </param>
/// <returns>The position into which the new element was inserted.</returns>
public int Add(TsCDaItemProperty value)
{
return Add((object)value);
}
/// Copies the objects to an Array, starting at a the specified index.
/// </summary>
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
public void CopyTo(TsCDaItemProperty[] array, int index)
{
CopyTo((Array)array, index);
}
#endregion
}
#region IList Members
/// <summary>
/// Inserts an item to the IList at the specified position.
/// </summary>
/// <param name="index">The zero-based index at which value should be inserted.</param>
/// <param name="value">The Object to insert into the IList. </param>
public void Insert(int index, TsCDaItemProperty value)
{
Insert(index, (object)value);
}
/// <summary>
/// Removes the first occurrence of a specific object from the IList.
/// </summary>
/// <param name="value">The Object to remove from the IList.</param>
public void Remove(TsCDaItemProperty value)
{
Remove((object)value);
}
/// <summary>
/// Determines whether the IList contains a specific value.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
public bool Contains(TsCDaItemProperty value)
{
return Contains((object)value);
}
/// <summary>
/// Determines the index of a specific item in the IList.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
public int IndexOf(TsCDaItemProperty value)
{
return IndexOf((object)value);
}
/// <summary>
/// Adds an item to the IList.
/// </summary>
/// <param name="value">The Object to add to the IList. </param>
/// <returns>The position into which the new element was inserted.</returns>
public int Add(TsCDaItemProperty value)
{
return Add((object)value);
}
#endregion
}
}

View File

@@ -26,79 +26,79 @@ using System;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// The results of an operation on a uniquely identifiable item.
/// </summary>
[Serializable]
public class TsCDaItemResult : TsCDaItem, IOpcResult
{
#region Fields
private OpcResult result_ = OpcResult.S_OK;
#endregion
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes the object with default values.
/// </summary>
public TsCDaItemResult() { }
/// <summary>
/// Initializes the object with an ItemIdentifier object.
/// </summary>
public TsCDaItemResult(OpcItem item) : base(item) { }
/// <summary>
/// Initializes the object with an ItemIdentifier object and Result.
/// </summary>
public TsCDaItemResult(OpcItem item, OpcResult resultId)
: base(item)
{
Result = resultId;
}
/// <summary>
/// Initializes the object with an Item object.
/// </summary>
public TsCDaItemResult(TsCDaItem item) : base(item) { }
/// <summary>
/// Initializes the object with an Item object and Result.
/// </summary>
public TsCDaItemResult(TsCDaItem item, OpcResult resultId)
: base(item)
{
Result = resultId;
}
/// <summary>
/// Initializes object with the specified ItemResult object.
/// </summary>
public TsCDaItemResult(TsCDaItemResult item)
: base(item)
{
if (item != null)
{
Result = item.Result;
DiagnosticInfo = item.DiagnosticInfo;
}
}
/// <summary>
/// The results of an operation on a uniquely identifiable item.
/// </summary>
[Serializable]
public class TsCDaItemResult : TsCDaItem, IOpcResult
{
#region Fields
private OpcResult result_ = OpcResult.S_OK;
#endregion
#region IOpcResult Members
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes the object with default values.
/// </summary>
public TsCDaItemResult() { }
/// <summary>
/// The error id for the result of an operation on an property.
/// </summary>
public OpcResult Result
{
get => result_;
/// <summary>
/// Initializes the object with an ItemIdentifier object.
/// </summary>
public TsCDaItemResult(OpcItem item) : base(item) { }
/// <summary>
/// Initializes the object with an ItemIdentifier object and Result.
/// </summary>
public TsCDaItemResult(OpcItem item, OpcResult resultId)
: base(item)
{
Result = resultId;
}
/// <summary>
/// Initializes the object with an Item object.
/// </summary>
public TsCDaItemResult(TsCDaItem item) : base(item) { }
/// <summary>
/// Initializes the object with an Item object and Result.
/// </summary>
public TsCDaItemResult(TsCDaItem item, OpcResult resultId)
: base(item)
{
Result = resultId;
}
/// <summary>
/// Initializes object with the specified ItemResult object.
/// </summary>
public TsCDaItemResult(TsCDaItemResult item)
: base(item)
{
if (item != null)
{
Result = item.Result;
DiagnosticInfo = item.DiagnosticInfo;
}
}
#endregion
#region IOpcResult Members
/// <summary>
/// The error id for the result of an operation on an property.
/// </summary>
public OpcResult Result
{
get => result_;
set => result_ = value;
}
/// <summary>
/// Vendor specific diagnostic information (not the localized error text).
/// </summary>
public string DiagnosticInfo { get; set; }
/// <summary>
/// Vendor specific diagnostic information (not the localized error text).
/// </summary>
public string DiagnosticInfo { get; set; }
#endregion
}
}
}

View File

@@ -27,27 +27,27 @@ using System;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Contains the value for a single item.
/// </summary>
[Serializable]
public class TsCDaItemValue : OpcItem
{
#region Fields
/// <summary>
/// Contains the value for a single item.
/// </summary>
[Serializable]
public class TsCDaItemValue : OpcItem
{
#region Fields
private TsCDaQuality daQuality_ = TsCDaQuality.Bad;
private DateTime timestamp_ = DateTime.MinValue;
private DateTime timestamp_ = DateTime.MinValue;
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes the object with default values.
/// </summary>
public TsCDaItemValue() { }
/// Initializes the object with default values.
/// </summary>
public TsCDaItemValue() { }
/// <summary>
/// Initializes the object with and ItemIdentifier object.
/// </summary>
public TsCDaItemValue(OpcItem item)
/// <summary>
/// Initializes the object with and ItemIdentifier object.
/// </summary>
public TsCDaItemValue(OpcItem item)
{
if (item == null)
{
@@ -59,19 +59,19 @@ namespace Technosoftware.DaAeHdaClient.Da
ServerHandle = item.ServerHandle;
}
/// <summary>
/// Initializes the object with the specified item name.
/// </summary>
public TsCDaItemValue(string itemName)
: base(itemName)
{
}
/// <summary>
/// Initializes the object with the specified item name.
/// </summary>
public TsCDaItemValue(string itemName)
: base(itemName)
{
}
/// <summary>
/// Initializes object with the specified ItemValue object.
/// </summary>
public TsCDaItemValue(TsCDaItemValue item)
: base(item)
/// <summary>
/// Initializes object with the specified ItemValue object.
/// </summary>
public TsCDaItemValue(TsCDaItemValue item)
: base(item)
{
if (item == null)
{
@@ -85,53 +85,53 @@ namespace Technosoftware.DaAeHdaClient.Da
}
#endregion
#region Properties
#region Properties
/// <summary>
/// The item value.
/// </summary>
public object Value { get; set; }
/// The item value.
/// </summary>
public object Value { get; set; }
/// <summary>
/// The quality of the item value.
/// </summary>
public TsCDaQuality Quality
{
get => daQuality_;
/// <summary>
/// The quality of the item value.
/// </summary>
public TsCDaQuality Quality
{
get => daQuality_;
set => daQuality_ = value;
}
/// <summary>
/// Whether the quality is specified.
/// </summary>
public bool QualitySpecified { get; set; }
/// <summary>
/// Whether the quality is specified.
/// </summary>
public bool QualitySpecified { get; set; }
/// <summary>
/// The timestamp for the item value.
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
/// the time format (UTC or local time).
/// </summary>
public DateTime Timestamp
{
get => timestamp_;
/// <summary>
/// The timestamp for the item value.
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
/// the time format (UTC or local time).
/// </summary>
public DateTime Timestamp
{
get => timestamp_;
set => timestamp_ = value;
}
/// <summary>
/// Whether the timestamp is specified.
/// </summary>
public bool TimestampSpecified { get; set; }
/// <summary>
/// Whether the timestamp is specified.
/// </summary>
public bool TimestampSpecified { get; set; }
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public override object Clone()
{
var clone = (TsCDaItemValue)MemberwiseClone();
clone.Value = OpcConvert.Clone(Value);
return clone;
}
/// Creates a deep copy of the object.
/// </summary>
public override object Clone()
{
var clone = (TsCDaItemValue)MemberwiseClone();
clone.Value = OpcConvert.Clone(Value);
return clone;
}
#endregion
}
}
}

View File

@@ -26,98 +26,98 @@ using System;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// The results of an operation on a uniquely identifiable item value.
/// </summary>
[Serializable]
public class TsCDaItemValueResult : TsCDaItemValue, IOpcResult
{
#region Fields
/// <summary>
/// The results of an operation on a uniquely identifiable item value.
/// </summary>
[Serializable]
public class TsCDaItemValueResult : TsCDaItemValue, IOpcResult
{
#region Fields
private OpcResult result_ = OpcResult.S_OK;
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes the object with default values.
/// </summary>
public TsCDaItemValueResult() { }
/// Initializes the object with default values.
/// </summary>
public TsCDaItemValueResult() { }
/// <summary>
/// Initializes the object with an ItemIdentifier object.
/// </summary>
public TsCDaItemValueResult(OpcItem item) : base(item) { }
/// <summary>
/// Initializes the object with an ItemIdentifier object.
/// </summary>
public TsCDaItemValueResult(OpcItem item) : base(item) { }
/// <summary>
/// Initializes the object with an ItemValue object.
/// </summary>
public TsCDaItemValueResult(TsCDaItemValue item) : base(item) { }
/// <summary>
/// Initializes the object with an ItemValue object.
/// </summary>
public TsCDaItemValueResult(TsCDaItemValue item) : base(item) { }
/// <summary>
/// Initializes object with the specified ItemValueResult object.
/// </summary>
public TsCDaItemValueResult(TsCDaItemValueResult item)
: base(item)
{
if (item != null)
{
Result = item.Result;
DiagnosticInfo = item.DiagnosticInfo;
}
}
/// <summary>
/// Initializes object with the specified ItemValueResult object.
/// </summary>
public TsCDaItemValueResult(TsCDaItemValueResult item)
: base(item)
{
if (item != null)
{
Result = item.Result;
DiagnosticInfo = item.DiagnosticInfo;
}
}
/// <summary>
/// Initializes the object with the specified item name and result code.
/// </summary>
public TsCDaItemValueResult(string itemName, OpcResult resultId)
: base(itemName)
{
Result = resultId;
}
/// <summary>
/// Initializes the object with the specified item name and result code.
/// </summary>
public TsCDaItemValueResult(string itemName, OpcResult resultId)
: base(itemName)
{
Result = resultId;
}
/// <summary>
/// Initializes the object with the specified item name, result code and diagnostic info.
/// </summary>
public TsCDaItemValueResult(string itemName, OpcResult resultId, string diagnosticInfo)
: base(itemName)
{
Result = resultId;
DiagnosticInfo = diagnosticInfo;
}
/// <summary>
/// Initializes the object with the specified item name, result code and diagnostic info.
/// </summary>
public TsCDaItemValueResult(string itemName, OpcResult resultId, string diagnosticInfo)
: base(itemName)
{
Result = resultId;
DiagnosticInfo = diagnosticInfo;
}
/// <summary>
/// Initialize object with the specified ItemIdentifier and result code.
/// </summary>
public TsCDaItemValueResult(OpcItem item, OpcResult resultId)
: base(item)
{
Result = resultId;
}
/// <summary>
/// Initialize object with the specified ItemIdentifier and result code.
/// </summary>
public TsCDaItemValueResult(OpcItem item, OpcResult resultId)
: base(item)
{
Result = resultId;
}
/// <summary>
/// Initializes the object with the specified ItemIdentifier, result code and diagnostic info.
/// </summary>
public TsCDaItemValueResult(OpcItem item, OpcResult resultId, string diagnosticInfo)
: base(item)
{
Result = resultId;
DiagnosticInfo = diagnosticInfo;
}
/// <summary>
/// Initializes the object with the specified ItemIdentifier, result code and diagnostic info.
/// </summary>
public TsCDaItemValueResult(OpcItem item, OpcResult resultId, string diagnosticInfo)
: base(item)
{
Result = resultId;
DiagnosticInfo = diagnosticInfo;
}
#endregion
#region IOpcResult Members
#region IOpcResult Members
/// <summary>
/// The error id for the result of an operation on an property.
/// </summary>
public OpcResult Result
{
get => result_;
/// The error id for the result of an operation on an property.
/// </summary>
public OpcResult Result
{
get => result_;
set => result_ = value;
}
/// <summary>
/// Vendor specific diagnostic information (not the localized error text).
/// </summary>
public string DiagnosticInfo { get; set; }
/// <summary>
/// Vendor specific diagnostic information (not the localized error text).
/// </summary>
public string DiagnosticInfo { get; set; }
#endregion
}
}
}

View File

@@ -25,20 +25,20 @@
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// <para>Defines the possible limit status bits.</para>
/// <para>The Limit Field is valid regardless of the Quality and Substatus. In some
/// cases such as Sensor Failure it can provide useful diagnostic information.</para>
/// </summary>
public enum TsDaLimitBits
/// <summary>
/// <para>Defines the possible limit status bits.</para>
/// <para>The Limit Field is valid regardless of the Quality and Substatus. In some
/// cases such as Sensor Failure it can provide useful diagnostic information.</para>
/// </summary>
public enum TsDaLimitBits
{
/// <summary>The value is free to move up or down</summary>
None = 0x0,
/// <summary>The value has pegged at some lower limit</summary>
Low = 0x1,
/// <summary>The value has pegged at some high limit</summary>
High = 0x2,
/// <summary>The value is a constant and cannot move</summary>
Constant = 0x3
}
/// <summary>The value is free to move up or down</summary>
None = 0x0,
/// <summary>The value has pegged at some lower limit</summary>
Low = 0x1,
/// <summary>The value has pegged at some high limit</summary>
High = 0x2,
/// <summary>The value is a constant and cannot move</summary>
Constant = 0x3
}
}

View File

@@ -25,294 +25,294 @@
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Defines identifiers for well-known properties.
/// </summary>
public class TsDaProperty
{
#region Data Access Properties
/// <summary>
/// Defines identifiers for well-known properties.
/// </summary>
public class TsDaProperty
{
#region Data Access Properties
/// <summary><para>Item Canonical DataType</para></summary>
public static readonly TsDaPropertyID DATATYPE = new TsDaPropertyID("dataType", 1, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Item Canonical DataType</para></summary>
public static readonly TsDaPropertyID DATATYPE = new TsDaPropertyID("dataType", 1, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Item Value</para></summary>
/// <remarks>
/// Note the type of value returned is as indicated by the "Item Canonical DataType"
/// and depends on the item. This will behave like a read from DEVICE.
/// </remarks>
public static readonly TsDaPropertyID VALUE = new TsDaPropertyID("value", 2, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Item Value</para></summary>
/// <remarks>
/// Note the type of value returned is as indicated by the "Item Canonical DataType"
/// and depends on the item. This will behave like a read from DEVICE.
/// </remarks>
public static readonly TsDaPropertyID VALUE = new TsDaPropertyID("value", 2, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Item Quality</para></summary>
/// <remarks>(OPCQUALITY stored in an I2). This will behave like a read from DEVICE.</remarks>
public static readonly TsDaPropertyID QUALITY = new TsDaPropertyID("quality", 3, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Item Quality</para></summary>
/// <remarks>(OPCQUALITY stored in an I2). This will behave like a read from DEVICE.</remarks>
public static readonly TsDaPropertyID QUALITY = new TsDaPropertyID("quality", 3, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Item Timestamp</para></summary>
/// <remarks>
/// (will be converted from FILETIME). This will behave like a read from
/// DEVICE.
/// </remarks>
public static readonly TsDaPropertyID TIMESTAMP = new TsDaPropertyID("timestamp", 4, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Item Timestamp</para></summary>
/// <remarks>
/// (will be converted from FILETIME). This will behave like a read from
/// DEVICE.
/// </remarks>
public static readonly TsDaPropertyID TIMESTAMP = new TsDaPropertyID("timestamp", 4, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Item Access Rights</para></summary>
/// <remarks>(OPCACCESSRIGHTS stored in an I4)</remarks>
public static readonly TsDaPropertyID ACCESSRIGHTS = new TsDaPropertyID("accessRights", 5, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Item Access Rights</para></summary>
/// <remarks>(OPCACCESSRIGHTS stored in an I4)</remarks>
public static readonly TsDaPropertyID ACCESSRIGHTS = new TsDaPropertyID("accessRights", 5, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Server Scan Rate</para></summary>
/// <remarks>
/// In Milliseconds. This represents the fastest rate at which the server could
/// obtain data from the underlying data source. The nature of this source is not defined
/// but is typically a DCS system, a SCADA system, a PLC via a COMM port or network, a
/// Device Network, etc. This value generally represents the best case fastest
/// RequestedUpdateRate which could be used if this item were added to an OPCGroup.<br/>
/// The accuracy of this value (the ability of the server to attain best case
/// performance) can be greatly affected by system load and other factors.
/// </remarks>
public static readonly TsDaPropertyID SCANRATE = new TsDaPropertyID("scanRate", 6, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Server Scan Rate</para></summary>
/// <remarks>
/// In Milliseconds. This represents the fastest rate at which the server could
/// obtain data from the underlying data source. The nature of this source is not defined
/// but is typically a DCS system, a SCADA system, a PLC via a COMM port or network, a
/// Device Network, etc. This value generally represents the best case fastest
/// RequestedUpdateRate which could be used if this item were added to an OPCGroup.<br/>
/// The accuracy of this value (the ability of the server to attain best case
/// performance) can be greatly affected by system load and other factors.
/// </remarks>
public static readonly TsDaPropertyID SCANRATE = new TsDaPropertyID("scanRate", 6, OpcNamespace.OPC_DATA_ACCESS);
/// <remarks>
/// <para>Indicate the type of Engineering Units (EU) information (if any) contained in
/// EUINFO.</para>
/// <list type="bullet">
/// <item>
/// 0 - No EU information available (EUINFO will be VT_EMPTY).
/// </item>
/// <item>
/// 1 - Analog - EUINFO will contain a SAFEARRAY of exactly two doubles
/// (VT_ARRAY | VT_R8) corresponding to the LOW and HI EU range.
/// </item>
/// <item>2 - Enumerated - EUINFO will contain a SAFEARRAY of strings (VT_ARRAY |
/// VT_BSTR) which contains a list of strings (Example: “OPEN”, “CLOSE”, “IN
/// TRANSIT”, etc.) corresponding to sequential numeric values (0, 1, 2,
/// etc.)</item>
/// </list>
/// </remarks>
/// <summary><para>Item EU Type</para></summary>
public static readonly TsDaPropertyID EUTYPE = new TsDaPropertyID("euType", 7, OpcNamespace.OPC_DATA_ACCESS);
/// <remarks>
/// <para>Indicate the type of Engineering Units (EU) information (if any) contained in
/// EUINFO.</para>
/// <list type="bullet">
/// <item>
/// 0 - No EU information available (EUINFO will be VT_EMPTY).
/// </item>
/// <item>
/// 1 - Analog - EUINFO will contain a SAFEARRAY of exactly two doubles
/// (VT_ARRAY | VT_R8) corresponding to the LOW and HI EU range.
/// </item>
/// <item>2 - Enumerated - EUINFO will contain a SAFEARRAY of strings (VT_ARRAY |
/// VT_BSTR) which contains a list of strings (Example: “OPEN”, “CLOSE”, “IN
/// TRANSIT”, etc.) corresponding to sequential numeric values (0, 1, 2,
/// etc.)</item>
/// </list>
/// </remarks>
/// <summary><para>Item EU Type</para></summary>
public static readonly TsDaPropertyID EUTYPE = new TsDaPropertyID("euType", 7, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Item EUInfo</para></summary>
/// <value>
/// <para>
/// If EUTYPE is “Analog” EUINFO will contain a SAFEARRAY of exactly two doubles
/// (VT_ARRAY | VT_R8) corresponding to the LOW and HI EU range.
/// </para>
/// <para>If EUTYPE is “Enumerated” - EUINFO will contain a SAFEARRAY of strings
/// (VT_ARRAY | VT_BSTR) which contains a list of strings (Example: “OPEN”, “CLOSE”,
/// “IN TRANSIT”, etc.) corresponding to sequential numeric values (0, 1, 2,
/// etc.)</para>
/// </value>
public static readonly TsDaPropertyID EUINFO = new TsDaPropertyID("euInfo", 8, OpcNamespace.OPC_DATA_ACCESS);
/// <summary><para>Item EUInfo</para></summary>
/// <value>
/// <para>
/// If EUTYPE is “Analog” EUINFO will contain a SAFEARRAY of exactly two doubles
/// (VT_ARRAY | VT_R8) corresponding to the LOW and HI EU range.
/// </para>
/// <para>If EUTYPE is “Enumerated” - EUINFO will contain a SAFEARRAY of strings
/// (VT_ARRAY | VT_BSTR) which contains a list of strings (Example: “OPEN”, “CLOSE”,
/// “IN TRANSIT”, etc.) corresponding to sequential numeric values (0, 1, 2,
/// etc.)</para>
/// </value>
public static readonly TsDaPropertyID EUINFO = new TsDaPropertyID("euInfo", 8, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>EU Units</para>
/// <para>e.g. "DEGC" or "GALLONS"</para>
/// </summary>
public static readonly TsDaPropertyID ENGINEERINGUINTS = new TsDaPropertyID("engineeringUnits", 100, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>EU Units</para>
/// <para>e.g. "DEGC" or "GALLONS"</para>
/// </summary>
public static readonly TsDaPropertyID ENGINEERINGUINTS = new TsDaPropertyID("engineeringUnits", 100, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Item Description</para>
/// <para>e.g. "Evaporator 6 Coolant Temp"</para>
/// </summary>
public static readonly TsDaPropertyID DESCRIPTION = new TsDaPropertyID("description", 101, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Item Description</para>
/// <para>e.g. "Evaporator 6 Coolant Temp"</para>
/// </summary>
public static readonly TsDaPropertyID DESCRIPTION = new TsDaPropertyID("description", 101, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>High EU</para>
/// <para>Present only for 'analog' data. This represents the highest value likely to
/// be obtained in normal operation and is intended for such use as automatically
/// scaling a bargraph display.</para>
/// <para>e.g. 1400.0</para>
/// </summary>
public static readonly TsDaPropertyID HIGHEU = new TsDaPropertyID("highEU", 102, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>High EU</para>
/// <para>Present only for 'analog' data. This represents the highest value likely to
/// be obtained in normal operation and is intended for such use as automatically
/// scaling a bargraph display.</para>
/// <para>e.g. 1400.0</para>
/// </summary>
public static readonly TsDaPropertyID HIGHEU = new TsDaPropertyID("highEU", 102, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Low EU</para>
/// <para>Present only for 'analog' data. This represents the lowest value likely to be
/// obtained in normal operation and is intended for such use as automatically scaling
/// a bargraph display.</para>
/// <para>e.g. -200.0</para>
/// </summary>
public static readonly TsDaPropertyID LOWEU = new TsDaPropertyID("lowEU", 103, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Low EU</para>
/// <para>Present only for 'analog' data. This represents the lowest value likely to be
/// obtained in normal operation and is intended for such use as automatically scaling
/// a bargraph display.</para>
/// <para>e.g. -200.0</para>
/// </summary>
public static readonly TsDaPropertyID LOWEU = new TsDaPropertyID("lowEU", 103, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>High Instrument Range</para>
/// <para>Present only for analog data. This represents the highest value that can be
/// returned by the instrument.</para>
/// <para>e.g. 9999.9</para>
/// </summary>
public static readonly TsDaPropertyID HIGHIR = new TsDaPropertyID("highIR", 104, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>High Instrument Range</para>
/// <para>Present only for analog data. This represents the highest value that can be
/// returned by the instrument.</para>
/// <para>e.g. 9999.9</para>
/// </summary>
public static readonly TsDaPropertyID HIGHIR = new TsDaPropertyID("highIR", 104, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Low Instrument Range</para>
/// <para>Present only for analog data. This represents the lowest value that can be
/// returned by the instrument.</para>
/// <para>e.g. -9999.9</para>
/// </summary>
public static readonly TsDaPropertyID LOWIR = new TsDaPropertyID("lowIR", 105, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Low Instrument Range</para>
/// <para>Present only for analog data. This represents the lowest value that can be
/// returned by the instrument.</para>
/// <para>e.g. -9999.9</para>
/// </summary>
public static readonly TsDaPropertyID LOWIR = new TsDaPropertyID("lowIR", 105, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Contact Close Label</para>
/// <para>Present only for discrete' data. This represents a string to be associated
/// with this contact when it is in the closed (non-zero) state</para>
/// <para>e.g. "RUN", "CLOSE", "ENABLE", "SAFE" ,etc.</para>
/// </summary>
public static readonly TsDaPropertyID CLOSELABEL = new TsDaPropertyID("closeLabel", 106, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Contact Close Label</para>
/// <para>Present only for discrete' data. This represents a string to be associated
/// with this contact when it is in the closed (non-zero) state</para>
/// <para>e.g. "RUN", "CLOSE", "ENABLE", "SAFE" ,etc.</para>
/// </summary>
public static readonly TsDaPropertyID CLOSELABEL = new TsDaPropertyID("closeLabel", 106, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Contact Open Label</para>
/// <para>Present only for discrete' data. This represents a string to be associated
/// with this contact when it is in the open (zero) state</para>
/// <para>e.g. "STOP", "OPEN", "DISABLE", "UNSAFE" ,etc.</para>
/// </summary>
public static readonly TsDaPropertyID OPENLABEL = new TsDaPropertyID("openLabel", 107, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Contact Open Label</para>
/// <para>Present only for discrete' data. This represents a string to be associated
/// with this contact when it is in the open (zero) state</para>
/// <para>e.g. "STOP", "OPEN", "DISABLE", "UNSAFE" ,etc.</para>
/// </summary>
public static readonly TsDaPropertyID OPENLABEL = new TsDaPropertyID("openLabel", 107, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Item Timezone</para>
/// <para>The difference in minutes between the items UTC Timestamp and the local time
/// in which the item value was obtained.</para>
/// </summary>
/// <remarks>
/// See the OPCGroup TimeBias property. Also see the WIN32 TIME_ZONE_INFORMATION
/// structure.
/// </remarks>
public static readonly TsDaPropertyID TIMEZONE = new TsDaPropertyID("timeZone", 108, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Item Timezone</para>
/// <para>The difference in minutes between the items UTC Timestamp and the local time
/// in which the item value was obtained.</para>
/// </summary>
/// <remarks>
/// See the OPCGroup TimeBias property. Also see the WIN32 TIME_ZONE_INFORMATION
/// structure.
/// </remarks>
public static readonly TsDaPropertyID TIMEZONE = new TsDaPropertyID("timeZone", 108, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Condition Status</para>
/// <para>The current alarm or condition status associated with the Item<br/>
/// e.g. "NORMAL", "ACTIVE", "HI ALARM", etc</para>
/// </summary>
public static readonly TsDaPropertyID CONDITION_STATUS = new TsDaPropertyID("conditionStatus", 300, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Condition Status</para>
/// <para>The current alarm or condition status associated with the Item<br/>
/// e.g. "NORMAL", "ACTIVE", "HI ALARM", etc</para>
/// </summary>
public static readonly TsDaPropertyID CONDITION_STATUS = new TsDaPropertyID("conditionStatus", 300, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Alarm Quick Help</para>
/// <para>A short text string providing a brief set of instructions for the operator to
/// follow when this alarm occurs.</para>
/// </summary>
public static readonly TsDaPropertyID ALARM_QUICK_HELP = new TsDaPropertyID("alarmQuickHelp", 301, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Alarm Quick Help</para>
/// <para>A short text string providing a brief set of instructions for the operator to
/// follow when this alarm occurs.</para>
/// </summary>
public static readonly TsDaPropertyID ALARM_QUICK_HELP = new TsDaPropertyID("alarmQuickHelp", 301, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Alarm Area List</para>
/// <para>An array of stings indicating the plant or alarm areas which include this
/// ItemID.</para>
/// </summary>
public static readonly TsDaPropertyID ALARM_AREA_LIST = new TsDaPropertyID("alarmAreaList", 302, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Alarm Area List</para>
/// <para>An array of stings indicating the plant or alarm areas which include this
/// ItemID.</para>
/// </summary>
public static readonly TsDaPropertyID ALARM_AREA_LIST = new TsDaPropertyID("alarmAreaList", 302, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Primary Alarm Area</para>
/// <para>A string indicating the primary plant or alarm area including this
/// ItemID</para>
/// </summary>
public static readonly TsDaPropertyID PRIMARY_ALARM_AREA = new TsDaPropertyID("primaryAlarmArea", 303, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Primary Alarm Area</para>
/// <para>A string indicating the primary plant or alarm area including this
/// ItemID</para>
/// </summary>
public static readonly TsDaPropertyID PRIMARY_ALARM_AREA = new TsDaPropertyID("primaryAlarmArea", 303, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Condition Logic</para>
/// <para>An arbitrary string describing the test being performed.</para>
/// <para>e.g. "High Limit Exceeded" or "TAG.PV &gt;= TAG.HILIM"</para>
/// </summary>
public static readonly TsDaPropertyID CONDITION_LOGIC = new TsDaPropertyID("conditionLogic", 304, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Condition Logic</para>
/// <para>An arbitrary string describing the test being performed.</para>
/// <para>e.g. "High Limit Exceeded" or "TAG.PV &gt;= TAG.HILIM"</para>
/// </summary>
public static readonly TsDaPropertyID CONDITION_LOGIC = new TsDaPropertyID("conditionLogic", 304, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Limit Exceeded</para>
/// <para>For multistate alarms, the condition exceeded</para>
/// <para>e.g. HIHI, HI, LO, LOLO</para>
/// </summary>
public static readonly TsDaPropertyID LIMIT_EXCEEDED = new TsDaPropertyID("limitExceeded", 305, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Limit Exceeded</para>
/// <para>For multistate alarms, the condition exceeded</para>
/// <para>e.g. HIHI, HI, LO, LOLO</para>
/// </summary>
public static readonly TsDaPropertyID LIMIT_EXCEEDED = new TsDaPropertyID("limitExceeded", 305, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>Deadband</summary>
public static readonly TsDaPropertyID DEADBAND = new TsDaPropertyID("deadband", 306, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>Deadband</summary>
public static readonly TsDaPropertyID DEADBAND = new TsDaPropertyID("deadband", 306, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>HiHi limit</summary>
public static readonly TsDaPropertyID HIHI_LIMIT = new TsDaPropertyID("hihiLimit", 307, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>HiHi limit</summary>
public static readonly TsDaPropertyID HIHI_LIMIT = new TsDaPropertyID("hihiLimit", 307, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>Hi Limit</summary>
public static readonly TsDaPropertyID HI_LIMIT = new TsDaPropertyID("hiLimit", 308, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>Hi Limit</summary>
public static readonly TsDaPropertyID HI_LIMIT = new TsDaPropertyID("hiLimit", 308, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>Lo Limit</summary>
public static readonly TsDaPropertyID LO_LIMIT = new TsDaPropertyID("loLimit", 309, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>Lo Limit</summary>
public static readonly TsDaPropertyID LO_LIMIT = new TsDaPropertyID("loLimit", 309, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>LoLo Limit</summary>
public static readonly TsDaPropertyID LOLO_LIMIT = new TsDaPropertyID("loloLimit", 310, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>LoLo Limit</summary>
public static readonly TsDaPropertyID LOLO_LIMIT = new TsDaPropertyID("loloLimit", 310, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>Rate of Change Limit</summary>
public static readonly TsDaPropertyID RATE_CHANGE_LIMIT = new TsDaPropertyID("rangeOfChangeLimit", 311, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>Rate of Change Limit</summary>
public static readonly TsDaPropertyID RATE_CHANGE_LIMIT = new TsDaPropertyID("rangeOfChangeLimit", 311, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>Deviation Limit</summary>
public static readonly TsDaPropertyID DEVIATION_LIMIT = new TsDaPropertyID("deviationLimit", 312, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>Deviation Limit</summary>
public static readonly TsDaPropertyID DEVIATION_LIMIT = new TsDaPropertyID("deviationLimit", 312, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Sound File</para>
/// <para>e.g. C:\MEDIA\FIC101.WAV, or .MID</para>
/// </summary>
public static readonly TsDaPropertyID SOUNDFILE = new TsDaPropertyID("soundFile", 313, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Sound File</para>
/// <para>e.g. C:\MEDIA\FIC101.WAV, or .MID</para>
/// </summary>
public static readonly TsDaPropertyID SOUNDFILE = new TsDaPropertyID("soundFile", 313, OpcNamespace.OPC_DATA_ACCESS);
#endregion
#region Complex Data Properties
#region Complex Data Properties
/// <summary>
/// <para>Type System ID</para>
/// <para>Complex Data Property</para>
/// </summary>
public static readonly TsDaPropertyID TYPE_SYSTEM_ID = new TsDaPropertyID("typeSystemID", 600, OpcNamespace.OPC_DATA_ACCESS);
/// <para>Type System ID</para>
/// <para>Complex Data Property</para>
/// </summary>
public static readonly TsDaPropertyID TYPE_SYSTEM_ID = new TsDaPropertyID("typeSystemID", 600, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Dictionary ID</para>
/// <para>Complex Data Property</para>
/// </summary>
public static readonly TsDaPropertyID DICTIONARY_ID = new TsDaPropertyID("dictionaryID", 601, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Dictionary ID</para>
/// <para>Complex Data Property</para>
/// </summary>
public static readonly TsDaPropertyID DICTIONARY_ID = new TsDaPropertyID("dictionaryID", 601, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Type ID</para>
/// <para>Complex Data Property</para>
/// </summary>
public static readonly TsDaPropertyID TYPE_ID = new TsDaPropertyID("typeID", 602, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Type ID</para>
/// <para>Complex Data Property</para>
/// </summary>
public static readonly TsDaPropertyID TYPE_ID = new TsDaPropertyID("typeID", 602, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Dictionary</para>
/// <para>Complex Data Property</para>
/// </summary>
public static readonly TsDaPropertyID DICTIONARY = new TsDaPropertyID("dictionary", 603, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Dictionary</para>
/// <para>Complex Data Property</para>
/// </summary>
public static readonly TsDaPropertyID DICTIONARY = new TsDaPropertyID("dictionary", 603, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Type description</para>
/// <para>Complex Data Property</para>
/// </summary>
public static readonly TsDaPropertyID TYPE_DESCRIPTION = new TsDaPropertyID("typeDescription", 604, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Type description</para>
/// <para>Complex Data Property</para>
/// </summary>
public static readonly TsDaPropertyID TYPE_DESCRIPTION = new TsDaPropertyID("typeDescription", 604, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Consistency Window</para>
/// <para>Complex Data Property</para>
/// </summary>
public static readonly TsDaPropertyID CONSISTENCY_WINDOW = new TsDaPropertyID("consistencyWindow", 605, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Consistency Window</para>
/// <para>Complex Data Property</para>
/// </summary>
public static readonly TsDaPropertyID CONSISTENCY_WINDOW = new TsDaPropertyID("consistencyWindow", 605, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Write Behaviour</para>
/// <para>Complex Data Property, defaults to “All or Nothing” if the complex data item
/// is writable. Not used for Read-Only items.</para>
/// </summary>
public static readonly TsDaPropertyID WRITE_BEHAVIOR = new TsDaPropertyID("writeBehavior", 606, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Write Behaviour</para>
/// <para>Complex Data Property, defaults to “All or Nothing” if the complex data item
/// is writable. Not used for Read-Only items.</para>
/// </summary>
public static readonly TsDaPropertyID WRITE_BEHAVIOR = new TsDaPropertyID("writeBehavior", 606, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Unconverted Item ID</para>
/// <para>Complex Data Property, the ID of the item that exposes the same complex data
/// value in its native format. This property is mandatory for items that implement
/// complex data type conversions.</para>
/// </summary>
public static readonly TsDaPropertyID UNCONVERTED_ITEM_ID = new TsDaPropertyID("unconvertedItemID", 607, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Unconverted Item ID</para>
/// <para>Complex Data Property, the ID of the item that exposes the same complex data
/// value in its native format. This property is mandatory for items that implement
/// complex data type conversions.</para>
/// </summary>
public static readonly TsDaPropertyID UNCONVERTED_ITEM_ID = new TsDaPropertyID("unconvertedItemID", 607, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Unfiltered Item ID</para>
/// <para>Complex Data Property, the ID the item that exposes the same complex data
/// value without any data filter or with the default query applied to it. It is
/// mandatory for items that implement complex data filters or queries.</para>
/// </summary>
public static readonly TsDaPropertyID UNFILTERED_ITEM_ID = new TsDaPropertyID("unfilteredItemID", 608, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Unfiltered Item ID</para>
/// <para>Complex Data Property, the ID the item that exposes the same complex data
/// value without any data filter or with the default query applied to it. It is
/// mandatory for items that implement complex data filters or queries.</para>
/// </summary>
public static readonly TsDaPropertyID UNFILTERED_ITEM_ID = new TsDaPropertyID("unfilteredItemID", 608, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Data Filter Value</para>
/// <para>Complex Data Property, the value of the filter that is currently applied to
/// the item. It is mandatory for items that implement complex data filters or
/// queries.</para>
/// </summary>
public static readonly TsDaPropertyID DATA_FILTER_VALUE = new TsDaPropertyID("dataFilterValue", 609, OpcNamespace.OPC_DATA_ACCESS);
/// <summary>
/// <para>Data Filter Value</para>
/// <para>Complex Data Property, the value of the filter that is currently applied to
/// the item. It is mandatory for items that implement complex data filters or
/// queries.</para>
/// </summary>
public static readonly TsDaPropertyID DATA_FILTER_VALUE = new TsDaPropertyID("dataFilterValue", 609, OpcNamespace.OPC_DATA_ACCESS);
#endregion
#region XML Data Access Properties
@@ -324,5 +324,5 @@ namespace Technosoftware.DaAeHdaClient.Da
public static readonly TsDaPropertyID VALUE_PRECISION = new TsDaPropertyID("valuePrecision", 111, OpcNamespace.OPC_DATA_ACCESS);
#endregion
}
}
}

View File

@@ -28,173 +28,173 @@ using System.Reflection;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Describes an item property.
/// </summary>
[Serializable]
public class TsDaPropertyDescription
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Describes an item property.
/// </summary>
[Serializable]
public class TsDaPropertyDescription
{
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes the object with the specified values.
/// </summary>
public TsDaPropertyDescription(TsDaPropertyID id, Type type, string name)
{
ID = id;
Type = type;
Name = name;
}
/// Initializes the object with the specified values.
/// </summary>
public TsDaPropertyDescription(TsDaPropertyID id, Type type, string name)
{
ID = id;
Type = type;
Name = name;
}
#endregion
#region Properties
#region Properties
/// <summary>
/// The unique identifier for the property.
/// </summary>
public TsDaPropertyID ID { get; set; }
/// The unique identifier for the property.
/// </summary>
public TsDaPropertyID ID { get; set; }
/// <summary>
/// The .NET data type for the property.
/// </summary>
public Type Type { get; set; }
/// <summary>
/// The .NET data type for the property.
/// </summary>
public Type Type { get; set; }
/// <summary>
/// The short description defined in the OPC specifications.
/// </summary>
public string Name { get; set; }
/// <summary>
/// The short description defined in the OPC specifications.
/// </summary>
public string Name { get; set; }
#endregion
#region Data Access Properties
#region Data Access Properties
/// <remarks/>
public static readonly TsDaPropertyDescription DATATYPE = new TsDaPropertyDescription(TsDaProperty.DATATYPE, typeof(Type), "Item Canonical DataType");
/// <remarks/>
public static readonly TsDaPropertyDescription VALUE = new TsDaPropertyDescription(TsDaProperty.VALUE, typeof(object), "Item Value");
/// <remarks/>
public static readonly TsDaPropertyDescription QUALITY = new TsDaPropertyDescription(TsDaProperty.QUALITY, typeof(TsCDaQuality), "Item Quality");
/// <remarks/>
public static readonly TsDaPropertyDescription TIMESTAMP = new TsDaPropertyDescription(TsDaProperty.TIMESTAMP, typeof(DateTime), "Item Timestamp");
/// <remarks/>
public static readonly TsDaPropertyDescription ACCESSRIGHTS = new TsDaPropertyDescription(TsDaProperty.ACCESSRIGHTS, typeof(TsDaAccessRights), "Item Access Rights");
/// <remarks/>
public static readonly TsDaPropertyDescription SCANRATE = new TsDaPropertyDescription(TsDaProperty.SCANRATE, typeof(float), "Server Scan Rate");
/// <remarks/>
public static readonly TsDaPropertyDescription EUTYPE = new TsDaPropertyDescription(TsDaProperty.EUTYPE, typeof(TsDaEuType), "Item EU Type");
/// <remarks/>
public static readonly TsDaPropertyDescription EUINFO = new TsDaPropertyDescription(TsDaProperty.EUINFO, typeof(string[]), "Item EU Info");
/// <remarks/>
public static readonly TsDaPropertyDescription ENGINEERINGUINTS = new TsDaPropertyDescription(TsDaProperty.ENGINEERINGUINTS, typeof(string), "EU Units");
/// <remarks/>
public static readonly TsDaPropertyDescription DESCRIPTION = new TsDaPropertyDescription(TsDaProperty.DESCRIPTION, typeof(string), "Item Description");
/// <remarks/>
public static readonly TsDaPropertyDescription HIGHEU = new TsDaPropertyDescription(TsDaProperty.HIGHEU, typeof(double), "High EU");
/// <remarks/>
public static readonly TsDaPropertyDescription LOWEU = new TsDaPropertyDescription(TsDaProperty.LOWEU, typeof(double), "Low EU");
/// <remarks/>
public static readonly TsDaPropertyDescription HIGHIR = new TsDaPropertyDescription(TsDaProperty.HIGHIR, typeof(double), "High Instrument Range");
/// <remarks/>
public static readonly TsDaPropertyDescription LOWIR = new TsDaPropertyDescription(TsDaProperty.LOWIR, typeof(double), "Low Instrument Range");
/// <remarks/>
public static readonly TsDaPropertyDescription CLOSELABEL = new TsDaPropertyDescription(TsDaProperty.CLOSELABEL, typeof(string), "Contact Close Label");
/// <remarks/>
public static readonly TsDaPropertyDescription OPENLABEL = new TsDaPropertyDescription(TsDaProperty.OPENLABEL, typeof(string), "Contact Open Label");
/// <remarks/>
public static readonly TsDaPropertyDescription TIMEZONE = new TsDaPropertyDescription(TsDaProperty.TIMEZONE, typeof(int), "Timezone");
/// <remarks/>
public static readonly TsDaPropertyDescription CONDITION_STATUS = new TsDaPropertyDescription(TsDaProperty.CONDITION_STATUS, typeof(string), "Condition Status");
/// <remarks/>
public static readonly TsDaPropertyDescription ALARM_QUICK_HELP = new TsDaPropertyDescription(TsDaProperty.ALARM_QUICK_HELP, typeof(string), "Alarm Quick Help");
/// <remarks/>
public static readonly TsDaPropertyDescription ALARM_AREA_LIST = new TsDaPropertyDescription(TsDaProperty.ALARM_AREA_LIST, typeof(string), "Alarm Area List");
/// <remarks/>
public static readonly TsDaPropertyDescription PRIMARY_ALARM_AREA = new TsDaPropertyDescription(TsDaProperty.PRIMARY_ALARM_AREA, typeof(string), "Primary Alarm Area");
/// <remarks/>
public static readonly TsDaPropertyDescription CONDITION_LOGIC = new TsDaPropertyDescription(TsDaProperty.CONDITION_LOGIC, typeof(string), "Condition Logic");
/// <remarks/>
public static readonly TsDaPropertyDescription LIMIT_EXCEEDED = new TsDaPropertyDescription(TsDaProperty.LIMIT_EXCEEDED, typeof(string), "Limit Exceeded");
/// <remarks/>
public static readonly TsDaPropertyDescription DEADBAND = new TsDaPropertyDescription(TsDaProperty.DEADBAND, typeof(double), "Deadband");
/// <remarks/>
public static readonly TsDaPropertyDescription HIHI_LIMIT = new TsDaPropertyDescription(TsDaProperty.HIHI_LIMIT, typeof(double), "HiHi Limit");
/// <remarks/>
public static readonly TsDaPropertyDescription HI_LIMIT = new TsDaPropertyDescription(TsDaProperty.HI_LIMIT, typeof(double), "Hi Limit");
/// <remarks/>
public static readonly TsDaPropertyDescription LO_LIMIT = new TsDaPropertyDescription(TsDaProperty.LO_LIMIT, typeof(double), "Lo Limit");
/// <remarks/>
public static readonly TsDaPropertyDescription LOLO_LIMIT = new TsDaPropertyDescription(TsDaProperty.LOLO_LIMIT, typeof(double), "LoLo Limit");
/// <remarks/>
public static readonly TsDaPropertyDescription RATE_CHANGE_LIMIT = new TsDaPropertyDescription(TsDaProperty.RATE_CHANGE_LIMIT, typeof(double), "Rate of Change Limit");
/// <remarks/>
public static readonly TsDaPropertyDescription DEVIATION_LIMIT = new TsDaPropertyDescription(TsDaProperty.DEVIATION_LIMIT, typeof(double), "Deviation Limit");
/// <remarks/>
public static readonly TsDaPropertyDescription SOUNDFILE = new TsDaPropertyDescription(TsDaProperty.SOUNDFILE, typeof(string), "Sound File");
#endregion
#region Complex Data Properties
public static readonly TsDaPropertyDescription DATATYPE = new TsDaPropertyDescription(TsDaProperty.DATATYPE, typeof(Type), "Item Canonical DataType");
/// <remarks/>
public static readonly TsDaPropertyDescription TYPE_SYSTEM_ID = new TsDaPropertyDescription(TsDaProperty.TYPE_SYSTEM_ID, typeof(string), "Type System ID");
/// <remarks/>
public static readonly TsDaPropertyDescription DICTIONARY_ID = new TsDaPropertyDescription(TsDaProperty.DICTIONARY_ID, typeof(string), "Dictionary ID");
/// <remarks/>
public static readonly TsDaPropertyDescription TYPE_ID = new TsDaPropertyDescription(TsDaProperty.TYPE_ID, typeof(string), "Type ID");
/// <remarks/>
public static readonly TsDaPropertyDescription DICTIONARY = new TsDaPropertyDescription(TsDaProperty.DICTIONARY, typeof(object), "Dictionary");
/// <remarks/>
public static readonly TsDaPropertyDescription TYPE_DESCRIPTION = new TsDaPropertyDescription(TsDaProperty.TYPE_DESCRIPTION, typeof(string), "Type Description");
/// <remarks/>
public static readonly TsDaPropertyDescription CONSISTENCY_WINDOW = new TsDaPropertyDescription(TsDaProperty.CONSISTENCY_WINDOW, typeof(string), "Consistency Window");
/// <remarks/>
public static readonly TsDaPropertyDescription WRITE_BEHAVIOR = new TsDaPropertyDescription(TsDaProperty.WRITE_BEHAVIOR, typeof(string), "Write Behavior");
/// <remarks/>
public static readonly TsDaPropertyDescription UNCONVERTED_ITEM_ID = new TsDaPropertyDescription(TsDaProperty.UNCONVERTED_ITEM_ID, typeof(string), "Unconverted Item ID");
/// <remarks/>
public static readonly TsDaPropertyDescription UNFILTERED_ITEM_ID = new TsDaPropertyDescription(TsDaProperty.UNFILTERED_ITEM_ID, typeof(string), "Unfiltered Item ID");
/// <remarks/>
public static readonly TsDaPropertyDescription DATA_FILTER_VALUE = new TsDaPropertyDescription(TsDaProperty.DATA_FILTER_VALUE, typeof(string), "Data Filter Value");
public static readonly TsDaPropertyDescription VALUE = new TsDaPropertyDescription(TsDaProperty.VALUE, typeof(object), "Item Value");
/// <remarks/>
public static readonly TsDaPropertyDescription QUALITY = new TsDaPropertyDescription(TsDaProperty.QUALITY, typeof(TsCDaQuality), "Item Quality");
/// <remarks/>
public static readonly TsDaPropertyDescription TIMESTAMP = new TsDaPropertyDescription(TsDaProperty.TIMESTAMP, typeof(DateTime), "Item Timestamp");
/// <remarks/>
public static readonly TsDaPropertyDescription ACCESSRIGHTS = new TsDaPropertyDescription(TsDaProperty.ACCESSRIGHTS, typeof(TsDaAccessRights), "Item Access Rights");
/// <remarks/>
public static readonly TsDaPropertyDescription SCANRATE = new TsDaPropertyDescription(TsDaProperty.SCANRATE, typeof(float), "Server Scan Rate");
/// <remarks/>
public static readonly TsDaPropertyDescription EUTYPE = new TsDaPropertyDescription(TsDaProperty.EUTYPE, typeof(TsDaEuType), "Item EU Type");
/// <remarks/>
public static readonly TsDaPropertyDescription EUINFO = new TsDaPropertyDescription(TsDaProperty.EUINFO, typeof(string[]), "Item EU Info");
/// <remarks/>
public static readonly TsDaPropertyDescription ENGINEERINGUINTS = new TsDaPropertyDescription(TsDaProperty.ENGINEERINGUINTS, typeof(string), "EU Units");
/// <remarks/>
public static readonly TsDaPropertyDescription DESCRIPTION = new TsDaPropertyDescription(TsDaProperty.DESCRIPTION, typeof(string), "Item Description");
/// <remarks/>
public static readonly TsDaPropertyDescription HIGHEU = new TsDaPropertyDescription(TsDaProperty.HIGHEU, typeof(double), "High EU");
/// <remarks/>
public static readonly TsDaPropertyDescription LOWEU = new TsDaPropertyDescription(TsDaProperty.LOWEU, typeof(double), "Low EU");
/// <remarks/>
public static readonly TsDaPropertyDescription HIGHIR = new TsDaPropertyDescription(TsDaProperty.HIGHIR, typeof(double), "High Instrument Range");
/// <remarks/>
public static readonly TsDaPropertyDescription LOWIR = new TsDaPropertyDescription(TsDaProperty.LOWIR, typeof(double), "Low Instrument Range");
/// <remarks/>
public static readonly TsDaPropertyDescription CLOSELABEL = new TsDaPropertyDescription(TsDaProperty.CLOSELABEL, typeof(string), "Contact Close Label");
/// <remarks/>
public static readonly TsDaPropertyDescription OPENLABEL = new TsDaPropertyDescription(TsDaProperty.OPENLABEL, typeof(string), "Contact Open Label");
/// <remarks/>
public static readonly TsDaPropertyDescription TIMEZONE = new TsDaPropertyDescription(TsDaProperty.TIMEZONE, typeof(int), "Timezone");
/// <remarks/>
public static readonly TsDaPropertyDescription CONDITION_STATUS = new TsDaPropertyDescription(TsDaProperty.CONDITION_STATUS, typeof(string), "Condition Status");
/// <remarks/>
public static readonly TsDaPropertyDescription ALARM_QUICK_HELP = new TsDaPropertyDescription(TsDaProperty.ALARM_QUICK_HELP, typeof(string), "Alarm Quick Help");
/// <remarks/>
public static readonly TsDaPropertyDescription ALARM_AREA_LIST = new TsDaPropertyDescription(TsDaProperty.ALARM_AREA_LIST, typeof(string), "Alarm Area List");
/// <remarks/>
public static readonly TsDaPropertyDescription PRIMARY_ALARM_AREA = new TsDaPropertyDescription(TsDaProperty.PRIMARY_ALARM_AREA, typeof(string), "Primary Alarm Area");
/// <remarks/>
public static readonly TsDaPropertyDescription CONDITION_LOGIC = new TsDaPropertyDescription(TsDaProperty.CONDITION_LOGIC, typeof(string), "Condition Logic");
/// <remarks/>
public static readonly TsDaPropertyDescription LIMIT_EXCEEDED = new TsDaPropertyDescription(TsDaProperty.LIMIT_EXCEEDED, typeof(string), "Limit Exceeded");
/// <remarks/>
public static readonly TsDaPropertyDescription DEADBAND = new TsDaPropertyDescription(TsDaProperty.DEADBAND, typeof(double), "Deadband");
/// <remarks/>
public static readonly TsDaPropertyDescription HIHI_LIMIT = new TsDaPropertyDescription(TsDaProperty.HIHI_LIMIT, typeof(double), "HiHi Limit");
/// <remarks/>
public static readonly TsDaPropertyDescription HI_LIMIT = new TsDaPropertyDescription(TsDaProperty.HI_LIMIT, typeof(double), "Hi Limit");
/// <remarks/>
public static readonly TsDaPropertyDescription LO_LIMIT = new TsDaPropertyDescription(TsDaProperty.LO_LIMIT, typeof(double), "Lo Limit");
/// <remarks/>
public static readonly TsDaPropertyDescription LOLO_LIMIT = new TsDaPropertyDescription(TsDaProperty.LOLO_LIMIT, typeof(double), "LoLo Limit");
/// <remarks/>
public static readonly TsDaPropertyDescription RATE_CHANGE_LIMIT = new TsDaPropertyDescription(TsDaProperty.RATE_CHANGE_LIMIT, typeof(double), "Rate of Change Limit");
/// <remarks/>
public static readonly TsDaPropertyDescription DEVIATION_LIMIT = new TsDaPropertyDescription(TsDaProperty.DEVIATION_LIMIT, typeof(double), "Deviation Limit");
/// <remarks/>
public static readonly TsDaPropertyDescription SOUNDFILE = new TsDaPropertyDescription(TsDaProperty.SOUNDFILE, typeof(string), "Sound File");
#endregion
#region Object Member Overrides
#region Complex Data Properties
/// <remarks/>
public static readonly TsDaPropertyDescription TYPE_SYSTEM_ID = new TsDaPropertyDescription(TsDaProperty.TYPE_SYSTEM_ID, typeof(string), "Type System ID");
/// <remarks/>
public static readonly TsDaPropertyDescription DICTIONARY_ID = new TsDaPropertyDescription(TsDaProperty.DICTIONARY_ID, typeof(string), "Dictionary ID");
/// <remarks/>
public static readonly TsDaPropertyDescription TYPE_ID = new TsDaPropertyDescription(TsDaProperty.TYPE_ID, typeof(string), "Type ID");
/// <remarks/>
public static readonly TsDaPropertyDescription DICTIONARY = new TsDaPropertyDescription(TsDaProperty.DICTIONARY, typeof(object), "Dictionary");
/// <remarks/>
public static readonly TsDaPropertyDescription TYPE_DESCRIPTION = new TsDaPropertyDescription(TsDaProperty.TYPE_DESCRIPTION, typeof(string), "Type Description");
/// <remarks/>
public static readonly TsDaPropertyDescription CONSISTENCY_WINDOW = new TsDaPropertyDescription(TsDaProperty.CONSISTENCY_WINDOW, typeof(string), "Consistency Window");
/// <remarks/>
public static readonly TsDaPropertyDescription WRITE_BEHAVIOR = new TsDaPropertyDescription(TsDaProperty.WRITE_BEHAVIOR, typeof(string), "Write Behavior");
/// <remarks/>
public static readonly TsDaPropertyDescription UNCONVERTED_ITEM_ID = new TsDaPropertyDescription(TsDaProperty.UNCONVERTED_ITEM_ID, typeof(string), "Unconverted Item ID");
/// <remarks/>
public static readonly TsDaPropertyDescription UNFILTERED_ITEM_ID = new TsDaPropertyDescription(TsDaProperty.UNFILTERED_ITEM_ID, typeof(string), "Unfiltered Item ID");
/// <remarks/>
public static readonly TsDaPropertyDescription DATA_FILTER_VALUE = new TsDaPropertyDescription(TsDaProperty.DATA_FILTER_VALUE, typeof(string), "Data Filter Value");
#endregion
#region Object Member Overrides
/// <summary>
/// Converts the description to a string.
/// </summary>
public override string ToString()
{
return Name;
}
/// Converts the description to a string.
/// </summary>
public override string ToString()
{
return Name;
}
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Returns the description for the specified property.
/// </summary>
public static TsDaPropertyDescription Find(TsDaPropertyID id)
{
var fields = typeof(TsDaPropertyDescription).GetFields(BindingFlags.Static | BindingFlags.Public);
/// Returns the description for the specified property.
/// </summary>
public static TsDaPropertyDescription Find(TsDaPropertyID id)
{
var fields = typeof(TsDaPropertyDescription).GetFields(BindingFlags.Static | BindingFlags.Public);
foreach (var field in fields)
{
var property = (TsDaPropertyDescription)field.GetValue(typeof(TsDaPropertyDescription));
foreach (var field in fields)
{
var property = (TsDaPropertyDescription)field.GetValue(typeof(TsDaPropertyDescription));
if (property.ID == id)
{
return property;
}
}
if (property.ID == id)
{
return property;
}
}
return null;
}
return null;
}
/// <summary>
/// Returns an array of all well-known property descriptions.
/// </summary>
public static TsDaPropertyDescription[] Enumerate()
{
var values = new ArrayList();
/// <summary>
/// Returns an array of all well-known property descriptions.
/// </summary>
public static TsDaPropertyDescription[] Enumerate()
{
var values = new ArrayList();
var fields = typeof(TsDaPropertyDescription).GetFields(BindingFlags.Static | BindingFlags.Public);
var fields = typeof(TsDaPropertyDescription).GetFields(BindingFlags.Static | BindingFlags.Public);
Array.ForEach(fields, field => values.Add(field.GetValue(typeof(TsDaPropertyDescription))));
Array.ForEach(fields, field => values.Add(field.GetValue(typeof(TsDaPropertyDescription))));
return (TsDaPropertyDescription[])values.ToArray(typeof(TsDaPropertyDescription));
}
return (TsDaPropertyDescription[])values.ToArray(typeof(TsDaPropertyDescription));
}
#endregion
}
}
}

View File

@@ -22,91 +22,91 @@
#region Using Directives
using System;
using System.Xml;
using System.Runtime.Serialization;
using System.Xml;
#endregion
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Contains a unique identifier for a property.
/// </summary>
[Serializable]
public struct TsDaPropertyID : ISerializable
{
#region Names Class
/// <summary>
/// Contains a unique identifier for a property.
/// </summary>
[Serializable]
public struct TsDaPropertyID : ISerializable
{
#region Names Class
/// <summary>
/// A set of names for fields used in serialization.
/// </summary>
private class Names
{
internal const string Name = "NA";
internal const string Namespace = "NS";
internal const string Code = "CO";
}
/// A set of names for fields used in serialization.
/// </summary>
private class Names
{
internal const string Name = "NA";
internal const string Namespace = "NS";
internal const string Code = "CO";
}
#endregion
#region Fields
#region Fields
private int code_;
private XmlQualifiedName qualifiedName_;
#endregion
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes a property identified by a qualified name.
/// </summary>
public TsDaPropertyID(XmlQualifiedName name) { qualifiedName_ = name; code_ = 0; }
/// <summary>
/// Initializes a property identified by an integer.
/// </summary>
public TsDaPropertyID(int code) { qualifiedName_ = null; code_ = code; }
/// <summary>
/// Initializes a property identified by a property description.
/// </summary>
public TsDaPropertyID(string name, int code, string ns) { qualifiedName_ = new XmlQualifiedName(name, ns); code_ = code; }
///<remarks>
/// During deserialization, SerializationInfo is passed to the class using the constructor provided for this purpose. Any visibility
/// constraints placed on the constructor are ignored when the object is deserialized; so you can mark the class as public,
/// protected, internal, or private. However, it is best practice to make the constructor protected unless the class is sealed, in which case
/// the constructor should be marked private. The constructor should also perform thorough input validation. To avoid misuse by malicious code,
/// the constructor should enforce the same security checks and permissions required to obtain an instance of the class using any other
/// constructor.
/// </remarks>
/// <summary>
/// Constructs a server by de-serializing its OpcUrl from the stream.
/// </summary>
private TsDaPropertyID(SerializationInfo info, StreamingContext context)
{
var enumerator = info.GetEnumerator();
var name = "";
var ns = "";
enumerator.Reset();
while (enumerator.MoveNext())
{
if (enumerator.Current.Name.Equals(Names.Name))
{
name = (string)enumerator.Current.Value;
continue;
}
if (enumerator.Current.Name.Equals(Names.Namespace))
{
ns = (string)enumerator.Current.Value;
}
}
qualifiedName_ = new XmlQualifiedName(name, ns);
code_ = (int)info.GetValue(Names.Code, typeof(int));
}
private XmlQualifiedName qualifiedName_;
#endregion
#region Properties
#region Constructors, Destructor, Initialization
/// <summary>
/// Used for properties identified by a qualified name.
/// </summary>
public XmlQualifiedName Name => qualifiedName_;
/// Initializes a property identified by a qualified name.
/// </summary>
public TsDaPropertyID(XmlQualifiedName name) { qualifiedName_ = name; code_ = 0; }
/// <summary>
/// Initializes a property identified by an integer.
/// </summary>
public TsDaPropertyID(int code) { qualifiedName_ = null; code_ = code; }
/// <summary>
/// Initializes a property identified by a property description.
/// </summary>
public TsDaPropertyID(string name, int code, string ns) { qualifiedName_ = new XmlQualifiedName(name, ns); code_ = code; }
///<remarks>
/// During deserialization, SerializationInfo is passed to the class using the constructor provided for this purpose. Any visibility
/// constraints placed on the constructor are ignored when the object is deserialized; so you can mark the class as public,
/// protected, internal, or private. However, it is best practice to make the constructor protected unless the class is sealed, in which case
/// the constructor should be marked private. The constructor should also perform thorough input validation. To avoid misuse by malicious code,
/// the constructor should enforce the same security checks and permissions required to obtain an instance of the class using any other
/// constructor.
/// </remarks>
/// <summary>
/// Constructs a server by de-serializing its OpcUrl from the stream.
/// </summary>
private TsDaPropertyID(SerializationInfo info, StreamingContext context)
{
var enumerator = info.GetEnumerator();
var name = "";
var ns = "";
enumerator.Reset();
while (enumerator.MoveNext())
{
if (enumerator.Current.Name.Equals(Names.Name))
{
name = (string)enumerator.Current.Value;
continue;
}
if (enumerator.Current.Name.Equals(Names.Namespace))
{
ns = (string)enumerator.Current.Value;
}
}
qualifiedName_ = new XmlQualifiedName(name, ns);
code_ = (int)info.GetValue(Names.Code, typeof(int));
}
#endregion
#region Properties
/// <summary>
/// Used for properties identified by a qualified name.
/// </summary>
public XmlQualifiedName Name => qualifiedName_;
/// <summary>
/// Used for properties identified by a integer.
@@ -114,85 +114,85 @@ namespace Technosoftware.DaAeHdaClient.Da
public int Code => code_;
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Returns true if the objects are equal.
/// </summary>
public static bool operator ==(TsDaPropertyID a, TsDaPropertyID b)
{
return a.Equals(b);
}
/// Returns true if the objects are equal.
/// </summary>
public static bool operator ==(TsDaPropertyID a, TsDaPropertyID b)
{
return a.Equals(b);
}
/// <summary>
/// Returns true if the objects are not equal.
/// </summary>
public static bool operator !=(TsDaPropertyID a, TsDaPropertyID b)
{
return !a.Equals(b);
}
/// <summary>
/// Returns true if the objects are not equal.
/// </summary>
public static bool operator !=(TsDaPropertyID a, TsDaPropertyID b)
{
return !a.Equals(b);
}
#endregion
#region Serialization Functions
#region Serialization Functions
/// <summary>
/// Serializes a server into a stream.
/// </summary>
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (qualifiedName_ != null)
{
info.AddValue(Names.Name, qualifiedName_.Name);
info.AddValue(Names.Namespace, qualifiedName_.Namespace);
}
info.AddValue(Names.Code, code_);
}
/// Serializes a server into a stream.
/// </summary>
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (qualifiedName_ != null)
{
info.AddValue(Names.Name, qualifiedName_.Name);
info.AddValue(Names.Namespace, qualifiedName_.Namespace);
}
info.AddValue(Names.Code, code_);
}
#endregion
#region Object Member Overrides
/// <summary>
/// Returns true if the target object is equal to the object.
/// </summary>
public override bool Equals(object target)
{
if (target != null && target.GetType() == typeof(TsDaPropertyID))
{
var propertyId = (TsDaPropertyID)target;
#region Object Member Overrides
/// <summary>
/// Returns true if the target object is equal to the object.
/// </summary>
public override bool Equals(object target)
{
if (target != null && target.GetType() == typeof(TsDaPropertyID))
{
var propertyId = (TsDaPropertyID)target;
// compare by integer if both specify valid integers.
if (propertyId.Code != 0 && Code != 0)
{
return (propertyId.Code == Code);
}
// compare by integer if both specify valid integers.
if (propertyId.Code != 0 && Code != 0)
{
return (propertyId.Code == Code);
}
// compare by name if both specify valid names.
if (propertyId.Name != null && Name != null)
{
return (propertyId.Name == Name);
}
}
// compare by name if both specify valid names.
if (propertyId.Name != null && Name != null)
{
return (propertyId.Name == Name);
}
}
return false;
}
return false;
}
/// <summary>
/// Returns a useful hash code for the object.
/// </summary>
public override int GetHashCode()
{
if (Code != 0) return Code.GetHashCode();
if (Name != null) return Name.GetHashCode();
return base.GetHashCode();
}
/// <summary>
/// Returns a useful hash code for the object.
/// </summary>
public override int GetHashCode()
{
if (Code != 0) return Code.GetHashCode();
if (Name != null) return Name.GetHashCode();
return base.GetHashCode();
}
/// <summary>
/// Converts the property id to a string.
/// </summary>
public override string ToString()
{
if (Name != null && Code != 0) return $"{Name.Name} ({Code})";
if (Name != null) return Name.Name;
if (Code != 0) return $"{Code}";
return "";
}
#endregion
}
/// <summary>
/// Converts the property id to a string.
/// </summary>
public override string ToString()
{
if (Name != null && Code != 0) return $"{Name.Name} ({Code})";
if (Name != null) return Name.Name;
if (Code != 0) return $"{Code}";
return "";
}
#endregion
}
}

View File

@@ -27,225 +27,225 @@ using System;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Contains the quality field for an item value.
/// </summary>
[Serializable]
public struct TsCDaQuality
{
#region Fields
/// <summary>
/// Contains the quality field for an item value.
/// </summary>
[Serializable]
public struct TsCDaQuality
{
#region Fields
private TsDaQualityBits qualityBits_;
private TsDaLimitBits limitBits_;
private byte vendorBits_;
private TsDaLimitBits limitBits_;
private byte vendorBits_;
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes the object with the specified quality.
/// </summary>
public TsCDaQuality(TsDaQualityBits quality)
{
qualityBits_ = quality;
limitBits_ = TsDaLimitBits.None;
vendorBits_ = 0;
}
/// Initializes the object with the specified quality.
/// </summary>
public TsCDaQuality(TsDaQualityBits quality)
{
qualityBits_ = quality;
limitBits_ = TsDaLimitBits.None;
vendorBits_ = 0;
}
/// <summary>
/// Initializes the object from the contents of a 16 bit integer.
/// </summary>
public TsCDaQuality(short code)
{
qualityBits_ = (TsDaQualityBits)(code & (short)TsDaQualityMasks.QualityMask);
limitBits_ = (TsDaLimitBits)(code & (short)TsDaQualityMasks.LimitMask);
vendorBits_ = (byte)((code & (short)TsDaQualityMasks.VendorMask) >> 8);
}
/// <summary>
/// Initializes the object from the contents of a 16 bit integer.
/// </summary>
public TsCDaQuality(short code)
{
qualityBits_ = (TsDaQualityBits)(code & (short)TsDaQualityMasks.QualityMask);
limitBits_ = (TsDaLimitBits)(code & (short)TsDaQualityMasks.LimitMask);
vendorBits_ = (byte)((code & (short)TsDaQualityMasks.VendorMask) >> 8);
}
#endregion
#region Properties
#region Properties
/// <summary>
/// The value in the quality bits field.
/// </summary>
public TsDaQualityBits QualityBits
{
get => qualityBits_;
/// The value in the quality bits field.
/// </summary>
public TsDaQualityBits QualityBits
{
get => qualityBits_;
set => qualityBits_ = value;
}
/// <summary>
/// The value in the limit bits field.
/// </summary>
public TsDaLimitBits LimitBits
{
get => limitBits_;
/// <summary>
/// The value in the limit bits field.
/// </summary>
public TsDaLimitBits LimitBits
{
get => limitBits_;
set => limitBits_ = value;
}
/// <summary>
/// The value in the quality bits field.
/// </summary>
public byte VendorBits
{
get => vendorBits_;
/// <summary>
/// The value in the quality bits field.
/// </summary>
public byte VendorBits
{
get => vendorBits_;
set => vendorBits_ = value;
}
/// <summary>
/// A 'good' quality value.
/// </summary>
public static readonly TsCDaQuality Good = new TsCDaQuality(TsDaQualityBits.Good);
/// <summary>
/// A 'good' quality value.
/// </summary>
public static readonly TsCDaQuality Good = new TsCDaQuality(TsDaQualityBits.Good);
/// <summary>
/// An 'bad' quality value.
/// </summary>
public static readonly TsCDaQuality Bad = new TsCDaQuality(TsDaQualityBits.Bad);
/// <summary>
/// An 'bad' quality value.
/// </summary>
public static readonly TsCDaQuality Bad = new TsCDaQuality(TsDaQualityBits.Bad);
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Returns the quality as a 16 bit integer.
/// </summary>
public short GetCode()
{
ushort code = 0;
/// Returns the quality as a 16 bit integer.
/// </summary>
public short GetCode()
{
ushort code = 0;
code |= (ushort)QualityBits;
code |= (ushort)LimitBits;
code |= (ushort)(VendorBits << 8);
code |= (ushort)QualityBits;
code |= (ushort)LimitBits;
code |= (ushort)(VendorBits << 8);
return (code <= short.MaxValue) ? (short)code : (short)-((ushort.MaxValue + 1 - code));
}
return (code <= short.MaxValue) ? (short)code : (short)-((ushort.MaxValue + 1 - code));
}
/// <summary>
/// Initializes the quality from a 16 bit integer.
/// </summary>
public void SetCode(short code)
{
qualityBits_ = (TsDaQualityBits)(code & (short)TsDaQualityMasks.QualityMask);
limitBits_ = (TsDaLimitBits)(code & (short)TsDaQualityMasks.LimitMask);
vendorBits_ = (byte)((code & (short)TsDaQualityMasks.VendorMask) >> 8);
}
/// <summary>
/// Initializes the quality from a 16 bit integer.
/// </summary>
public void SetCode(short code)
{
qualityBits_ = (TsDaQualityBits)(code & (short)TsDaQualityMasks.QualityMask);
limitBits_ = (TsDaLimitBits)(code & (short)TsDaQualityMasks.LimitMask);
vendorBits_ = (byte)((code & (short)TsDaQualityMasks.VendorMask) >> 8);
}
/// <summary>
/// Returns true if the objects are equal.
/// </summary>
public static bool operator ==(TsCDaQuality a, TsCDaQuality b)
{
return a.Equals(b);
}
/// <summary>
/// Returns true if the objects are equal.
/// </summary>
public static bool operator ==(TsCDaQuality a, TsCDaQuality b)
{
return a.Equals(b);
}
/// <summary>
/// Returns true if the objects are not equal.
/// </summary>
public static bool operator !=(TsCDaQuality a, TsCDaQuality b)
{
return !a.Equals(b);
}
/// <summary>
/// Returns true if the objects are not equal.
/// </summary>
public static bool operator !=(TsCDaQuality a, TsCDaQuality b)
{
return !a.Equals(b);
}
#endregion
#region Object Member Overrides
#region Object Member Overrides
/// <summary>
/// Converts a quality to a string with the format: 'quality[limit]:vendor'.
/// </summary>
public override string ToString()
{
string text = null;
/// Converts a quality to a string with the format: 'quality[limit]:vendor'.
/// </summary>
public override string ToString()
{
string text = null;
switch (QualityBits)
{
case TsDaQualityBits.Good:
text += "(Good";
break;
case TsDaQualityBits.GoodLocalOverride:
text += "(Good:Local Override";
break;
case TsDaQualityBits.Bad:
text += "(Bad";
break;
case TsDaQualityBits.BadConfigurationError:
text += "(Bad:Configuration Error";
break;
case TsDaQualityBits.BadNotConnected:
text += "(Bad:Not Connected";
break;
case TsDaQualityBits.BadDeviceFailure:
text += "(Bad:Device Failure";
break;
case TsDaQualityBits.BadSensorFailure:
text += "(Bad:Sensor Failure";
break;
case TsDaQualityBits.BadLastKnownValue:
text += "(Bad:Last Known Value";
break;
case TsDaQualityBits.BadCommFailure:
text += "(Bad:Communication Failure";
break;
case TsDaQualityBits.BadOutOfService:
text += "(Bad:Out of Service";
break;
case TsDaQualityBits.BadWaitingForInitialData:
text += "(Bad:Waiting for Initial Data";
break;
case TsDaQualityBits.Uncertain:
text += "(Uncertain";
break;
case TsDaQualityBits.UncertainLastUsableValue:
text += "(Uncertain:Last Usable Value";
break;
case TsDaQualityBits.UncertainSensorNotAccurate:
text += "(Uncertain:Sensor not Accurate";
break;
case TsDaQualityBits.UncertainEUExceeded:
text += "(Uncertain:Engineering Unit exceeded";
break;
case TsDaQualityBits.UncertainSubNormal:
text += "(Uncertain:Sub Normal";
break;
}
switch (QualityBits)
{
case TsDaQualityBits.Good:
text += "(Good";
break;
case TsDaQualityBits.GoodLocalOverride:
text += "(Good:Local Override";
break;
case TsDaQualityBits.Bad:
text += "(Bad";
break;
case TsDaQualityBits.BadConfigurationError:
text += "(Bad:Configuration Error";
break;
case TsDaQualityBits.BadNotConnected:
text += "(Bad:Not Connected";
break;
case TsDaQualityBits.BadDeviceFailure:
text += "(Bad:Device Failure";
break;
case TsDaQualityBits.BadSensorFailure:
text += "(Bad:Sensor Failure";
break;
case TsDaQualityBits.BadLastKnownValue:
text += "(Bad:Last Known Value";
break;
case TsDaQualityBits.BadCommFailure:
text += "(Bad:Communication Failure";
break;
case TsDaQualityBits.BadOutOfService:
text += "(Bad:Out of Service";
break;
case TsDaQualityBits.BadWaitingForInitialData:
text += "(Bad:Waiting for Initial Data";
break;
case TsDaQualityBits.Uncertain:
text += "(Uncertain";
break;
case TsDaQualityBits.UncertainLastUsableValue:
text += "(Uncertain:Last Usable Value";
break;
case TsDaQualityBits.UncertainSensorNotAccurate:
text += "(Uncertain:Sensor not Accurate";
break;
case TsDaQualityBits.UncertainEUExceeded:
text += "(Uncertain:Engineering Unit exceeded";
break;
case TsDaQualityBits.UncertainSubNormal:
text += "(Uncertain:Sub Normal";
break;
}
if (LimitBits != TsDaLimitBits.None)
{
text += $":[{LimitBits.ToString()}]";
}
else
{
text += ":Not Limited";
}
if (LimitBits != TsDaLimitBits.None)
{
text += $":[{LimitBits.ToString()}]";
}
else
{
text += ":Not Limited";
}
if (VendorBits != 0)
{
text += $":{VendorBits,0:X})";
}
else
{
text += ")";
}
if (VendorBits != 0)
{
text += $":{VendorBits,0:X})";
}
else
{
text += ")";
}
return text;
}
return text;
}
/// <summary>
/// Determines whether the specified Object is equal to the current Quality
/// </summary>
public override bool Equals(object target)
{
if (target == null || target.GetType() != typeof(TsCDaQuality)) return false;
/// <summary>
/// Determines whether the specified Object is equal to the current Quality
/// </summary>
public override bool Equals(object target)
{
if (target == null || target.GetType() != typeof(TsCDaQuality)) return false;
var quality = (TsCDaQuality)target;
var quality = (TsCDaQuality)target;
if (QualityBits != quality.QualityBits) return false;
if (LimitBits != quality.LimitBits) return false;
if (VendorBits != quality.VendorBits) return false;
if (QualityBits != quality.QualityBits) return false;
if (LimitBits != quality.LimitBits) return false;
if (VendorBits != quality.VendorBits) return false;
return true;
}
return true;
}
/// <summary>
/// Returns hash code for the current Quality.
/// </summary>
public override int GetHashCode()
{
return GetCode();
}
#endregion
}
/// <summary>
/// Returns hash code for the current Quality.
/// </summary>
public override int GetHashCode()
{
return GetCode();
}
#endregion
}
}

View File

@@ -25,90 +25,90 @@
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// <para>Defines the possible quality status bits.</para>
/// <para>These flags represent the quality state for an item's data value. This is
/// intended to be similar to but slightly simpler than the Field-bus Data Quality
/// Specification (section 4.4.1 in the H1 Final Specifications). This design makes it
/// fairly easy for both servers and client applications to determine how much
/// functionality they want to implement.</para>
/// </summary>
public enum TsDaQualityBits
/// <summary>
/// <para>Defines the possible quality status bits.</para>
/// <para>These flags represent the quality state for an item's data value. This is
/// intended to be similar to but slightly simpler than the Field-bus Data Quality
/// Specification (section 4.4.1 in the H1 Final Specifications). This design makes it
/// fairly easy for both servers and client applications to determine how much
/// functionality they want to implement.</para>
/// </summary>
public enum TsDaQualityBits
{
/// <summary>The Quality of the value is Good.</summary>
Good = 0x000000C0,
/// <summary>The value has been Overridden. Typically this means the input has been disconnected and a manually entered value has been 'forced'.</summary>
GoodLocalOverride = 0x000000D8,
/// <summary>The value is bad but no specific reason is known.</summary>
Bad = 0x00000000,
/// <summary>
/// There is some server specific problem with the configuration. For example the
/// item in question has been deleted from the configuration.
/// </summary>
BadConfigurationError = 0x00000004,
/// <summary>
/// The input is required to be logically connected to something but is not. This
/// quality may reflect that no value is available at this time, for reasons like the value
/// may have not been provided by the data source.
/// </summary>
BadNotConnected = 0x00000008,
/// <summary>A device failure has been detected.</summary>
BadDeviceFailure = 0x0000000c,
/// <summary>
/// A sensor failure had been detected (the Limits field can provide additional
/// diagnostic information in some situations).
/// </summary>
BadSensorFailure = 0x00000010,
/// <summary>
/// Communications have failed. However, the last known value is available. Note that
/// the age of the value may be determined from the time stamp in the item state.
/// </summary>
BadLastKnownValue = 0x00000014,
/// <summary>Communications have failed. There is no last known value is available.</summary>
BadCommFailure = 0x00000018,
/// <summary>
/// The block is off scan or otherwise locked. This quality is also used when the
/// active state of the item or the subscription containing the item is InActive.
/// </summary>
BadOutOfService = 0x0000001C,
/// <summary>
/// After Items are added to a subscription, it may take some time for the server to
/// actually obtain values for these items. In such cases the client might perform a read
/// (from cache), or establish a ConnectionPoint based subscription and/or execute a
/// Refresh on such a subscription before the values are available. This sub-status is only
/// available from OPC DA 3.0 or newer servers.
/// </summary>
BadWaitingForInitialData = 0x00000020,
/// <summary>There is no specific reason why the value is uncertain.</summary>
Uncertain = 0x00000040,
/// <summary>
/// Whatever was writing this value has stopped doing so. The returned value should
/// be regarded as stale. Note that this differs from a BAD value with sub-status
/// badLastKnownValue (Last Known Value). That status is associated specifically with a
/// detectable communications error on a fetched value. This error is associated with the
/// failure of some external source to put something into the value within an acceptable
/// period of time. Note that the age of the value can be determined from the time stamp
/// in the item state.
/// </summary>
UncertainLastUsableValue = 0x00000044,
/// <summary>
/// Either the value has pegged at one of the sensor limits (in which case the
/// limit field should be set to low or high) or the sensor is otherwise known to be out of
/// calibration via some form of internal diagnostics (in which case the limit field should
/// be none).
/// </summary>
UncertainSensorNotAccurate = 0x00000050,
/// <summary>
/// The returned value is outside the limits defined for this parameter. Note that in
/// this case (per the Field-bus Specification) the Limits field indicates which limit has
/// been exceeded but does NOT necessarily imply that the value cannot move farther out of
/// range.
/// </summary>
UncertainEUExceeded = 0x00000054,
/// <summary>
/// The value is derived from multiple sources and has less than the required number
/// of Good sources.
/// </summary>
UncertainSubNormal = 0x00000058
}
/// <summary>The Quality of the value is Good.</summary>
Good = 0x000000C0,
/// <summary>The value has been Overridden. Typically this means the input has been disconnected and a manually entered value has been 'forced'.</summary>
GoodLocalOverride = 0x000000D8,
/// <summary>The value is bad but no specific reason is known.</summary>
Bad = 0x00000000,
/// <summary>
/// There is some server specific problem with the configuration. For example the
/// item in question has been deleted from the configuration.
/// </summary>
BadConfigurationError = 0x00000004,
/// <summary>
/// The input is required to be logically connected to something but is not. This
/// quality may reflect that no value is available at this time, for reasons like the value
/// may have not been provided by the data source.
/// </summary>
BadNotConnected = 0x00000008,
/// <summary>A device failure has been detected.</summary>
BadDeviceFailure = 0x0000000c,
/// <summary>
/// A sensor failure had been detected (the Limits?field can provide additional
/// diagnostic information in some situations).
/// </summary>
BadSensorFailure = 0x00000010,
/// <summary>
/// Communications have failed. However, the last known value is available. Note that
/// the age?of the value may be determined from the time stamp in the item state.
/// </summary>
BadLastKnownValue = 0x00000014,
/// <summary>Communications have failed. There is no last known value is available.</summary>
BadCommFailure = 0x00000018,
/// <summary>
/// The block is off scan or otherwise locked. This quality is also used when the
/// active state of the item or the subscription containing the item is InActive.
/// </summary>
BadOutOfService = 0x0000001C,
/// <summary>
/// After Items are added to a subscription, it may take some time for the server to
/// actually obtain values for these items. In such cases the client might perform a read
/// (from cache), or establish a ConnectionPoint based subscription and/or execute a
/// Refresh on such a subscription before the values are available. This sub-status is only
/// available from OPC DA 3.0 or newer servers.
/// </summary>
BadWaitingForInitialData = 0x00000020,
/// <summary>There is no specific reason why the value is uncertain.</summary>
Uncertain = 0x00000040,
/// <summary>
/// Whatever was writing this value has stopped doing so. The returned value should
/// be regarded as stale? Note that this differs from a BAD value with sub-status
/// badLastKnownValue (Last Known Value). That status is associated specifically with a
/// detectable communications error on a fetched?value. This error is associated with the
/// failure of some external source to put?something into the value within an acceptable
/// period of time. Note that the age?of the value can be determined from the time stamp
/// in the item state.
/// </summary>
UncertainLastUsableValue = 0x00000044,
/// <summary>
/// Either the value has pegged?at one of the sensor limits (in which case the
/// limit field should be set to low or high) or the sensor is otherwise known to be out of
/// calibration via some form of internal diagnostics (in which case the limit field should
/// be none).
/// </summary>
UncertainSensorNotAccurate = 0x00000050,
/// <summary>
/// The returned value is outside the limits defined for this parameter. Note that in
/// this case (per the Field-bus Specification) the Limits?field indicates which limit has
/// been exceeded but does NOT necessarily imply that the value cannot move farther out of
/// range.
/// </summary>
UncertainEUExceeded = 0x00000054,
/// <summary>
/// The value is derived from multiple sources and has less than the required number
/// of Good sources.
/// </summary>
UncertainSubNormal = 0x00000058
}
}

View File

@@ -25,16 +25,16 @@
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Defines bit masks for the quality.
/// </summary>
public enum TsDaQualityMasks : int
{
/// <summary>Quality related bits</summary>
QualityMask = +0x00FC,
/// <summary>Limit related bits</summary>
LimitMask = +0x0003,
/// <summary>Vendor specific bits</summary>
VendorMask = -0x00FD
}
/// <summary>
/// Defines bit masks for the quality.
/// </summary>
public enum TsDaQualityMasks : int
{
/// <summary>Quality related bits</summary>
QualityMask = +0x00FC,
/// <summary>Limit related bits</summary>
LimitMask = +0x0003,
/// <summary>Vendor specific bits</summary>
VendorMask = -0x00FD
}
}

View File

@@ -26,33 +26,33 @@ using System;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Describes the state of a subscription.
/// </summary>
[Serializable]
public class TsCDaRequest : IOpcRequest
{
#region Fields
/// <summary>
/// Describes the state of a subscription.
/// </summary>
[Serializable]
public class TsCDaRequest : IOpcRequest
{
#region Fields
private ITsCDaSubscription subscription_;
private object handle_;
private object handle_;
#endregion
#region Constructors, Destructor, Initialization
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes the object with a subscription and a unique id.
/// </summary>
public TsCDaRequest(ITsCDaSubscription subscription, object handle)
{
subscription_ = subscription;
handle_ = handle;
}
/// Initializes the object with a subscription and a unique id.
/// </summary>
public TsCDaRequest(ITsCDaSubscription subscription, object handle)
{
subscription_ = subscription;
handle_ = handle;
}
#endregion
#region Properties
#region Properties
/// <summary>
/// The subscription processing the request.
/// </summary>
public ITsCDaSubscription Subscription => subscription_;
/// The subscription processing the request.
/// </summary>
public ITsCDaSubscription Subscription => subscription_;
/// <summary>
/// An unique identifier, assigned by the client, for the request.
@@ -66,5 +66,5 @@ namespace Technosoftware.DaAeHdaClient.Da
/// </summary>
public void Cancel(TsCDaCancelCompleteEventHandler callback) { subscription_.Cancel(this, callback); }
#endregion
}
}
}

View File

@@ -26,50 +26,50 @@ using System;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Filters applied by the server before returning item results.
/// </summary>
[Flags]
public enum TsCDaResultFilter
{
/// <summary>
/// Include the ItemName in the ItemIdentifier if bit is set.
/// </summary>
ItemName = 0x01,
/// <summary>
/// Filters applied by the server before returning item results.
/// </summary>
[Flags]
public enum TsCDaResultFilter
{
/// <summary>
/// Include the ItemName in the ItemIdentifier if bit is set.
/// </summary>
ItemName = 0x01,
/// <summary>
/// Include the ItemPath in the ItemIdentifier if bit is set.
/// </summary>
ItemPath = 0x02,
/// <summary>
/// Include the ItemPath in the ItemIdentifier if bit is set.
/// </summary>
ItemPath = 0x02,
/// <summary>
/// Include the ClientHandle in the ItemIdentifier if bit is set.
/// </summary>
ClientHandle = 0x04,
/// <summary>
/// Include the ClientHandle in the ItemIdentifier if bit is set.
/// </summary>
ClientHandle = 0x04,
/// <summary>
/// Include the Timestamp in the ItemValue if bit is set.
/// </summary>
ItemTime = 0x08,
/// <summary>
/// Include the Timestamp in the ItemValue if bit is set.
/// </summary>
ItemTime = 0x08,
/// <summary>
/// Include verbose, localized error text with result if bit is set.
/// </summary>
ErrorText = 0x10,
/// <summary>
/// Include verbose, localized error text with result if bit is set.
/// </summary>
ErrorText = 0x10,
/// <summary>
/// Include additional diagnostic information with result if bit is set.
/// </summary>
DiagnosticInfo = 0x20,
/// <summary>
/// Include additional diagnostic information with result if bit is set.
/// </summary>
DiagnosticInfo = 0x20,
/// <summary>
/// Include the ItemName and Timestamp if bit is set.
/// </summary>
Minimal = ItemName | ItemTime,
/// <summary>
/// Include the ItemName and Timestamp if bit is set.
/// </summary>
Minimal = ItemName | ItemTime,
/// <summary>
/// Include all information in the results if bit is set.
/// </summary>
All = 0x3F
}
/// <summary>
/// Include all information in the results if bit is set.
/// </summary>
All = 0x3F
}
}

View File

@@ -22,8 +22,8 @@
#region Using Directives
using System;
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.Runtime.Serialization;
#endregion
namespace Technosoftware.DaAeHdaClient.Da

View File

@@ -25,44 +25,44 @@
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// The set of possible server states.
/// </summary>
public enum TsCDaServerState
{
/// <summary>
/// The server state is not known.
/// </summary>
Unknown,
/// <summary>
/// The set of possible server states.
/// </summary>
public enum TsCDaServerState
{
/// <summary>
/// The server state is not known.
/// </summary>
Unknown,
/// <summary>
/// The server is running normally.
/// </summary>
Running,
/// <summary>
/// The server is running normally.
/// </summary>
Running,
/// <summary>
/// The server is not functioning due to a fatal error.
/// </summary>
Failed,
/// <summary>
/// The server is not functioning due to a fatal error.
/// </summary>
Failed,
/// <summary>
/// The server cannot load its configuration information.
/// </summary>
NoConfig,
/// <summary>
/// The server cannot load its configuration information.
/// </summary>
NoConfig,
/// <summary>
/// The server has halted all communication with the underlying hardware.
/// </summary>
Suspended,
/// <summary>
/// The server has halted all communication with the underlying hardware.
/// </summary>
Suspended,
/// <summary>
/// The server is disconnected from the underlying hardware.
/// </summary>
Test,
/// <summary>
/// The server is disconnected from the underlying hardware.
/// </summary>
Test,
/// <summary>
/// The server cannot communicate with the underlying hardware.
/// </summary>
CommFault
}
/// <summary>
/// The server cannot communicate with the underlying hardware.
/// </summary>
CommFault
}
}

View File

@@ -26,67 +26,67 @@ using System;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Defines masks to be used when modifying the subscription or item state.
/// </summary>
[Flags]
public enum TsCDaStateMask
{
/// <summary>
/// The name of the subscription.
/// </summary>
Name = 0x0001,
/// <summary>
/// Defines masks to be used when modifying the subscription or item state.
/// </summary>
[Flags]
public enum TsCDaStateMask
{
/// <summary>
/// The name of the subscription.
/// </summary>
Name = 0x0001,
/// <summary>
/// The client assigned handle for the item or subscription.
/// </summary>
ClientHandle = 0x0002,
/// <summary>
/// The client assigned handle for the item or subscription.
/// </summary>
ClientHandle = 0x0002,
/// <summary>
/// The locale to use for results returned to the client from the subscription.
/// </summary>
Locale = 0x0004,
/// <summary>
/// The locale to use for results returned to the client from the subscription.
/// </summary>
Locale = 0x0004,
/// <summary>
/// Whether the item or subscription is active.
/// </summary>
Active = 0x0008,
/// <summary>
/// Whether the item or subscription is active.
/// </summary>
Active = 0x0008,
/// <summary>
/// The maximum rate at which data update notifications are sent.
/// </summary>
UpdateRate = 0x0010,
/// <summary>
/// The maximum rate at which data update notifications are sent.
/// </summary>
UpdateRate = 0x0010,
/// <summary>
/// The longest period between data update notifications.<br/>
/// <strong>Note:</strong> This feature is only supported with OPC Data Access 3.0
/// Servers.
/// </summary>
KeepAlive = 0x0020,
/// <summary>
/// The longest period between data update notifications.<br/>
/// <strong>Note:</strong> This feature is only supported with OPC Data Access 3.0
/// Servers.
/// </summary>
KeepAlive = 0x0020,
/// <summary>
/// The requested data type for the item.
/// </summary>
ReqType = 0x0040,
/// <summary>
/// The requested data type for the item.
/// </summary>
ReqType = 0x0040,
/// <summary>
/// The deadband for the item or subscription.
/// </summary>
Deadband = 0x0080,
/// <summary>
/// The deadband for the item or subscription.
/// </summary>
Deadband = 0x0080,
/// <summary>
/// The rate at which the server should check for changes to an item value.
/// </summary>
SamplingRate = 0x0100,
/// <summary>
/// The rate at which the server should check for changes to an item value.
/// </summary>
SamplingRate = 0x0100,
/// <summary>
/// Whether the server should buffer multiple changes to a single item.
/// </summary>
EnableBuffering = 0x0200,
/// <summary>
/// Whether the server should buffer multiple changes to a single item.
/// </summary>
EnableBuffering = 0x0200,
/// <summary>
/// All fields are valid.
/// </summary>
All = 0xFFFF
}
/// <summary>
/// All fields are valid.
/// </summary>
All = 0xFFFF
}
}

View File

@@ -210,8 +210,10 @@ namespace Technosoftware.DaAeHdaClient.Da
/// <summary>
/// The items belonging to the subscription.
/// </summary>
public TsCDaItem[] Items {
get {
public TsCDaItem[] Items
{
get
{
if (daItems_ == null) return new TsCDaItem[0];
var items = new TsCDaItem[daItems_.Length];
for (var ii = 0; ii < daItems_.Length; ii++) items[ii] = (TsCDaItem)daItems_[ii].Clone();
@@ -562,7 +564,8 @@ namespace Technosoftware.DaAeHdaClient.Da
/// <summary>
/// An event to receive data change updates.
/// </summary>
public event TsCDaDataChangedEventHandler DataChangedEvent {
public event TsCDaDataChangedEventHandler DataChangedEvent
{
add => Subscription.DataChangedEvent += value;
remove => Subscription.DataChangedEvent -= value;
}

View File

@@ -27,84 +27,84 @@ using System.Collections;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>A collection of subscriptions.</summary>
[Serializable]
public class TsCDaSubscriptionCollection : ICollection, ICloneable, IList
{
///////////////////////////////////////////////////////////////////////
#region Fields
/// <summary>A collection of subscriptions.</summary>
[Serializable]
public class TsCDaSubscriptionCollection : ICollection, ICloneable, IList
{
///////////////////////////////////////////////////////////////////////
#region Fields
private ArrayList _subscriptions = new ArrayList();
private ArrayList _subscriptions = new ArrayList();
#endregion
#endregion
///////////////////////////////////////////////////////////////////////
#region Constructors, Destructor, Initialization
///////////////////////////////////////////////////////////////////////
#region Constructors, Destructor, Initialization
/// <summary>
/// Initializes object with the default values.
/// </summary>
public TsCDaSubscriptionCollection() { }
/// <summary>
/// Initializes object with the default values.
/// </summary>
public TsCDaSubscriptionCollection() { }
/// <summary>
/// Initializes object with the specified SubscriptionCollection object.
/// </summary>
public TsCDaSubscriptionCollection(TsCDaSubscriptionCollection subscriptions)
{
if (subscriptions != null)
{
foreach (TsCDaSubscription subscription in subscriptions)
{
Add(subscription);
}
}
}
/// <summary>
/// Initializes object with the specified SubscriptionCollection object.
/// </summary>
public TsCDaSubscriptionCollection(TsCDaSubscriptionCollection subscriptions)
{
if (subscriptions != null)
{
foreach (TsCDaSubscription subscription in subscriptions)
{
Add(subscription);
}
}
}
#endregion
#endregion
///////////////////////////////////////////////////////////////////////
#region Properties
///////////////////////////////////////////////////////////////////////
#region Properties
/// <summary>
/// Gets the item at the specified index.
/// </summary>
public TsCDaSubscription this[int index]
{
get => (TsCDaSubscription)_subscriptions[index];
/// <summary>
/// Gets the item at the specified index.
/// </summary>
public TsCDaSubscription this[int index]
{
get => (TsCDaSubscription)_subscriptions[index];
set => _subscriptions[index] = value;
}
#endregion
#endregion
///////////////////////////////////////////////////////////////////////
#region ICloneable Members
///////////////////////////////////////////////////////////////////////
#region ICloneable Members
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var clone = (TsCDaSubscriptionCollection)MemberwiseClone();
/// <summary>
/// Creates a deep copy of the object.
/// </summary>
public virtual object Clone()
{
var clone = (TsCDaSubscriptionCollection)MemberwiseClone();
clone._subscriptions = new ArrayList();
clone._subscriptions = new ArrayList();
foreach (TsCDaSubscription subscription in _subscriptions)
{
clone._subscriptions.Add(subscription.Clone());
}
foreach (TsCDaSubscription subscription in _subscriptions)
{
clone._subscriptions.Add(subscription.Clone());
}
return clone;
}
return clone;
}
#endregion
#endregion
///////////////////////////////////////////////////////////////////////
#region ICollection Members
///////////////////////////////////////////////////////////////////////
#region ICollection Members
/// <summary>
/// Indicates whether access to the ICollection is synchronized (thread-safe).
/// </summary>
public bool IsSynchronized => false;
/// <summary>
/// Indicates whether access to the ICollection is synchronized (thread-safe).
/// </summary>
public bool IsSynchronized => false;
/// <summary>
/// Gets the number of objects in the collection.
@@ -117,150 +117,150 @@ namespace Technosoftware.DaAeHdaClient.Da
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
public void CopyTo(Array array, int index)
{
if (_subscriptions != null)
{
_subscriptions.CopyTo(array, index);
}
}
{
if (_subscriptions != null)
{
_subscriptions.CopyTo(array, index);
}
}
/// <summary>
/// Copies the objects to an Array, starting at a the specified index.
/// </summary>
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
public void CopyTo(TsCDaSubscription[] array, int index)
{
CopyTo((Array)array, index);
}
/// <summary>
/// Copies the objects to an Array, starting at a the specified index.
/// </summary>
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
public void CopyTo(TsCDaSubscription[] array, int index)
{
CopyTo((Array)array, index);
}
/// <summary>
/// Indicates whether access to the ICollection is synchronized (thread-safe).
/// </summary>
public object SyncRoot => this;
/// <summary>
/// Indicates whether access to the ICollection is synchronized (thread-safe).
/// </summary>
public object SyncRoot => this;
#endregion
///////////////////////////////////////////////////////////////////////
#region IEnumerable Members
///////////////////////////////////////////////////////////////////////
#region IEnumerable Members
/// <summary>
/// Returns an enumerator that can iterate through a collection.
/// </summary>
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
public IEnumerator GetEnumerator()
{
return _subscriptions.GetEnumerator();
}
/// <summary>
/// Returns an enumerator that can iterate through a collection.
/// </summary>
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
public IEnumerator GetEnumerator()
{
return _subscriptions.GetEnumerator();
}
#endregion
#endregion
///////////////////////////////////////////////////////////////////////
#region IList Members
///////////////////////////////////////////////////////////////////////
#region IList Members
/// <summary>
/// Gets a value indicating whether the IList is read-only.
/// </summary>
public bool IsReadOnly => false;
/// <summary>
/// Gets a value indicating whether the IList is read-only.
/// </summary>
public bool IsReadOnly => false;
/// <summary>
/// Gets or sets the element at the specified index.
/// </summary>
object IList.this[int index]
{
get => _subscriptions[index];
{
get => _subscriptions[index];
set
{
if (!typeof(TsCDaSubscription).IsInstanceOfType(value))
{
throw new ArgumentException("May only add Subscription objects into the collection.");
}
{
if (!typeof(TsCDaSubscription).IsInstanceOfType(value))
{
throw new ArgumentException("May only add Subscription objects into the collection.");
}
_subscriptions[index] = value;
}
}
_subscriptions[index] = value;
}
}
/// <summary>
/// Removes the IList subscription at the specified index.
/// </summary>
/// <param name="index">The zero-based index of the subscription to remove.</param>
public void RemoveAt(int index)
{
_subscriptions.RemoveAt(index);
}
/// <summary>
/// Removes the IList subscription at the specified index.
/// </summary>
/// <param name="index">The zero-based index of the subscription to remove.</param>
public void RemoveAt(int index)
{
_subscriptions.RemoveAt(index);
}
/// <summary>
/// Inserts an subscription to the IList at the specified position.
/// </summary>
/// <param name="index">The zero-based index at which value should be inserted.</param>
/// <param name="value">The Object to insert into the IList. </param>
public void Insert(int index, object value)
{
if (!typeof(TsCDaSubscription).IsInstanceOfType(value))
{
throw new ArgumentException("May only add Subscription objects into the collection.");
}
/// <summary>
/// Inserts an subscription to the IList at the specified position.
/// </summary>
/// <param name="index">The zero-based index at which value should be inserted.</param>
/// <param name="value">The Object to insert into the IList. </param>
public void Insert(int index, object value)
{
if (!typeof(TsCDaSubscription).IsInstanceOfType(value))
{
throw new ArgumentException("May only add Subscription objects into the collection.");
}
_subscriptions.Insert(index, value);
}
_subscriptions.Insert(index, value);
}
/// <summary>
/// Removes the first occurrence of a specific object from the IList.
/// </summary>
/// <param name="value">The Object to remove from the IList.</param>
public void Remove(object value)
{
_subscriptions.Remove(value);
}
/// <summary>
/// Removes the first occurrence of a specific object from the IList.
/// </summary>
/// <param name="value">The Object to remove from the IList.</param>
public void Remove(object value)
{
_subscriptions.Remove(value);
}
/// <summary>
/// Determines whether the IList contains a specific value.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
public bool Contains(object value)
{
return _subscriptions.Contains(value);
}
/// <summary>
/// Determines whether the IList contains a specific value.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
public bool Contains(object value)
{
return _subscriptions.Contains(value);
}
/// <summary>
/// Removes all subscriptions from the IList.
/// </summary>
public void Clear()
{
_subscriptions.Clear();
}
/// <summary>
/// Removes all subscriptions from the IList.
/// </summary>
public void Clear()
{
_subscriptions.Clear();
}
/// <summary>
/// Determines the index of a specific subscription in the IList.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
public int IndexOf(object value)
{
return _subscriptions.IndexOf(value);
}
/// <summary>
/// Determines the index of a specific subscription in the IList.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
public int IndexOf(object value)
{
return _subscriptions.IndexOf(value);
}
/// <summary>
/// Adds an subscription to the IList.
/// </summary>
/// <param name="value">The Object to add to the IList. </param>
/// <returns>The position into which the new element was inserted.</returns>
public int Add(object value)
{
if (!typeof(TsCDaSubscription).IsInstanceOfType(value))
{
throw new ArgumentException("May only add Subscription objects into the collection.");
}
/// <summary>
/// Adds an subscription to the IList.
/// </summary>
/// <param name="value">The Object to add to the IList. </param>
/// <returns>The position into which the new element was inserted.</returns>
public int Add(object value)
{
if (!typeof(TsCDaSubscription).IsInstanceOfType(value))
{
throw new ArgumentException("May only add Subscription objects into the collection.");
}
return _subscriptions.Add(value);
}
return _subscriptions.Add(value);
}
/// <summary>
/// Indicates whether the IList has a fixed size.
/// </summary>
public bool IsFixedSize => false;
/// <summary>
/// Indicates whether the IList has a fixed size.
/// </summary>
public bool IsFixedSize => false;
/// <summary>
/// Inserts an subscription to the IList at the specified position.
@@ -268,49 +268,49 @@ namespace Technosoftware.DaAeHdaClient.Da
/// <param name="index">The zero-based index at which value should be inserted.</param>
/// <param name="value">The Object to insert into the IList. </param>
public void Insert(int index, TsCDaSubscription value)
{
Insert(index, (object)value);
}
{
Insert(index, (object)value);
}
/// <summary>
/// Removes the first occurrence of a specific object from the IList.
/// </summary>
/// <param name="value">The Object to remove from the IList.</param>
public void Remove(TsCDaSubscription value)
{
Remove((object)value);
}
/// <summary>
/// Removes the first occurrence of a specific object from the IList.
/// </summary>
/// <param name="value">The Object to remove from the IList.</param>
public void Remove(TsCDaSubscription value)
{
Remove((object)value);
}
/// <summary>
/// Determines whether the IList contains a specific value.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
public bool Contains(TsCDaSubscription value)
{
return Contains((object)value);
}
/// <summary>
/// Determines whether the IList contains a specific value.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
public bool Contains(TsCDaSubscription value)
{
return Contains((object)value);
}
/// <summary>
/// Determines the index of a specific subscription in the IList.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
public int IndexOf(TsCDaSubscription value)
{
return IndexOf((object)value);
}
/// <summary>
/// Determines the index of a specific subscription in the IList.
/// </summary>
/// <param name="value">The Object to locate in the IList.</param>
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
public int IndexOf(TsCDaSubscription value)
{
return IndexOf((object)value);
}
/// <summary>
/// Adds an subscription to the IList.
/// </summary>
/// <param name="value">The Object to add to the IList. </param>
/// <returns>The position into which the new element was inserted.</returns>
public int Add(TsCDaSubscription value)
{
return Add((object)value);
}
/// <summary>
/// Adds an subscription to the IList.
/// </summary>
/// <param name="value">The Object to add to the IList. </param>
/// <returns>The position into which the new element was inserted.</returns>
public int Add(TsCDaSubscription value)
{
return Add((object)value);
}
#endregion
}
#endregion
}
}

View File

@@ -26,45 +26,45 @@ using System;
namespace Technosoftware.DaAeHdaClient.Da
{
/// <summary>
/// Describes the state of a subscription.
/// </summary>
[Serializable]
public class TsCDaSubscriptionState : ICloneable
{
#region Fields
/// <summary>
/// Describes the state of a subscription.
/// </summary>
[Serializable]
public class TsCDaSubscriptionState : ICloneable
{
#region Fields
private bool active_ = true;
private int updateRate_ = 500;
private float deadband_;
private int updateRate_ = 500;
private float deadband_;
#endregion
#region Properties
#region Properties
/// <summary>
/// A unique name for the subscription controlled by the client.
/// </summary>
public string Name { get; set; }
/// A unique name for the subscription controlled by the client.
/// </summary>
public string Name { get; set; }
/// <summary>
/// A unique identifier for the subscription assigned by the client.
/// </summary>
public object ClientHandle { get; set; }
/// <summary>
/// A unique identifier for the subscription assigned by the client.
/// </summary>
public object ClientHandle { get; set; }
/// <summary>
/// A unique subscription identifier assigned by the server.
/// </summary>
public object ServerHandle { get; set; }
/// <summary>
/// A unique subscription identifier assigned by the server.
/// </summary>
public object ServerHandle { get; set; }
/// <summary>
/// The locale used for any error messages or results returned to the client.
/// </summary>
public string Locale { get; set; }
/// <summary>
/// The locale used for any error messages or results returned to the client.
/// </summary>
public string Locale { get; set; }
/// <summary>
/// Whether the subscription is scanning for updates to send to the client.
/// </summary>
public bool Active
{
get => active_;
/// <summary>
/// Whether the subscription is scanning for updates to send to the client.
/// </summary>
public bool Active
{
get => active_;
set => active_ = value;
}
@@ -82,8 +82,8 @@ namespace Technosoftware.DaAeHdaClient.Da
/// the fastest practical rate.
/// </remarks>
public int UpdateRate
{
get => updateRate_;
{
get => updateRate_;
set => updateRate_ = value;
}
@@ -114,59 +114,59 @@ namespace Technosoftware.DaAeHdaClient.Da
/// </remarks>
public int KeepAlive { get; set; }
/// <summary>
/// The minimum percentage change from 0.0 to 100.0 required to trigger a data update
/// for an item.
/// </summary>
/// <remarks>
/// <para>The range of the Deadband is from 0.0 to 100.0 Percent. Deadband will only
/// apply to items in the subscription that have a dwEUType of Analog available. If the
/// EU Type is Analog, then the EU Low and EU High values for the item can be used to
/// calculate the range for the item. This range will be multiplied with the Deadband
/// to generate an exception limit. An exception is determined as follows:</para>
/// <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
/// <para>Exception if (absolute value of (last cached value - current value) &gt;
/// (pPercentDeadband/100.0) * (EU High - EU Low) )</para>
/// </blockquote>
/// <para>The PercentDeadband can be set when CreateSubscription is called, allowing
/// the same PercentDeadband to be used for all items within that particular
/// subscription. However, with OPC DA 3.0, it is allowable to set the PercentDeadband
/// on a per item basis. This means that each item can potentially override the
/// PercentDeadband set for the subscription it resides within.</para>
/// <para>If the exception limit is exceeded, then the last cached value is updated
/// with the new value and a notification will be sent to the clients callback (if
/// any). The PercentDeadband is an optional behavior for the server. If the client
/// does not specify this value on a server that does support the behavior, the default
/// value of 0 (zero) will be assumed, and all value changes will update the CACHE.
/// Note that the timestamp will be updated regardless of whether the cached value is
/// updated. A server which does not support deadband should return an error
/// (OPC_E_DEADBANDNOTSUPPORTED) if the client requests a deadband other than
/// 0.0.</para>
/// <para>The UpdateRate for a subscription or the sampling rate of the item, if set,
/// determines time between when a value is checked to see if the exception limit has
/// been exceeded. The PercentDeadband is used to keep noisy signals from updating the
/// client unnecessarily.</para>
/// </remarks>
public float Deadband
{
get => deadband_;
/// <summary>
/// The minimum percentage change from 0.0 to 100.0 required to trigger a data update
/// for an item.
/// </summary>
/// <remarks>
/// <para>The range of the Deadband is from 0.0 to 100.0 Percent. Deadband will only
/// apply to items in the subscription that have a dwEUType of Analog available. If the
/// EU Type is Analog, then the EU Low and EU High values for the item can be used to
/// calculate the range for the item. This range will be multiplied with the Deadband
/// to generate an exception limit. An exception is determined as follows:</para>
/// <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
/// <para>Exception if (absolute value of (last cached value - current value) &gt;
/// (pPercentDeadband/100.0) * (EU High - EU Low) )</para>
/// </blockquote>
/// <para>The PercentDeadband can be set when CreateSubscription is called, allowing
/// the same PercentDeadband to be used for all items within that particular
/// subscription. However, with OPC DA 3.0, it is allowable to set the PercentDeadband
/// on a per item basis. This means that each item can potentially override the
/// PercentDeadband set for the subscription it resides within.</para>
/// <para>If the exception limit is exceeded, then the last cached value is updated
/// with the new value and a notification will be sent to the clients callback (if
/// any). The PercentDeadband is an optional behavior for the server. If the client
/// does not specify this value on a server that does support the behavior, the default
/// value of 0 (zero) will be assumed, and all value changes will update the CACHE.
/// Note that the timestamp will be updated regardless of whether the cached value is
/// updated. A server which does not support deadband should return an error
/// (OPC_E_DEADBANDNOTSUPPORTED) if the client requests a deadband other than
/// 0.0.</para>
/// <para>The UpdateRate for a subscription or the sampling rate of the item, if set,
/// determines time between when a value is checked to see if the exception limit has
/// been exceeded. The PercentDeadband is used to keep noisy signals from updating the
/// client unnecessarily.</para>
/// </remarks>
public float Deadband
{
get => deadband_;
set => deadband_ = value;
}
/// <summary>
/// TimeZone Bias of Group (in minutes).
/// </summary>
public int TimeBias { get; set; }
/// <summary>
/// TimeZone Bias of Group (in minutes).
/// </summary>
public int TimeBias { get; set; }
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a shallow copy of the object.
/// </summary>
public virtual object Clone()
{
return MemberwiseClone();
}
/// Creates a shallow copy of the object.
/// </summary>
public virtual object Clone()
{
return MemberwiseClone();
}
#endregion
}
}
}

View File

@@ -88,10 +88,10 @@ namespace Technosoftware.DaAeHdaClient.Hda
/// <param name="items">The set of items to read (must include the item name).</param>
/// <returns>A set of values, qualities and timestamps within the requested time range for each item.</returns>
TsCHdaItemValueCollection[] ReadRaw(
TsCHdaTime startTime,
TsCHdaTime endTime,
int maxValues,
bool includeBounds,
TsCHdaTime startTime,
TsCHdaTime endTime,
int maxValues,
bool includeBounds,
OpcItem[] items);
/// <summary>
@@ -167,10 +167,10 @@ namespace Technosoftware.DaAeHdaClient.Hda
/// <param name="items">The set of items to read (must include the item name).</param>
/// <returns>A set of values, qualities and timestamps within the requested time range for each item.</returns>
TsCHdaItemValueCollection[] ReadProcessed(
TsCHdaTime startTime,
TsCHdaTime endTime,
TsCHdaTime startTime,
TsCHdaTime endTime,
decimal resampleInterval,
TsCHdaItem[] items);
TsCHdaItem[] items);
/// <summary>
/// Sends an asynchronous request to read processed data from the historian database for a set of items.
@@ -270,9 +270,9 @@ namespace Technosoftware.DaAeHdaClient.Hda
/// <param name="items">The set of items to read (must include the item name).</param>
/// <returns>A set of values, qualities and timestamps within the requested time range for each item.</returns>
TsCHdaModifiedValueCollection[] ReadModified(
TsCHdaTime startTime,
TsCHdaTime endTime,
int maxValues,
TsCHdaTime startTime,
TsCHdaTime endTime,
int maxValues,
OpcItem[] items);
/// <summary>
@@ -304,10 +304,10 @@ namespace Technosoftware.DaAeHdaClient.Hda
/// <param name="attributeIDs">The attributes to read.</param>
/// <returns>A set of attribute values for each requested attribute.</returns>
TsCHdaItemAttributeCollection ReadAttributes(
TsCHdaTime startTime,
TsCHdaTime endTime,
TsCHdaTime startTime,
TsCHdaTime endTime,
OpcItem item,
int[] attributeIDs);
int[] attributeIDs);
/// <summary>
/// Sends an asynchronous request to read the attributes of an item.
@@ -337,8 +337,8 @@ namespace Technosoftware.DaAeHdaClient.Hda
/// <param name="items">The set of items to read (must include the item name).</param>
/// <returns>A set of annotations within the requested time range for each item.</returns>
TsCHdaAnnotationValueCollection[] ReadAnnotations(
TsCHdaTime startTime,
TsCHdaTime endTime,
TsCHdaTime startTime,
TsCHdaTime endTime,
OpcItem[] items);
/// <summary>
@@ -433,8 +433,8 @@ namespace Technosoftware.DaAeHdaClient.Hda
/// <param name="items">The set of items to delete (must include the item name).</param>
/// <returns>The results of the delete operation for each item.</returns>
OpcItemResult[] Delete(
TsCHdaTime startTime,
TsCHdaTime endTime,
TsCHdaTime startTime,
TsCHdaTime endTime,
OpcItem[] items);
/// <summary>

Some files were not shown because too many files have changed in this diff Show More