From f8d23dcf8d6501482db1a5180325194232afe96c Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期五, 18 七月 2025 17:30:09 +0800 Subject: [PATCH] 封装部分业务代码,继续优化日志打印流程 --- device/OpcUaHelper.cs | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/device/OpcUaHelper.cs b/device/OpcUaHelper.cs index 555fea1..106acb9 100644 --- a/device/OpcUaHelper.cs +++ b/device/OpcUaHelper.cs @@ -22,7 +22,7 @@ { try { - // 鍒涘缓涓�釜搴旂敤閰嶇疆瀵硅薄锛岀敤浜庤缃簲鐢ㄥ悕绉般�鍞竴鏍囪瘑銆佺被鍨嬨�璇佷功鍜屽畨鍏ㄧ瓥鐣�+ // 鍒涘缓涓�釜搴旂敤閰嶇疆瀵硅薄,鐢ㄤ簬璁剧疆搴旂敤鍚嶇О,鍞竴鏍囪瘑,绫诲瀷,璇佷功鍜屽畨鍏ㄧ瓥鐣� var config = new ApplicationConfiguration() { ApplicationName = "MyClient", @@ -48,18 +48,18 @@ // 楠岃瘉搴旂敤閰嶇疆瀵硅薄 await config.Validate(ApplicationType.Client); - // 璁剧疆璇佷功楠岃瘉浜嬩欢锛岀敤浜庤嚜鍔ㄦ帴鍙椾笉鍙椾俊浠荤殑璇佷功 + // 璁剧疆璇佷功楠岃瘉浜嬩欢,鐢ㄤ簬鑷姩鎺ュ彈涓嶅彈淇′换鐨勮瘉涔� if (config.SecurityConfiguration.AutoAcceptUntrustedCertificates) { config.CertificateValidator.CertificateValidation += (s, e) => { e.Accept = (e.Error.StatusCode == StatusCodes.BadCertificateUntrusted); }; } - // 鍒涘缓涓�釜搴旂敤瀹炰緥瀵硅薄锛岀敤浜庢鏌ヨ瘉涔�+ // 鍒涘缓涓�釜搴旂敤瀹炰緥瀵硅薄,鐢ㄤ簬妫�煡璇佷功 var application = new ApplicationInstance(config); // 妫�煡搴旂敤瀹炰緥瀵硅薄鐨勮瘉涔� bool check = await application.CheckApplicationInstanceCertificate(false, 2048); - // 鍒涘缓涓�釜浼氳瘽瀵硅薄锛岀敤浜庤繛鎺ュ埌 OPC UA 鏈嶅姟鍣�+ // 鍒涘缓涓�釜浼氳瘽瀵硅薄,鐢ㄤ簬杩炴帴鍒�OPC UA 鏈嶅姟鍣� EndpointDescription endpointDescription = CoreClientUtils.SelectEndpoint("opc.tcp://172.16.57.41:4840", true); EndpointConfiguration endpointConfiguration = EndpointConfiguration.Create(config); ConfiguredEndpoint endpoint = new ConfiguredEndpoint(null, endpointDescription, endpointConfiguration); -- Gitblit v1.9.1