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 | /*! |
36 | Default constructs a browse request with no parameters set. |
37 | */ |
38 | QOpcUaBrowseRequest::QOpcUaBrowseRequest() |
39 | : data(new QOpcUaBrowseRequestData) |
40 | { |
41 | } |
42 | |
43 | /*! |
44 | Creates a browse request from \a other. |
45 | */ |
46 | QOpcUaBrowseRequest::QOpcUaBrowseRequest(const QOpcUaBrowseRequest &other) |
47 | : data(other.data) |
48 | { |
49 | } |
50 | |
51 | /*! |
52 | Sets the values from \a rhs in this browse request. |
53 | */ |
54 | QOpcUaBrowseRequest &QOpcUaBrowseRequest::operator=(const QOpcUaBrowseRequest &rhs) |
55 | { |
56 | if (this != &rhs) |
57 | data.operator=(o: rhs.data); |
58 | return *this; |
59 | } |
60 | |
61 | QOpcUaBrowseRequest::~QOpcUaBrowseRequest() |
62 | { |
63 | } |
64 | |
65 | /*! |
66 | Returns the browse direction. |
67 | */ |
68 | QOpcUaBrowseRequest::BrowseDirection QOpcUaBrowseRequest::browseDirection() const |
69 | { |
70 | return data->browseDirection; |
71 | } |
72 | |
73 | /*! |
74 | Sets the browse direction to \a browseDirection. |
75 | */ |
76 | void QOpcUaBrowseRequest::setBrowseDirection(const QOpcUaBrowseRequest::BrowseDirection &browseDirection) |
77 | { |
78 | data->browseDirection = browseDirection; |
79 | } |
80 | |
81 | /*! |
82 | Returns the reference type id. |
83 | */ |
84 | QString QOpcUaBrowseRequest::referenceTypeId() const |
85 | { |
86 | return data->referenceTypeId; |
87 | } |
88 | |
89 | /*! |
90 | Sets the reference type id to \a referenceTypeId. |
91 | */ |
92 | void QOpcUaBrowseRequest::setReferenceTypeId(const QString &referenceTypeId) |
93 | { |
94 | data->referenceTypeId = referenceTypeId; |
95 | } |
96 | |
97 | /*! |
98 | Sets the reference type id to \a referenceTypeId. |
99 | */ |
100 | void QOpcUaBrowseRequest::setReferenceTypeId(QOpcUa::ReferenceTypeId referenceTypeId) |
101 | { |
102 | data->referenceTypeId = QOpcUa::nodeIdFromReferenceType(referenceType: referenceTypeId); |
103 | } |
104 | |
105 | /*! |
106 | Returns true if subtypes of the reference type will be retrieved too. |
107 | */ |
108 | bool QOpcUaBrowseRequest::includeSubtypes() const |
109 | { |
110 | return data->includeSubtypes; |
111 | } |
112 | |
113 | /*! |
114 | Sets the inclusion of subtypes of the reference type to \a includeSubtypes. |
115 | */ |
116 | void QOpcUaBrowseRequest::setIncludeSubtypes(bool includeSubtypes) |
117 | { |
118 | data->includeSubtypes = includeSubtypes; |
119 | } |
120 | |
121 | /*! |
122 | Returns the node class mask. |
123 | */ |
124 | QOpcUa::NodeClasses QOpcUaBrowseRequest::nodeClassMask() const |
125 | { |
126 | return data->nodeClassMask; |
127 | } |
128 | |
129 | /*! |
130 | Sets the node class mask to \a nodeClassMask. |
131 | Nodes of all classes included into the node class mask will be returned |
132 | by the browse operation. |
133 | */ |
134 | void QOpcUaBrowseRequest::setNodeClassMask(const QOpcUa::NodeClasses &nodeClassMask) |
135 | { |
136 | data->nodeClassMask = nodeClassMask; |
137 | } |
138 | |
139 | QT_END_NAMESPACE |
140 | |