Corrections et améliorations Historien

This commit is contained in:
jfmartel
2024-07-11 14:26:37 -04:00
parent 09ce9cbf5d
commit 8eb851b2cd
9 changed files with 51 additions and 14 deletions
+16 -4
View File
@@ -42,6 +42,7 @@ void CPIHistorianManager::NewModbusConnection()
connect(NewSession,SIGNAL(PIHistorianSessionClosed(CPIHistorianSession*)),this,SLOT(HistorianSessionClosed(CPIHistorianSession*)));
mHistorianSessionsList.append(NewSession);
NewSession->OpenSession(SessionSocket);
emit HistorianConnected();
}
}
@@ -55,6 +56,11 @@ void CPIHistorianManager::HistorianSessionClosed(CPIHistorianSession *SessionPtr
CPIHistorianSession *Session = mHistorianSessionsList.takeAt(i);
Session->CloseSession();
delete Session;
if(mHistorianSessionsList.size() == 0)
{
emit HistorianDisconnected();
}
return;
}
}
@@ -270,6 +276,10 @@ int CPIHistorianManager::NewZT1Passage(CZTPassageInfo ZT1PassageInfo)
mPIHistorianRepo->WriteSingleReg(HISTORIAN_LAST_TRAIN_ID2_REG_ADD,ZT1PassageInfo.mTrainCompo2);
mPIHistorianRepo->WriteSingleReg(HISTORIAN_LAST_TRAIN_ID3_REG_ADD,ZT1PassageInfo.mTrainCompo3);
mNbPassagesToday ++;
mPIHistorianRepo->WriteSingleReg(HISTORIAN_TRAINS_TODAY_REG_ADD,mNbPassagesToday);
QDateTime PassageDateTime = ZT1PassageInfo.mPassageDateTime;
quint16 year, month, day, hour, minute, seconds;
year = (quint16)PassageDateTime.date().year();
@@ -415,7 +425,7 @@ int CPIHistorianManager::NewZT1Passage(CZTPassageInfo ZT1PassageInfo)
}
mNbPassagesToday ++;
mNbDeclToday += NbDecl;
mNbDeclTotal += NbDecl;
mNbFNToday += NbDeclFN;
@@ -423,9 +433,8 @@ int CPIHistorianManager::NewZT1Passage(CZTPassageInfo ZT1PassageInfo)
mNbPPIZT1Today += NbDeclPPI;
mNbPPEZT1Today += NbDeclPPE;
mPIHistorianRepo->WriteSingleReg(HISTORIAN_TRAINS_TODAY_REG_ADD,mNbPassagesToday);
mPIHistorianRepo->WriteSingleReg(HISTORIAN_DETECTIONS_TOTAL_REG_ADD,ZT1PassageInfo.mNbDeclenchements);
mPIHistorianRepo->WriteSingleReg(HISTORIAN_DETECTIONS_TODAY_REG_ADD,mNbDeclToday);
mPIHistorianRepo->WriteSingleReg(HISTORIAN_DETECTIONS_TOTAL_REG_ADD,ZT1PassageInfo.mNbDeclenchements);
mPIHistorianRepo->WriteSingleReg(HISTORIAN_FN_DETECTS_TODAY_REG_ADD,mNbFNToday);
mPIHistorianRepo->WriteSingleReg(HISTORIAN_PPI_ZT1_DETECTS_TODAY_REG_ADD,mNbPPIZT1Today);
mPIHistorianRepo->WriteSingleReg(HISTORIAN_PPE_ZT1_DETECTS_TODAY_REG_ADD,mNbPPEZT1Today);
@@ -433,6 +442,8 @@ int CPIHistorianManager::NewZT1Passage(CZTPassageInfo ZT1PassageInfo)
}
return RET_OK;
}
@@ -561,7 +572,7 @@ int CPIHistorianManager::NewZT2Passage(CZTPassageInfo ZT2PassageInfo)
void CPIHistorianManager::StartHistorianTimer()
{
QTime Time = QTime::currentTime();
int Delay = Time.msecsTo(QTime(23,59,59));
int Delay = Time.msecsTo(QTime(23,59,59,999));
if(Delay < 0)
{
Delay += MSECS_IN_A_DAY;
@@ -578,6 +589,7 @@ void CPIHistorianManager::HistorianTimerExpired()
mNbPPEZT1Today = 0;
mNbPPIZT2Today = 0;
mNbPPEZT2Today = 0;
mNbDeclToday = 0;
StartHistorianTimer();
+3
View File
@@ -56,6 +56,9 @@ public slots:
void SEIDisconnected();
void HistorianTimerExpired();
signals:
void HistorianConnected();
void HistorianDisconnected();
};