1#ifndef H_EXTENSIONS_CUTEHMI_MODBUS_4_INCLUDE_CUTEHMI_MODBUS_ABSTRACTCLIENT_HPP
2#define H_EXTENSIONS_CUTEHMI_MODBUS_4_INCLUDE_CUTEHMI_MODBUS_ABSTRACTCLIENT_HPP
4#include "AbstractDevice.hpp"
6#include "internal/PollingIterator.hpp"
35 QML_UNCREATABLE(
"AbstractClient is an abstract class")
38 static constexpr int INITIAL_POLLING_INTERVAL = 250;
40 static constexpr int INITIAL_POLLING_TASK_INTERVAL = 10;
42 static constexpr int INITIAL_REQUEST_INTERVAL = 5;
47 Q_PROPERTY(
int pollingInterval READ pollingInterval WRITE setPollingInterval NOTIFY pollingIntervalChanged)
53 Q_PROPERTY(
int pollingTaskInterval READ pollingTaskInterval WRITE setPollingTaskInterval NOTIFY pollingTaskIntervalChanged)
66 Q_PROPERTY(
int requestInterval READ requestInterval WRITE setRequestInterval NOTIFY requestIntervalChanged)
71 Q_PROPERTY(
int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged STORED
false)
73 int pollingInterval()
const;
75 void setPollingInterval(
int interval);
77 int pollingTaskInterval()
const;
79 void setPollingTaskInterval(
int interval);
81 int requestInterval()
const;
83 void setRequestInterval(
int interval);
123 void handleRequest(
const QJsonObject & request)
override;
128 virtual void onStateChanged();
146 void dequeueRequest();
154 int pollingTaskInterval;
156 qint64 lastProcessRequestTimestamp;
157 QTimer requestDequeueTimer;
161 pollingIterator(device),
162 pollingInterval(INITIAL_POLLING_INTERVAL),
163 pollingTaskInterval(INITIAL_POLLING_TASK_INTERVAL),
164 requestInterval(INITIAL_REQUEST_INTERVAL),
165 lastProcessRequestTimestamp(0)
Abstract client.
Definition: AbstractClient.hpp:32
virtual int timeout() const =0
Q_SIGNAL void requestAccepted(QJsonObject request)
void pollingIntervalChanged()
void pollingTaskIntervalChanged()
Q_SIGNAL void pollingRequested()
virtual void setTimeout(int timeout)=0
Q_SIGNAL void pollingTaskFinished()
Q_SIGNAL void pollingFinished()
void requestIntervalChanged()
Q_SIGNAL void pollingTaskRequested()
Abstract Modbus device.
Definition: AbstractDevice.hpp:38
Definition: PollingIterator.hpp:18