1#ifndef H_EXTENSIONS_CUTEHMI_MODBUS_4_INCLUDE_CUTEHMI_MODBUS_INTERNAL_QTSERVERMIXIN_HPP
2#define H_EXTENSIONS_CUTEHMI_MODBUS_4_INCLUDE_CUTEHMI_MODBUS_INTERNAL_QTSERVERMIXIN_HPP
8#include <QModbusDataUnitMap>
14template <
typename DERIVED>
18 bool setMap(
const QModbusDataUnitMap & map);
25 const DERIVED & derived()
const;
30template <
typename DERIVED>
40template<
typename DERIVED>
50 for (quint16 index = 0, address =
static_cast<quint16
>(newData->
startAddress()); index < static_cast<quint16>(newData->
valueCount()); index++, address++) {
54 newData->
setValue(
static_cast<int>(index), derived().m->coilData->value(address)->value());
59 for (quint16 index = 0, address =
static_cast<quint16
>(newData->
startAddress()); index < static_cast<quint16>(newData->
valueCount()); index++, address++) {
63 newData->
setValue(
static_cast<int>(index), derived().m->discreteInputData->value(address)->value());
68 for (quint16 index = 0, address =
static_cast<quint16
>(newData->
startAddress()); index < static_cast<quint16>(newData->
valueCount()); index++, address++) {
72 newData->
setValue(
static_cast<int>(index), derived().m->holdingRegisterData->value(address)->value());
77 for (quint16 index = 0, address =
static_cast<quint16
>(newData->
startAddress()); index < static_cast<quint16>(newData->
valueCount()); index++, address++) {
81 newData->
setValue(
static_cast<int>(index), derived().m->inputRegisterData->value(address)->value());
93template<
typename DERIVED>
103 for (quint16 index = 0, address =
static_cast<quint16
>(newData.
startAddress()); index < static_cast<quint16>(newData.
valueCount()); index++, address++) {
107 derived().m->coilData->value(address)->setValue(
static_cast<bool>(newData.
value(
static_cast<int>(index))));
112 for (quint16 index = 0, address =
static_cast<quint16
>(newData.
startAddress()); index <
static_cast<quint16
>(newData.
valueCount()); index++, address++) {
116 derived().m->discreteInputData->value(address)->setValue(
static_cast<bool>(newData.
value(
static_cast<int>(index))));
121 for (quint16 index = 0, address =
static_cast<quint16
>(newData.
startAddress()); index <
static_cast<quint16
>(newData.
valueCount()); index++, address++) {
125 derived().m->holdingRegisterData->value(address)->setValue(newData.
value(
static_cast<int>(index)));
130 for (quint16 index = 0, address =
static_cast<quint16
>(newData.
startAddress()); index <
static_cast<quint16
>(newData.
valueCount()); index++, address++) {
134 derived().m->inputRegisterData->value(address)->setValue(newData.
value(
static_cast<int>(index)));
161template <
typename DERIVED>
164 return static_cast<const DERIVED &
>(*this);
167template <
typename DERIVED>
168DERIVED & QtServerMixin<DERIVED>::derived()
170 return static_cast<DERIVED &
>(*this);
Definition: QtServerMixin.hpp:16
bool setMap(const QModbusDataUnitMap &map)
Definition: QtServerMixin.hpp:31
bool readData(QModbusDataUnit *newData) const
Definition: QtServerMixin.hpp:41
bool writeData(const QModbusDataUnit &newData)
Definition: QtServerMixin.hpp:94
#define CUTEHMI_WARNING(EXPR)
QModbusDataUnit::RegisterType registerType() const const
void setValue(int index, quint16 value)
int startAddress() const const
quint16 value(int index) const const
uint valueCount() const const