#ifndef MASTERCTRLINTERFACE_H
#define MASTERCTRLINTERFACE_H
#include <QObject>
#include "NetworkProtocol.h"
#include "GlobalDefine.h"
#include "ProtocolDefs.h"
#include <QTcpSocket>
#include "SMSMessage.h"
#include <QTimer>

class CMasterCtrlInterface : public QObject, public CNetworkProtocol
{
    Q_OBJECT

public:
    CMasterCtrlInterface();


    QTcpSocket *mNetworkCommSocket;
    int mDeviceAddress;
    int mNetworkPort;
    QString mMasterCtrlIPAddress;
    int mMyDeviceID;
    QTimer mMasterReconnectTimer;

    int ConnectToMasterCtrl();
    int DisconnectMasterCtrl();
    int SendMasterCtrlCommand(unsigned char MessageID, QByteArray Data);
    virtual int NewFrameReceived(int TargetDeviceID, int TargetDeviceAddress, int SenderID, int SenderAddress, int MessageID, int DataSize, QByteArray Data);

    virtual int DeviceFrameReceived(int TargetDeviceID, int TargetDeviceAddress, int SenderID, int SenderAddress, int MessageID, int DataSize, QByteArray Data) = 0;
    virtual int DeviceConnectedToMaster(bool Connected = true) = 0;




public slots:
    void NetworkSocketConnected();
    void NetworkSocketDataAvailable();
    void NetworkSocketDisconnected();
    void NetworkReconnectTimerExpired();

};

#endif // MASTERCTRLINTERFACE_H
