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 | |
18 | Objects of this class and the statuscode of the request are returned in the \l QOpcUaHistoryReadResponse::readHistoryDataFinished(const QList<QOpcUaHistoryData> &results, QOpcUa::UaStatusCode serviceResult) |
19 | signal and contain the result of a request. |
20 | |
21 | */ |
22 | |
23 | /*! |
24 | \enum QOpcUaHistoryReadResponse::State |
25 | |
26 | This enum specifies the state the response is in. |
27 | |
28 | \value Unknown |
29 | \value Reading |
30 | \value Finished |
31 | \value MoreDataAvailable |
32 | \value Error |
33 | */ |
34 | |
35 | /*! |
36 | \fn QOpcUaHistoryReadResponse::readHistoryDataFinished(const QList<QOpcUaHistoryData> &results, QOpcUa::UaStatusCode serviceResult); |
37 | |
38 | This signal is emitted when a historical data request is finished. It adds |
39 | to \a results and sets \a serviceResult to indicate the state of the result. |
40 | |
41 | \sa data(), serviceResult() |
42 | */ |
43 | |
44 | /*! |
45 | \fn QOpcUaHistoryReadResponse::stateChanged(State state) |
46 | |
47 | This signal is emitted when the of a historical data request is changed. |
48 | It sets \a state to indicate the state of the change. |
49 | */ |
50 | QOpcUaHistoryReadResponse::QOpcUaHistoryReadResponse(QOpcUaHistoryReadResponseImpl *impl) |
51 | : QObject(*new QOpcUaHistoryReadResponsePrivate(impl), nullptr) |
52 | {} |
53 | |
54 | /*! |
55 | The destructor for QOpcUaHistoryReadResponse |
56 | */ |
57 | QOpcUaHistoryReadResponse::~QOpcUaHistoryReadResponse() |
58 | { |
59 | } |
60 | |
61 | /*! |
62 | Returns \c true if there are more values available from the historic data request. |
63 | */ |
64 | bool QOpcUaHistoryReadResponse::hasMoreData() const |
65 | { |
66 | return d_func()->m_impl->hasMoreData(); |
67 | } |
68 | |
69 | /*! |
70 | Returns \c true if a read request for more historic values is successfully dispatched. |
71 | */ |
72 | bool QOpcUaHistoryReadResponse::readMoreData() |
73 | { |
74 | return d_func()->m_impl->readMoreData(); |
75 | } |
76 | |
77 | /*! |
78 | Returns the current state of historic data request. |
79 | */ |
80 | QOpcUaHistoryReadResponse::State QOpcUaHistoryReadResponse::state() const |
81 | { |
82 | return d_func()->m_impl->state(); |
83 | } |
84 | |
85 | /*! |
86 | Releases the continuation points and sets the request as finished. |
87 | Returns \c true if the pending request has been successfully finished; otherwise returns false. |
88 | */ |
89 | bool QOpcUaHistoryReadResponse::releaseContinuationPoints() |
90 | { |
91 | return d_func()->m_impl->releaseContinuationPoints(); |
92 | } |
93 | |
94 | /*! |
95 | Returns a list which contains the requested historic data. |
96 | */ |
97 | QList<QOpcUaHistoryData> QOpcUaHistoryReadResponse::data() const |
98 | { |
99 | return d_func()->m_impl->data(); |
100 | } |
101 | |
102 | /*! |
103 | Returns the serviceresult of the historic data request. |
104 | */ |
105 | QOpcUa::UaStatusCode QOpcUaHistoryReadResponse::serviceResult() const |
106 | { |
107 | return d_func()->m_impl->serviceResult(); |
108 | } |
109 | |
110 | QT_END_NAMESPACE |
111 | |