Transert SAMBA et script d'update prêts à tester.

This commit is contained in:
jfmartel
2023-04-21 12:28:10 -04:00
parent 7207362d5c
commit 9a7a288575
13 changed files with 149 additions and 53 deletions
+2 -1
View File
@@ -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);
}
+1 -1
View File
@@ -126,7 +126,7 @@ public slots:
void LogsArchivingFinished();
// void TableCurItemChanged(QTableWidgetItem*,QTableWidgetItem*);
void LogsTableCellSelected(/*int, int*/);
void NewTrainLogFileSaved(QString);
void NewTrainLogFileSaved(QString,bool);
};
+14 -5
View File
@@ -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);
}
+2 -2
View File
@@ -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);
};
+6 -2
View File
@@ -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;
+1 -1
View File
@@ -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:
+51 -2
View File
@@ -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;
}
+11
View File
@@ -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
+8 -3
View File
@@ -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());