Adds immediate migration results in progress

This commit is contained in:
torsten committed 2026-08-19 11:18:24 +02:00
1 parent 8453e104c5
commit 3bb6e89496
2102 files changed
+17482 -15071

No files matched your search

@@ -17,10 +17,9 @@ namespace TrainingAreaBase
AesStateHandler::AesStateHandler(MainHandler *mainHandler)
: m_dbInterface(mainHandler->dbHandler()->db())
, m_exerciseId(mainHandler->exerciseId())
{}
AesStateHandler::AesStateHandler(MainHandler *mainHandler) : m_dbInterface(mainHandler->dbHandler()->db())
, m_exerciseId(mainHandler->exerciseId()),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
template<>
@@ -30,7 +29,7 @@ void RecvFromDdsAes::txData(const TrainingAreaBase::TetraIcd::DusMineReactivatio
m_sentAesTelegrams.push_back(new TrainingAreaBase::TetraIcd::DusMineReactivation(tele));
m_sentAesTelegramsAesIds.push_back(-1);
m_checkOutdatedTelegramsTimer->start();
DEBUG_LOG() << "Appending " << tele.type() << " to m_sentAesTelegrams";
DEBUG_LOG(m_logger) << "Appending " << tele.type() << " to m_sentAesTelegrams";
}
bool AesStateHandler::init()
@@ -41,14 +40,14 @@ bool AesStateHandler::init()
m_tetraId2ddsId[item.aesTetraId] = item.aesDdsId;
m_ddsId2TetraId[item.aesDdsId] = item.aesTetraId;
DEBUG_LOG() << "AES internal DDS id: " << item.aesDdsId << " - tetra id: " << item.aesTetraId;
DEBUG_LOG(m_logger) << "AES internal DDS id: " << item.aesDdsId << " - tetra id: " << item.aesTetraId;
if (item.isAvailableInTetra)
m_aesInTetraAvailable += item.aesTetraId;
};
if (!m_dbInterface->selectByExerciseId(cb, m_exerciseId))
{
ERROR_LOG() << "Error retrieving data from database!";
ERROR_LOG(m_logger) << "Error retrieving data from database!";
return false;
}
@@ -72,7 +71,7 @@ int AesStateHandler::createAesTetraId(int aesDdsId, bool &alreadyExists)
aes2Ta.exerciseId = m_exerciseId;
if (!m_dbInterface->insert(aes2Ta))
{
WARNING_LOG() << "Unable to create a valid area effect simulation id for tetra!";
WARNING_LOG(m_logger) << "Unable to create a valid area effect simulation id for tetra!";
return -1;
}
@@ -94,7 +93,7 @@ bool AesStateHandler::update(int aesDdsId, int aesTetraId, bool bSentToTetra)
aes2Ta.exerciseId = m_exerciseId;
if (!m_dbInterface->update(aes2Ta))
{
WARNING_LOG() << "Unable to update area effect simulation id for tetra in database!";
WARNING_LOG(m_logger) << "Unable to update area effect simulation id for tetra in database!";
return false;
}
@@ -203,7 +202,7 @@ bool RecvFromDdsAes::init()
return false;
}
DEBUG_LOG() << "RecvFromDdsAes::init() successful";
DEBUG_LOG(m_logger) << "RecvFromDdsAes::init() successful";
return true;
}
@@ -360,7 +359,7 @@ bool RecvFromDdsAes::sendSingleFireSMArt(const SendCesHitRequest &request)
if (!bAlreadyExists)
{
WARNING_LOG() << "Trying to send a SMArt single fire to training area but it was not created until now... !?";
WARNING_LOG(m_logger) << "Trying to send a SMArt single fire to training area but it was not created until now... !?";
bool bOnlyNameChanged;
dataChanged(data, bOnlyNameChanged);
}
@@ -376,7 +375,7 @@ bool RecvFromDdsAes::sendSingleFireSMArt(const SendCesHitRequest &request)
template <typename T>
void RecvFromDdsAes::handleEffectSimulation(const T &data, DataModification modType, TetraIcd::AreaEffectSimulationType aesType)
{
DEBUG_LOG() << "RecvFromDdsAes::handleEffectSimulation(id=" << data.id()
DEBUG_LOG(m_logger) << "RecvFromDdsAes::handleEffectSimulation(id=" << data.id()
<< ", modType: " << static_cast<int>(modType)
<< ", type=" << static_cast<int>(aesType)
<< ", name: " << data.name()
@@ -390,7 +389,7 @@ void RecvFromDdsAes::handleEffectSimulation(const T &data, DataModification modT
{
if (m_mainHandler->pdmHandler()->isSmartChargeType(data.chargeStruct()))
{
DEBUG_LOG() << "Do not send SMART Single/AreaFire to Tetra as broadcast, hits are send directly.";
DEBUG_LOG(m_logger) << "Do not send SMART Single/AreaFire to Tetra as broadcast, hits are send directly.";
return;
}
}
@@ -577,7 +576,7 @@ void RecvFromDdsAes::onTriggeredImpactsChanged(const AreaEffectSimulation::Trigg
const auto &mineArea = it->second;
if (mineArea.isDus() || mineArea.isConcrete())
{
INFO_LOG() << "Not publishing mineArea single state for " << data.aesItemId() << " - is a DUS mineArea";
INFO_LOG(m_logger) << "Not publishing mineArea single state for " << data.aesItemId() << " - is a DUS mineArea";
return;
}
@@ -588,7 +587,7 @@ void RecvFromDdsAes::onTriggeredImpactsChanged(const AreaEffectSimulation::Trigg
case AreaEffectSimulation::AesEffectState::EsRemoved:
case AreaEffectSimulation::AesEffectState::EsUnknown:
{
INFO_LOG() << "Not publishing mineArea single state for " << data.aesItemId() << " - with state " << AreaEffectSimulation::toString(mineArea.effectStateId());
INFO_LOG(m_logger) << "Not publishing mineArea single state for " << data.aesItemId() << " - with state " << AreaEffectSimulation::toString(mineArea.effectStateId());
return;
}
default:
@@ -597,7 +596,7 @@ void RecvFromDdsAes::onTriggeredImpactsChanged(const AreaEffectSimulation::Trigg
}
else
{
INFO_LOG() << "Storing mineArea single state, as we dont have the corresponding mineArea yet aesId" << data.aesItemId();
INFO_LOG(m_logger) << "Storing mineArea single state, as we dont have the corresponding mineArea yet aesId" << data.aesItemId();
m_temporarySingleMineState[data.aesItemId()] = data;
return;
}
@@ -647,7 +646,7 @@ void RecvFromDdsAes::onDusMineStateChanged(const AreaEffectSimulation::DusMineSt
if (!m_minesToSend.isEmpty())
m_sendDusMineReactivtionTimer->start();
else
INFO_LOG() << "Nothing changed in DusMineState of MineArea: " << data.id();
INFO_LOG(m_logger) << "Nothing changed in DusMineState of MineArea: " << data.id();
}
void RecvFromDdsAes::onSendDusMineReactivationTimeout()
@@ -660,7 +659,7 @@ void RecvFromDdsAes::onSendDusMineReactivationTimeout()
out.dusSerialNumbers.push_back(mineId);
}
m_minesToSend.clear();
INFO_LOG() << "Reactivating " << out.dusSerialNumbers.size() << " mines";
INFO_LOG(m_logger) << "Reactivating " << out.dusSerialNumbers.size() << " mines";
txData(out);
}
@@ -748,7 +747,7 @@ void RecvFromDdsAes::onEffectsChanged(const AreaEffectSimulation::Effects &data,
const int aesTetraId = m_aesStateHandler->createAesTetraId(aesItemId, bAlreadyExists);
DEBUG_LOG() << "RecvFromDdsAes::onEffectsChanged(Effects, "
DEBUG_LOG(m_logger) << "RecvFromDdsAes::onEffectsChanged(Effects, "
<< aesTetraId << ")";
TetraIcd::CreateAreaExplosion cAes;
@@ -801,7 +800,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::AirS
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionSingle, aes.id());
return;
}
DEBUG_LOG() << "RecvFromDdsAes::sendCreateEffectSimulation(AirSupportImpact, "
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(AirSupportImpact, "
<< aesTetraId << ")";
TetraIcd::CreateSingleExplosion cAes;
@@ -829,7 +828,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::BCCo
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::CContamination, aes.id());
return;
}
DEBUG_LOG() << "RecvFromDdsAes::sendCreateEffectSimulation(BCContamination, "
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(BCContamination, "
<< aesTetraId << ")";
TetraIcd::CreateCContamination cAes;
cAes.expansionFactor = pdm()->dtc()->expansionFactor(aes.chargeStruct().chargeTypeId(),
@@ -876,7 +875,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionArea, aes.id());
return;
}
DEBUG_LOG() << "RecvFromDdsAes::sendCreateEffectSimulation(ExplosionArea, "
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(ExplosionArea, "
<< aesTetraId << ")";
TetraIcd::CreateAreaExplosion cAes;
@@ -904,7 +903,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
const bool bIsLaserGuidable = m_mainHandler->pdmHandler()->isLaserGuidable(aes.chargeStruct());
DEBUG_LOG() << "RecvFromDdsAes::sendCreateEffectSimulation "
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation "
<< ", aes " << aes
<< ", bIsLaserGuidable " << bIsLaserGuidable;
@@ -920,7 +919,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionArea, aes.id());
return;
}
DEBUG_LOG() << "RecvFromDdsAes::sendCreateEffectSimulation(ExplosionArea, "
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(ExplosionArea, "
<< aesTetraId << ")";
TetraIcd::CreateAreaExplosion cAes;
@@ -969,7 +968,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionSingle, aes.id());
return;
}
DEBUG_LOG() << "RecvFromDdsAes::sendCreateEffectSimulation(ExplosionSingle, "
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(ExplosionSingle, "
<< aesTetraId << ")";
TetraIcd::CreateSingleExplosion cAes;
@@ -995,7 +994,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Mine
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::MineArea, aes.id());
return;
}
DEBUG_LOG() << "RecvFromDdsAes::sendCreateEffectSimulation(MineArea, "
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(MineArea, "
<< aesTetraId << ")";
TetraIcd::CreateMineArea cAes;
@@ -1025,20 +1024,20 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Mine
const QPointF relStart = m_posHandler->geographicToRelativePointF(s.positionStart());
const QPointF relEnd = m_posHandler->geographicToRelativePointF(s.positionEnd());
const QLineF line({relStart.x(), relStart.y()}, {relEnd.x(), relEnd.y()});
DEBUG_LOG() << "relStart: x: " << relStart.x() << ", y: " << relStart.y();
DEBUG_LOG() << "relEnd: x: " << relEnd.x() << ", y: " << relEnd.y();
DEBUG_LOG(m_logger) << "relStart: x: " << relStart.x() << ", y: " << relStart.y();
DEBUG_LOG(m_logger) << "relEnd: x: " << relEnd.x() << ", y: " << relEnd.y();
QTransform trans;
trans.rotate(0-line.angle());
const QPointF ofs = trans.map(QPointF(aes.width() / 2, 0));
DEBUG_LOG() << "ofs: x: " << ofs.x() << ", y: " << ofs.y();
DEBUG_LOG(m_logger) << "ofs: x: " << ofs.x() << ", y: " << ofs.y();
segment.relStart.offsetX = qRound(relStart.x() + ofs.y());
segment.relStart.offsetY = qRound(relStart.y() - ofs.x());
segment.relEnd.offsetX = qRound(relEnd.x() + ofs.y());
segment.relEnd.offsetY = qRound(relEnd.y() - ofs.x());
DEBUG_LOG() << "start offset: x: " << segment.relStart.offsetX << ", y: " << segment.relStart.offsetY;
DEBUG_LOG() << "end offset: x: " << segment.relEnd.offsetX << ", y: " << segment.relEnd.offsetY;
DEBUG_LOG(m_logger) << "start offset: x: " << segment.relStart.offsetX << ", y: " << segment.relStart.offsetY;
DEBUG_LOG(m_logger) << "end offset: x: " << segment.relEnd.offsetX << ", y: " << segment.relEnd.offsetY;
}
cAes.segments.push_back(segment);
}
@@ -1056,7 +1055,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::NCon
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::NContamination, aes.id());
return;
}
DEBUG_LOG() << "RecvFromDdsAes::sendCreateEffectSimulation(NContamination, "
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(NContamination, "
<< aesTetraId << ")";
TetraIcd::CreateNContamination cAes;
@@ -1080,7 +1079,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Func
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::FunctionalArea, aes.id());
return;
}
DEBUG_LOG() << "RecvFromDdsAes::sendCreateEffectSimulation(FunctionalArea, "
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(FunctionalArea, "
<< aesTetraId << ")";
TetraIcd::CreateFunctionalArea fAes;
@@ -1106,7 +1105,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Tech
return;
}
DEBUG_LOG() << "RecvFromDdsAes::sendCreateEffectSimulation(TechnicalArea, "
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(TechnicalArea, "
<< aesTetraId << ")";
TetraIcd::TechnicalArea fAes;
@@ -1128,7 +1127,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::DusS
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::DusSingleMineSimulator, aes.id());
return;
}
DEBUG_LOG() << "RecvFromDdsAes::sendCreateEffectSimulation(DusSingleMine, "
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(DusSingleMine, "
<< aesTetraId << ")";
TetraIcd::CreateDusSingleMine dAes;
@@ -1157,10 +1156,10 @@ void RecvFromDdsAes::sendModifyEffectSimulationName(TetraIcd::AreaEffectSimulati
if (aesTetraId == 0)
{
WARNING_LOG() << "Trying to modify an effect simulation name but have no aes identification: " << name;
WARNING_LOG(m_logger) << "Trying to modify an effect simulation name but have no aes identification: " << name;
return;
}
DEBUG_LOG() << "RecvFromDdsAes::sendModifyEffectSimulationName(" << static_cast<int>(aesType)
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendModifyEffectSimulationName(" << static_cast<int>(aesType)
<< ", " << aesTetraId << ", " << name << ")";
TetraIcd::ModifyAreaEffectSimulationName mAes;
@@ -1184,16 +1183,16 @@ void RecvFromDdsAes::sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationTy
const int aesTetraId = m_aesStateHandler->getAesTetraId(aesDdsId);
if (aesTetraId == 0)
{
DEBUG_LOG() << "Could not find a valid tetra id for aes dds id " << aesDdsId;
DEBUG_LOG(m_logger) << "Could not find a valid tetra id for aes dds id " << aesDdsId;
return;
}
if (!m_aesStateHandler->update(aesDdsId, aesTetraId, false))
{
WARNING_LOG() << "Could not update Aes state handler (" << aesDdsId
WARNING_LOG(m_logger) << "Could not update Aes state handler (" << aesDdsId
<< ", " << aesTetraId << ")";
}
DEBUG_LOG() << "RecvFromDdsAes::sendRemoveEffectSimulation(id=" << aesDdsId
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendRemoveEffectSimulation(id=" << aesDdsId
<< ", type=" << static_cast<int>(aesType)
<< ", tetraId=" << aesTetraId << ")";
@@ -1222,15 +1221,15 @@ void RecvFromDdsAes::sendPauseEffectSimulation(int aesDdsId)
const int aesTetraId = m_aesStateHandler->getAesTetraId(aesDdsId);
if (aesTetraId == 0)
{
DEBUG_LOG() << "Could not find a valid tetra id for aes dds id " << aesDdsId ;
DEBUG_LOG(m_logger) << "Could not find a valid tetra id for aes dds id " << aesDdsId ;
return;
}
if (!m_aesStateHandler->update(aesDdsId, aesTetraId, true))
{
WARNING_LOG() << "Could not update Aes state handler (" << aesDdsId
WARNING_LOG(m_logger) << "Could not update Aes state handler (" << aesDdsId
<< ", " << aesTetraId << ")";
}
DEBUG_LOG() << "RecvFromDdsAes::sendPauseEffectSimulation(id=" << aesDdsId
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendPauseEffectSimulation(id=" << aesDdsId
<< ", tetraId=" << aesTetraId << ")";
TetraIcd::PauseEffectSimulation dAes;
@@ -1254,15 +1253,15 @@ void RecvFromDdsAes::sendResumeEffectSimulation(const AreaEffectSimulation::Expl
const int aesTetraId = m_aesStateHandler->getAesTetraId(aes.id());
if (aesTetraId == 0)
{
DEBUG_LOG() << "Could not find a valid tetra id for aes dds id " << aesDdsId ;
DEBUG_LOG(m_logger) << "Could not find a valid tetra id for aes dds id " << aesDdsId ;
return;
}
if (!m_aesStateHandler->update(aesDdsId, aesTetraId, true))
{
WARNING_LOG() << "Could not update Aes state handler (" << aesDdsId
WARNING_LOG(m_logger) << "Could not update Aes state handler (" << aesDdsId
<< ", " << aesTetraId << ")";
}
DEBUG_LOG() << "RecvFromDdsAes::sendPauseEffectSimulation(id=" << aesDdsId
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendPauseEffectSimulation(id=" << aesDdsId
<< ", tetraId=" << aesTetraId << ")";
TetraIcd::ResumeEffectSimulation dAes;
@@ -1294,15 +1293,15 @@ void RecvFromDdsAes::sendResumeEffectSimulation(const AreaEffectSimulation::Expl
const int aesTetraId = m_aesStateHandler->getAesTetraId(aes.id());
if (aesTetraId == 0)
{
WARNING_LOG() << "Could not find a valid tetra id for aes dds id " << aesDdsId ;
WARNING_LOG(m_logger) << "Could not find a valid tetra id for aes dds id " << aesDdsId ;
return;
}
if (!m_aesStateHandler->update(aesDdsId, aesTetraId, true))
{
WARNING_LOG() << "Could not update Aes state handler (" << aesDdsId
WARNING_LOG(m_logger) << "Could not update Aes state handler (" << aesDdsId
<< ", " << aesTetraId << ")";
}
DEBUG_LOG() << "RecvFromDdsAes::sendPauseEffectSimulation(id=" << aesDdsId
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendPauseEffectSimulation(id=" << aesDdsId
<< ", tetraId=" << aesTetraId << ")";
TetraIcd::ResumeEffectSimulation dAes;
@@ -1340,7 +1339,7 @@ void RecvFromDdsAes::onCheckOutdatedTelegrams()
}
if (!deactivatedAesIds.contains(aesId))
continue;
INFO_LOG() << "Removing tele " << tele->type() << " from aes tele stack";
INFO_LOG(m_logger) << "Removing tele " << tele->type() << " from aes tele stack";
delete tele;
m_sentAesTelegrams.removeAt(i);
m_sentAesTelegramsAesIds.removeAt(i);