diff --git a/Configuration/ZT.cfg b/Configuration/ZT.cfg index 5d8b20b..0790a3b 100644 --- a/Configuration/ZT.cfg +++ b/Configuration/ZT.cfg @@ -63,23 +63,6 @@ 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 SIMULATEUR=OUI @@ -96,9 +79,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 @@ -107,3 +90,15 @@ STATION=ANGRIGNON #STATION=MONTMORENCY_10_12 #STATION=MONTMORENCY_10_22 #STATION=DU_COLLEGE + + +#---------------------------------- +#Paramètres du dossier partagé sur le réseau (SAMBA) pour la copie des fichiers logs +#Activation de la copie des fichiers sur le réseau (OUI ou NON) +ACTIVER_SAMBA=OUI +#Path du dossier cible sur le réseau +NETWORK_SHARE_PATH=//192.168.50.110/TestZT +#Login pour accéder au drive +NETWORK_SHARE_LOGIN=JF +#Mot de passe pour accéder au drive +NETWORK_SHARE_PASSWORD=signal77240 diff --git a/Configuration/ZTSettings.ztc b/Configuration/ZTSettings.ztc index 836c945..cb8f2f7 100644 Binary files a/Configuration/ZTSettings.ztc and b/Configuration/ZTSettings.ztc differ diff --git a/UpdateZT.sh b/UpdateZT.sh index 343a2da..633a6a4 100755 --- a/UpdateZT.sh +++ b/UpdateZT.sh @@ -3,8 +3,8 @@ #ZT Update Script V1.0 -ZTVERSION=V1.21 -VERSIONROOT=ZoneTest_V121 #Nom du répertoire sur la clef USB contenant la nouvelle version +ZTVERSION=V1.25 +VERSIONROOT=ZoneTest_V125 #Nom du répertoire sur la clef USB contenant la nouvelle version ARCHIVEDIR=/home/zonetest/Archives ZTEXECDIR=/home/zonetest/ZT USBEXECDIR=$VERSIONROOT/EXE @@ -25,15 +25,15 @@ if [ "$UserInput" != "o" ]; then exit 0 fi -echo " " -echo "Les valeurs d'adresse IP et de calibration PG seront écrasées." -echo "Les avez-vous à portée de main? (o ou n)" -read UserInput2 -if [ "$UserInput2" != "o" ]; then - echo "Vous devez redémarrer l'ordinateur pour lancer le logiciel ZT" - echo "Il faut maintenir le bouton enfoncé pendant quelques secondes" - exit 0 -fi +#echo " " +#echo "Les valeurs d'adresse IP et de calibration PG seront écrasées." +#echo "Les avez-vous à portée de main? (o ou n)" +#read UserInput2 +#if [ "$UserInput2" != "o" ]; then +# echo "Vous devez redémarrer l'ordinateur pour lancer le logiciel ZT" +# echo "Il faut maintenir le bouton enfoncé pendant quelques secondes" +# exit 0 +#fi echo " " echo "Lancement de la mise à jour..." @@ -53,7 +53,7 @@ else fi echo " " -echo "Copie des fichier exécutables de la ZT dans $ZTEXECDIR" +echo "Copie des fichiers exécutables de la ZT dans $ZTEXECDIR" if cp -rf ./$USBEXECDIR/* $ZTEXECDIR then echo "Fichiers copiés avec succès" @@ -63,16 +63,38 @@ else fi echo " " -echo "Désactivation du log d'ingénierie" -sed -i 's/ENGLOG/#ENGLOG/g' $ZTCONFIGFILE -sed -i 's/##ENGLOG/#ENGLOG/g' $ZTCONFIGFILE -echo "OK:" - +echo "Création du répertoire réseau" +if mkdir -p /home/zonetest/ZT/NetDrive +then + echo "OK" +else + echo "Erreur de création du répertoire. Il faudra le faire manuellement..." + exit 1 +fi echo " " echo "Synchronisation. Ceci prendra plusieurs secondes..." sync +CONFIG_FILE_PATH=$ZTEXECDIR/Configuration/ZT.cfg +echo " " +echo "Ajout des informations SAMBA dans le fichier de configuration" +echo -e " +#---------------------------------- +Paramètres du dossier partagé sur le réseau (SAMBA) pour la copie des fichiers logs +#Activation de la copie des fichiers sur le réseau (OUI ou NON) +ACTIVER_SAMBA=OUI +#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\n" >> $CONFIG_FILE_PATH +echo "Modification du fichier de configuration OK" + + + + echo " " echo "----------------------------------------------------" echo "La mise à jour s'est déroulée avec succès." diff --git a/ZT b/ZT new file mode 100755 index 0000000..2d606be Binary files /dev/null and b/ZT differ diff --git a/sources/GuiElements/LogsListPage.cpp b/sources/GuiElements/LogsListPage.cpp index fdc82da..d7d0fd6 100644 --- a/sources/GuiElements/LogsListPage.cpp +++ b/sources/GuiElements/LogsListPage.cpp @@ -258,9 +258,10 @@ unsigned int CLogsListPage::DeleteAllFiles() return RET_OK; } -void CLogsListPage::NewTrainLogFileSaved(QString Filename) +void CLogsListPage::NewTrainLogFileSaved(QString Filename, bool Detection) { Q_UNUSED(Filename) + Q_UNUSED(Detection) RefreshList(true); } diff --git a/sources/GuiElements/LogsListPage.h b/sources/GuiElements/LogsListPage.h index f57d328..84f1c12 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(QString); + void NewTrainLogFileSaved(QString,bool); }; diff --git a/sources/NetDriveMgr.cpp b/sources/NetDriveMgr.cpp index d422f9a..1880197 100644 --- a/sources/NetDriveMgr.cpp +++ b/sources/NetDriveMgr.cpp @@ -96,7 +96,7 @@ int CNetDriveMgr::CopyFileToNetworkDrive(QString FilePath) return RET_OK; } -int CNetDriveMgr::TransferTrainLogToNetDrive(QString NewLogFileName) +int CNetDriveMgr::TransferTrainLogToNetDrive(QString NewLogFileName, bool Detection) { if(mIsNetDriveEnabled == false) return RET_ERROR; @@ -107,7 +107,16 @@ int CNetDriveMgr::TransferTrainLogToNetDrive(QString NewLogFileName) } QString DestFilePath = NewLogFileName; - DestFilePath.prepend(mFilesPrefix + "-"); + if(Detection == true) + { + DestFilePath.prepend(mFilesPrefix + "-D-"); //Flag indiquant que ce passage contient des détections (D) + } + else + { + DestFilePath.prepend(mFilesPrefix + "-N-"); //Flag inidiquant un passage normal (sans détection) (N) + } + + DestFilePath.prepend(mNASMountPath); QString OriginFilePath = NewLogFileName; OriginFilePath.prepend("./Trains/"); @@ -182,7 +191,7 @@ int CNetDriveMgr::NetworkDriveStateMachine(int Event) //The network drive is stale or disconnected mTransferProcess->kill(); mNetDriveSMState = NET_DRIVE_STANDBY_STATE; - QString("Failed to transfer ZT log file to NAS"); + qDebug("Failed to transfer ZT log file to NAS"); break; } case NET_DRIVE_SM_PROCESS_FINISHED_EVENT: @@ -366,7 +375,7 @@ int CNetDriveMgr::UnMountNetworkDrive() } -void CNetDriveMgr::NewTrainFileSaved(QString filename) +void CNetDriveMgr::NewTrainFileSaved(QString filename, bool Detection) { - TransferTrainLogToNetDrive(filename); + TransferTrainLogToNetDrive(filename,Detection); } diff --git a/sources/NetDriveMgr.h b/sources/NetDriveMgr.h index 58c0a51..448157a 100644 --- a/sources/NetDriveMgr.h +++ b/sources/NetDriveMgr.h @@ -40,7 +40,7 @@ public: bool IsNetworkDriveMounted(); bool IsNetworkDriveAvailable(); int CopyFileToNetworkDrive(QString FilePath); - int TransferTrainLogToNetDrive(QString NewLogFileName); + int TransferTrainLogToNetDrive(QString NewLogFileName,bool Detection); int TransferZTLogToNetDrive(); int InitNetDriveMgr(bool Enabled,QString RemoteAccessPath, QString RemoteLogin, QString RemotePwd, QString RemoteDomain, QString FilenamePrefix); int MountNetworkDrive(); @@ -65,7 +65,7 @@ signals: public slots: void ProcessExecTimerExpired(); void ProcessFinished( int exitCode, QProcess::ExitStatus exitStatus); - void NewTrainFileSaved(QString filename); + void NewTrainFileSaved(QString filename, bool); }; diff --git a/sources/ZTStateMachine.cpp b/sources/ZTStateMachine.cpp index bc4f4e1..6a3aa27 100755 --- a/sources/ZTStateMachine.cpp +++ b/sources/ZTStateMachine.cpp @@ -1726,9 +1726,11 @@ unsigned int CZTStateMachine::SaveZT1EventsLog(CZT1Log *Log) CTrainLogFileMgr::instance()->SaveCSVFile(FilePath,Log,&mZT1DetectionsLog,mZTStationPtr->GetStationTextualName()); } + bool Detection = !mZT1DetectionsLog.isEmpty(); + DestroyZT1Log(); - emit NewTrainLogSaved(FileName); + emit NewTrainLogSaved(FileName, Detection); return RET_OK; @@ -1753,9 +1755,11 @@ unsigned int CZTStateMachine::SaveZT2EventsLog(CZT2Log *Log) CTrainLogFileMgr::instance()->SaveCSVFile(FilePath,Log,&mZT2DetectionsLog,mZTStationPtr->GetStationTextualName()); } + bool Detection = !mZT1DetectionsLog.isEmpty(); + DestroyZT2Log(); - emit NewTrainLogSaved(FileName); + emit NewTrainLogSaved(FileName, Detection); return RET_OK; diff --git a/sources/ZTStateMachine.h b/sources/ZTStateMachine.h index f5f53c7..5e5cd8f 100644 --- a/sources/ZTStateMachine.h +++ b/sources/ZTStateMachine.h @@ -234,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(QString Filename); //Signal envoyé pour notifier l'interface graphique qu'un nouveau fichier de passage a été sauvegardé. + void NewTrainLogSaved(QString Filename, bool Detection); //Signal envoyé pour notifier l'interface graphique qu'un nouveau fichier de passage a été sauvegardé. public slots: diff --git a/sources/ZTconfigmgr.cpp b/sources/ZTconfigmgr.cpp index cbd5e98..bb17e9f 100644 --- a/sources/ZTconfigmgr.cpp +++ b/sources/ZTconfigmgr.cpp @@ -59,6 +59,9 @@ CZTConfigMgr::CZTConfigMgr() //Modbus communication with CC mUseModbusCCMode = ZT_CONFIG_MODBUS_ENABLE_AUTODETECT; mModbusCCIFName = "INVALID"; + + //SAMBA drive parameters + mActivateSAMBADrive = false; } ZTConfigResult CZTConfigMgr::LoadZTConfig() @@ -259,8 +262,34 @@ ZTConfigResult CZTConfigMgr::LoadZTConfig() mConfig_LazerProbeModulesConfigList.append(LazerProbeConfig); CEngLog::instance()->AddLogString(QString().sprintf("LazerProbeEXT_%d = Port: %s",LazerProbeConfig.ProbeID,LazerProbeConfig.SerialPort.toUtf8().constData())); } - - + else if(string.contains("ACTIVER_SAMBA")) + { + if(string.mid(pos) == "OUI") + { + mActivateSAMBADrive = true; + CEngLog::instance()->AddLogString(QString().sprintf("Copie sur répertoire SAMBA activée"),1); + } + else if(string.mid(pos) == "NON") + { + mActivateSAMBADrive = true; + CEngLog::instance()->AddLogString(QString().sprintf("Copie sur répertoire SAMBA désactivée"),1); + } + } + else if(string.contains("NETWORK_SHARE_PATH")) + { + mSAMBAMountPoint = string.mid(pos); + CEngLog::instance()->AddLogString(QString("Point d'accès SAMBA: %1").arg(mSAMBAMountPoint),1); + } + else if(string.contains("NETWORK_SHARE_LOGIN")) + { + mSAMBALogin = string.mid(pos); + CEngLog::instance()->AddLogString(QString("Login SAMBA: %1").arg(mSAMBALogin),1); + } + else if(string.contains("NETWORK_SHARE_PASSWORD")) + { + mSAMBAPassword = string.mid(pos); + CEngLog::instance()->AddLogString(QString("Password SAMBA: %1").arg(mSAMBAPassword),1); + } } } } @@ -335,3 +364,23 @@ QString CZTConfigMgr::GetDataQIPAddress() { return mDataQIPAddr; } + +bool CZTConfigMgr::GetSAMBADriveActivated() +{ + return mActivateSAMBADrive; +} + +QString CZTConfigMgr::GetSAMBAMountPoint() +{ + return mSAMBAMountPoint; +} + +QString CZTConfigMgr::GetSAMBALogin() +{ + return mSAMBALogin; +} + +QString CZTConfigMgr::GetSAMBAPassword() +{ + return mSAMBAPassword; +} diff --git a/sources/ZTconfigmgr.h b/sources/ZTconfigmgr.h index 0e2e400..a9f92f9 100644 --- a/sources/ZTconfigmgr.h +++ b/sources/ZTconfigmgr.h @@ -97,6 +97,12 @@ public: int GetModbusSEIDevID(); QString GetModbusCCIFName(); // int GetLaserSensorCalib(){return mConfig_Station_LaserSensorCalib;} + bool GetSAMBADriveActivated(); + QString GetSAMBAMountPoint(); + QString GetSAMBALogin(); + QString GetSAMBAPassword(); + + @@ -121,6 +127,11 @@ private: int mModbusSEIPort; int mModbusSEIDevID; +// SAMBA drive parametesr + bool mActivateSAMBADrive; + QString mSAMBAMountPoint; + QString mSAMBALogin; + QString mSAMBAPassword; }; #endif // ZTCONFIGMGR_H diff --git a/sources/Zonetest.cpp b/sources/Zonetest.cpp index bb70e4a..28fb3d2 100644 --- a/sources/Zonetest.cpp +++ b/sources/Zonetest.cpp @@ -288,9 +288,9 @@ unsigned int CZoneTest::Start() // mEventMgr->UpdateEvents(mZTSettings->mDetectionFunctionSettings); mZTStateMachine->mZTDetectionConfig = mZTSettings->mDetectionFunctionSettings; - connect(mZTStateMachine,SIGNAL(NewTrainLogSaved(QString)),panel.mLogsListPage,SLOT(NewTrainLogFileSaved(QString))); + connect(mZTStateMachine,SIGNAL(NewTrainLogSaved(QString,bool)),panel.mLogsListPage,SLOT(NewTrainLogFileSaved(QString,bool))); - connect(mZTStateMachine,SIGNAL(NewTrainLogSaved(QString)),&mNetworkDriveMgr,SLOT(NewTrainFileSaved(QString))); + connect(mZTStateMachine,SIGNAL(NewTrainLogSaved(QString,bool)),&mNetworkDriveMgr,SLOT(NewTrainFileSaved(QString,bool))); CZTLog::instance()->mProgramHandle = this; @@ -642,7 +642,12 @@ unsigned int CZoneTest::InitZT() panel.mZTMainPage->mZT2Stats->Init(true); - mNetworkDriveMgr.InitNetDriveMgr(true,"//192.168.50.110/TestZT","JF","signal77240","",mZTStation->GetStationShortName()); + bool UseNetworkDrive = CZTConfigMgr::instance()->GetSAMBADriveActivated(); + QString SAMBAMountPoint = CZTConfigMgr::instance()->GetSAMBAMountPoint(); + QString SAMBALogin = CZTConfigMgr::instance()->GetSAMBALogin(); + QString SAMBAPassword = CZTConfigMgr::instance()->GetSAMBAPassword(); + mNetworkDriveMgr.InitNetDriveMgr(UseNetworkDrive,SAMBAMountPoint,SAMBALogin,SAMBAPassword,"",mZTStation->GetStationShortName()); + // mNetworkDriveMgr.InitNetDriveMgr(true,"//192.168.50.50/TestZT","JF","signal77240","",mZTStation->GetStationShortName());