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 | #include "qopcuahistoryreadresponse.h" |
5 | |
6 | #include "private/qopcuahistoryreadresponse_p.h" |
7 | #include "private/qopcuahistoryreadresponseimpl_p.h" |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | /*! |
11 | \class QOpcUaHistoryReadResponse |
12 | \inmodule QtOpcUa |
13 | \brief This class is used for requesting historical data and storing the results. |
14 | \since 6.3 |
15 | |
16 | A historical data request to an OPC UA server can be specified by a \l QOpcUaHistoryReadRawRequest |
17 | or \l QOpcUaHistoryReadEventRequest. |
18 | |
19 | Objects of this class and the statuscode of the request are returned in the |
20 | \l QOpcUaHistoryReadResponse::readHistoryDataFinished(const QList<QOpcUaHistoryData> &results, QOpcUa::UaStatusCode serviceResult) |
21 | or \l QOpcUaHistoryReadResponse::readHistoryEventsFinished(const QList<QOpcUaHistoryEvent> &results, QOpcUa::UaStatusCode serviceResult) |
22 | signal depending on the request type and contain the result of a request. |
23 | |
24 | */ |
25 | |
26 | /*! |
27 | \enum QOpcUaHistoryReadResponse::State |
28 | |
29 | This enum specifies the state the response is in. |
30 | |
31 | \value Unknown |
32 | \value Reading |
33 | \value Finished |
34 | \value MoreDataAvailable |
35 | \value Error |
36 | */ |
37 | |
38 | /*! |
39 | \fn QOpcUaHistoryReadResponse::readHistoryDataFinished(const QList<QOpcUaHistoryData> &results, QOpcUa::UaStatusCode serviceResult); |
40 | |
41 | This signal is emitted when a historical data request is finished. It adds |
42 | to \a results and sets \a serviceResult to indicate the state of the result. |
43 | |
44 | \sa data(), serviceResult() |
45 | */ |
46 | |
47 | /*! |
48 | \fn QOpcUaHistoryReadResponse::readHistoryEventsFinished(const QList<QOpcUaHistoryEvent> &results, QOpcUa::UaStatusCode serviceResult) |
49 | \since 6.7 |
50 | |
51 | This signal is emitted when a historical event request is finished. |
52 | The new history data and any previous data is returned in \a results and \a serviceResult indicates the state of the result. |
53 | |
54 | \sa events(), serviceResult() |
55 | */ |
56 | |
57 | /*! |
58 | \fn QOpcUaHistoryReadResponse::stateChanged(State state) |
59 | |
60 | This signal is emitted when the of a historical data request is changed. |
61 | It sets \a state to indicate the state of the change. |
62 | */ |
63 | QOpcUaHistoryReadResponse::QOpcUaHistoryReadResponse(QOpcUaHistoryReadResponseImpl *impl) |
64 | : QObject(*new QOpcUaHistoryReadResponsePrivate(impl), nullptr) |
65 | {} |
66 | |
67 | /*! |
68 | The destructor for QOpcUaHistoryReadResponse |
69 | */ |
70 | QOpcUaHistoryReadResponse::~QOpcUaHistoryReadResponse() |
71 | { |
72 | } |
73 | |
74 | /*! |
75 | Returns \c true if there are more values available from the historic data request. |
76 | */ |
77 | bool QOpcUaHistoryReadResponse::hasMoreData() const |
78 | { |
79 | return d_func()->m_impl->hasMoreData(); |
80 | } |
81 | |
82 | /*! |
83 | Returns \c true if a read request for more historic values is successfully dispatched. |
84 | */ |
85 | bool QOpcUaHistoryReadResponse::readMoreData() |
86 | { |
87 | return d_func()->m_impl->readMoreData(); |
88 | } |
89 | |
90 | /*! |
91 | Returns the current state of historic data request. |
92 | */ |
93 | QOpcUaHistoryReadResponse::State QOpcUaHistoryReadResponse::state() const |
94 | { |
95 | return d_func()->m_impl->state(); |
96 | } |
97 | |
98 | /*! |
99 | Releases the continuation points and sets the request as finished. |
100 | Returns \c true if the pending request has been successfully finished; otherwise returns false. |
101 | */ |
102 | bool QOpcUaHistoryReadResponse::releaseContinuationPoints() |
103 | { |
104 | return d_func()->m_impl->releaseContinuationPoints(); |
105 | } |
106 | |
107 | /*! |
108 | Returns a list which contains the requested historic data. |
109 | */ |
110 | QList<QOpcUaHistoryData> QOpcUaHistoryReadResponse::data() const |
111 | { |
112 | return d_func()->m_impl->data(); |
113 | } |
114 | |
115 | /*! |
116 | \since 6.7 |
117 | Returns a list of \l QOpcUaHistoryEvent containing a list of events for every node |
118 | to read in the request. |
119 | */ |
120 | QList<QOpcUaHistoryEvent> QOpcUaHistoryReadResponse::events() const |
121 | { |
122 | return d_func()->m_impl->events(); |
123 | } |
124 | |
125 | /*! |
126 | Returns the serviceresult of the historic data request. |
127 | */ |
128 | QOpcUa::UaStatusCode QOpcUaHistoryReadResponse::serviceResult() const |
129 | { |
130 | return d_func()->m_impl->serviceResult(); |
131 | } |
132 | |
133 | QT_END_NAMESPACE |
134 | |