ZT/sources/NetDriveMgr.h

73 lines
1.7 KiB
C++

#ifndef NETDRIVEMGR_H
#define NETDRIVEMGR_H
#include <QObject>
#include <QProcess>
#include <QTimer>
enum eNetworkDriveSMStates
{
NET_DRIVE_STANDBY_STATE,
NET_DRIVE_TRANSFERRING_TRAIN_LOG_STATE,
NET_DRIVE_TRANSFERRING_ZT_LOG_STATE,
NET_DRIVE_TRASFERRING_MISC_FILE_STATE,
NET_DRIVE_MOUNTING_STATE,
NET_DRIVE_RETRY_MOUNTING_STATE,
NET_DRIVE_MAX_STATE
};
enum eNetworkDriveSMEvents
{
NET_DRIVE_SM_PROCESS_TIMER_EXPIRED_EVENT,
NET_DRIVE_SM_PROCESS_FINISHED_EVENT,
NET_DRIVE_SM_MAX_EVENT
};
#define NAS_MOUNT_POINT "/home/zonetest/ZT/NetDrive"
#define PROCESS_TIMEOUT 10000 //ms
#define MOUNT_TIMEOUT 10000
class CNetDriveMgr : public QObject
{
Q_OBJECT
public:
explicit CNetDriveMgr(QObject *parent = 0);
~CNetDriveMgr();
bool IsNetworkDriveMounted();
bool IsNetworkDriveAvailable();
int CopyFileToNetworkDrive(QString FilePath);
int TransferTrainLogToNetDrive(QString NewLogFileName);
int TransferZTLogToNetDrive();
int InitNetDriveMgr(bool Enabled,QString RemoteAccessPath, QString RemoteLogin, QString RemotePwd, QString RemoteDomain, QString FilenamePrefix);
int MountNetworkDrive();
int UnMountNetworkDrive();
int NetworkDriveStateMachine(int Event);
private:
QString mRemoteDriveAccessPath;
QString mRemoteDriveLogin;
QString mRemoteDrivePassword;
QString mRemoteDriveDomain;
QString mNASMountPath;
QString mFilesPrefix;
int mNetDriveSMState;
QProcess *mTransferProcess;
QTimer *mProcessTimer;
bool mIsNetDriveEnabled;
signals:
public slots:
void ProcessExecTimerExpired();
void ProcessFinished( int exitCode, QProcess::ExitStatus exitStatus);
void NewTrainFileSaved(QString filename);
};
#endif // NETDRIVEMGR_H