|
|
@@ -2,7 +2,6 @@
|
|
|
using Opc.Ua.Client;
|
|
|
using Opc.Ua.Configuration;
|
|
|
using System.Collections.Concurrent;
|
|
|
-using System.Reflection.Metadata;
|
|
|
using System.Security.Cryptography.X509Certificates;
|
|
|
using YSAI.Core.data;
|
|
|
using YSAI.Core.@enum;
|
|
|
@@ -11,7 +10,6 @@ using YSAI.Core.virtualAddress;
|
|
|
using YSAI.Log;
|
|
|
using YSAI.Opc.ua.client.unility;
|
|
|
using YSAI.Unility;
|
|
|
-using static Opc.Ua.Client.SessionReconnectHandler;
|
|
|
using static YSAI.Opc.ua.client.OpcUaClientData;
|
|
|
|
|
|
namespace YSAI.Opc.ua.client
|
|
|
@@ -948,7 +946,7 @@ namespace YSAI.Opc.ua.client
|
|
|
subscription.DisplayName = Tag; //订阅的显示名称
|
|
|
subscription.TimestampsToReturn = TimestampsToReturn.Both; //与通知消息一起返回的时间戳
|
|
|
subscription.StateChanged += delegate (Subscription subscription, SubscriptionStateChangedEventArgs e) { Subscription_StateChanged(subscription, e, Tag); }; //订阅状态
|
|
|
-
|
|
|
+
|
|
|
//监控项集合
|
|
|
List<MonitoredItem> monitoredItems = new List<MonitoredItem>();
|
|
|
|
|
|
@@ -1281,7 +1279,7 @@ namespace YSAI.Opc.ua.client
|
|
|
throw new Exception(string.Format("证书验证错误:{0},{1}", eventArgs.Error.Code, eventArgs.Error.AdditionalInfo));
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
//用配置的当前状态更新验证器。
|
|
|
certificateValidator.Update(new SecurityConfiguration
|
|
|
{
|
|
|
@@ -1354,7 +1352,7 @@ namespace YSAI.Opc.ua.client
|
|
|
endpoint.Update(endpointDescription);
|
|
|
|
|
|
//通过调用CreateSession服务创建与服务器的新通信会话
|
|
|
- clientSession = Session.Create(AC, endpoint, true, false,$"{AC.ApplicationName}.{Guid.NewGuid().ToNString()}", (uint)basics.Timeout, UserIdentity, new string[] { }).WaitAsync(new TimeSpan(0, 0, 0, 0, basics.Timeout)).Result;
|
|
|
+ clientSession = Session.Create(AC, endpoint, true, false, $"{AC.ApplicationName}.{Guid.NewGuid().ToNString()}", (uint)basics.Timeout, UserIdentity, new string[] { }).WaitAsync(new TimeSpan(0, 0, 0, 0, basics.Timeout)).Result;
|
|
|
|
|
|
//当会话关闭,则关闭订阅
|
|
|
clientSession.DeleteSubscriptionsOnClose = true;
|