1// Copyright (C) 2015 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 "qopcuaeuinformation.h"
5#include "qopcualocalizedtext.h"
6
7QT_BEGIN_NAMESPACE
8
9/*!
10 \class QOpcUaEUInformation
11 \inmodule QtOpcUa
12 \brief The OPC UA EURange type.
13
14 This is the Qt OPC UA representation for the OPC UA EUInformation type defined in OPC UA 1.05 part 8, 5.6.3.
15 EUInformation values contain information about units and are mostly used as property of a node with a numeric value attribute.
16 The information can e. g. be used to add text and tooltips to GUI elements.
17*/
18
19class QOpcUaEUInformationData : public QSharedData
20{
21public:
22 QString namespaceUri;
23 qint32 unitId{0};
24 QOpcUaLocalizedText displayName;
25 QOpcUaLocalizedText description;
26};
27
28/*!
29 Default constructs an EU information with no parameters set.
30*/
31QOpcUaEUInformation::QOpcUaEUInformation()
32 : data(new QOpcUaEUInformationData)
33{
34}
35
36/*!
37 Constructs a EUinformation from \a rhs.
38*/
39QOpcUaEUInformation::QOpcUaEUInformation(const QOpcUaEUInformation &rhs)
40 : data(rhs.data)
41{
42}
43
44/*!
45 Constructs a EUinformation with namespace URI \a namespaceUri, unit id \a unitId,
46 display name \a displayName and description \a description.
47*/
48QOpcUaEUInformation::QOpcUaEUInformation(const QString &namespaceUri, qint32 unitId, const QOpcUaLocalizedText &displayName,
49 const QOpcUaLocalizedText &description)
50 : data(new QOpcUaEUInformationData)
51{
52 data->namespaceUri = namespaceUri;
53 data->unitId = unitId;
54 data->displayName = displayName;
55 data->description = description;
56}
57
58
59/*!
60 Sets the values from \a rhs in this EUinformation.
61*/
62QOpcUaEUInformation &QOpcUaEUInformation::operator=(const QOpcUaEUInformation &rhs)
63{
64 if (this != &rhs)
65 data.operator=(o: rhs.data);
66 return *this;
67}
68
69/*!
70 Returns \c true if this EUinformation has the same value as \a rhs.
71*/
72bool QOpcUaEUInformation::operator==(const QOpcUaEUInformation &rhs) const
73{
74 return data->namespaceUri == rhs.namespaceUri() &&
75 data->unitId == rhs.unitId() &&
76 data->displayName == rhs.displayName() &&
77 data->description == rhs.description();
78}
79
80QOpcUaEUInformation::~QOpcUaEUInformation()
81{
82}
83
84/*!
85 Returns the description of the unit, for example \e {degree Celsius}.
86*/
87QOpcUaLocalizedText QOpcUaEUInformation::description() const
88{
89 return data->description;
90}
91
92/*!
93 Sets the description if the unit to \a description.
94*/
95void QOpcUaEUInformation::setDescription(const QOpcUaLocalizedText &description)
96{
97 data->description = description;
98}
99
100/*!
101 Returns the display name of the unit, for example \e {°C}.
102*/
103QOpcUaLocalizedText QOpcUaEUInformation::displayName() const
104{
105 return data->displayName;
106}
107
108/*!
109 Sets the display name of the unit to \a displayName.
110*/
111void QOpcUaEUInformation::setDisplayName(const QOpcUaLocalizedText &displayName)
112{
113 data->displayName = displayName;
114}
115
116/*!
117 Returns the machine-readable identifier for the unit.
118*/
119qint32 QOpcUaEUInformation::unitId() const
120{
121 return data->unitId;
122}
123
124/*!
125 Sets the machine-readable identifier for the unit to \a unitId.
126*/
127void QOpcUaEUInformation::setUnitId(qint32 unitId)
128{
129 data->unitId = unitId;
130}
131
132/*!
133 Returns the namespace URI of the unit.
134*/
135QString QOpcUaEUInformation::namespaceUri() const
136{
137 return data->namespaceUri;
138}
139
140/*!
141 Sets the namespace URI of the unit to \a namespaceUri.
142*/
143void QOpcUaEUInformation::setNamespaceUri(const QString &namespaceUri)
144{
145 data->namespaceUri = namespaceUri;
146}
147
148/*!
149 Converts this EUinformation to \l QVariant.
150*/
151QOpcUaEUInformation::operator QVariant() const
152{
153 return QVariant::fromValue(value: *this);
154}
155
156QT_END_NAMESPACE
157

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qtopcua/src/opcua/client/qopcuaeuinformation.cpp