1#ifndef H_EXTENSIONS_CUTEHMI_MODBUS_4_INCLUDE_CUTEHMI_MODBUS_REGISTER16CONTROLLER_HPP
2#define H_EXTENSIONS_CUTEHMI_MODBUS_4_INCLUDE_CUTEHMI_MODBUS_REGISTER16CONTROLLER_HPP
4#include "internal/common.hpp"
5#include "internal/RegisterControllerMixin.hpp"
6#include "Register16.hpp"
7#include "AbstractRegisterController.hpp"
24 QML_UNCREATABLE(
"Register16Controller is an abstract class")
36 static constexpr qreal INITIAL_VALUE = 0.0;
37 static constexpr qreal INITIAL_VALUE_SCALE = 1.0;
38 static constexpr
Encoding INITIAL_ENCODING = UINT16;
40 Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged)
41 Q_PROPERTY(qreal valueScale READ valueScale WRITE setValueScale NOTIFY valueScaleChanged)
42 Q_PROPERTY(
Encoding encoding READ encoding WRITE setEncoding NOTIFY encodingChanged)
50 void setValue(qreal value);
52 qreal valueScale() const;
54 void setValueScale(qreal valueScale);
68 void valueScaleChanged();
70 void encodingChanged();
83 virtual
void requestWriteRegister(quint16 address, quint16 value,
QUuid * requestId) const = 0;
85 virtual
Register16 * registerAt(quint16 address) const = 0;
89 quint16 bytes() const override;
91 void onDeviceDestroyed() override;
101 void updateValue(quint16 value);
105 static qreal Decode(quint16 value,
Encoding encoding);
107 static quint16 Encode(qreal value,
Encoding encoding);
109 static
bool ValidateEncoding(qreal value,
Encoding encoding);
111 void requestWrite(qreal value);
113 bool verifyRegisterValue() const;
121 bool postponedWritePending;
123 qreal requestedValue;
129 value(INITIAL_VALUE),
130 valueScale(INITIAL_VALUE_SCALE),
131 encoding(INITIAL_ENCODING),
132 postponedWritePending(
false),
133 adjustingValue(
false),
Abstract Modbus device.
Definition: AbstractDevice.hpp:38
Abstract register controller.
Definition: AbstractRegisterController.hpp:20
Register controller for 16 bit registers.
Definition: Register16Controller.hpp:21
Encoding
Definition: Register16Controller.hpp:30
@ INT16
Definition: Register16Controller.hpp:31
Cached properties of 16 bit register.
Definition: Register16.hpp:15
Definition: RegisterControllerMixin.hpp:18