1 | // Copyright (C) 2019 The Qt Company Ltd. |
2 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com |
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
4 | |
5 | #include "qopcuaapplicationdescription.h" |
6 | |
7 | QT_BEGIN_NAMESPACE |
8 | |
9 | /*! |
10 | \class QOpcUaApplicationDescription |
11 | \inmodule QtOpcUa |
12 | \brief The OPC UA ApplicationDescription. |
13 | |
14 | The application description contains information about an OPC UA application. |
15 | */ |
16 | |
17 | /*! |
18 | \qmltype ApplicationDescription |
19 | \inqmlmodule QtOpcUa |
20 | \brief The OPC UA ApplicationDescription. |
21 | \since QtOpcUa 5.13 |
22 | |
23 | The application description contains information about an OPC UA application. |
24 | */ |
25 | |
26 | /*! |
27 | \enum QOpcUaApplicationDescription::ApplicationType |
28 | |
29 | This enum type holds the application type. |
30 | |
31 | \value Server This application is a server. |
32 | \value Client This application is a client. |
33 | \value ClientAndServer This application is a client and a server. |
34 | \value DiscoveryServer This application is a discovery server. |
35 | */ |
36 | |
37 | /*! |
38 | \qmlproperty enumeration ApplicationDescription::ApplicationType |
39 | |
40 | The application type. |
41 | |
42 | \value Server This application is a server. |
43 | \value Client This application is a client. |
44 | \value ClientAndServer This application is a client and a server. |
45 | \value DiscoveryServer This application is a discovery server. |
46 | */ |
47 | |
48 | /*! |
49 | \property QOpcUaApplicationDescription::applicationName |
50 | |
51 | Name describing the application. |
52 | */ |
53 | |
54 | /*! |
55 | \qmlproperty LocalizedText ApplicationDescription::applicationName |
56 | |
57 | Name describing the application. |
58 | */ |
59 | |
60 | /*! |
61 | \property QOpcUaApplicationDescription::applicationType |
62 | |
63 | The application's type: server, client, both, or discovery server. |
64 | */ |
65 | |
66 | /*! |
67 | \qmlproperty ApplicationType ApplicationDescription::applicationType |
68 | |
69 | The application's type: server, client, both, or discovery server. |
70 | */ |
71 | |
72 | /*! |
73 | \property QOpcUaApplicationDescription::applicationUri |
74 | |
75 | The globally unique identifier for this application instance. |
76 | */ |
77 | |
78 | /*! |
79 | \qmlproperty string ApplicationDescription::applicationUri |
80 | |
81 | The globally unique identifier for this application instance. |
82 | */ |
83 | |
84 | /*! |
85 | \property QOpcUaApplicationDescription::discoveryProfileUri |
86 | |
87 | The URI of the supported discovery profile. |
88 | */ |
89 | |
90 | /*! |
91 | \qmlproperty string ApplicationDescription::discoveryProfileUri |
92 | |
93 | The URI of the supported discovery profile. |
94 | */ |
95 | |
96 | /*! |
97 | \property QOpcUaApplicationDescription::discoveryUrls |
98 | |
99 | A list of URLs of discovery endpoints. |
100 | */ |
101 | |
102 | /*! |
103 | \qmlproperty list ApplicationDescription::discoveryUrls |
104 | |
105 | A list of URLs of discovery endpoints. |
106 | */ |
107 | |
108 | /*! |
109 | \property QOpcUaApplicationDescription::gatewayServerUri |
110 | |
111 | The URI of the gateway server. |
112 | */ |
113 | |
114 | /*! |
115 | \qmlproperty string ApplicationDescription::gatewayServerUri |
116 | |
117 | The URI of the gateway server. |
118 | */ |
119 | |
120 | /*! |
121 | \property QOpcUaApplicationDescription::productUri |
122 | |
123 | The globally unique identifier for this product. |
124 | */ |
125 | |
126 | /*! |
127 | \qmlproperty string ApplicationDescription::productUri |
128 | |
129 | The globally unique identifier for this product. |
130 | */ |
131 | |
132 | class QOpcUaApplicationDescriptionData : public QSharedData |
133 | { |
134 | public: |
135 | QString applicationUri; |
136 | QString productUri; |
137 | QOpcUaLocalizedText applicationName; |
138 | QOpcUaApplicationDescription::ApplicationType applicationType{QOpcUaApplicationDescription::ApplicationType::Server}; |
139 | QString gatewayServerUri; |
140 | QString discoveryProfileUri; |
141 | QList<QString> discoveryUrls; |
142 | }; |
143 | |
144 | QOpcUaApplicationDescription::QOpcUaApplicationDescription() |
145 | : data(new QOpcUaApplicationDescriptionData) |
146 | { |
147 | } |
148 | |
149 | /*! |
150 | Constructs an application description from \a other. |
151 | */ |
152 | QOpcUaApplicationDescription::QOpcUaApplicationDescription(const QOpcUaApplicationDescription &other) |
153 | : data(other.data) |
154 | { |
155 | } |
156 | |
157 | /*! |
158 | Sets the values from \a other in this application description. |
159 | */ |
160 | QOpcUaApplicationDescription &QOpcUaApplicationDescription::operator=(const QOpcUaApplicationDescription &other) |
161 | { |
162 | this->data = other.data; |
163 | return *this; |
164 | } |
165 | |
166 | /*! |
167 | Returns \c true if this application description has the same value as \a rhs. |
168 | */ |
169 | bool QOpcUaApplicationDescription::operator==(const QOpcUaApplicationDescription &rhs) const |
170 | { |
171 | return rhs.productUri() == productUri() && |
172 | rhs.discoveryUrls() == discoveryUrls() && |
173 | rhs.applicationUri() == applicationUri() && |
174 | rhs.applicationName() == applicationName() && |
175 | rhs.applicationType() == applicationType() && |
176 | rhs.gatewayServerUri() == gatewayServerUri() && |
177 | rhs.discoveryProfileUri() == rhs.discoveryProfileUri(); |
178 | } |
179 | |
180 | QOpcUaApplicationDescription::~QOpcUaApplicationDescription() |
181 | { |
182 | } |
183 | |
184 | /*! |
185 | Returns a list of URLs of discovery endpoints. |
186 | */ |
187 | QList<QString> QOpcUaApplicationDescription::discoveryUrls() const |
188 | { |
189 | return data->discoveryUrls; |
190 | } |
191 | |
192 | /*! |
193 | Returns a reference to a list of URLs of discovery endpoints. |
194 | */ |
195 | QList<QString> &QOpcUaApplicationDescription::discoveryUrlsRef() |
196 | { |
197 | return data->discoveryUrls; |
198 | } |
199 | |
200 | /*! |
201 | Sets the discovery URLs to \a discoveryUrls. |
202 | */ |
203 | void QOpcUaApplicationDescription::setDiscoveryUrls(const QList<QString> &discoveryUrls) |
204 | { |
205 | data->discoveryUrls = discoveryUrls; |
206 | } |
207 | |
208 | /*! |
209 | Returns the URI of the supported discovery profile. |
210 | */ |
211 | QString QOpcUaApplicationDescription::discoveryProfileUri() const |
212 | { |
213 | return data->discoveryProfileUri; |
214 | } |
215 | |
216 | /*! |
217 | Sets the discovery profile URI to \a discoveryProfileUri. |
218 | */ |
219 | void QOpcUaApplicationDescription::setDiscoveryProfileUri(const QString &discoveryProfileUri) |
220 | { |
221 | data->discoveryProfileUri = discoveryProfileUri; |
222 | } |
223 | |
224 | /*! |
225 | Returns the URI of the gateway server. |
226 | */ |
227 | QString QOpcUaApplicationDescription::gatewayServerUri() const |
228 | { |
229 | return data->gatewayServerUri; |
230 | } |
231 | |
232 | /*! |
233 | Sets the URI of the gateway server to \a gatewayServerUri. |
234 | */ |
235 | void QOpcUaApplicationDescription::setGatewayServerUri(const QString &gatewayServerUri) |
236 | { |
237 | data->gatewayServerUri = gatewayServerUri; |
238 | } |
239 | |
240 | /*! |
241 | Returns the application's type (server, client, both, discovery server). |
242 | */ |
243 | QOpcUaApplicationDescription::ApplicationType QOpcUaApplicationDescription::applicationType() const |
244 | { |
245 | return data->applicationType; |
246 | } |
247 | |
248 | /*! |
249 | Sets the application type to \a applicationType. |
250 | */ |
251 | void QOpcUaApplicationDescription::setApplicationType(ApplicationType applicationType) |
252 | { |
253 | data->applicationType = applicationType; |
254 | } |
255 | |
256 | /*! |
257 | Returns a name describing the application. |
258 | */ |
259 | QOpcUaLocalizedText QOpcUaApplicationDescription::applicationName() const |
260 | { |
261 | return data->applicationName; |
262 | } |
263 | |
264 | /*! |
265 | Sets the application name to \a applicationName. |
266 | */ |
267 | void QOpcUaApplicationDescription::setApplicationName(const QOpcUaLocalizedText &applicationName) |
268 | { |
269 | data->applicationName = applicationName; |
270 | } |
271 | |
272 | /*! |
273 | Returns the globally unique identifier for this product. |
274 | */ |
275 | QString QOpcUaApplicationDescription::productUri() const |
276 | { |
277 | return data->productUri; |
278 | } |
279 | |
280 | /*! |
281 | Sets the globally unique identifier for this product to \a productUri. |
282 | */ |
283 | void QOpcUaApplicationDescription::setProductUri(const QString &productUri) |
284 | { |
285 | data->productUri = productUri; |
286 | } |
287 | |
288 | /*! |
289 | Returns the globally unique identifier for this application instance. |
290 | */ |
291 | QString QOpcUaApplicationDescription::applicationUri() const |
292 | { |
293 | return data->applicationUri; |
294 | } |
295 | |
296 | /*! |
297 | Sets the globally unique identifier for this application instance to \a applicationUri. |
298 | */ |
299 | void QOpcUaApplicationDescription::setApplicationUri(const QString &applicationUri) |
300 | { |
301 | data->applicationUri = applicationUri; |
302 | } |
303 | |
304 | QT_END_NAMESPACE |
305 | |