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 .