#ifndef CMODBUSZTMASTER_H
#define CMODBUSZTMASTER_H

#include <QObject>
#include "ModbusBackend.h"




class CModbusZTMaster : public CModbusBackend
{
    Q_OBJECT
public:
    explicit CModbusZTMaster(CModbusRepository *Repo);
    ~CModbusZTMaster();

    int ConnectToSlave(QString SlaveIP, int SlavePort);
    int DisconnectFromSlave();
    int ReadModbusRegisters();
    int SendModbusRegisters();

    virtual void RegistersDatabaseUpdated(quint16 StartAddress, quint16 Length);
    virtual void ModbusResponseException(quint8 ExceptionCode, quint8 FctCode);
    
signals:
    void ModbusMasterConnected(CModbusZTMaster *);
    void ModbusMasterDisconnected(CModbusZTMaster *);
    void ModbusMasterRepositoryUpdated();
    void ModbusTransaction();

public slots:
    void SocketConnected();
    void SocketDisconnected();
};

#endif // CMODBUSZTMASTER_H
