1// Copyright (C) 2021 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 OPCUADATACHANGEFILTER_P_H
5#define OPCUADATACHANGEFILTER_P_H
6
7#include <QOpcUaMonitoringParameters>
8#include <QtQml/qqml.h>
9#include <QtCore/private/qglobal_p.h>
10
11//
12// W A R N I N G
13// -------------
14//
15// This file is not part of the Qt API. It exists purely as an
16// implementation detail. This header file may change from version to
17// version without notice, or even be removed.
18//
19// We mean it.
20//
21
22QT_BEGIN_NAMESPACE
23
24class OpcUaDataChangeFilter : public QObject {
25 Q_OBJECT
26 Q_PROPERTY(DataChangeTrigger trigger READ trigger WRITE setTrigger)
27 Q_PROPERTY(DeadbandType deadbandType READ deadbandType WRITE setDeadbandType)
28 Q_PROPERTY(double deadbandValue READ deadbandValue WRITE setDeadbandValue)
29
30 QML_NAMED_ELEMENT(DataChangeFilter)
31 QML_ADDED_IN_VERSION(5, 13)
32
33public:
34 // Same as in QOpcUaMonitoringParameters::DataChangeFilter::DataChangeTrigger
35 enum class DataChangeTrigger {
36 Status = 0,
37 StatusOrValue = 1,
38 StatusOrValueOrTimestamp = 2
39 };
40 Q_ENUM(DataChangeTrigger)
41
42 // Same as in QOpcUaMonitoringParameters::DataChangeFilter::DeadbandType
43 enum class DeadbandType {
44 None = 0,
45 Absolute = 1,
46 Percent = 2
47 };
48 Q_ENUM(DeadbandType)
49
50 explicit OpcUaDataChangeFilter(QObject *parent = nullptr);
51 OpcUaDataChangeFilter(const OpcUaDataChangeFilter &);
52 OpcUaDataChangeFilter &operator=(const OpcUaDataChangeFilter &);
53 bool operator==(const OpcUaDataChangeFilter &) const;
54 ~OpcUaDataChangeFilter();
55
56 DataChangeTrigger trigger() const;
57 DeadbandType deadbandType() const;
58 double deadbandValue() const;
59
60 const QOpcUaMonitoringParameters::DataChangeFilter &filter() const;
61
62signals:
63 void filterChanged();
64
65public slots:
66 void setTrigger(DataChangeTrigger trigger);
67 void setDeadbandType(DeadbandType deadbandType);
68 void setDeadbandValue(double deadbandValue);
69
70private:
71 QOpcUaMonitoringParameters::DataChangeFilter m_filter;
72};
73
74QT_END_NAMESPACE
75
76#endif // OPCUADATACHANGEFILTER_P_H
77

source code of qtopcua/src/declarative_opcua/opcuadatachangefilter_p.h