ZT/sources/Modbus/ModbusSEIMgr.h
2019-09-19 14:13:48 -04:00

51 lines
1.2 KiB
C++

#ifndef CMODBUSSEIMGR_H
#define CMODBUSSEIMGR_H
#include <QObject>
#include "ModbusBackend.h"
#include <QTimer>
#include <QElapsedTimer>
#include <QHostAddress>
class CModbusSEIMgr : public CModbusBackend
{
Q_OBJECT
public:
explicit CModbusSEIMgr(CModbusRepository *Repo, QHostAddress ServerIP, int ModbusPort, int DevID);
~CModbusSEIMgr();
int ConnectToSlave(QHostAddress SlaveIP, int SlavePort);
int DisconnectFromSlave();
int ReadModbusRegisters();
int StartSEICommunication();
int SEISettingsChanged(QHostAddress ServerIP, int ModbusPort, int DevID);
virtual void RegistersDatabaseUpdated(quint16 StartAddress, quint16 Length);
virtual void ModbusResponseException(quint8 ExceptionCode, quint8 FctCode);
QTimer *mConnectionTimer;
QTimer *mSEIWatchdogTimer;
QElapsedTimer mConnectionTimeout;
private:
int mModbusPort;
QHostAddress mSEIIPAddress;
signals:
void ModbusMasterConnected(qint32 LocalIP, qint32 RemoteIP);
void ModbusMasterDisconnected();
void ModbusMasterRepositoryUpdated();
public slots:
void SocketConnected();
void SocketDisconnected();
void ConnectionTimerExpired();
};
#endif // CMODBUSSEIMGR_H