1// Copyright (C) 2019 The Qt Company Ltd.
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 <opcuareaditem_p.h>
5
6QT_BEGIN_NAMESPACE
7
8/*!
9 \qmltype ReadItem
10 \inqmlmodule QtOpcUa
11 \brief Specifies an item to be read from the server.
12 \since QtOpcUa 5.13
13 \deprecated [6.9]
14
15 This type is used to specify items to be read from the server using the function
16 \l Connection::readNodeAttributes.
17*/
18
19/*!
20 \qmlproperty Constants.NodeAttribute ReadItem::attribute
21
22 Determines the attribute of the node to be read.
23*/
24
25/*!
26 \qmlproperty string ReadItem::indexRange
27
28 Determines the index range of the attribute to be read.
29 If not needed, leave this property empty.
30*/
31
32/*!
33 \qmlproperty string ReadItem::nodeId
34
35 Determines the node id of the node to be read.
36*/
37
38/*!
39 \qmlproperty variant ReadItem::ns
40
41 Determines the namespace of the node to be read.
42 The namespace can be given by name or index.
43 If this property is given, any namespace in the node id will be
44 ignored.
45*/
46
47class OpcUaReadItemData : public QSharedData
48{
49public:
50 QOpcUa::NodeAttribute attribute;
51 QString indexRange;
52 QString nodeId;
53 QVariant namespaceIdentifier;
54};
55
56OpcUaReadItem::OpcUaReadItem()
57 : data(new OpcUaReadItemData)
58{
59 data->attribute = QOpcUa::NodeAttribute::Value;
60}
61
62OpcUaReadItem::OpcUaReadItem(const OpcUaReadItem &other)
63 : data(other.data)
64{
65}
66
67OpcUaReadItem &OpcUaReadItem::operator=(const OpcUaReadItem &rhs)
68{
69 if (this != &rhs)
70 data.operator=(o: rhs.data);
71 return *this;
72}
73
74OpcUaReadItem::~OpcUaReadItem() = default;
75
76const QString &OpcUaReadItem::indexRange() const
77{
78 return data->indexRange;
79}
80
81void OpcUaReadItem::setIndexRange(const QString &indexRange)
82{
83 data->indexRange = indexRange;
84}
85
86const QString &OpcUaReadItem::nodeId() const
87{
88 return data->nodeId;
89}
90
91void OpcUaReadItem::setNodeId(const QString &nodeId)
92{
93 data->nodeId = nodeId;
94}
95
96QOpcUa::NodeAttribute OpcUaReadItem::attribute() const
97{
98 return data->attribute;
99}
100
101void OpcUaReadItem::setAttribute(QOpcUa::NodeAttribute attribute)
102{
103 data->attribute = attribute;
104}
105
106const QVariant &OpcUaReadItem::namespaceIdentifier() const
107{
108 return data->namespaceIdentifier;
109}
110
111void OpcUaReadItem::setNamespaceIdentifier(const QVariant &namespaceIdentifier)
112{
113 data->namespaceIdentifier = namespaceIdentifier;
114}
115
116OpcUaReadItem OpcUaReadItemFactory::create()
117{
118 return OpcUaReadItem();
119}
120
121QT_END_NAMESPACE
122
123

source code of qtopcua/src/declarative_opcua/opcuareaditem.cpp