diff --git a/Configuration/ZT.cfg b/Configuration/ZT.cfg index 2ec85a7..5d8b20b 100644 --- a/Configuration/ZT.cfg +++ b/Configuration/ZT.cfg @@ -63,6 +63,22 @@ MODBUS_SEI_DEVID=1 #Port Modbus/TCP MODBUS_SEI_PORT=502 +#---------------------------------- +#Paramètres du dossier partagé sur le réseau pour la copie des fichiers logs +#Path du dossier cible sur le réseau +NETWORK_SHARE_PATH=//192.168.50.110/TestZT +#Login pour accéder au drive +NETWORK_SHALRE_LOGIN=JF +#Mot de passe pour accéder au drive +NETWORK_SHARE_PASSWORD=signal77240 + +#Path du dossier cible sur le réseau +#NETWORK_SHARE_PATH=//ca01-sdg-fs03.metro.local/vers_corpo/CT +#Login pour accéder au drive +#NETWORK_SHALRE_LOGIN=service.controle_train +#Mot de passe pour accéder au drive +#NETWORK_SHARE_PASSWORD=SigN4lisat1On!77240?TraNsf3Rt@ + #---------------------------------- #Changer cette valeur à OUI ou NON pour activer le @@ -80,9 +96,9 @@ ENGLOG=3 #Une seule station doit être sélectionnée #STATION=HONORE_BEAUGRAND -#STATION=ANGRIGNON +STATION=ANGRIGNON #STATION=HENRI_BOURASSA -STATION=COTE_VERTU +#STATION=COTE_VERTU #STATION=BERRI_UQAM #STATION=LONGUEIL #STATION=SAINT_MICHEL diff --git a/Configuration/ZTSettings.ztc b/Configuration/ZTSettings.ztc index 12aa062..836c945 100644 Binary files a/Configuration/ZTSettings.ztc and b/Configuration/ZTSettings.ztc differ diff --git a/ZT.pro b/ZT.pro index c0e9791..c6afee6 100644 --- a/ZT.pro +++ b/ZT.pro @@ -120,7 +120,8 @@ SOURCES += \ sources/Modbus/NetworkCfgMgr.cpp \ sources/Modbus/ModbusSEIMgr.cpp \ sources/GuiElements/SEISettingsPage.cpp \ - sources/GuiElements/ModbusDisplayPage.cpp + sources/GuiElements/ModbusDisplayPage.cpp \ + sources/NetDriveMgr.cpp HEADERS += \ sources/MainPanel.h \ @@ -241,7 +242,8 @@ HEADERS += \ sources/Modbus/ModbusSEIMgr.h \ sources/Modbus/ModbusSEIDefs.h \ sources/GuiElements/SEISettingsPage.h \ - sources/GuiElements/ModbusDisplayPage.h + sources/GuiElements/ModbusDisplayPage.h \ + sources/NetDriveMgr.h #QMAKE_LIBDIR += ./ExtLib #QT += network diff --git a/sources/GuiElements/EngineeringPage.cpp b/sources/GuiElements/EngineeringPage.cpp index 48951d8..430c5f6 100644 --- a/sources/GuiElements/EngineeringPage.cpp +++ b/sources/GuiElements/EngineeringPage.cpp @@ -46,6 +46,7 @@ #include #include #include "RamMonitor.h" + //#include CEngineeringPage::~CEngineeringPage() diff --git a/sources/GuiElements/EthConnWidget.cpp b/sources/GuiElements/EthConnWidget.cpp index 064b4c1..561cfd5 100644 --- a/sources/GuiElements/EthConnWidget.cpp +++ b/sources/GuiElements/EthConnWidget.cpp @@ -10,7 +10,8 @@ *******************************************************************************/ /* Description: - Affiche un bitmap d'une DEL verte (allumée ou éteinte). + Affiche un bitmap d'une prise verte lorsque la connexion est etablie ou + rouge lorsque la connexion est rompue. */ diff --git a/sources/GuiElements/LogsListPage.cpp b/sources/GuiElements/LogsListPage.cpp index c1cbda7..fdc82da 100644 --- a/sources/GuiElements/LogsListPage.cpp +++ b/sources/GuiElements/LogsListPage.cpp @@ -258,8 +258,9 @@ unsigned int CLogsListPage::DeleteAllFiles() return RET_OK; } -void CLogsListPage::NewTrainLogFileSaved() +void CLogsListPage::NewTrainLogFileSaved(QString Filename) { + Q_UNUSED(Filename) RefreshList(true); } diff --git a/sources/GuiElements/LogsListPage.h b/sources/GuiElements/LogsListPage.h index 75d9faa..f57d328 100644 --- a/sources/GuiElements/LogsListPage.h +++ b/sources/GuiElements/LogsListPage.h @@ -126,7 +126,7 @@ public slots: void LogsArchivingFinished(); // void TableCurItemChanged(QTableWidgetItem*,QTableWidgetItem*); void LogsTableCellSelected(/*int, int*/); - void NewTrainLogFileSaved(); + void NewTrainLogFileSaved(QString); }; diff --git a/sources/NetDriveMgr.cpp b/sources/NetDriveMgr.cpp new file mode 100644 index 0000000..d422f9a --- /dev/null +++ b/sources/NetDriveMgr.cpp @@ -0,0 +1,372 @@ +#include "NetDriveMgr.h" +#include +#include "GlobalDefine.h" +#include + + + +/// sudo mount -t cifs -o domain=TID,user=JF,password=signal77240,vers=2.1 //192.168.50.110/TestZT /home/zonetest/ZT/NetDrive +/// /proc/self/mountinfo +/// /proc/self/mounts +/// /sys/class/net/eth0 +/// + + + + +CNetDriveMgr::CNetDriveMgr(QObject *parent) : + QObject(parent) +{ + mNetDriveSMState = NET_DRIVE_MOUNTING_STATE; + mProcessTimer = new QTimer(); + mProcessTimer->setSingleShot(true); + connect(mProcessTimer,SIGNAL(timeout()),this,SLOT(ProcessExecTimerExpired())); + + mNASMountPath = NAS_MOUNT_POINT; + mNASMountPath.append("/"); + + mTransferProcess = new QProcess(this); + connect(mTransferProcess,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(ProcessFinished(int,QProcess::ExitStatus))); + + mIsNetDriveEnabled = false; +} + +CNetDriveMgr::~CNetDriveMgr() +{ + delete mProcessTimer; + delete mTransferProcess; +} + +bool CNetDriveMgr::IsNetworkDriveAvailable() +{ + bool ret = false; + QFile *SysFile = new QFile("/sys/class/net/eth0/carrier"); + if(SysFile) + { + SysFile->open(QIODevice::ReadOnly | QIODevice::Text | QIODevice::Unbuffered); + QString FileData = QString(SysFile->readAll()); + SysFile->close(); + + if(FileData.isEmpty() == false) + { + if(FileData.left(1) == "1") + { + ret = true; + } + else if(FileData.left(1) == "0") + { + ret = false; + } + else + { + ret = false; + qDebug("CNetDriveMgr: Valeur inatendue dans/sys/class/net/eth0/carrier"); + } + } + } + delete SysFile; + return ret; +} + +bool CNetDriveMgr::IsNetworkDriveMounted() +{ + bool ret = false; + QFile *MountInfo = new QFile("/proc/self/mounts"); + if(MountInfo) + { + MountInfo->open(QIODevice::ReadOnly | QIODevice::Text | QIODevice::Unbuffered); + QString FileData = QString(MountInfo->readAll()); + MountInfo->close(); + + if(FileData.contains(NAS_MOUNT_POINT) == true) + { + ret = true; + } + } + delete MountInfo; + return ret; + +} + +int CNetDriveMgr::CopyFileToNetworkDrive(QString FilePath) +{ + if(mIsNetDriveEnabled == false) + return RET_ERROR; + + return RET_OK; +} + +int CNetDriveMgr::TransferTrainLogToNetDrive(QString NewLogFileName) +{ + if(mIsNetDriveEnabled == false) + return RET_ERROR; + + if(mNetDriveSMState != NET_DRIVE_STANDBY_STATE) + { + return RET_ERROR; + } + + QString DestFilePath = NewLogFileName; + DestFilePath.prepend(mFilesPrefix + "-"); + DestFilePath.prepend(mNASMountPath); + QString OriginFilePath = NewLogFileName; + OriginFilePath.prepend("./Trains/"); + + QString Cmd = QString ("cp -f %1 %2").arg(OriginFilePath).arg(DestFilePath); + + + mTransferProcess->start(Cmd); + mProcessTimer->start(PROCESS_TIMEOUT); //Allow some time to copy the file + mNetDriveSMState = NET_DRIVE_TRANSFERRING_TRAIN_LOG_STATE; + + + return RET_OK; +} + +int CNetDriveMgr::TransferZTLogToNetDrive() +{ + if(mIsNetDriveEnabled == false) + return RET_ERROR; + + + QString DestFileDate = QDate::currentDate().toString("yyyyMMdd"); + QString DestFilePath = QString("%1%2%3_LogZT.txt").arg(mNASMountPath).arg(mFilesPrefix).arg(DestFileDate); + QString OriginFilePath = QString("./LOG/LogZT.txt"); + + QString Cmd = QString ("cp -f %1 %2").arg(OriginFilePath).arg(DestFilePath); + + + mTransferProcess->start(Cmd); + mProcessTimer->start(PROCESS_TIMEOUT); //Allow some time to copy the file + mNetDriveSMState = NET_DRIVE_TRANSFERRING_ZT_LOG_STATE; + return RET_OK; +} + +int CNetDriveMgr::NetworkDriveStateMachine(int Event) +{ + switch(mNetDriveSMState) + { + case NET_DRIVE_STANDBY_STATE: + { + break; + } + case NET_DRIVE_TRANSFERRING_TRAIN_LOG_STATE: + { + switch(Event) + { + case NET_DRIVE_SM_PROCESS_TIMER_EXPIRED_EVENT: + { + //The network drive is stale or disconnected + mTransferProcess->kill(); + mNetDriveSMState = NET_DRIVE_STANDBY_STATE; + qDebug("Failed to transfer train log file to NAS"); + break; + } + case NET_DRIVE_SM_PROCESS_FINISHED_EVENT: + { + mProcessTimer->stop(); + TransferZTLogToNetDrive(); + qDebug("NAS transfer result: %s @ %s",qPrintable(mTransferProcess->readAllStandardOutput()),qPrintable(mTransferProcess->readAllStandardError())); + break; + } + } + + break; + } + case NET_DRIVE_TRANSFERRING_ZT_LOG_STATE: + { + switch(Event) + { + case NET_DRIVE_SM_PROCESS_TIMER_EXPIRED_EVENT: + { + //The network drive is stale or disconnected + mTransferProcess->kill(); + mNetDriveSMState = NET_DRIVE_STANDBY_STATE; + QString("Failed to transfer ZT log file to NAS"); + break; + } + case NET_DRIVE_SM_PROCESS_FINISHED_EVENT: + { + mNetDriveSMState = NET_DRIVE_STANDBY_STATE; + qDebug("NAS transfer result: %s @ %s",qPrintable(mTransferProcess->readAllStandardOutput()),qPrintable(mTransferProcess->readAllStandardError())); + mProcessTimer->stop(); + break; + } + } + break; + } + case NET_DRIVE_TRASFERRING_MISC_FILE_STATE: + { + switch(Event) + { + case NET_DRIVE_SM_PROCESS_TIMER_EXPIRED_EVENT: + { + break; + } + case NET_DRIVE_SM_PROCESS_FINISHED_EVENT: + { + break; + } + } + break; + } + case NET_DRIVE_MOUNTING_STATE: + { + switch(Event) + { + case NET_DRIVE_SM_PROCESS_TIMER_EXPIRED_EVENT: + { + qDebug("Failed to mount network drive within allowed period. Will retry later %s @ %s",qPrintable(mTransferProcess->readAllStandardOutput()),qPrintable(mTransferProcess->readAllStandardError())); + + QString stdout = QString(mTransferProcess->readAllStandardOutput()); + QString stderr = QString(mTransferProcess->readAllStandardError()); + + mTransferProcess->kill(); + mNetDriveSMState = NET_DRIVE_RETRY_MOUNTING_STATE; + + MountNetworkDrive(); + + break; + } + case NET_DRIVE_SM_PROCESS_FINISHED_EVENT: + { + QString StdOut = mTransferProcess->readAllStandardOutput(); + qDebug("%s",qPrintable(StdOut)); + mProcessTimer->stop(); + + if(IsNetworkDriveMounted()) + { + qDebug("Drive mounted successfuly"); + mNetDriveSMState = NET_DRIVE_STANDBY_STATE; + } + else + { + qDebug("Mount command failed: %s @ %s",qPrintable(mTransferProcess->readAllStandardOutput()),qPrintable(mTransferProcess->readAllStandardError())); + mNetDriveSMState = NET_DRIVE_RETRY_MOUNTING_STATE; + mProcessTimer->start(MOUNT_TIMEOUT); + } + + + break; + } + } + break; + } + case NET_DRIVE_RETRY_MOUNTING_STATE: + { + switch(Event) + { + case NET_DRIVE_SM_PROCESS_TIMER_EXPIRED_EVENT: + { + qDebug("Retrying to mount net drive"); + MountNetworkDrive(); + break; + } + case NET_DRIVE_SM_PROCESS_FINISHED_EVENT: + { + //Should not come here... + break; + } + } + break; + } + } + + return RET_OK; +} + + + +void CNetDriveMgr::ProcessFinished(int exitCode, QProcess::ExitStatus exitStatus) +{ + Q_UNUSED(exitCode) + Q_UNUSED(exitStatus) + + qDebug("Process finished %d - %d",exitCode,exitStatus); + NetworkDriveStateMachine(NET_DRIVE_SM_PROCESS_FINISHED_EVENT); + +} + +void CNetDriveMgr::ProcessExecTimerExpired() +{ + NetworkDriveStateMachine(NET_DRIVE_SM_PROCESS_TIMER_EXPIRED_EVENT); +} + +int CNetDriveMgr::InitNetDriveMgr(bool Enabled, QString RemoteAccessPath, QString RemoteLogin, QString RemotePwd, QString RemoteDomain, QString FilenamePrefix) +{ + if(Enabled == false) + { + mIsNetDriveEnabled = false; + return RET_OK; + } + mIsNetDriveEnabled = true; + + mRemoteDriveAccessPath = RemoteAccessPath; + mRemoteDriveLogin = RemoteLogin; + mRemoteDrivePassword = RemotePwd; + mRemoteDriveDomain = RemoteDomain; + mFilesPrefix = FilenamePrefix; + + MountNetworkDrive(); + +} + +int CNetDriveMgr::MountNetworkDrive() +{ + if(mIsNetDriveEnabled == false) + return RET_ERROR; + + if(IsNetworkDriveMounted()) + { + qDebug("Network drive already mounted, aborting mount operation"); + mNetDriveSMState = NET_DRIVE_STANDBY_STATE; + return RET_ERROR; //drive already mounted. + } + + if(IsNetworkDriveAvailable() == false) //Network is disconnected... retry later. + { + qDebug("Network interface not connected. Cannot mount network drive. Will retry later"); + mNetDriveSMState = NET_DRIVE_RETRY_MOUNTING_STATE; + mProcessTimer->start(MOUNT_TIMEOUT); + return RET_ERROR; + } + //sudo mount -t cifs -o domain=TID,user=JF,password=signal77240,vers=2.1 //192.168.50.110/TestZT /home/zonetest/ZT/NetDrive + + qDebug("Trying to mount network drive"); + QString Cmd; + if(mRemoteDriveDomain.isEmpty()) + Cmd = QString("mount -t cifs -o user=%2,password=%3,vers=2.1 %4 %5").arg(mRemoteDriveLogin).arg(mRemoteDrivePassword).arg(mRemoteDriveAccessPath).arg(NAS_MOUNT_POINT); + else + Cmd = QString("mount -t cifs -o domain=%1,user=%2,password=%3,vers=2.1 %4 %5").arg(mRemoteDriveDomain).arg(mRemoteDriveLogin).arg(mRemoteDrivePassword).arg(mRemoteDriveAccessPath).arg(NAS_MOUNT_POINT); + + mTransferProcess->start(Cmd); + mNetDriveSMState = NET_DRIVE_MOUNTING_STATE; + mProcessTimer->start(MOUNT_TIMEOUT); + + return RET_OK; +} + +int CNetDriveMgr::UnMountNetworkDrive() +{ + if(mIsNetDriveEnabled == false) + return RET_ERROR; + + if(IsNetworkDriveMounted() == false) + { + qDebug("Network drive not mounted, aborting unmount operation"); + mNetDriveSMState = NET_DRIVE_MOUNTING_STATE; + return RET_ERROR; //drive already mounted. + } + + QString Cmd = QString("umount %1").arg(NAS_MOUNT_POINT); + QProcess::startDetached(Cmd); + mNetDriveSMState = NET_DRIVE_MOUNTING_STATE; + + return RET_OK; + +} + +void CNetDriveMgr::NewTrainFileSaved(QString filename) +{ + TransferTrainLogToNetDrive(filename); +} diff --git a/sources/NetDriveMgr.h b/sources/NetDriveMgr.h new file mode 100644 index 0000000..58c0a51 --- /dev/null +++ b/sources/NetDriveMgr.h @@ -0,0 +1,72 @@ +#ifndef NETDRIVEMGR_H +#define NETDRIVEMGR_H + +#include +#include +#include + +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 diff --git a/sources/ZTStateMachine.cpp b/sources/ZTStateMachine.cpp index a1625f5..bc4f4e1 100755 --- a/sources/ZTStateMachine.cpp +++ b/sources/ZTStateMachine.cpp @@ -60,6 +60,7 @@ CZTStateMachine::CZTStateMachine(CZoneTest *ZTPtr, QObject *parent) : mLogMgr = 0; mCalibrationPassagesCount = 0; mModbusCCMgr = 0; + //mNetworkDriveMgr = 0; //mExtIOInterface = 0; mNbPassages = 0; @@ -1497,6 +1498,11 @@ void CZTStateMachine::BindModbusCCMgrPtr(CModbusCCMgr *ModbusCCPtr) mModbusCCMgr = ModbusCCPtr; } +//void CZTStateMachine::BindNetworkDrivePtr(CNetDriveMgr *mNetDrivePtr) +//{ +// mNetDrivePtr = mNetDrivePtr; +//} + unsigned int CZTStateMachine::SetPGTreshold(qint32 PGTreshold) { mZT1WorkerThread->SetPGTreshold(PGTreshold); @@ -1702,24 +1708,27 @@ unsigned int CZTStateMachine::DestroyCalibrationData() unsigned int CZTStateMachine::SaveZT1EventsLog(CZT1Log *Log) { - QString FileName1 = "./Trains/LOGZT1_"; + QString FileName1 = "LOGZT1_"; FileName1 += QDateTime::currentDateTime().toString("yyyy-MM-dd-hh-mm-ss-zzz"); QString FileName = FileName1 + ".bin"; + QString FilePath = FileName; + FilePath.prepend("./Trains/"); qDebug("%s",FileName.toAscii().data()); - CTrainLogFileMgr::instance()->SaveTrainLog(FileName,Log,&mZT1DetectionsLog,mZTStationPtr->GetStationTextualName()); - mLogMgr->ParseNewLog(FileName); + CTrainLogFileMgr::instance()->SaveTrainLog(FilePath,Log,&mZT1DetectionsLog,mZTStationPtr->GetStationTextualName()); + mLogMgr->ParseNewLog(FilePath); if(mAutoExportZT1CSV) { - FileName = FileName1 + ".csv"; - CTrainLogFileMgr::instance()->SaveCSVFile(FileName,Log,&mZT1DetectionsLog,mZTStationPtr->GetStationTextualName()); + FilePath = FileName1 + ".csv"; + FilePath.prepend("./Trains/"); + CTrainLogFileMgr::instance()->SaveCSVFile(FilePath,Log,&mZT1DetectionsLog,mZTStationPtr->GetStationTextualName()); } DestroyZT1Log(); - emit NewTrainLogSaved(); + emit NewTrainLogSaved(FileName); return RET_OK; @@ -1727,23 +1736,26 @@ unsigned int CZTStateMachine::SaveZT1EventsLog(CZT1Log *Log) unsigned int CZTStateMachine::SaveZT2EventsLog(CZT2Log *Log) { - QString FileName1 = "./Trains/LOGZT2_"; + QString FileName1 = "LOGZT2_"; FileName1 += QDateTime::currentDateTime().toString("yyyy-MM-dd-hh-mm-ss-zzz"); QString FileName = FileName1 + ".bin"; + QString FilePath = FileName; + FilePath.prepend("./Trains/"); qDebug("%s",FileName.toAscii().data()); - CTrainLogFileMgr::instance()->SaveTrainLog(FileName,Log,&mZT2DetectionsLog,mZTStationPtr->GetStationTextualName()); - mLogMgr->ParseNewLog(FileName); + CTrainLogFileMgr::instance()->SaveTrainLog(FilePath,Log,&mZT2DetectionsLog,mZTStationPtr->GetStationTextualName()); + mLogMgr->ParseNewLog(FilePath); if(mAutoExportZT2CSV) { - FileName = FileName1 + ".csv"; - CTrainLogFileMgr::instance()->SaveCSVFile(FileName,Log,&mZT2DetectionsLog,mZTStationPtr->GetStationTextualName()); + FilePath = FileName1 + ".csv"; + FilePath.prepend("./Trains/"); + CTrainLogFileMgr::instance()->SaveCSVFile(FilePath,Log,&mZT2DetectionsLog,mZTStationPtr->GetStationTextualName()); } DestroyZT2Log(); - emit NewTrainLogSaved(); + emit NewTrainLogSaved(FileName); return RET_OK; diff --git a/sources/ZTStateMachine.h b/sources/ZTStateMachine.h index ee21899..f5f53c7 100644 --- a/sources/ZTStateMachine.h +++ b/sources/ZTStateMachine.h @@ -46,6 +46,7 @@ //#include "ModbusRepository.h" #include "TKTransportInterface.h" #include "ModbusCCMgr.h" +#include "NetDriveMgr.h" #define ZT_SM_DEFAULT_LOG_DELAY 10 //millilseconds @@ -108,6 +109,7 @@ public: unsigned int ZTStateMachine(unsigned int Event, unsigned int SubEvent = 0); //Exécution de la SM principale void BindPointers(CStation *ptr,CInputModule *InputModule,COutputModule *OutputModule,CZTPage *ZTPagePTr,CPCIIOMgr *PCIIOPtr,CAbstractLazerProbe *PGIntProbePtr, CAbstractLazerProbe *PGExtProbePTr,CLogMgr *LogMgr,CTKTransportInterface *TKTransport,CZTSimulator *ZTSimPtr = 0,CAnalogInputModule *DataQInterface = 0); //Assignation de pointeurs void BindModbusCCMgrPtr(CModbusCCMgr *ModbusCCPtr); + // void BindNetworkDrivePtr(CNetDriveMgr *mNetDrivePtr); CZTDetectionFunctionConfig *mZTDetectionConfig; CTKGenerator *mTKGenerator; //pointeur vers la classe qui gère les alarmes au PCC @@ -178,6 +180,7 @@ private: CInputModule *mInputModule; // CModbusRepository *mCCModbusRepo; CModbusCCMgr *mModbusCCMgr; + // CNetDriveMgr *mNetworkDriveMgr; CPCIIOMgr *mPCIIOPtr; @@ -231,7 +234,7 @@ signals: void PGCalibrationFinished(int); //Signal envoyé lorsque la calibration est terminée. Le paramètre est la valeur calculée. void PGCalibrationStatus(int,int); //Signal envoyé pour informer de l'état de la calibration. Le paramètre 1 est le nombre de passages à date et le 2è est le nombre requis. void MaintenancePPActivated(unsigned int); //Signal envoyé à la page d'entretien pour indiquer qu'une pédale PP a été activée. - void NewTrainLogSaved(); //Signal envoyé pour notifier l'interface graphique qu'un nouveau fichier de passage a été sauvegardé. + void NewTrainLogSaved(QString Filename); //Signal envoyé pour notifier l'interface graphique qu'un nouveau fichier de passage a été sauvegardé. public slots: diff --git a/sources/ZTVersion.h b/sources/ZTVersion.h index 033b6ea..19595ae 100755 --- a/sources/ZTVersion.h +++ b/sources/ZTVersion.h @@ -29,9 +29,12 @@ #ifndef ZTVERSION_H #define ZTVERSION_H -#define ZT_SOFT_VERSION "V1.24" +#define ZT_SOFT_VERSION "V1.25" //LOG DES CHANGEMENTS +//Version 1.25 +//-Ajout de la fonctionnalité de transfert des fichiers de passage sur le réseau + //Version 1.24 //-Changements à la station Côte-Vertu pour la nouvelle configuration de la ZT. //-Correction d'un petit bug qui ne permettait pas d'avoir le bon itinéraire dans les diff --git a/sources/Zonetest.cpp b/sources/Zonetest.cpp index 29faf3a..bb70e4a 100644 --- a/sources/Zonetest.cpp +++ b/sources/Zonetest.cpp @@ -288,7 +288,9 @@ unsigned int CZoneTest::Start() // mEventMgr->UpdateEvents(mZTSettings->mDetectionFunctionSettings); mZTStateMachine->mZTDetectionConfig = mZTSettings->mDetectionFunctionSettings; - connect(mZTStateMachine,SIGNAL(NewTrainLogSaved()),panel.mLogsListPage,SLOT(NewTrainLogFileSaved())); + connect(mZTStateMachine,SIGNAL(NewTrainLogSaved(QString)),panel.mLogsListPage,SLOT(NewTrainLogFileSaved(QString))); + + connect(mZTStateMachine,SIGNAL(NewTrainLogSaved(QString)),&mNetworkDriveMgr,SLOT(NewTrainFileSaved(QString))); CZTLog::instance()->mProgramHandle = this; @@ -640,6 +642,7 @@ unsigned int CZoneTest::InitZT() panel.mZTMainPage->mZT2Stats->Init(true); + mNetworkDriveMgr.InitNetDriveMgr(true,"//192.168.50.110/TestZT","JF","signal77240","",mZTStation->GetStationShortName()); @@ -652,6 +655,7 @@ unsigned int CZoneTest::InitZT() TransportInterface->BindPointers(mZTStation->GetOutputMasks(),mExtIOWorkerThread); panel.mZTMainPage->mZT1Stats->Init(false); panel.mZTMainPage->mZT2Stats->Init(false); + mNetworkDriveMgr.InitNetDriveMgr(false,"","","","",""); } connect(mTKTransportInterface,SIGNAL(TKOutputStatesChanged(bool,bool)),panel.mMaintenancePage,SLOT(TKOutputChanged(bool,bool))); diff --git a/sources/Zonetest.h b/sources/Zonetest.h index 649cb26..d988516 100644 --- a/sources/Zonetest.h +++ b/sources/Zonetest.h @@ -59,6 +59,7 @@ #include "ModbusCCMgr.h" #include "ModbusSEIMgr.h" #include "NetworkCfgMgr.h" +#include "NetDriveMgr.h" #include "TCPProtocol.h" @@ -201,6 +202,7 @@ private: CModbusCCMgr *mModbusCCMgr; CModbusSEIMgr *mModbusSEIMgr; CNetworkCfgMgr mNetworkCfgMgr; + CNetDriveMgr mNetworkDriveMgr; QLocalSocket mACPISocket; // CWatchdogCtrl mWatchdogCtrl;