| 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 | #ifndef OPCUAATTRIBUTEOPERAND_P_H |
| 5 | #define OPCUAATTRIBUTEOPERAND_P_H |
| 6 | |
| 7 | #include <private/opcuaoperandbase_p.h> |
| 8 | #include <private/opcuanodeid_p.h> |
| 9 | |
| 10 | #include <QOpcUaAttributeOperand> |
| 11 | #include <QQmlListProperty> |
| 12 | #include <QList> |
| 13 | #include <QtQml/qqml.h> |
| 14 | |
| 15 | // |
| 16 | // W A R N I N G |
| 17 | // ------------- |
| 18 | // |
| 19 | // This file is not part of the Qt API. It exists purely as an |
| 20 | // implementation detail. This header file may change from version to |
| 21 | // version without notice, or even be removed. |
| 22 | // |
| 23 | // We mean it. |
| 24 | // |
| 25 | |
| 26 | QT_BEGIN_NAMESPACE |
| 27 | |
| 28 | class OpcUaRelativeNodePath; |
| 29 | class QOpcUaClient; |
| 30 | |
| 31 | class OpcUaAttributeOperand : public OpcUaOperandBase, private QOpcUaAttributeOperand { |
| 32 | Q_OBJECT |
| 33 | Q_PROPERTY(QQmlListProperty<OpcUaRelativeNodePath> browsePath READ browsePath) |
| 34 | Q_PROPERTY(QString indexRange READ indexRange WRITE setIndexRange) |
| 35 | Q_PROPERTY(QOpcUa::NodeAttribute nodeAttribute READ nodeAttribute WRITE setNodeAttribute) |
| 36 | Q_PROPERTY(OpcUaNodeId* typeId READ typeId WRITE setTypeId) |
| 37 | Q_PROPERTY(QString alias READ alias WRITE setAlias) |
| 38 | |
| 39 | QML_NAMED_ELEMENT(AttributeOperand) |
| 40 | QML_ADDED_IN_VERSION(5, 13) |
| 41 | |
| 42 | public: |
| 43 | explicit OpcUaAttributeOperand(QObject *parent = nullptr); |
| 44 | ~OpcUaAttributeOperand(); |
| 45 | virtual QVariant toCppVariant(QOpcUaClient *client) const override; |
| 46 | |
| 47 | OpcUaNodeId *typeId() const; |
| 48 | void setTypeId(OpcUaNodeId *nodeId); |
| 49 | |
| 50 | QString alias() const; |
| 51 | void setAlias(const QString &alias); |
| 52 | |
| 53 | QString indexRange() const; |
| 54 | void setIndexRange(const QString &indexRange); |
| 55 | |
| 56 | QOpcUa::NodeAttribute nodeAttribute() const; |
| 57 | void setNodeAttribute(QOpcUa::NodeAttribute nodeAttribute); |
| 58 | |
| 59 | QQmlListProperty<OpcUaRelativeNodePath> browsePath(); |
| 60 | void appendBrowsePathElement(OpcUaRelativeNodePath *nodeId); |
| 61 | int browsePathSize() const; |
| 62 | OpcUaRelativeNodePath *browsePathElement(int index) const; |
| 63 | void clearBrowsePath(); |
| 64 | |
| 65 | signals: |
| 66 | void dataChanged(); |
| 67 | |
| 68 | private: |
| 69 | static void appendBrowsePathElement(QQmlListProperty<OpcUaRelativeNodePath> *list, OpcUaRelativeNodePath *nodeId); |
| 70 | static qsizetype browsePathSize(QQmlListProperty<OpcUaRelativeNodePath> *list); |
| 71 | static OpcUaRelativeNodePath* browsePathElement(QQmlListProperty<OpcUaRelativeNodePath> *list, qsizetype index); |
| 72 | static void clearBrowsePath(QQmlListProperty<OpcUaRelativeNodePath> *list); |
| 73 | |
| 74 | QList<OpcUaRelativeNodePath*> m_browsePath; |
| 75 | OpcUaNodeId *m_nodeId = nullptr; |
| 76 | }; |
| 77 | |
| 78 | QT_END_NAMESPACE |
| 79 | |
| 80 | #endif // OPCUASIMPLEATTRIBUTEOPERAND_P_H |
| 81 |
