1 #ifndef H_EXTENSIONS_CUTEHMI_MODBUS_2_INCLUDE_CUTEHMI_MODBUS_INTERNAL_QTCLIENTBACKEND_HPP
2 #define H_EXTENSIONS_CUTEHMI_MODBUS_2_INCLUDE_CUTEHMI_MODBUS_INTERNAL_QTCLIENTBACKEND_HPP
6 #include "AbstractClientBackend.hpp"
10 #include <QModbusClient>
32 virtual int slaveAddress()
const = 0;
34 virtual void configureConnection() = 0;
38 bool proceedRequest(
QUuid requestId)
override;
40 void readCoils(
QUuid requestId, quint16 startAddress, quint16 endAddress)
override;
42 void writeCoil(
QUuid requestId, quint16 address,
bool value)
override;
44 void writeMultipleCoils(
QUuid requestId, quint16 startAddress,
const QVector<quint16> & values)
override;
46 void readDiscreteInputs(
QUuid requestId, quint16 startAddress, quint16 endAddress)
override;
48 void readHoldingRegisters(
QUuid requestId, quint16 startAddress, quint16 endAddress)
override;
50 void writeHoldingRegister(
QUuid requestId, quint16 address, quint16 value)
override;
52 void writeMultipleHoldingRegisters(
QUuid requestId, quint16 startAddress,
const QVector<quint16> & values)
override;
54 void readInputRegisters(
QUuid requestId, quint16 startAddress, quint16 endAddress)
override;
56 void readExceptionStatus(
QUuid requestId)
override;
60 void fetchCommEventCounter(
QUuid requestId)
override;
62 void fetchCommEventLog(
QUuid requestId)
override;
64 void reportSlaveId(
QUuid requestId)
override;
66 void readFileRecord(
QUuid requestId, quint8 byteCount,
QJsonArray subrequests)
override;
68 void writeFileRecord(
QUuid requestId, quint8 byteCount,
QJsonArray subrequests)
override;
70 void maskWriteHoldingRegister(
QUuid requestId, quint16 address, quint16 andMask, quint16 orMask)
override;
72 void readWriteMultipleHoldingRegisters(
QUuid requestId, quint16 readStartAddress, quint16 readEndAddress, quint16 writeAddress,
const QVector<quint16> & values)
override;
74 void readFIFOQueue(
QUuid requestId, quint16 address)
override;
79 void close()
override;
82 void onStateChanged(QModbusDevice::State state);
84 void onErrorOccurred(QModbusDevice::Error error);
100 void pushByte(uchar
byte, uchar *& destination);
107 void pushWord(uint word, uchar *& destination);
114 uchar pullByte(
const uchar *& source);
121 uint pullWord(
const uchar *& source);