#ifndef TCPCLIENT_H
#define TCPCLIENT_H

#include <QObject>
#include <QTcpSocket>
#include <QHostAddress>
#include <QDataStream>
#include <QTcpServer>
#include <QFile>
#include <QCoreApplication>
#include "Core\recognizesystem.h"
#include "Core\tools.h"
#include "Core\updatecontroller.h"
#include "Core\externalexecuter.h"

class UpdateController;
class RecognizeSystem;

class TCPClient : public QObject
{
    Q_OBJECT


public:
    explicit TCPClient(QObject *parent = 0);
    void Initialize(RecognizeSystem *recognize,ExternalExecuter *externalExecuter);
    void SetConnect(ServerSettings *serverSettings);
    void SendClientAutorization();
    void SendFile();
    void SetDisconnect();
    void WaitWrites();
    void WaitRead(int time);
    QTcpSocket* GetSocket();
    ~TCPClient();

signals:
    void onSendDebugLog(QString message);
    void Recognize(QTcpSocket *socket);
    void ConnectionState(bool flag);

public slots:
    void MessageEntered(QString message);

private slots:
    void onReadyRead();

private:
    QTcpSocket *socket;
    RecognizeSystem *recognizeSystem;
    ExternalExecuter * externalExecuter;
};

#endif // TCPCLIENT_H
