OpcDaNetCore 2.0.0

dotnet add package OpcDaNetCore --version 2.0.0                
NuGet\Install-Package OpcDaNetCore -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OpcDaNetCore" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OpcDaNetCore --version 2.0.0                
#r "nuget: OpcDaNetCore, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install OpcDaNetCore as a Cake Addin
#addin nuget:?package=OpcDaNetCore&version=2.0.0

// Install OpcDaNetCore as a Cake Tool
#tool nuget:?package=OpcDaNetCore&version=2.0.0                

Opc Da for .NET

This package allows you to use the OPC DA protocol in .Net applications.

NOTE: The OPC DA is only supported in Windows platforms.

Installation

You can install this package with command:

dotnet add package OpcDaNetCore

Use

Find servers

You can find available servers by specifying the ip address:

var servers = await BrowseOpcDaServers.BrowseServersAsync("localhost");

Build a Service

You can build an OPC DA service using the selected server from previous method:

ServerHost host = servers.FirstOrDefault();
using var server = await new OpcDaFactory()
    .WithServer(host)
    .BuildAsync();

Or you can add server specifications manually:

using var server = await new OpcDaFactory()
    .WithIp("localhost")
    .WithServerName("Kepware.KEPServerEX.V5")
    .BuildAsync();

You can browse nodes:

var browse = await server.BrowseNodeAsync(null);

foreach (var browseElement in browse)
{
    Console.WriteLine($"{browseElement.Name}; {browseElement.Id}; Has children: {browseElement.HasChildren}");
}

var node = browse.FirstOrDefault()?.Id;

browse = await server.BrowseNodeAsync(node);

foreach (var browseElement in browse)
{
    Console.WriteLine($"{browseElement.Name}; {browseElement.Id}; Has children: {browseElement.HasChildren}");
}

You can add items to a group. If the group does not exists, then will be created:

server.AddItems("Group 1", "Simulation Examples.Functions.Ramp2", "Simulation Examples.Functions.Ramp3");

You can remove items from a group:

server.RemoveItems("Group 1", "Simulation Examples.Functions.Ramp2", "Simulation Examples.Functions.Ramp3");

You can read all items in a group:

var read = server.Read("Group 1");

foreach (var readElement in read)
{
    Console.WriteLine($"{readElement.ItemName} - {readElement.Value}");
}

Or read specific items. In this method you can read any item available in the server, not just items from a specific group, but must specify a group:

var readAny = server.Read("Group 1", "Simulation Examples.Functions.Ramp1", "Simulation Examples.Functions.Sine1");

foreach (var readElement in readAny)
{
    Console.WriteLine($"{readElement.ItemName} - {readElement.Value}");
}

You can write into tags:

var valueToWrite1 = new ItemDataValue("Channel1.Device1.Tag2", 125);
var valueToWrite2 = new ItemDataValue("Channel1.Device1.Tag3", 126);
server.Write("Group 1",valueToWrite1, valueToWrite2);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 1,096 11/18/2023
1.0.2 227 8/19/2023
1.0.1 159 8/19/2023
1.0.0 152 8/18/2023