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 <private/opcuadatachangefilter_p.h> |
5 | |
6 | QT_BEGIN_NAMESPACE |
7 | |
8 | OpcUaDataChangeFilter::OpcUaDataChangeFilter(QObject *parent) |
9 | : QObject(parent) |
10 | { |
11 | |
12 | } |
13 | |
14 | OpcUaDataChangeFilter::OpcUaDataChangeFilter(const OpcUaDataChangeFilter &other) |
15 | : QObject(nullptr) |
16 | , m_filter(other.filter()) |
17 | { |
18 | } |
19 | |
20 | OpcUaDataChangeFilter::~OpcUaDataChangeFilter() = default; |
21 | |
22 | OpcUaDataChangeFilter &OpcUaDataChangeFilter::operator=(const OpcUaDataChangeFilter &other) |
23 | { |
24 | m_filter = other.filter(); |
25 | return *this; |
26 | } |
27 | |
28 | bool OpcUaDataChangeFilter::operator==(const OpcUaDataChangeFilter &other) const |
29 | { |
30 | return m_filter == other.filter(); |
31 | } |
32 | |
33 | OpcUaDataChangeFilter::DataChangeTrigger OpcUaDataChangeFilter::trigger() const |
34 | { |
35 | return static_cast<OpcUaDataChangeFilter::DataChangeTrigger>(m_filter.trigger()); |
36 | } |
37 | |
38 | OpcUaDataChangeFilter::DeadbandType OpcUaDataChangeFilter::deadbandType() const |
39 | { |
40 | return static_cast<OpcUaDataChangeFilter::DeadbandType>(m_filter.deadbandType()); |
41 | } |
42 | |
43 | double OpcUaDataChangeFilter::deadbandValue() const |
44 | { |
45 | return m_filter.deadbandValue(); |
46 | } |
47 | |
48 | const QOpcUaMonitoringParameters::DataChangeFilter &OpcUaDataChangeFilter::filter() const |
49 | { |
50 | return m_filter; |
51 | } |
52 | |
53 | void OpcUaDataChangeFilter::setTrigger(DataChangeTrigger trigger) |
54 | { |
55 | const auto newValue = static_cast<QOpcUaMonitoringParameters::DataChangeFilter::DataChangeTrigger>(trigger); |
56 | |
57 | if (m_filter.trigger() == newValue) |
58 | return; |
59 | m_filter.setTrigger(newValue); |
60 | emit filterChanged(); |
61 | } |
62 | |
63 | void OpcUaDataChangeFilter::setDeadbandType(DeadbandType deadbandType) |
64 | { |
65 | const auto newValue = static_cast<QOpcUaMonitoringParameters::DataChangeFilter::DeadbandType>(deadbandType); |
66 | |
67 | if (m_filter.deadbandType() == newValue) |
68 | return; |
69 | m_filter.setDeadbandType(newValue); |
70 | emit filterChanged(); |
71 | } |
72 | |
73 | void OpcUaDataChangeFilter::setDeadbandValue(double deadbandValue) |
74 | { |
75 | if (deadbandValue == m_filter.deadbandValue()) |
76 | return; |
77 | m_filter.setDeadbandValue(deadbandValue); |
78 | emit filterChanged(); |
79 | } |
80 | |
81 | QT_END_NAMESPACE |
82 |