OPC.UA.Api.Helper/ClientDiscovery.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections;

using Opc.Ua;
using Opc.Ua.Client;

namespace Siemens.OpcUA
{
    public class Discovery
    {
        #region Construction
        public Discovery()
        {
        }
        #endregion

        #region Public Interfaces
        /// <summary>
        /// Returns a list of OPC UA servers.
        /// </summary>
        /// <param name="discoveryUrl">The discovery URL.</param>
        /// <param name="servers">The servers being found.</param>
        public void FindServers(Uri discoveryUrl, ref ApplicationDescriptionCollection servers)
        {
            try
            {
                // Create Discovery Client.
                DiscoveryClient client = DiscoveryClient.Create(discoveryUrl);

                // Look for servers.
                servers = client.FindServers(null);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        /// <summary>
        /// Returns a list of endpoints for a server.
        /// </summary>
        /// <param name="discoveryUrl">The discovery URL.</param>
        /// <param name="endpoints">The according endpoints.</param>
        public void GetEndpoints(Uri discoveryUrl, ref EndpointDescriptionCollection endpoints)
        {
            try
            {
                // Create Discovery Client.
                DiscoveryClient client = DiscoveryClient.Create(discoveryUrl);

                // Get endpoints.
                endpoints = client.GetEndpoints(null);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        #endregion
    }
后面还有 1 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。