1 | // Copyright (C) 2021 basysKom GmbH, opensource@basyskom.com |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | // |
5 | // W A R N I N G |
6 | // ------------- |
7 | // |
8 | // This file is not part of the Qt API. It exists purely as an |
9 | // implementation detail. This header file may change from version to |
10 | // version without notice, or even be removed. |
11 | // |
12 | // We mean it. |
13 | // |
14 | |
15 | #ifndef QOPCUAHISTORYREADRESPONSEIMPL_H |
16 | #define QOPCUAHISTORYREADRESPONSEIMPL_H |
17 | |
18 | #include <QtOpcUa/qopcuahistoryreadresponse.h> |
19 | #include <QtOpcUa/qopcuahistoryreadrawrequest.h> |
20 | |
21 | #include <private/qobject_p.h> |
22 | #include <QObject> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class Q_OPCUA_EXPORT QOpcUaHistoryReadResponseImpl : public QObject { |
27 | Q_OBJECT |
28 | |
29 | public: |
30 | QOpcUaHistoryReadResponseImpl(const QOpcUaHistoryReadRawRequest &request); |
31 | ~QOpcUaHistoryReadResponseImpl(); |
32 | |
33 | bool hasMoreData() const; |
34 | bool readMoreData(); |
35 | QOpcUaHistoryReadResponse::State state() const; |
36 | |
37 | bool releaseContinuationPoints(); |
38 | |
39 | QList<QOpcUaHistoryData> data() const; |
40 | QOpcUa::UaStatusCode serviceResult() const; |
41 | |
42 | Q_INVOKABLE void handleDataAvailable(const QList<QOpcUaHistoryData> &data, const QList<QByteArray> &continuationPoints, |
43 | QOpcUa::UaStatusCode serviceResult, quint64 responseHandle); |
44 | Q_INVOKABLE void handleRequestError(quint64 requestHandle); |
45 | |
46 | quint64 handle() const; |
47 | |
48 | Q_SIGNALS: |
49 | void historyReadRawRequested(QOpcUaHistoryReadRawRequest request, QList<QByteArray> continuationPoints, bool releaseContinuationPoints, quint64 handle); |
50 | void readHistoryDataFinished(QList<QOpcUaHistoryData> results, QOpcUa::UaStatusCode serviceResult); |
51 | void stateChanged(QOpcUaHistoryReadResponse::State state); |
52 | |
53 | protected: |
54 | void setState(QOpcUaHistoryReadResponse::State state); |
55 | |
56 | private: |
57 | enum class RequestType { |
58 | Unknown, |
59 | ReadRaw |
60 | }; |
61 | |
62 | QOpcUaHistoryReadResponse::State m_state = QOpcUaHistoryReadResponse::State::Reading; |
63 | QList<QByteArray> m_continuationPoints; |
64 | |
65 | RequestType m_requestType = RequestType::Unknown; |
66 | QOpcUaHistoryReadRawRequest m_readRawRequest; |
67 | QList<QOpcUaHistoryData> m_data; |
68 | QOpcUa::UaStatusCode m_serviceResult = QOpcUa::UaStatusCode::Good; |
69 | QList<int> m_dataMapping; |
70 | |
71 | static quint64 m_currentHandle; |
72 | |
73 | quint64 m_handle = 0; |
74 | }; |
75 | |
76 | QT_END_NAMESPACE |
77 | |
78 | #endif // QOPCUAHISTORYREADRESPONSEIMPL_H |
79 | |