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

@@ -11,15 +11,14 @@
namespace BuildingControlUnit
{
MainHandler::MainHandler()
: QObject()
MainHandler::MainHandler() : QObject()
, m_bsmApi(nullptr)
, m_jsonApi(nullptr)
, m_vwmApi(nullptr)
, m_handelEffectsBsm(nullptr)
, m_handleHttpRequest(nullptr)
, m_bsmFlash(BEO_Auto)
{}
, m_bsmFlash(BEO_Auto),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
MainHandler::~MainHandler()
{
@@ -59,17 +58,17 @@ bool MainHandler::init(const QString &ammuXml,
}
if (!m_vwmApi->init(ammuXml, vwmXml, bsmConfig, initBuilding))
{
ERROR_LOG() << "Can not initialize VWM API - aborting";
ERROR_LOG(m_logger) << "Can not initialize VWM API - aborting";
return false;
}
if (!m_jsonApi->init(listenPort))
{
ERROR_LOG() << "Can not initialize Json API - aborting";
ERROR_LOG(m_logger) << "Can not initialize Json API - aborting";
return false;
}
if (!m_bsmApi->init(bsmConfig))
{
ERROR_LOG() << "Can not initialize BSM API - aborting";
ERROR_LOG(m_logger) << "Can not initialize BSM API - aborting";
return false;
}
@@ -135,16 +134,16 @@ bool MainHandler::init(const QString &ammuXml,
void MainHandler::setInitialOverrides(const QString &hostname)
{
DEBUG_LOG() << "setInitialOverrides m_handelEffectsVec.size()=" << m_handelEffectsVec.size();
DEBUG_LOG(m_logger) << "setInitialOverrides m_handelEffectsVec.size()=" << m_handelEffectsVec.size();
for ( int i = 0; i < m_handelEffectsVec.size(); i++)
{
QString hostnameLocal = m_handelEffectsVec.at(i)->hostname();
const QVector<BcuEffectState> effectStates = m_handelEffectsVec.at(i)->getOverrides();
DEBUG_LOG() << "setInitialOverrides host=" << hostnameLocal
DEBUG_LOG(m_logger) << "setInitialOverrides host=" << hostnameLocal
<< " effectStates.size=" << effectStates.size();
for (int j = 0; j < effectStates.size(); j++)
DEBUG_LOG() << "setInitialOverrides j=" << j
DEBUG_LOG(m_logger) << "setInitialOverrides j=" << j
<< " id=" << effectStates[j].id
<< " type=" << effectStates[j].type
<< " override=" << effectStates[j].effectOverride;
@@ -171,7 +170,7 @@ void MainHandler::onHitResult(const HitResult &result, const QMap<int, Contamina
{
Q_UNUSED(contaminationStates)
const VWM::Charge charge = m_vwmApi->chargeFromChargeTypeId(result.chargeTypeId);
DEBUG_LOG() << "onHitResult chargeTypeId=" << result.chargeTypeId
DEBUG_LOG(m_logger) << "onHitResult chargeTypeId=" << result.chargeTypeId
<< " result.effectSoundId=" << result.effectSoundId
<< " damagePercentNew=" << result.damagePercentNew
<< " destructiveFactor=" << charge.destructiveFactor;
@@ -182,15 +181,15 @@ void MainHandler::onHitResult(const HitResult &result, const QMap<int, Contamina
{
for (HandelEffects *he : std::as_const(m_handelEffectsVec))
{
DEBUG_LOG() << "playHitSound @EGCU " << he->hostname() << ", SoundId: " << result.effectSoundId;
DEBUG_LOG(m_logger) << "playHitSound @EGCU " << he->hostname() << ", SoundId: " << result.effectSoundId;
he->playHitSound(result.effectSoundId);
}
}
DEBUG_LOG() << "HitResult: " << result;
DEBUG_LOG(m_logger) << "HitResult: " << result;
if (result.sensorId != 0 && result.originatorId != 0 && m_bsmFlash != BEO_Off && charge.destructiveFactor > 1 )
{
DEBUG_LOG() << "BSM Flash";
DEBUG_LOG(m_logger) << "BSM Flash";
m_bsmApi->triggerFlashlight(result.sensorId);
m_bsmApi->triggerFlashlightPulse(result.sensorId,
QString(),
@@ -200,7 +199,7 @@ void MainHandler::onHitResult(const HitResult &result, const QMap<int, Contamina
Settings::flashDuration());
}
else
DEBUG_LOG() << "Kein BSM Flash";
DEBUG_LOG(m_logger) << "Kein BSM Flash";
@@ -210,14 +209,14 @@ void MainHandler::onHitResult(const HitResult &result, const QMap<int, Contamina
for (int i = 0; i < m_egcuConfig.egcus.size(); i++)
{
DEBUG_LOG() << "segmentDamage.size=" << segmentDamage.size();
DEBUG_LOG(m_logger) << "segmentDamage.size=" << segmentDamage.size();
if ( i < segmentDamage.size() )
{
DEBUG_LOG() << "segmentDamage[" << i <<"]=" << segmentDamage[i];
DEBUG_LOG(m_logger) << "segmentDamage[" << i <<"]=" << segmentDamage[i];
m_handelEffectsVec[i]->startEffects(segmentDamage[i]);
}
else
DEBUG_LOG() << "No segment Damage for egcu:" << m_egcuConfig.egcus[i].hostname;
DEBUG_LOG(m_logger) << "No segment Damage for egcu:" << m_egcuConfig.egcus[i].hostname;
}
m_handelEffectsBsm->startEffects(result.damagePercentNew);
}
@@ -231,22 +230,22 @@ void MainHandler::onUnknownDirectHit(int sensorId)
void MainHandler::onSetEffectStatesRequest(const QString &hostname, const QVector<BcuEffectState> &effectStates)
{
DEBUG_LOG() << "1 BSM flash hostname='" << hostname
DEBUG_LOG(m_logger) << "1 BSM flash hostname='" << hostname
<< "' isEmpty:"<< hostname.isEmpty()
<<" isNull:" << hostname.isNull();
m_effectStates.insert(hostname, effectStates);
if (hostname.isEmpty())
{
m_bsmFlash = BEO_Auto;
DEBUG_LOG() << "2 BSM flash =" << m_bsmFlash;
DEBUG_LOG(m_logger) << "2 BSM flash =" << m_bsmFlash;
m_handelEffectsBsm->setOverrides(effectStates);
for ( int i = 0; i < effectStates.size(); i++)
{
DEBUG_LOG() << "3 BSM flash =" << m_bsmFlash;
DEBUG_LOG(m_logger) << "3 BSM flash =" << m_bsmFlash;
if ( effectStates.at(i).type == BET_BsmFlash)
{
m_bsmFlash = effectStates.at(i).effectOverride;
DEBUG_LOG() << "4 BSM flash =" << m_bsmFlash;
DEBUG_LOG(m_logger) << "4 BSM flash =" << m_bsmFlash;
break;
}
}
@@ -266,7 +265,7 @@ void MainHandler::onSwitchRelayRequest(const QString &hostname, const SwitchRela
{
if (m_handelEffectsVec[i]->hostname() == hostname )
{
DEBUG_LOG() << "switchRelay "
DEBUG_LOG(m_logger) << "switchRelay "
<< " id=" << switchRelayValues.id
<< " bcuRelayState=" << switchRelayValues.bcuRelayState;
m_handelEffectsVec[i]->switchRelay(switchRelayValues);
@@ -328,7 +327,7 @@ QVector<int> MainHandler::getSegmentDamage(const QVector<HitRoom> &allHitRooms,
if (egcu.roomIds.size() > 0 )
averageDamage = damagePercentSegment / egcu.roomIds.size();
result.append(averageDamage);
INFO_LOG() << "getSegmentDamage[" << egcu.hostname << "]=" << averageDamage;
INFO_LOG(m_logger) << "getSegmentDamage[" << egcu.hostname << "]=" << averageDamage;
}
}
return result;
@@ -337,7 +336,7 @@ QVector<int> MainHandler::getSegmentDamage(const QVector<HitRoom> &allHitRooms,
void MainHandler::flashBuildingDestructionIndicator(int egcu)
{
ERROR_LOG() << "TODO flashBuildingDestructionIndicator egcu=" << egcu;
ERROR_LOG(m_logger) << "TODO flashBuildingDestructionIndicator egcu=" << egcu;