#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 "sendsystem.h"
#include "Datas.h"


class RecognizeSystem;
class SendSystem;

class TCPClient : public QObject
{
    Q_OBJECT


public:
    explicit TCPClient(QObject *parent = 0);
    void initialize(RecognizeSystem *recognize,SendSystem *sendSystem);
    void setConnect(ServerSettings *serverSettings);
    void setDisconnect();

    void waitRead(int time);
    QTcpSocket* getSocket();
    ~TCPClient();

    bool getIsConnected() const;

signals:
    void sigSendDebugLog(QString message);
    void sigRecognize(QTcpSocket *socket);
    void sigServerDisconnect();
    void sigConnectionState(bool flag);
    void sigSetSocket(QTcpSocket *socket);

    void signal_ConnectedToServer(bool state);

public slots:
    void slotSendCommand(QString message);
    void slotConnectNotify();

private slots:
    void slotReadyRead();


private:
    SendSystem *sendSystem;
    QTcpSocket *socket;
    RecognizeSystem *recognizeSystem;
    bool isConnected;    
};

#endif // TCPCLIENT_H
