1 | // Copyright (C) 2018 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 "qopcuabrowserequest.h" |
5 | |
6 | QT_BEGIN_NAMESPACE |
7 | |
8 | /*! |
9 | \class QOpcUaBrowseRequest |
10 | \inmodule QtOpcUa |
11 | \brief Contains parameters for a call to the OPC UA browse service. |
12 | |
13 | \sa QOpcUaNode::browse() |
14 | */ |
15 | |
16 | /*! |
17 | \enum QOpcUaBrowseRequest::BrowseDirection |
18 | |
19 | This enum specifies the possible browse directions supported by a browse call. |
20 | |
21 | \value Forward Follow references in the forward direction. |
22 | \value Inverse Follow references in the inverse direction. |
23 | \value Both Follow references in both directions. |
24 | */ |
25 | |
26 | class QOpcUaBrowseRequestData : public QSharedData |
27 | { |
28 | public: |
29 | QOpcUaBrowseRequest::BrowseDirection browseDirection {QOpcUaBrowseRequest::BrowseDirection::Forward}; |
30 | QString referenceTypeId; |
31 | bool includeSubtypes {false}; |
32 | QOpcUa::NodeClasses nodeClassMask; |
33 | }; |
34 | |
35 | QOpcUaBrowseRequest::QOpcUaBrowseRequest() |
36 | : data(new QOpcUaBrowseRequestData) |
37 | { |
38 | } |
39 | |
40 | /*! |
41 | Creates a browse request from \a other. |
42 | */ |
43 | QOpcUaBrowseRequest::QOpcUaBrowseRequest(const QOpcUaBrowseRequest &other) |
44 | : data(other.data) |
45 | { |
46 | } |
47 | |
48 | /*! |
49 | Sets the values from \a rhs in this browse request. |
50 | */ |
51 | QOpcUaBrowseRequest &QOpcUaBrowseRequest::operator=(const QOpcUaBrowseRequest &rhs) |
52 | { |
53 | if (this != &rhs) |
54 | data.operator=(o: rhs.data); |
55 | return *this; |
56 | } |
57 | |
58 | QOpcUaBrowseRequest::~QOpcUaBrowseRequest() |
59 | { |
60 | } |
61 | |
62 | /*! |
63 | Returns the browse direction. |
64 | */ |
65 | QOpcUaBrowseRequest::BrowseDirection QOpcUaBrowseRequest::browseDirection() const |
66 | { |
67 | return data->browseDirection; |
68 | } |
69 | |
70 | /*! |
71 | Sets the browse direction to \a browseDirection. |
72 | */ |
73 | void QOpcUaBrowseRequest::setBrowseDirection(const QOpcUaBrowseRequest::BrowseDirection &browseDirection) |
74 | { |
75 | data->browseDirection = browseDirection; |
76 | } |
77 | |
78 | /*! |
79 | Returns the reference type id. |
80 | */ |
81 | QString QOpcUaBrowseRequest::referenceTypeId() const |
82 | { |
83 | return data->referenceTypeId; |
84 | } |
85 | |
86 | /*! |
87 | Sets the reference type id to \a referenceTypeId. |
88 | */ |
89 | void QOpcUaBrowseRequest::setReferenceTypeId(const QString &referenceTypeId) |
90 | { |
91 | data->referenceTypeId = referenceTypeId; |
92 | } |
93 | |
94 | /*! |
95 | Sets the reference type id to \a referenceTypeId. |
96 | */ |
97 | void QOpcUaBrowseRequest::setReferenceTypeId(QOpcUa::ReferenceTypeId referenceTypeId) |
98 | { |
99 | data->referenceTypeId = QOpcUa::nodeIdFromReferenceType(referenceType: referenceTypeId); |
100 | } |
101 | |
102 | /*! |
103 | Returns true if subtypes of the reference type will be retrieved too. |
104 | */ |
105 | bool QOpcUaBrowseRequest::includeSubtypes() const |
106 | { |
107 | return data->includeSubtypes; |
108 | } |
109 | |
110 | /*! |
111 | Sets the inclusion of subtypes of the reference type to \a includeSubtypes. |
112 | */ |
113 | void QOpcUaBrowseRequest::setIncludeSubtypes(bool includeSubtypes) |
114 | { |
115 | data->includeSubtypes = includeSubtypes; |
116 | } |
117 | |
118 | /*! |
119 | Returns the node class mask. |
120 | */ |
121 | QOpcUa::NodeClasses QOpcUaBrowseRequest::nodeClassMask() const |
122 | { |
123 | return data->nodeClassMask; |
124 | } |
125 | |
126 | /*! |
127 | Sets the node class mask to \a nodeClassMask. |
128 | Nodes of all classes included into the node class mask will be returned |
129 | by the browse operation. |
130 | */ |
131 | void QOpcUaBrowseRequest::setNodeClassMask(const QOpcUa::NodeClasses &nodeClassMask) |
132 | { |
133 | data->nodeClassMask = nodeClassMask; |
134 | } |
135 | |
136 | QT_END_NAMESPACE |
137 |