iotgateway/Plugins/Plugin/UAService.cs

40 lines
1.0 KiB
C#
Raw Normal View History

2021-12-23 08:22:03 +00:00
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
2021-12-23 08:22:03 +00:00
{
string applicationName = "ConsoleReferenceServer";
string configSectionName = "Quickstarts.ReferenceServer";
public UAServer<ReferenceServer> server = null;
2021-12-23 08:22:03 +00:00
public UAService()
2021-12-23 08:22:03 +00:00
{
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()
2021-12-23 08:22:03 +00:00
{
server.StopAsync().ConfigureAwait(false);
}
}
}