QOpcUaProvider Class
QOpcUaProvider creates an instance of QOpcUaClient. More...
Header: | #include <QOpcUaProvider> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS OpcUa) target_link_libraries(mytarget PRIVATE Qt6::OpcUa) |
qmake: | QT += opcua |
Inherits: | QObject |
Public Functions
QOpcUaProvider(QObject *parent = nullptr) | |
QOpcUaClient * | createClient(const QString &backend, const QVariantMap &backendProperties = QVariantMap()) |
Static Public Members
QStringList | availableBackends() |
Detailed Description
QOpcUaProvider allows the user to create an instance of QOpcUaClient by loading a QOpcUaPlugin using the Qt plugin system.
For the available plugins and their capabilities please refer to the introduction.
Example
This code creates a client using the first available backend:
QOpcUaProvider provider; QStringList available = provider.availableBackends(); if (!available.isEmpty()) { QOpcUaClient *client = provider.createClient(available[0]); if (client) qDebug() << "Client successfully created"; }
Member Function Documentation
[explicit]
QOpcUaProvider::QOpcUaProvider(QObject *parent = nullptr)
Creates a new OPC UA provider with a given parent.
[static]
QStringList QOpcUaProvider::availableBackends()
Returns a QStringList of available plugins.
[invokable]
QOpcUaClient *QOpcUaProvider::createClient(const QString &backend, const QVariantMap &backendProperties = QVariantMap())
Returns a pointer to a QOpcUaClient object by loading the selected backend as a plugin and creating a client object. If the plugin loading fails, nullptr
is returned instead.
The user is responsible for deleting the returned QOpcUaClient object when it is no longer needed.
The optional argument backendProperties can be used to pass custom backend specific settings as key value pairs. Those settings are specific to the backend being instantiated.
Available settings are
Setting string | Backend | Description |
---|---|---|
disableEncryptedPasswordCheck | Unified Automation | By default, the backend refuses to connect to endpoints without encryption to avoid sending passwords in clear text. This parameter allows to disable this feature. |
enableVerboseDebugOutput | Unified Automation | Tells the backend to print additional output to the terminal. The backend specific logging level is set to OPCUA_TRACE_OUTPUT_LEVEL_ALL . |
minimumClientIterateIntervalMs | open62541 | This parameter is no longer evaluated by the backend and has been replaced by clientIterateIntervalMs . |
clientIterateIntervalMs | open62541 | Defines the client iterate interval for the backend. If the client is causing too much CPU load, setting this value higher than the default will reduce the CPU load at the price of an increased response time to service requests and value updates from subscriptions. The default value is 50ms. |
asyncRequestTimeoutMs | open62541 | Defines the timeout for asynchronous requests to an OPC UA server. If the server doesn't reply to a service request before the timeout occurs, the service call fails and the finished signal will contain a bad status code. The default value is 15000ms. |
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
© 2024 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.