| 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 | |
| 6 | QT_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 | |
| 47 | class OpcUaReadItemData : public QSharedData |
| 48 | { |
| 49 | public: |
| 50 | QOpcUa::NodeAttribute attribute; |
| 51 | QString indexRange; |
| 52 | QString nodeId; |
| 53 | QVariant namespaceIdentifier; |
| 54 | }; |
| 55 | |
| 56 | OpcUaReadItem::OpcUaReadItem() |
| 57 | : data(new OpcUaReadItemData) |
| 58 | { |
| 59 | data->attribute = QOpcUa::NodeAttribute::Value; |
| 60 | } |
| 61 | |
| 62 | OpcUaReadItem::OpcUaReadItem(const OpcUaReadItem &other) |
| 63 | : data(other.data) |
| 64 | { |
| 65 | } |
| 66 | |
| 67 | OpcUaReadItem &OpcUaReadItem::operator=(const OpcUaReadItem &rhs) |
| 68 | { |
| 69 | if (this != &rhs) |
| 70 | data.operator=(o: rhs.data); |
| 71 | return *this; |
| 72 | } |
| 73 | |
| 74 | OpcUaReadItem::~OpcUaReadItem() = default; |
| 75 | |
| 76 | const QString &OpcUaReadItem::indexRange() const |
| 77 | { |
| 78 | return data->indexRange; |
| 79 | } |
| 80 | |
| 81 | void OpcUaReadItem::setIndexRange(const QString &indexRange) |
| 82 | { |
| 83 | data->indexRange = indexRange; |
| 84 | } |
| 85 | |
| 86 | const QString &OpcUaReadItem::nodeId() const |
| 87 | { |
| 88 | return data->nodeId; |
| 89 | } |
| 90 | |
| 91 | void OpcUaReadItem::setNodeId(const QString &nodeId) |
| 92 | { |
| 93 | data->nodeId = nodeId; |
| 94 | } |
| 95 | |
| 96 | QOpcUa::NodeAttribute OpcUaReadItem::attribute() const |
| 97 | { |
| 98 | return data->attribute; |
| 99 | } |
| 100 | |
| 101 | void OpcUaReadItem::setAttribute(QOpcUa::NodeAttribute attribute) |
| 102 | { |
| 103 | data->attribute = attribute; |
| 104 | } |
| 105 | |
| 106 | const QVariant &OpcUaReadItem::namespaceIdentifier() const |
| 107 | { |
| 108 | return data->namespaceIdentifier; |
| 109 | } |
| 110 | |
| 111 | void OpcUaReadItem::setNamespaceIdentifier(const QVariant &namespaceIdentifier) |
| 112 | { |
| 113 | data->namespaceIdentifier = namespaceIdentifier; |
| 114 | } |
| 115 | |
| 116 | OpcUaReadItem OpcUaReadItemFactory::create() |
| 117 | { |
| 118 | return OpcUaReadItem(); |
| 119 | } |
| 120 | |
| 121 | QT_END_NAMESPACE |
| 122 | |
| 123 |
