CuteHMI - Modbus (CuteHMI.Modbus.4)
DummyClient.hpp
1#ifndef H_EXTENSIONS_CUTEHMI_MODBUS_4_INCLUDE_CUTEHMI_MODBUS_DUMMYCLIENT_HPP
2#define H_EXTENSIONS_CUTEHMI_MODBUS_4_INCLUDE_CUTEHMI_MODBUS_DUMMYCLIENT_HPP
3
4#include "internal/common.hpp"
5#include "internal/DummyClientConfig.hpp"
6#include "internal/DummyClientBackend.hpp"
7#include "internal/PollingIterator.hpp"
8#include "AbstractClient.hpp"
9
10#include <QThread>
11#include <QQmlEngine>
12
13#include <vector>
14
15namespace cutehmi {
16namespace modbus {
17
24class CUTEHMI_MODBUS_API DummyClient:
26{
27 Q_OBJECT
28 QML_NAMED_ELEMENT(DummyClient)
29
30 public:
31 static constexpr int INITIAL_OPEN_LATENCY = internal::DummyClientConfig::INITIAL_OPEN_LATENCY;
32 static constexpr int INITIAL_CLOSE_LATENCY = internal::DummyClientConfig::INITIAL_CLOSE_LATENCY;
33 static constexpr int INITIAL_LATENCY = internal::DummyClientConfig::INITIAL_LATENCY;
34
35 Q_PROPERTY(int connectLatency READ connectLatency WRITE setConnectLatency NOTIFY connectLatencyChanged)
36 Q_PROPERTY(int disconnectLatency READ disconnectLatency WRITE setDisconnectLatency NOTIFY disconnectLatencyChanged)
37 Q_PROPERTY(int latency READ latency WRITE setLatency NOTIFY latencyChanged)
38
39 DummyClient(QObject * parent = nullptr);
40
41 ~DummyClient() override;
42
43 int connectLatency() const;
44
45 void setConnectLatency(int connectLatency);
46
47 int disconnectLatency() const;
48
49 void setDisconnectLatency(int disconnectLatency);
50
51 int latency() const;
52
53 void setLatency(int latency);
54
55 int timeout() const override;
56
57 void setTimeout(int timeout) override;
58
59 public slots:
60 void open() override;
61
62 void close() override;
63
64 signals:
66
68
70
71 private:
72 struct Members {
75 QThread thread;
76
77 Members():
78 backend(& config)
79 {
80 }
81 };
82
84};
85
86}
87}
88
89#endif
90
91//(c)C: Copyright © 2022, Michał Policht <michal@policht.pl>. All rights reserved.
92//(c)C: SPDX-License-Identifier: LGPL-3.0-or-later OR MIT
93//(c)C: This file is a part of CuteHMI.
94//(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
95//(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
96//(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
97//(c)C: Additionally, this file is licensed under terms of MIT license as expressed below.
98//(c)C: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
99//(c)C: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
100//(c)C: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Abstract client.
Definition: AbstractClient.hpp:32
Dummy client.
Definition: DummyClient.hpp:26
Definition: DummyClientBackend.hpp:14
Definition: DummyClientConfig.hpp:15
static constexpr int INITIAL_LATENCY
Definition: DummyClientConfig.hpp:21
static constexpr int INITIAL_CLOSE_LATENCY
Definition: DummyClientConfig.hpp:20
static constexpr int INITIAL_OPEN_LATENCY
Definition: DummyClientConfig.hpp:19