QOpcUaProvider Class

QOpcUaProvider creates an instance of QOpcUaClient . 更多...

头: #include <QOpcUaProvider>
CMake: find_package(Qt6 REQUIRED COMPONENTS OpcUa)
target_link_libraries(mytarget PRIVATE Qt6::OpcUa)
qmake: QT += opcua
继承: QObject

公共函数

QOpcUaProvider (QObject * parent = nullptr)
QOpcUaClient * createClient (const QString & backend , const QVariantMap & backendProperties = QVariantMap())

静态公共成员

QStringList availableBackends ()

详细描述

QOpcUaProvider allows the user to create an instance of QOpcUaClient by loading a QOpcUaPlugin using the Qt plugin system.

范例

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";
}
					

成员函数文档编制

[explicit] QOpcUaProvider:: QOpcUaProvider ( QObject * parent = nullptr)

Creates a new OPC UA provider with a given parent .

[static] QStringList QOpcUaProvider:: availableBackends ()

返回 QStringList of available plugins.

[invokable] QOpcUaClient *QOpcUaProvider:: createClient (const QString & backend , const QVariantMap & backendProperties = QVariantMap())

返回指针指向 QOpcUaClient object by loading the selected backend as a plugin and creating a client object. If the plugin loading fails, nullptr 被返回取而代之。

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 描述
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.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .