mirror of
https://gitee.com/iioter/iotgateway.git
synced 2024-12-02 03:38:01 +08:00
40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using Microsoft.Extensions.Hosting;
|
|
using Opc.Ua;
|
|
using Quickstarts;
|
|
using Quickstarts.ReferenceServer;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Plugin
|
|
{
|
|
public class UAService :IDisposable
|
|
{
|
|
string applicationName = "ConsoleReferenceServer";
|
|
string configSectionName = "Quickstarts.ReferenceServer";
|
|
|
|
public UAServer<ReferenceServer> server = null;
|
|
|
|
public UAService()
|
|
{
|
|
server = new UAServer<ReferenceServer>(null)
|
|
{
|
|
AutoAccept = false,
|
|
Password = null
|
|
};
|
|
|
|
server.LoadAsync(applicationName, configSectionName).ConfigureAwait(false);
|
|
server.CheckCertificateAsync(false).ConfigureAwait(false);
|
|
server.StartAsync().ConfigureAwait(false);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
server.StopAsync().ConfigureAwait(false);
|
|
}
|
|
}
|
|
}
|