EasyUaClnt a simplicity wrapper library based on AsOpcUac

Hello Community,

I would like to share with you a library we developed in B&R Spain.

General information

The EasyUaClnt is a simplicity wrapper library based on AsOpcUac. Anyone who has tried to program a functionality (node read, node write, subscription…) with the AsOpcUac library knows that for each functionality, several function block (FUB) calls are required. The idea behind this library is to provide a clear interface to the user and encapsulate each functionality in one function block (FUB).

Minimum versions
Minimum version requirements are:

  • Automation Studio: 4.2
  • Automation Runtime: C4.25

The functionalities of this library exhibit no constraints when compared with the AsOpcUac library ones. It allows the user to perform the following actions in OPC UA as a client in a easier way:

  • Read
  • ReadList
  • ReadBluk
  • Write
  • WriteList
  • WriteBulk
  • Subscription
  • SubscriptionList
  • MethodCall
  • ConnectionGetStatus

Library help
The library has its own help that comes with samples for each of the functionalities listed before. From AS can be accessed by pressing F1 over the library.


EasyUaRead - Read an OPC UA node
In the following example is shown how an OPC UA node can be read from an OPC UA Server using just 1 FUB. To achieve the same result using AsOpcUac is necessary the usage of 6 FUBs.

  • AsOpcUac: UA_Connect → UA_GetNamespaceIndex → UA_NodeGetHandle → UA_Read → UA_NodeReleaseHandle → UA_Disconnect
  • EasyUaClint: EasyUaRead

The Controller 1 ( works as OPC UA Client and implements the function EasyUaRead from the library EasyUaClnt. The value of the variable read from the server is copied to the local variable “VarA” of the task “Read”.

The Controller 2 ( works as OPC UA Server. In the Controller 2 the name of the variable is “VarX” and it is a local variables of the task “ServerTask” and it is Enabled in the OPC UA Default View configuration.

Controller 1 code - Task Read

	EasyUaRead_0.ServerEndpointUrl := 'opc.tcp://';
	EasyUaRead_0.NodeID.NamespaceIndex := 6;
	EasyUaRead_0.NodeID.Identifier := '::ServerTask:VarX';
	EasyUaRead_0.NodeID.IdentifierType := UAIdentifierType_String;
	EasyUaRead_0.Variable := '::Read:VarA';


Execution of the FUB

Downloads and links

Last binary library version
EasyUaClnt V1.02.0: EasyUaClnt.zip (684.3 KB)

Source code repository
B&R GitHub source code repository: Source Code

Regards colleagues,



That’s great ! This could save a lot of our time.

1 Like

Thanks for the feedback Christoph Hilchenbach! The README is already added and the pull request will be done asap.

Hello @javier.novella !
Great job. I have problems opening the Help of the imported Library. There is no content. Any idea why?

Hi Filipe

This is probably a Windows Security thing, which can happen for CHM files which were downloaded from the internet. Try right-click on the CHM and open the properties. There should be some kind of unlock checkbox or button if I remember correctly.


It worked with your workaround! Thanks

Thanks for the tip Patrick! :slight_smile:

This link explains why opening chm files sometimes shows no contents:


Receiving this error when trying to utilize ‘EasyUaSubscriptionList’

Properties of EasyUaClnt Library shows version 1.02
And trying to import existing library only gives option for version 1.02, but compiler still produces same error.
(As a new user I can only include one image in my comment)

Here is screenshot on library property version

You have to deploy the EasyUaClnt library to the software configuration (together with some other libraries):

1 Like

Hi @javier.novella ,
thank you for this library, this currently makes my life much easier - communicating with an external (not B&R and not Pub/Sub capable) OPC/UA Server through standard OPC/UA Block Read & Write Requests.

We are using Block-Reads in a cyclic manner - there your default behaviour is not yet the one I needed, so I did a patch to your internal statemachine for a rapid prototype.
The prototype with the patch is working nicely at high frequency.

May I propose a small modification, that helps, when you really want to do a high frequency block read - without setting up the connection for every single Read Request.
If you are OK, I can propose that through a fork/pull-request


1 Like

Hello Thomas,

Thanks for your message and support! You can fork it for sure as we talked privately.

For your cyclic-reads I understand your use-case but I would recommend you to switch to Subscriptions.

Thanks in advance and best regards!