#ifndef SFTPSERVERMANAGER_H
#define SFTPSERVERMANAGER_H

#include <QObject>
#include <QProcess>
#include <QTimer>

//#define USE_SCP
#define SFTP_PROCESS_TIMEOUT 60000 //60s -- Le délai typique est de 45 secondes pour compléter le transfert.

class CSFTPServerManager : public QObject
{
    Q_OBJECT
public:
    CSFTPServerManager();

        ~CSFTPServerManager();
    int InitFTPServerManager(bool EnableSFTPClient, QString SFTPLogin, QString SFTPPassword, QString SFTPServerAddress, QString SFTPRemoteDir, QString FilenamePrefix, bool CopyEngLog);
    int TransferTrainLogToSFTPServer(QString Filename, bool Detection);

private:
    bool mEnableSFTPClient;
    QString mSFTPLogin;
    QString mSFTPPassword;
    QString mSFTPServerAddress;
    QString mSFTPRemoteDir;
    QString mFilenamePrefix;
    bool mCopyEngLog;


    QProcess *mTransferProcess;
    QTimer *mProcessTimer;

public slots:
    void NewTrainFileSaved(QString,bool);
    void ProcessTimerExpired();
    void ProcessFinished(int ExitCode, QProcess::ExitStatus ExitStatus);

};

#endif // SFTPSERVERMANAGER_H
