#ifndef CMODBUSMASTER_H
#define CMODBUSMASTER_H

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




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

    int ConnectToSlave(QString SlaveIP, int SlavePort);
    int DisconnectFromSlave();
    int ReadModbusRegisters();
    int SendAN1ToZT();
    int SendAN2ToZT();
    int SendWatchdog();
    int SendDateTime();
    int SendTrainData();
    int SendZTInhibitionData();

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

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

#endif // CMODBUSMASTER_H
