JinianNet.OpcUaClient 0.0.2

dotnet add package JinianNet.OpcUaClient --version 0.0.2                
NuGet\Install-Package JinianNet.OpcUaClient -Version 0.0.2                
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="JinianNet.OpcUaClient" Version="0.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JinianNet.OpcUaClient --version 0.0.2                
#r "nuget: JinianNet.OpcUaClient, 0.0.2"                
#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 JinianNet.OpcUaClient as a Cake Addin
#addin nuget:?package=JinianNet.OpcUaClient&version=0.0.2

// Install JinianNet.OpcUaClient as a Cake Tool
#tool nuget:?package=JinianNet.OpcUaClient&version=0.0.2                

OpcUaClient

Client for OPC UA Server

How to use

Install

dotnet add package JinianNet.OpcUaClient

Import

 using JinianNet.OpcClient;

Create a instance

 var client = new OpcUaClient("opc.tcp://localhost:52240");
 //Or
 var client2 = new UaClient("opc.tcp://localhost:52240", "admin", "password");

Create a session on the server

 client.Connect();
 or 
 await client.ConnectAsync();

Close session

 client.Disconnect();

Read a tag

 var data = client.ReadValue<int>("ns=1;s=Root_test1");
 //Or
 data = await client.ReadValueAsync<int>("ns=1;s=Root_test1");

Read multiple tags

var address = new List<String>
{
  "ns=1;s=Root_test1",
  "ns=1;s=Root_test2",
  "ns=1;s=Root_test3",
  "ns=1;s=Root_test4"
}

 var tags = client.ReadValue<int>(address);
 //Or
 tags await = client.ReadValueAsync<int>(address);
 
 foreach(var value in tags)
 {
    Console.WriteLine($"value: {value}"); 
 }

Write a tag

 client.WriteAsync("ns=1;s=Root_test1", 1);
 //Or
 await client.WriteNodeAsync("ns=1;s=Root_test1", 1);

Write multiple tags

var tags = new List<string>
{
  "ns=1;s=Root_test1",
  "ns=1;s=Root_test2",
  "ns=1;s=Root_test3",
  "ns=1;s=Root_test4"
};

var values = new List<object>
{
  1,
  2,
  3,
  4
};
client.WriteNodes(tags,values);

Monitoring tag

 client.Register("group1", new string[]{  "ns=1;s=Root_test1", "ns=1;s=Root_test2" }, (arr) => {
    foreach (var node in arr)
    {
        Console.WriteLine(node.Value.ToString());
    }
 });

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
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
0.0.2 94 10/17/2024
0.0.1 99 10/12/2024