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#include <QtOpcUa/qopcuahistoryreadeventrequest.h>
21#include <QtOpcUa/qopcuahistoryevent.h>
22
23#include <private/qobject_p.h>
24#include <QObject>
25
26QT_BEGIN_NAMESPACE
27
28class Q_OPCUA_EXPORT QOpcUaHistoryReadResponseImpl : public QObject {
29 Q_OBJECT
30
31public:
32 QOpcUaHistoryReadResponseImpl(const QOpcUaHistoryReadRawRequest &request);
33 QOpcUaHistoryReadResponseImpl(const QOpcUaHistoryReadEventRequest &request);
34 ~QOpcUaHistoryReadResponseImpl();
35
36 bool hasMoreData() const;
37 bool readMoreData();
38 QOpcUaHistoryReadResponse::State state() const;
39
40 bool releaseContinuationPoints();
41
42 QList<QOpcUaHistoryData> data() const;
43 QList<QOpcUaHistoryEvent> events() const;
44 QOpcUa::UaStatusCode serviceResult() const;
45
46 Q_INVOKABLE void handleDataAvailable(const QList<QOpcUaHistoryData> &data, const QList<QByteArray> &continuationPoints,
47 QOpcUa::UaStatusCode serviceResult, quint64 responseHandle);
48 Q_INVOKABLE void handleEventsAvailable(const QList<QOpcUaHistoryEvent> &data, const QList<QByteArray> &continuationPoints,
49 QOpcUa::UaStatusCode serviceResult, quint64 responseHandle);
50 Q_INVOKABLE void handleRequestError(quint64 requestHandle);
51
52 quint64 handle() const;
53
54Q_SIGNALS:
55 void historyReadRawRequested(QOpcUaHistoryReadRawRequest request, QList<QByteArray> continuationPoints, bool releaseContinuationPoints, quint64 handle);
56 void historyReadEventsRequested(QOpcUaHistoryReadEventRequest request, QList<QByteArray> continuationPoints, bool releaseContinuationPoints, quint64 handle);
57 void readHistoryDataFinished(QList<QOpcUaHistoryData> results, QOpcUa::UaStatusCode serviceResult);
58 void readHistoryEventsFinished(QList<QOpcUaHistoryEvent> results, QOpcUa::UaStatusCode serviceResult);
59 void stateChanged(QOpcUaHistoryReadResponse::State state);
60
61protected:
62 void setState(QOpcUaHistoryReadResponse::State state);
63
64 QOpcUaHistoryReadRawRequest createReadRawRequestWithContinuationPoints();
65 QOpcUaHistoryReadEventRequest createEventRequestWithContinuationPoints();
66
67private:
68 enum class RequestType {
69 Unknown,
70 ReadRaw,
71 ReadEvent
72 };
73
74 QOpcUaHistoryReadResponse::State m_state = QOpcUaHistoryReadResponse::State::Reading;
75 QList<QByteArray> m_continuationPoints;
76
77 RequestType m_requestType = RequestType::Unknown;
78 QOpcUaHistoryReadRawRequest m_readRawRequest;
79 QOpcUaHistoryReadEventRequest m_readEventRequest;
80 QList<QOpcUaHistoryData> m_data;
81 QList<QOpcUaHistoryEvent> m_events;
82 QOpcUa::UaStatusCode m_serviceResult = QOpcUa::UaStatusCode::Good;
83 QList<int> m_dataMapping;
84
85 static quint64 m_currentHandle;
86
87 quint64 m_handle = 0;
88};
89
90QT_END_NAMESPACE
91
92#endif // QOPCUAHISTORYREADRESPONSEIMPL_H
93

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtopcua/src/opcua/client/qopcuahistoryreadresponseimpl_p.h