Qt OPC UA

The Qt OPC UA module implements a Qt API to interact with OPC UA on top of a 3rd party OPC UA stack.

The stacks are connected via plugins and can be selected/switched at runtime. Currently, the following implementations are supported

  • Open62541 v0.3, MPLv2
  • Unified Automation C++ SDK (UACpp), Commercial

This module is still in development but is available as a technology preview. This means it is unstable, likely to change and provided as a convenience only.

Getting started

Add the following line to your .pro file

QT += opcua

and include the Qt OPC UA headers into your files using

#include <QtOpcUa>

The examples demonstrate how to use Qt OPC UA API to interact with an OPC UA server.

A short introduction to OPC UA

OPC UA is a protocol for data modelling and exchange of data in industrial applications.

An OPC UA server offers access to data which is organized in a mesh of nodes connected by references. The use of different reference types and nodes containing metadata enable a client to navigate and interpret the data without knowing their structure in advance.

Each node has a unique identifier and attributes that can be read and written. Among others, there are Variable nodes which store values and callable Method nodes with attached nodes describing parameters and return values. Notifications in case of events and monitoring of Variable nodes for value changes are offered too.

Complex objects can be created by combining nodes using references, inheritance is also possible. OPC UA offers support for pre-made models which can be extended to fit special needs.

OPC UA is the platform-independent successor of OPC Classic intended for usage on all levels, from embedded sensors up to manufacturing execution and enterprise resource planning systems. It has a service-oriented architecture based on standardized messages for service requests and responses. There are different ways for these messages to be encoded and transported over the network. The most common way is binary encoding over TCP.

Implemented features from the OPC UA protocol

The following features of OPC UA are supported by Qt OPC UA:

FeatureOpen62541 pluginUACpp plugin
ReadXX
Batch readX
WriteXX
Batch writeX
Multidimensional arraysX
BrowseXX
Data change subscriptionsXX
Event subscriptionsXX
Modify subscriptions / monitored ItemsXX
Method callsXX
Browse path resolutionXX
GetEndpointsXX
FindServersX
NodeManagementX

Data types

A subset of the OPC UA data types is currently supported in Qt OPC UA. Most of them are available with all backends.

Data typeOpen62541 pluginUACpp pluginQt OPC UA data type
Int16, Int32, Int64XXDirectly used
UInt16, UInt32, UInt64XXDirectly used
ByteXXquint8
SByteXXqint8
BooleanXXDirectly used
DoubleXXDirectly used
FloatXXDirectly used
StringXXQString
LocalizedTextXXQOpcUa::QLocalizedText
DateTimeXXQDateTime
ByteStringXXQByteArray
XmlElementXXQString
NodeIdXXQString
GUIDXXQUuid
QualifiedNameXXQOpcUa::QQualifiedName
StatusCodeXXQOpcUa::UaStatusCode
RangeXXQOpcUa::QRange
EUInformationXXQOpcUa::QEUInformation
ComplexNumberXXQOpcUa::QComplexNumber
DoubleComplexNumberXXQOpcUa::QDoubleComplexNumber
AxisInformationXXQOpcUa::QAxisInformation
XVXXQOpcUa::QXValue
ArgumentXQOpcUa::QArgument
ExpandedNodeIdXXQOpcUa::QExpandedNodeId
ExtensionObjectXQOpcUa::QExtensionObject

Classes and ownership

Two important classes are exposed to the user: QOpcUaClient and QOpcUaNode.

Objects of both classes are owned by the user and must be deleted when they are no longer needed.

Logging categories

The following logging categories are used by Qt OPC UA

Logging CategoryDescription
qt.opcuaPlugin independent messages generated by QOpcUaProvider and QOpcUaClient
qt.opcua.plugins.open62541Messages generated by the open62541 plugin
qt.opcua.plugins.uacppMessages generated by the UACpp plugin

Licenses

The Qt OPC UA module is available under commercial licenses from The Qt Company. In addition, it is available under free software licenses. These free software licenses are GNU Lesser General Public License, version 3, or the GNU General Public License, version 2. See Qt Licensing for further details.

Furthermore Qt OPC UA contains plugins under following licenses:

Open62541

The Open62541 plugin is available under the same licenses as Qt OPC UA. The Open62541 library itself is licensed under Mozilla Public License v2.0.

UA CPP

The UA CPP plugin is available under commercial licenses from The Qt Company. The UA CPP library itself is available under commercial licenses from Unified Automation.

© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.