45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
using EonaCat.Connections.OpcUa.Infrastructure;
|
|
using EonaCat.Connections.OpcUa.Models;
|
|
using Opc.Ua;
|
|
using Opc.Ua.Server;
|
|
|
|
namespace EonaCat.Connections.OpcUa.Server;
|
|
|
|
internal sealed class EonaCatOpcUaServer : StandardServer
|
|
{
|
|
private readonly string _namespaceUri;
|
|
private readonly IReadOnlyCollection<OpcUaNodeDefinition> _nodes;
|
|
private readonly IReadOnlyCollection<OpcUaMethodDefinition> _methods;
|
|
|
|
public EonaCatOpcUaServer(
|
|
string namespaceUri,
|
|
IReadOnlyCollection<OpcUaNodeDefinition> nodes,
|
|
IReadOnlyCollection<OpcUaMethodDefinition> methods)
|
|
: base(OpcUaRuntime.Telemetry)
|
|
{
|
|
_namespaceUri = namespaceUri;
|
|
_nodes = nodes;
|
|
_methods = methods;
|
|
}
|
|
|
|
public OpcUaAddressSpace? AddressSpace { get; private set; }
|
|
|
|
protected override MasterNodeManager CreateMasterNodeManager(
|
|
IServerInternal server,
|
|
ApplicationConfiguration configuration)
|
|
{
|
|
AddressSpace = new OpcUaAddressSpace(server, configuration, _namespaceUri, _nodes, _methods);
|
|
return new MasterNodeManager(server, configuration, null, AddressSpace);
|
|
}
|
|
|
|
protected override ServerProperties LoadServerProperties() => new()
|
|
{
|
|
ManufacturerName = "EonaCat",
|
|
ProductName = "EonaCat Generic OPC UA Server",
|
|
ProductUri = "urn:EonaCat:Connector:OpcUa",
|
|
SoftwareVersion = Utils.GetAssemblySoftwareVersion(),
|
|
BuildNumber = Utils.GetAssemblyBuildNumber(),
|
|
BuildDate = Utils.GetAssemblyTimestamp()
|
|
};
|
|
}
|