Overview¶
ASNeG OPC UA Stack is not only an open source implementation of OPC UA protocol in C++. It is a framework that provides tools to create, develop, test and distribute OPC UA applications. This document describes the most important components and features of the stack.
Structure of ASNeG OPC UA Stack¶
The stack contains the following components:
- C++ Client\Server SDK
- Application Server
- Development Tools
C++ Client\Server SDK is an implementation OPC UA client server in C++. The SDK provides API to write your own OPC UA server and client applications and you can use it without the rest of the stack.
Application Server provides an Application API which automates many of typical for an OPC UA application operations. Moreover, it has an Application Manager. It loads the user applications as shared libraries (.so, .dll) and runs them. You can learn more about below
Development Tools is a set of scripts and programs that automate creating, building and distributing OPC UA applications.
Project Builder creates a template of a CMake project that contains everything to start developing an application from scratch.
Build Scripts are scripts that build the created by Project Builder project and package it into DEB, RPM or MSI packages for distribution. Also, the scripts provide standalone packaging, when they include the whole stack with dependencies in the package so that the application can run without the stack.
Type Generator generates C++ classes from OPC UA types described in XML Node Set by OPC UA Modeler. With Type Generator users can describe their data as objects and implement the business logic in C++. Then they can make instances of the types without registering their variables in Information Model.
CLI OPC UA Client is a simple console program which you can use to test your applications.
Application Server¶
Using Application Server a developer doesn’t need to implement the communication part of the OPC server and can focus on the domain logic of the user application.
A user application contains an Application Model and an Application Library.
The Application Model describes in XML how the application data is available in Information Model for the OPC UA client. It contains information about types, Variables, Methods and References between the Nodes. The Application Server loads the Application Model in the format specified by OPC UA Standard so that the developer can write it by using ASNeG OPC UA Designer or any other GUI tools.
The Application Library implements the business logic of the user application in C++. The Application Server provides an Application API. The user application can use it to access to Information Model, subscribe notifications about the actions of the client (e.g., read\write operations, authentication), implement a Method, fire an Event and so on.
Since a user application is developed by using C++ Client\Server SDK, it can use its client part to exchange data with other OPC UA servers in the network.
Development Process¶
We have already described the main components of the stack. In this section we’ll show how they are used to develop a user application.
At first we have to create a CMake project from a template with Project Builder. The project has empty Application Library’s classes, configuration files and Build Scripts.
The next step is to create Application Model manually or with a GUI tool (for example, ASNeG OPC UA Designer). In Application Model we can describe some domain specific types and generate C++ classes from it by using Type Generator.
Then we implement the domain logic and build Application Library with Build Scripts. The application can be installed locally or run in Docker container to test and debug it.
Finally we can use Build Scripts to package our application into MSI, DEB or RPM packages to distribute it on other machines.
OPC UA Specification Coverage¶
Before using the stack in your project, pay attention to the OPC UA services which the stack supports. If you doesn’t find that you need in the tables below, feel free to make an issue on Github and we’ll make our best to add it.
Client Library:
Service Set | Function | OPC UA Interface | Value Based Interface | ||
---|---|---|---|---|---|
Sync | Async | Sync | Async | ||
Discover | Find Server | ||||
Get Endpoints | ✓ | ✓ | |||
Register Server | |||||
Secure | Open Secure Channel | ✓ | ✓ | ✓ | ✓ |
Close Secure Channel | ✓ | ✓ | ✓ | ✓ | |
Session | Create Session | ✓ | ✓ | ✓ | ✓ |
Activate Session | ✓ | ✓ | ✓ | ✓ | |
Close Session | ✓ | ✓ | ✓ | ✓ | |
Cancel Session | ✓ | ✓ | |||
Node Management | Add Nodes | ✓ | ✓ | ||
Add References | ✓ | ✓ | |||
Delete Nodes | ✓ | ✓ | |||
Delete References | ✓ | ✓ | |||
View | Browse | ✓ | ✓ | ||
Browse Next | ✓ | ✓ | |||
Translate Browse Paths | ✓ | ✓ | |||
Register Nodes | |||||
Unregister Nodes | |||||
Query | Query First | ✓ | ✓ | ||
Query Next | ✓ | ✓ | |||
Attribute | Read | ✓ | ✓ | ✓ | ✓ |
History Read | ✓ | ✓ | |||
Write | ✓ | ✓ | ✓ | ✓ | |
History Update | ✓ | ✓ | |||
Method | Call | ✓ | ✓ | ||
Monitored Item | Create Monitored Items | ✓ | ✓ | ✓ | ✓ |
Modify Monitored Items | ✓ | ✓ | |||
Set Monitoring Mode | ✓ | ✓ | |||
Set Triggering | ✓ | ✓ | |||
Delete Monitored Items | ✓ | ✓ | ✓ | ✓ | |
Subscription | Create Subscription | ✓ | ✓ | ✓ | ✓ |
Modify Subscription | ✓ | ✓ | |||
Publish/Set | ✓ | ✓ | ✓ | ✓ | |
Republish | |||||
Transfer Subscription | |||||
Delete Subscription | ✓ | ✓ | ✓ | ✓ |
Columns:
- OPC UA Interface contains the OPC UA interface with full functionality. To use the interface OPC UA skills are necessary
- Value Based Interface contains a value based interface with limited functionality. To use the interface OPC UA skills are not necessary
Server Library:
Service Set | Function | Information Model | Appl Interface | |
---|---|---|---|---|
Sync | Async | |||
Discover | Find Server | |||
Get Endpoints | ✓ | |||
Register Server | ||||
Secure | Open Secure Channel | ✓ | ||
Close Secure Channel | ✓ | |||
Session | Create Session | ✓ | ||
Activate Session | ✓ | |||
Close Session | ✓ | |||
Cancel Session | ||||
Node Management | Add Nodes | |||
Add References | ||||
Delete Nodes | ||||
Delete References | ||||
View | Browse | ✓ | ||
Browse Next | ✓ | |||
Translate Browse Paths | ||||
Register Nodes | ||||
Unregister Nodes | ||||
Query | Query First | |||
Query Next | ||||
Attribute | Read | ✓ | ✓ | ✓ |
History Read | ✓ | ✓ | ||
Write | ✓ | ✓ | ✓ | |
History Update | ||||
Method | Call | ✓ | ✓ | ✓ |
Monitored Item | Create Monitored Items | ✓ | ✓ | |
Modify Monitored Items | ||||
Set Monitoring Mode | ||||
Set Triggering | ||||
Delete Monitored Items | ✓ | ✓ | ||
Subscription | Create Subscription | ✓ | ||
Modify Subscription | ||||
Publish/Set | ✓ | ✓ | ||
Republish | ||||
Transfer Subscription | ||||
Delete Subscription | ✓ | |||
Alarms & Events | Alarms | ✓ | ✓ | |
Events | ✓ | ✓ |
Columns:
- Information Model - Interface of the OPC UA information model of the OPC UA Server
- OPC UA Interface - OPC UA Applications are deployed to the OPC UA Server in form of libraries. The OPC UA Interface contains the full OPC UA functionality. To use the interface OPC UA skills are necessary.
- Value Based Interface - OPC UA Applications are deployed to the OPC UA Server in form of libraries. The value based Interface contains the limited OPC UA functionality. To use the interface OPC UA skills are not necessary.
Security:
Type | Client | Server | |
---|---|---|---|
Security Mode | None | ✓ | ✓ |
Sign | ✓ | ✓ | |
Sign and Encrypt | ✓ | ✓ | |
Security Policy | None | ✓ | ✓ |
Basic128Rsa15 | ✓ | ✓ | |
Basic256 | ✓ | ✓ | |
Basic256Sha256 | ✓ | ✓ | |
User Authentication Policy | Anonymous | ✓ | ✓ |
Username | ✓ | ✓ | |
IssuedToken | ✓ | ✓ | |
Certificate | ✓ | ✓ |