Clean
This commit is contained in:
@@ -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.
|
||||
@@ -48,13 +48,13 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
/// Initializes a browse position
|
||||
/// </summary>
|
||||
internal BrowsePosition(
|
||||
OpcItem itemID,
|
||||
TsCDaBrowseFilters filters,
|
||||
string continuationPoint)
|
||||
OpcItem itemID,
|
||||
TsCDaBrowseFilters filters,
|
||||
string continuationPoint)
|
||||
:
|
||||
base(itemID, filters)
|
||||
{
|
||||
ContinuationPoint = continuationPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -32,77 +32,77 @@ namespace Technosoftware.DaAeHdaClient.Com
|
||||
/// Defines all well known COM DA HRESULT codes.
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -166,7 +163,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
|
||||
// invoke COM method.
|
||||
try
|
||||
{
|
||||
{
|
||||
var server = BeginComCall<IOPCServer>(methodName, true);
|
||||
|
||||
(server).GetErrorString(
|
||||
@@ -188,7 +185,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
}
|
||||
finally
|
||||
{
|
||||
EndComCall(methodName);
|
||||
EndComCall(methodName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,7 +234,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
|
||||
// invoke COM method.
|
||||
try
|
||||
{
|
||||
{
|
||||
var server = BeginComCall<IOPCServer>(methodName, true);
|
||||
(server).GetStatus(out pStatus);
|
||||
|
||||
@@ -292,10 +289,10 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
var pQualities = IntPtr.Zero;
|
||||
var pTimestamps = IntPtr.Zero;
|
||||
var pErrors = IntPtr.Zero;
|
||||
|
||||
|
||||
// invoke COM method.
|
||||
try
|
||||
{
|
||||
{
|
||||
var server = BeginComCall<IOPCItemIO>(methodName, true);
|
||||
server.Read(
|
||||
count,
|
||||
@@ -424,7 +421,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
|
||||
// invoke COM method.
|
||||
try
|
||||
{
|
||||
{
|
||||
var server = BeginComCall<IOPCItemIO>(methodName, true);
|
||||
server.WriteVQT(
|
||||
count,
|
||||
@@ -500,7 +497,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
var revisedUpdateRate = 0;
|
||||
|
||||
var hDeadband = GCHandle.Alloc(result.Deadband, GCHandleType.Pinned);
|
||||
|
||||
|
||||
// invoke COM method.
|
||||
try
|
||||
{
|
||||
@@ -538,12 +535,12 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
}
|
||||
|
||||
if (group == null) throw new OpcResultException(OpcResult.E_FAIL, "The subscription was not created.");
|
||||
|
||||
|
||||
methodName = "IOPCGroupStateMgt2.SetKeepAlive";
|
||||
|
||||
// set the keep alive rate if requested.
|
||||
try
|
||||
{
|
||||
{
|
||||
var keepAlive = 0;
|
||||
var comObject = BeginComCall<IOPCGroupStateMgt2>(group, methodName, true);
|
||||
comObject.SetKeepAlive(result.KeepAlive, out keepAlive);
|
||||
@@ -562,9 +559,9 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
}
|
||||
finally
|
||||
{
|
||||
EndComCall(methodName);
|
||||
EndComCall(methodName);
|
||||
}
|
||||
|
||||
|
||||
// save server handle.
|
||||
result.ServerHandle = serverHandle;
|
||||
|
||||
@@ -619,7 +616,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
|
||||
// invoke COM method.
|
||||
try
|
||||
{
|
||||
{
|
||||
var server = BeginComCall<IOPCServer>(methodName, true);
|
||||
server.RemoveGroup((int)state.ServerHandle, 0);
|
||||
|
||||
@@ -635,7 +632,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
}
|
||||
finally
|
||||
{
|
||||
EndComCall(methodName);
|
||||
EndComCall(methodName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -670,7 +667,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
|
||||
// invoke COM method.
|
||||
try
|
||||
{
|
||||
{
|
||||
var server = BeginComCall<IOPCBrowse>(methodName, true);
|
||||
server.Browse(
|
||||
(itemId != null && itemId.ItemName != null) ? itemId.ItemName : "",
|
||||
@@ -699,7 +696,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
}
|
||||
finally
|
||||
{
|
||||
EndComCall(methodName);
|
||||
EndComCall(methodName);
|
||||
}
|
||||
|
||||
// unmarshal results.
|
||||
@@ -760,7 +757,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
|
||||
// invoke COM method.
|
||||
try
|
||||
{
|
||||
{
|
||||
var server = BeginComCall<IOPCBrowse>(methodName, true);
|
||||
server.Browse(
|
||||
(itemID != null && itemID.ItemName != null) ? itemID.ItemName : "",
|
||||
@@ -789,7 +786,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
}
|
||||
finally
|
||||
{
|
||||
EndComCall(methodName);
|
||||
EndComCall(methodName);
|
||||
}
|
||||
|
||||
// unmarshal results.
|
||||
@@ -842,7 +839,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
|
||||
// invoke COM method.
|
||||
try
|
||||
{
|
||||
{
|
||||
var server = BeginComCall<IOPCBrowse>(methodName, true);
|
||||
server.GetProperties(
|
||||
itemIds.Length,
|
||||
@@ -863,8 +860,8 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
throw Technosoftware.DaAeHdaClient.Com.Interop.CreateException(methodName, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
EndComCall(methodName);
|
||||
{
|
||||
EndComCall(methodName);
|
||||
}
|
||||
|
||||
// unmarshal results.
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
var localeID = 0;
|
||||
var clientHandle = 0;
|
||||
var serverHandle = 0;
|
||||
|
||||
|
||||
var subscription = BeginComCall<IOPCGroupStateMgt>(methodName, true);
|
||||
subscription.GetState(
|
||||
out updateRate,
|
||||
@@ -289,7 +289,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
{
|
||||
methodName = "IOPCGroupStateMgt2.GetKeepAlive";
|
||||
try
|
||||
{
|
||||
{
|
||||
var keepAlive = 0;
|
||||
var subscription = BeginComCall<IOPCGroupStateMgt2>(methodName, true);
|
||||
subscription.GetKeepAlive(out keepAlive);
|
||||
@@ -328,7 +328,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
if (subscription_ == null) throw new NotConnectedException();
|
||||
|
||||
lock (lock_)
|
||||
{
|
||||
{
|
||||
var methodName = "IOPCGroupStateMgt.SetName";
|
||||
// update the subscription name.
|
||||
if ((masks & (int)TsCDaStateMask.Name) != 0 && state.Name != name_)
|
||||
@@ -378,7 +378,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
|
||||
methodName = "IOPCGroupStateMgt.SetState";
|
||||
try
|
||||
{
|
||||
{
|
||||
var subscription = BeginComCall<IOPCGroupStateMgt>(methodName, true);
|
||||
subscription.SetState(
|
||||
((masks & (int)TsCDaStateMask.UpdateRate) != 0) ? hUpdateRate.AddrOfPinnedObject() : IntPtr.Zero,
|
||||
@@ -415,7 +415,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
|
||||
methodName = "IOPCGroupStateMgt2.SetKeepAlive";
|
||||
try
|
||||
{
|
||||
{
|
||||
var subscription = BeginComCall<IOPCGroupStateMgt2>(methodName, true);
|
||||
subscription.SetKeepAlive(state.KeepAlive, out keepAlive);
|
||||
|
||||
@@ -477,7 +477,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
|
||||
var methodName = "IOPCItemMgt.AddItems";
|
||||
try
|
||||
{
|
||||
{
|
||||
var subscription = BeginComCall<IOPCItemMgt>(methodName, true);
|
||||
subscription.AddItems(
|
||||
count,
|
||||
@@ -647,7 +647,7 @@ namespace Technosoftware.DaAeHdaClient.Com.Da
|
||||
|
||||
var methodName = "IOPCItemMgt.RemoveItems";
|
||||
try
|
||||
{
|
||||
{
|
||||
var subscription = BeginComCall<IOPCItemMgt>(methodName, true);
|
||||
subscription.RemoveItems(itemIDs.Length, serverHandles, out pErrors);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user