| 1 | // Copyright (C) 2017 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QOPEN62541CLIENT_H |
| 5 | #define QOPEN62541CLIENT_H |
| 6 | |
| 7 | #ifdef USE_SYSTEM_OPEN62541 |
| 8 | #include <open62541/config.h> |
| 9 | #else |
| 10 | #include "qopen62541.h" |
| 11 | #endif |
| 12 | |
| 13 | #include <private/qopcuaclientimpl_p.h> |
| 14 | |
| 15 | #include <QtCore/qtimer.h> |
| 16 | |
| 17 | QT_BEGIN_NAMESPACE |
| 18 | |
| 19 | class Open62541AsyncBackend; |
| 20 | |
| 21 | class QOpen62541Client : public QOpcUaClientImpl |
| 22 | { |
| 23 | Q_OBJECT |
| 24 | |
| 25 | public: |
| 26 | explicit QOpen62541Client(const QVariantMap &backendProperties); |
| 27 | ~QOpen62541Client(); |
| 28 | |
| 29 | void connectToEndpoint(const QOpcUaEndpointDescription &endpoint) override; |
| 30 | void disconnectFromEndpoint() override; |
| 31 | |
| 32 | QOpcUaNode *node(const QString &nodeId) override; |
| 33 | |
| 34 | QString backend() const override; |
| 35 | |
| 36 | bool requestEndpoints(const QUrl &url) override; |
| 37 | |
| 38 | bool findServers(const QUrl &url, const QStringList &localeIds, const QStringList &serverUris) override; |
| 39 | |
| 40 | bool readNodeAttributes(const QList<QOpcUaReadItem> &nodesToRead) override; |
| 41 | bool writeNodeAttributes(const QList<QOpcUaWriteItem> &nodesToWrite) override; |
| 42 | |
| 43 | QOpcUaHistoryReadResponse *readHistoryData(const QOpcUaHistoryReadRawRequest &request) override; |
| 44 | QOpcUaHistoryReadResponse *readHistoryEvents(const QOpcUaHistoryReadEventRequest &request) override; |
| 45 | |
| 46 | bool addNode(const QOpcUaAddNodeItem &nodeToAdd) override; |
| 47 | bool deleteNode(const QString &nodeId, bool deleteTargetReferences) override; |
| 48 | |
| 49 | bool addReference(const QOpcUaAddReferenceItem &referenceToAdd) override; |
| 50 | bool deleteReference(const QOpcUaDeleteReferenceItem &referenceToDelete) override; |
| 51 | |
| 52 | QStringList supportedSecurityPolicies() const override; |
| 53 | QList<QOpcUaUserTokenPolicy::TokenType> supportedUserTokenTypes() const override; |
| 54 | |
| 55 | Q_INVOKABLE bool handleHistoryReadRawRequested(const QOpcUaHistoryReadRawRequest &request, const QList<QByteArray> &continuationPoints, |
| 56 | bool releaseContinuationPoints, quint64 handle); |
| 57 | |
| 58 | bool registerNodes(const QStringList &nodesToRegister) override; |
| 59 | bool unregisterNodes(const QStringList &nodesToUnregister) override; |
| 60 | |
| 61 | bool handleHistoryReadEventsRequested(const QOpcUaHistoryReadEventRequest &request, const QList<QByteArray> &continuationPoints, |
| 62 | bool releaseContinuationPoints, quint64 handle); |
| 63 | |
| 64 | signals: |
| 65 | void historyReadRequestError(quint64 handle); |
| 66 | |
| 67 | private slots: |
| 68 | |
| 69 | private: |
| 70 | friend class QOpen62541Node; |
| 71 | QThread *m_thread; |
| 72 | Open62541AsyncBackend *m_backend; |
| 73 | |
| 74 | #ifdef UA_ENABLE_ENCRYPTION |
| 75 | bool m_hasSha1SignatureSupport = false; |
| 76 | #endif |
| 77 | }; |
| 78 | |
| 79 | QT_END_NAMESPACE |
| 80 | |
| 81 | #endif // QOPEN62541CLIENT_H |
| 82 |
