OPCUA.Library
11.0.2
dotnet add package OPCUA.Library --version 11.0.2
NuGet\Install-Package OPCUA.Library -Version 11.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="OPCUA.Library" Version="11.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OPCUA.Library --version 11.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: OPCUA.Library, 11.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 OPCUA.Library as a Cake Addin #addin nuget:?package=OPCUA.Library&version=11.0.2 // Install OPCUA.Library as a Cake Tool #tool nuget:?package=OPCUA.Library&version=11.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Client configuration
public string ApplicationName { get; set; } = "XserverIoT.OPCUAClient";
public int SessionTimeout { get; set; } = 60000;
public int OperationTimeout { get; set; } = 60000;
public int DisconnectTimeout { get; set; } = 10000;
public int ReconnectTimeout { get; set; } = 10000;
public int ReadAttempt { get; set; } = 3;
public int ReadDelay { get; set; } = 1000;
/// OPCUA server address
public string ServerAddress { get; set; }
public string CertificateFilePath { get; set; }
/// Set UserIdentity Configuration
public UserIdentity UserIdentityConfiguration { get; set; } = new UserIdentity();
/// Set ServerEndpoint Configuration
public ServerEndpoint ServerEndpointConfiguration { get; set; } = new ServerEndpoint();
Read the values of several Nodes
public async Task<ReadResult> ReadValues (List<OPCReadNode> ReadNodes)
Write the values of several Nodes
public async Task<WriteResult> WriteValues(List<OPCWriteNode> WriteNodes)
Establishes a connection to the OPC UA server
public Result Connect()
Closes an activated session and terminates the connection to the server
public Result Disconnect()
Example
OPCUAClient OPCUAClient = new OPCUAClient();
private async void Button_Click_4(object sender, RoutedEventArgs e)
{
if (OPCUAClient.Connected == true)
{
return;
}
var certificateFile = await Package.Current.InstalledLocation.GetFileAsync(@"Assets\Client.Uwp.pfx");
OPCUAClient.CertificateFilePath = certificateFile.Path;
OPCUAClient.ServerAddress = "opc.tcp://localhost:53530/OPCUA/SimulationServer";
var res = OPCUAClient.Connect();
}
private void Button_Click_5(object sender, RoutedEventArgs e)
{
var res = OPCUAClient.Disconnect();
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
List<OPCReadNode> OPCNodes = new List<OPCReadNode>();
OPCReadNode onenode = new OPCReadNode();
onenode.Name = "Counter";
onenode.NodeId = "ns=3;s=Counter";
OPCNodes.Add(onenode);
var result = await OPCUAClient.ReadValues(OPCNodes);
}
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
List<OPCWriteNode> OPCNodes = new List<OPCWriteNode>();
OPCWriteNode onenode = new OPCWriteNode();
onenode.Name = "Test2";
onenode.NodeId = "ns=3;s=Test2";
onenode.Value = (double)DateTime.Now.Second;
OPCNodes.Add(onenode);
var result = await OPCUAClient.WriteValues(OPCNodes);
}
Set Authentication
Usernames and Password:
private async void Button_Click_4(object sender, RoutedEventArgs e)
{
var certificateFile = await Package.Current.InstalledLocation.GetFileAsync(@"Assets\Client.Uwp.pfx");
OPCUAClient.CertificateFilePath = certificateFile.Path;
OPCUAClient.ServerAddress = "opc.tcp://localhost:53530/OPCUA/SimulationServer";
//Set Authentication
OPCUAClient.UserIdentityConfiguration.UserIdentityType = UserIdentityType.UsernamePassword;
OPCUAClient.UserIdentityConfiguration.Username = "user";
OPCUAClient.UserIdentityConfiguration.Password = "user";
var res = OPCUAClient.Connect();
}
Set Endpoint Configuration
private async void Button_Click(object sender, RoutedEventArgs e)
{
var certificateFile = await Package.Current.InstalledLocation.GetFileAsync(@"Assets\Client.Uwp.pfx");
OPCUAClient.CertificateFilePath = certificateFile.Path;
OPCUAClient.ServerAddress = "opc.tcp://localhost:53530/OPCUA/SimulationServer";
//Set Authentication
OPCUAClient.UserIdentityConfiguration.UserIdentityType = UserIdentityType.UsernamePassword;
OPCUAClient.UserIdentityConfiguration.Username = "user";
OPCUAClient.UserIdentityConfiguration.Password = "user";
//Set Endpoint Configuration
OPCUAClient.ServerEndpointConfiguration.UseHighLevelEndpoint = true;
OPCUAClient.ServerEndpointConfiguration.UseOnlySecureEndpoints = true;
EndpointPolicy Policy = new EndpointPolicy();
Policy.OpcSecurityMode = OPCUA.Library.OpcSecurityMode.None;
Policy.OpcSecurityAlgorithm = OPCUA.Library.OpcSecurityAlgorithm.Basic256;
OPCUAClient.ServerEndpointConfiguration.OpcSecurityPolicy = Policy;
var res = OPCUAClient.Connect();
}
General configuration
private async void Button_Click(object sender, RoutedEventArgs e)
{
var certificateFile = await Package.Current.InstalledLocation.GetFileAsync(@"Assets\Client.Uwp.pfx");
OPCUAClient.CertificateFilePath = certificateFile.Path;
OPCUAClient.ServerAddress = "opc.tcp://localhost:53530/OPCUA/SimulationServer";
//Set Authentication
OPCUAClient.UserIdentityConfiguration.UserIdentityType = UserIdentityType.UsernamePassword;
OPCUAClient.UserIdentityConfiguration.Username = "user";
OPCUAClient.UserIdentityConfiguration.Password = "user";
//General Configuration
OPCUAClient.ApplicationName = "My App";
OPCUAClient.SessionTimeout = 20000;
OPCUAClient.OperationTimeout = 30000;
OPCUAClient.DisconnectTimeout =5000;
OPCUAClient.ReconnectTimeout = 6000;
var res = OPCUAClient.Connect();
}
Product | Versions 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 was computed. 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.
-
.NETStandard 2.0
- Opc.UaFx.Client (>= 2.41.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.