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

@@ -26,23 +26,22 @@ namespace AreaEffectSimulation
AbstractFiringStrategy::AbstractFiringStrategy(ObjectEffector *parent)
: QObject(parent)
, m_effector(parent)
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG() << Q_FUNC_INFO << " END";
AbstractFiringStrategy::AbstractFiringStrategy(ObjectEffector *parent) : QObject(parent)
, m_effector(parent),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
AbstractFiringStrategy::~AbstractFiringStrategy()
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
void AbstractFiringStrategy::calculateDispersionTrajectory()
{
DEBUG_LOG() << "calculateDispersionTrajectory";
DEBUG_LOG(m_logger) << "calculateDispersionTrajectory";
// 1. Neuen Zielpunkt berechnen
const auto &intendendTrajectory = m_effector->intendendTrajectory();
@@ -50,7 +49,7 @@ void AbstractFiringStrategy::calculateDispersionTrajectory()
// sanity check:
if (intendendTrajectory.size() < 2)
{
ERROR_LOG() << Q_FUNC_INFO
ERROR_LOG(m_logger) << Q_FUNC_INFO
<< " size of intendendTrajectory not sufficiant, size=" << intendendTrajectory.size();
return;
}
@@ -73,7 +72,7 @@ std::vector<Core::GeoPositionRelativeTime> AbstractFiringStrategy::buildTrajecto
// sanity check:
if (relativeTrajectory.size() < 2)
{
ERROR_LOG() << Q_FUNC_INFO
ERROR_LOG(m_logger) << Q_FUNC_INFO
<< " size of relativeTrajectory not sufficiant, size=" << relativeTrajectory.size();
return {};
}
@@ -89,7 +88,7 @@ std::vector<Core::GeoPositionRelativeTime> AbstractFiringStrategy::buildTrajecto
// Aehnlich wie Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/aes_handler.cpp Zeile 365
for (const TrajectoryPoint &trajPntRelPos : std::as_const(relativeTrajectory))
{
DEBUG_LOG() << "Flugbahnpunkt: trajPntRelPos :" << trajPntRelPos; // benefit from operator<<:
DEBUG_LOG(m_logger) << "Flugbahnpunkt: trajPntRelPos :" << trajPntRelPos; // benefit from operator<<:
// // geographic offers nice feature to add an offset:
// const QPointF &trajectoryAbsGeo = launchUtm.geographic(trajPntRelPos);
@@ -104,7 +103,7 @@ std::vector<Core::GeoPositionRelativeTime> AbstractFiringStrategy::buildTrajecto
// Position des Participants mit der m_participantId
const double zValue = effectorPositionGeo.z() + trajPntRelPos.position.z(); // trajPntRelPos.position.z() ist die Hoehe
DEBUG_LOG() << "trajPntAbsUtm :" << trajPntAbsUtm << ", trajPntAbsGeo :" << trajPntAbsGeo;
DEBUG_LOG(m_logger) << "trajPntAbsUtm :" << trajPntAbsUtm << ", trajPntAbsGeo :" << trajPntAbsGeo;
geometry.emplace_back(Core::GeoPositionRelativeTime(trajPntAbsGeo.x(), trajPntAbsGeo.y(), zValue, trajPntRelPos.time));
}
return geometry;
@@ -115,7 +114,7 @@ TrajectoryTimeAware AbstractFiringStrategy::buildTrajectoryTimeAware(const std::
// sanity check:
if (trajectoryGeometry.size() < 2)
{
ERROR_LOG() << Q_FUNC_INFO
ERROR_LOG(m_logger) << Q_FUNC_INFO
<< " size of trajectoryGeometry not sufficiant, size=" << trajectoryGeometry.size();
return {};
}
@@ -133,14 +132,14 @@ TrajectoryTimeAware AbstractFiringStrategy::buildTrajectoryTimeAware(const std::
int AbstractFiringStrategy::sendChargeEffect(const TrajectoryTimeAware &trajectoryTimeAware, const QJsonObject &properties)
{
DEBUG_LOG() << "sendChargeEffect";
DEBUG_LOG(m_logger) << "sendChargeEffect";
const auto &trajGeometry = trajectoryTimeAware.geometry();
// sanity check:
if (trajGeometry.size() < 2)
{
ERROR_LOG() << Q_FUNC_INFO
ERROR_LOG(m_logger) << Q_FUNC_INFO
<< " size of trajectoryTimeAware.geometry not sufficiant, size=" << trajGeometry.size();
return -1;
}
@@ -165,7 +164,7 @@ int AbstractFiringStrategy::sendChargeEffect(const TrajectoryTimeAware &trajecto
chargeEffect.trajectoryTimeAware(trajectoryTimeAware);
const auto &reply = m_effector->mainHandler()->chargeEffectHandler()->createChargeEffect(chargeEffect);
DEBUG_LOG() << "reply.id=" << reply.id() << ", str:" << reply.str() << ", uniqueId:" << reply.uniqueId();
DEBUG_LOG(m_logger) << "reply.id=" << reply.id() << ", str:" << reply.str() << ", uniqueId:" << reply.uniqueId();
return reply.id();
}
@@ -178,21 +177,21 @@ Core::GeoPosition AbstractFiringStrategy::participantPosition(int participantId)
int32_t AbstractFiringStrategy::gearTypeId(int chargeTypeId, int participantId)
{
DEBUG_LOG() << "getGearTypeId"
DEBUG_LOG(m_logger) << "getGearTypeId"
<< ", chargeTypeId:" << chargeTypeId << ", participantId:" << participantId;
m_effector->mainHandler()->dds()->ppmDtc()->enableDynamicParticipantData(true);
m_effector->mainHandler()->dds()->ppmDtc()->waitForHistoricalDataDynamicParticipantData(1000);
const ParticipantManagement::DynamicParticipantData &dynamicParticipantData = m_effector->mainHandler()->dds()->ppmDtc()->dynamicParticipantData(participantId);
DEBUG_LOG() << "gearSize " << dynamicParticipantData.gear().size();
DEBUG_LOG(m_logger) << "gearSize " << dynamicParticipantData.gear().size();
const auto& participantData_gear = dynamicParticipantData.gear();
for (const auto &gear : std::as_const(participantData_gear))
{
DEBUG_LOG() << "gear.chargeTypeId(): " << gear.chargeTypeId() << ", chargeTypeId:" << chargeTypeId;
DEBUG_LOG(m_logger) << "gear.chargeTypeId(): " << gear.chargeTypeId() << ", chargeTypeId:" << chargeTypeId;
if (gear.chargeTypeId() == chargeTypeId)
{
DEBUG_LOG() << "getGearTypeId return: " << gear.gearTypeId();
DEBUG_LOG(m_logger) << "getGearTypeId return: " << gear.gearTypeId();
if (gear.gearTypeId() != 0)
return gear.gearTypeId();
else
@@ -83,7 +83,7 @@ ModuleTestEffectCluster::ModuleTestEffectCluster(int domainId, int exerciseId)
this,
[this]()
{
DEBUG_LOG() << "Wirkfeldplanung";
DEBUG_LOG(m_logger) << "Wirkfeldplanung";
doEffectClusterModifyRequest();
});
}
@@ -91,28 +91,28 @@ ModuleTestEffectCluster::ModuleTestEffectCluster(int domainId, int exerciseId)
void ModuleTestEffectCluster::onEffectClusterModifyReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onEffectClusterModifyReply: " << m_replyError << ", aesItemId=" << replyObject.id();
DEBUG_LOG(m_logger) << " got reply - onEffectClusterModifyReply: " << m_replyError << ", aesItemId=" << replyObject.id();
m_aesItemId = replyObject.id();
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onEffectClusterModifyReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onEffectClusterModifyReply: " << replyObject.translated();
}
void ModuleTestEffectCluster::onAcknowledgeExternalAesItemReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onAcknowledgeExternalAesItemReply: " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onAcknowledgeExternalAesItemReply: " << m_replyError;
sendTabExFire();
// AES::EffectState von ES_Received -> ES_Created
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onAcknowledgeExternalAesItemReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onAcknowledgeExternalAesItemReply: " << replyObject.translated();
}
void ModuleTestEffectCluster::onModifyPartyDataReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onModifyPartyDataReply: " << m_replyError << " " << replyObject.additionalInfo();
DEBUG_LOG(m_logger) << " got reply - onModifyPartyDataReply: " << m_replyError << " " << replyObject.additionalInfo();
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onModifyPartyDataReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onModifyPartyDataReply: " << replyObject.translated();
if (!m_participantChangeRequestDone)
{
participantChangeRequest();
@@ -123,24 +123,24 @@ void ModuleTestEffectCluster::onModifyPartyDataReply(const Core::FunctionReplyOb
void ModuleTestEffectCluster::onModifyParticipantDataReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " \n\ngot reply - onModifyParticipantDataReply error: " << m_replyError << ", additionalInfo: " << replyObject.additionalInfo();
DEBUG_LOG(m_logger) << " \n\ngot reply - onModifyParticipantDataReply error: " << m_replyError << ", additionalInfo: " << replyObject.additionalInfo();
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onModifyParticipantDataReply: " << replyObject.translated();
DEBUG_LOG() << "onModifyParticipantDataReply => Set Participant Pos";
ERROR_LOG(m_logger) << " got reply - onModifyParticipantDataReply: " << replyObject.translated();
DEBUG_LOG(m_logger) << "onModifyParticipantDataReply => Set Participant Pos";
QJsonArray jsonArray = QJsonDocument::fromJson(QByteArray::fromStdString(replyObject.additionalInfo())).object().value(QLatin1String("participants")).toArray();
DEBUG_LOG() << "available_in_exercise jsonDocument.size()=" << jsonArray.size();
DEBUG_LOG(m_logger) << "available_in_exercise jsonDocument.size()=" << jsonArray.size();
// ParticipantId aus dem Result bestimmen, keine Unit
// Dieser einfache Test arbeitet mit einem Participant
for (auto it = jsonArray.constBegin(); it != jsonArray.constEnd(); ++it)
{
int participantId = it->toInt();
DEBUG_LOG() << "participantId=" << participantId;
DEBUG_LOG(m_logger) << "participantId=" << participantId;
ParticipantManagement::Participant participant = m_ppmDtc->participant(participantId);
if (m_ppmDtc->type(participant.typeId()).typeClass().underlying() != ParticipantManagement::TypeClass::Unit)
{
DEBUG_LOG() << "m_participant1.id=" << participantId;
DEBUG_LOG(m_logger) << "m_participant1.id=" << participantId;
m_participant1.id(participantId); // wichtig zum loeschen
DEBUG_LOG() << "m_participantId keine Unit=" << participantId;
DEBUG_LOG(m_logger) << "m_participantId keine Unit=" << participantId;
setParticipantPos(participantId);
setEquipmentGearCharge(participantId);
@@ -150,7 +150,7 @@ void ModuleTestEffectCluster::onModifyParticipantDataReply(const Core::FunctionR
}
else
{
DEBUG_LOG() << "m_participant0.id=" << participantId;
DEBUG_LOG(m_logger) << "m_participant0.id=" << participantId;
m_participant0.id(participantId); // wichtig zum loeschen
}
}
@@ -168,7 +168,7 @@ void ModuleTestEffectCluster::onAesItemViewChanged(const AesItemView &aesItemVie
if (aesItemView.aesItemId() != m_aesItemId)
return;
DEBUG_LOG() << " got onAesItemViewChanged: "
DEBUG_LOG(m_logger) << " got onAesItemViewChanged: "
<< ", aesItemId=" << aesItemView.aesItemId() << ", aesType=" << aesType << ", effectStateId=" << aesItemView.effectStateId();
QCOMPARE(aesItemView.effectStateId(), m_effectStates[m_effectStateCounter]);
@@ -176,14 +176,14 @@ void ModuleTestEffectCluster::onAesItemViewChanged(const AesItemView &aesItemVie
if (aesItemView.effectStateId() == AreaEffectSimulation::AesEffectState::EsReceived)
{
DEBUG_LOG() << "sendAcknowledgeExternalAesItemRequest aesItemId=" << aesItemView.aesItemId();
DEBUG_LOG(m_logger) << "sendAcknowledgeExternalAesItemRequest aesItemId=" << aesItemView.aesItemId();
sendAcknowledgeExternalAesItemRequest(aesItemView.aesItemId());
}
}
void ModuleTestEffectCluster::sendTabExFire()
{
DEBUG_LOG() << "sendTabExFire";
DEBUG_LOG(m_logger) << "sendTabExFire";
TrainingAreaBase::EX_Fire exFire;
exFire.effectorId(m_effectorId); // Kenner z.B B1
exFire.identifier(m_identifier.toStdString()); // Verein z.B 451100
@@ -199,16 +199,16 @@ void ModuleTestEffectCluster::onEffectsChanged(const Effects &effects, DataModif
if (modType == DataModification::eRemoved)
return;
AreaEffectSimulation::AesType_def::type aesType = effects.aesTypeId().underlying();
DEBUG_LOG() << " got onEffectsChanged - m_data: " << m_data.id() << ", aesType=" << aesType;
DEBUG_LOG(m_logger) << " got onEffectsChanged - m_data: " << m_data.id() << ", aesType=" << aesType;
++m_counterDds.cntEffectClusterEffects;
m_effects = effects;
DEBUG_LOG() << " got onEffectsChanged - m_effects: " << m_effects;
DEBUG_LOG(m_logger) << " got onEffectsChanged - m_effects: " << m_effects;
}
void ModuleTestEffectCluster::onChargeEffectChanged(const ChargeEffect &chargeEffect, DataModification modType)
{
DEBUG_LOG() << "onChargeEffectChanged state=" << chargeEffect.state();
DEBUG_LOG(m_logger) << "onChargeEffectChanged state=" << chargeEffect.state();
if (modType == DataModification::eRemoved)
return;
if (chargeEffect.state() == AreaEffectSimulation::AesEffectState::EsActivated)
@@ -225,7 +225,7 @@ void ModuleTestEffectCluster::onChargeEffectChanged(const ChargeEffect &chargeEf
}
else if (chargeEffect.state() == AreaEffectSimulation::AesEffectState::EsExpired)
participantDeleteRequest();
DEBUG_LOG() << " got onEffectsChanged - m_effects: " << m_effects;
DEBUG_LOG(m_logger) << " got onEffectsChanged - m_effects: " << m_effects;
}
void ModuleTestEffectCluster::onTrajectoryTimeAwareChanged(const TrajectoryTimeAware &data, DataModification modType)
@@ -236,12 +236,12 @@ void ModuleTestEffectCluster::onTrajectoryTimeAwareChanged(const TrajectoryTimeA
++m_counterDds.cntTrajectory;
DEBUG_LOG() << " got TrajectoryTimeAwareChanged - data: " << data.id() << ", cntTrajectory=" << m_counterDds.cntTrajectory;
DEBUG_LOG(m_logger) << " got TrajectoryTimeAwareChanged - data: " << data.id() << ", cntTrajectory=" << m_counterDds.cntTrajectory;
}
void ModuleTestEffectCluster::dumpCnt()
{
DEBUG_LOG() << Q_FUNC_INFO << " Counter: "
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " Counter: "
<< " cntEffectCluster = " << m_counterDds.cntEffectCluster << ", cntAtEffectCluster = " << m_counterDds.cntAtEffectCluster
<< ", cntGunToTargetLine = " << m_counterDds.cntAtEffectClusterGunToTargetLine << ", cntClusterEffects = " << m_counterDds.cntEffectClusterEffects
<< ", cntTrajectory = " << m_counterDds.cntTrajectory;
@@ -258,7 +258,7 @@ bool ModuleTestEffectCluster::waitForData(const std::function<bool()> &func, int
for (int i = 0; i < retryCount; ++i)
{
TRACE_LOG() << " waitForData - i: " << i;
TRACE_LOG(m_logger) << " waitForData - i: " << i;
if (func())
return true;
QTest::qWait(1000);
@@ -299,7 +299,7 @@ EffectCluster ModuleTestEffectCluster::getEcForTneVerification(const QString &ea
QPointF bottomLeft(Polygons::centerPoint2BottomLeft(cp.geographic(), width, height, rot));
DEBUG_LOG() << " bottomLeft" << bottomLeft;
DEBUG_LOG(m_logger) << " bottomLeft" << bottomLeft;
eaData.area().cornerBottomLeft(Core::GeoPosition(bottomLeft.x(), bottomLeft.y(), 0.0));
eaData.area().height(height);
@@ -359,23 +359,23 @@ std::vector<Core::RelativePositionRelativeTime> ModuleTestEffectCluster::parseTr
}
}
points.push_back(p);
DEBUG_LOG() << "Punkt gelesen: offsetY" << p.offsetX() << ", offsetY" << p.offsetY() << ", offsetZ" << p.offsetZ() << ", time=" << p.relativeTime();
DEBUG_LOG(m_logger) << "Punkt gelesen: offsetY" << p.offsetX() << ", offsetY" << p.offsetY() << ", offsetZ" << p.offsetZ() << ", time=" << p.relativeTime();
}
}
if (xml.hasError())
{
DEBUG_LOG() << "XML Fehler:" << xml.errorString();
DEBUG_LOG(m_logger) << "XML Fehler:" << xml.errorString();
}
DEBUG_LOG() << "file.close()";
DEBUG_LOG(m_logger) << "file.close()";
file.close();
DEBUG_LOG() << "return points";
DEBUG_LOG(m_logger) << "return points";
return points;
}
int ModuleTestEffectCluster::sendAcknowledgeExternalAesItemRequest(int aesItemId)
{
DEBUG_LOG() << "sendAcknowledgeExternalAesItemRequest aesItemId=" << aesItemId;
DEBUG_LOG(m_logger) << "sendAcknowledgeExternalAesItemRequest aesItemId=" << aesItemId;
int ret = m_aesFtc->acknowledgeExternalAesItemRequest(AcknowledgeExternalAesItemRequest(aesItemId), this);
return ret;
}
@@ -387,9 +387,9 @@ int ModuleTestEffectCluster::doEffectClusterModifyRequest()
m_reference = dateTimeString;
if (eaData.effectStart().is_set())
INFO_LOG() << " effectClusterModifyRequest with effectStart: " << QDateTime::fromMSecsSinceEpoch(eaData.effectStart().get()).toString();
INFO_LOG(m_logger) << " effectClusterModifyRequest with effectStart: " << QDateTime::fromMSecsSinceEpoch(eaData.effectStart().get()).toString();
else
INFO_LOG() << " effectClusterModifyRequest with effectStart: not set ";
INFO_LOG(m_logger) << " effectClusterModifyRequest with effectStart: not set ";
FlightCurve fc;
// if (eaData.flightCurve().is_set())
@@ -439,7 +439,7 @@ int ModuleTestEffectCluster::doEffectClusterModifyRequest()
AreaEffectSimulation::EffectorData effector;
effector.angleOfFall(0);
effector.participantId(m_participant1.id()); // Participant
DEBUG_LOG() << "effector.participantId(m_participant1.id()=" << m_participant1.id();
DEBUG_LOG(m_logger) << "effector.participantId(m_participant1.id()=" << m_participant1.id();
effector.flightTime(39526.3);
effector.peakHeight(2002.0);
@@ -454,26 +454,26 @@ int ModuleTestEffectCluster::doEffectClusterModifyRequest()
effector.mhpPosition(mhpPosition);
effector.trajectoryRelative(trajectory);
DEBUG_LOG() << "effector";
DEBUG_LOG(m_logger) << "effector";
std::vector<AreaEffectSimulation::EffectorData> effectors;
effectors.push_back(effector);
DEBUG_LOG() << "Nach effector";
DEBUG_LOG(m_logger) << "Nach effector";
eaData.id(0);
eaData.effectSourceId(ProjectDataManagement::EffectSource::ES_ADLER);
eaData.firePurposeId(2);
eaData.partyId(4);
eaData.participantId(m_participant0.id()); // Unit
DEBUG_LOG() << "eaData.participantId(m_participant0.id()=" << m_participant0.id();
DEBUG_LOG(m_logger) << "eaData.participantId(m_participant0.id()=" << m_participant0.id();
eaData.externalId(7);
eaData.effectMarkingInTa(1);
eaData.name(dateTimeString.toStdString());
eaData.element(dateTimeString.toStdString());
DEBUG_LOG() << "Vor send effectClusterModifyRequest";
DEBUG_LOG(m_logger) << "Vor send effectClusterModifyRequest";
int ret = m_aesFtc->effectClusterModifyRequest(EffectClusterModifyRequest(eaData.id(),
eaData.name(),
@@ -493,7 +493,7 @@ int ModuleTestEffectCluster::doEffectClusterModifyRequest()
eaData.effectMarkingInTa(),
eaData.properties()),
this);
DEBUG_LOG() << "send effectClusterModifyRequest ret=" << ret;
DEBUG_LOG(m_logger) << "send effectClusterModifyRequest ret=" << ret;
return ret;
}
@@ -502,31 +502,31 @@ void ModuleTestEffectCluster::waitForEffectStates(int lineNumber, int durPrep, i
// expected condition:
if (!waitForData([this]() { return m_replyError == false; }, 1))
{
ERROR_LOG() << "Error on request"
ERROR_LOG(m_logger) << "Error on request"
<< ", lineNumber = " << lineNumber;
return;
}
INFO_LOG() << Q_FUNC_INFO << " waiting for EsPrepared...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsPrepared...";
if (!waitForData([this]() { return m_data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsPrepared; }, durPrep))
{
ERROR_LOG() << "Timeout waiting for EsPrepared of explosion cluster with id " << m_data.id() << ", lineNumber = " << lineNumber;
ERROR_LOG(m_logger) << "Timeout waiting for EsPrepared of explosion cluster with id " << m_data.id() << ", lineNumber = " << lineNumber;
QVERIFY2(false, "ERROR, exit");
return;
}
INFO_LOG() << Q_FUNC_INFO << " waiting for EsActivated...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsActivated...";
if (!waitForData([this]() { return m_data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated; }, durAct))
{
ERROR_LOG() << "Timeout waiting for EsActivated of explosion cluster with id " << m_data.id() << ", lineNumber = " << lineNumber;
ERROR_LOG(m_logger) << "Timeout waiting for EsActivated of explosion cluster with id " << m_data.id() << ", lineNumber = " << lineNumber;
QVERIFY2(false, "ERROR, exit");
return;
}
INFO_LOG() << Q_FUNC_INFO << " waiting for EsExpired...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsExpired...";
if (!waitForData([this]() { return m_data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired; }, durExp))
{
ERROR_LOG() << "Timeout waiting for EsExpired of explosion cluster with id " << m_data.id() << ", lineNumber = " << lineNumber;
ERROR_LOG(m_logger) << "Timeout waiting for EsExpired of explosion cluster with id " << m_data.id() << ", lineNumber = " << lineNumber;
QVERIFY2(false, "ERROR, exit");
return;
}
@@ -534,7 +534,7 @@ void ModuleTestEffectCluster::waitForEffectStates(int lineNumber, int durPrep, i
void ModuleTestEffectCluster::disconnectFromParty()
{
DEBUG_LOG() << "PPM::ModifyPartyDataRequest";
DEBUG_LOG(m_logger) << "PPM::ModifyPartyDataRequest";
ParticipantManagement::Party party;
@@ -559,14 +559,14 @@ void ModuleTestEffectCluster::disconnectFromParty()
if (!m_ppmFtc->modifyPartyDataRequest(req, this))
{
ERROR_LOG() << "Error creating party data";
ERROR_LOG(m_logger) << "Error creating party data";
// failExit();
}
}
void ModuleTestEffectCluster::connectToParty()
{
DEBUG_LOG() << "PPM::ModifyPartyDataRequest";
DEBUG_LOG(m_logger) << "PPM::ModifyPartyDataRequest";
ParticipantManagement::Party party;
@@ -592,14 +592,14 @@ void ModuleTestEffectCluster::connectToParty()
if (!m_ppmFtc->modifyPartyDataRequest(req, this))
{
ERROR_LOG() << "Error creating party data";
ERROR_LOG(m_logger) << "Error creating party data";
// failExit();
}
}
void ModuleTestEffectCluster::participantChangeRequest()
{
DEBUG_LOG() << "PPM::participantChangerequest";
DEBUG_LOG(m_logger) << "PPM::participantChangerequest";
m_participant0.id(0);
m_participant0.partyId(4);
@@ -643,14 +643,14 @@ void ModuleTestEffectCluster::participantChangeRequest()
req.data(data);
if (!m_ppmFtc->modifyParticipantDataRequest(req, this))
{
ERROR_LOG() << "Error creating party data";
ERROR_LOG(m_logger) << "Error creating party data";
// failExit();
}
}
void ModuleTestEffectCluster::participantDeleteRequest()
{
DEBUG_LOG() << "PPM::participantDeleteRequest";
DEBUG_LOG(m_logger) << "PPM::participantDeleteRequest";
m_participant0.isDeleted(true);
@@ -664,14 +664,14 @@ void ModuleTestEffectCluster::participantDeleteRequest()
req.data(data);
if (!m_ppmFtc->modifyParticipantDataRequest(req, this))
{
ERROR_LOG() << "Error creating party data";
ERROR_LOG(m_logger) << "Error creating party data";
// failExit();
}
}
void ModuleTestEffectCluster::setParticipantPos(int participantId)
{
DEBUG_LOG() << "setupParticipants";
DEBUG_LOG(m_logger) << "setupParticipants";
TrainingAreaBase::TabPosition position;
Core::GeoPosition geoPos;
TrainingAreaBase::EquipmentPosition pos;
@@ -680,7 +680,7 @@ void ModuleTestEffectCluster::setParticipantPos(int participantId)
geoPos.lat(0.91579597);
geoPos.z(0.0);
DEBUG_LOG() << " initTestCase_data1 ...";
DEBUG_LOG(m_logger) << " initTestCase_data1 ...";
pos.equipmentNumber(participantId * -1); // ParticipantId
pos.sampleTime(QDateTime::currentMSecsSinceEpoch());
position.reportingSource(Core::PositionReportingSource::SetByOperator);
@@ -691,7 +691,7 @@ void ModuleTestEffectCluster::setParticipantPos(int participantId)
void ModuleTestEffectCluster::setEquipmentGearCharge(int participantId)
{
DEBUG_LOG() << "setupEquipmentGearCharge";
DEBUG_LOG(m_logger) << "setupEquipmentGearCharge";
TrainingAreaBase::EquipmentGearChargeState egs;
TrainingAreaBase::GearCharge charge;
std::vector<TrainingAreaBase::GearCharge> charges;
@@ -729,7 +729,7 @@ void ModuleTestEffectCluster::setEquipmentGearCharge(int participantId)
void ModuleTestEffectCluster::onPartyChanged(const ParticipantManagement::Party &data, DataModification modType)
{
DEBUG_LOG() << "onPartyChanged:" << data;
DEBUG_LOG(m_logger) << "onPartyChanged:" << data;
// Remove Participant:
if (modType == DataModification::eRemoved)
{
@@ -741,14 +741,14 @@ void ModuleTestEffectCluster::onPartyChanged(const ParticipantManagement::Party
return;
}
DEBUG_LOG() << "onPartyChanged id= " << data.id();
DEBUG_LOG(m_logger) << "onPartyChanged id= " << data.id();
if (m_ppmDtc->saaConnectedState(data.id()) == ParticipantManagement::ConnectState::Connected)
{
DEBUG_LOG() << "onPartyChanged saaConnectedState == connected";
DEBUG_LOG(m_logger) << "onPartyChanged saaConnectedState == connected";
}
else if (m_ppmDtc->saaConnectedState(data.id()) == ParticipantManagement::ConnectState::Disconnected)
{
DEBUG_LOG() << "onPartyChanged saaConnectedState == disconnected => connectToParty";
DEBUG_LOG(m_logger) << "onPartyChanged saaConnectedState == disconnected => connectToParty";
connectToParty();
}
}
@@ -762,7 +762,7 @@ void ModuleTestEffectCluster::initTestCase()
// DdsConnector
//
DEBUG_LOG() << "DDSConnector: m_domainId " << m_domainId << ", m_exerciseId " << m_exerciseId;
DEBUG_LOG(m_logger) << "DDSConnector: m_domainId " << m_domainId << ", m_exerciseId " << m_exerciseId;
QFile file(s_REQUEST_SPL_FILE);
const bool bFileExists = file.exists();
@@ -774,14 +774,14 @@ void ModuleTestEffectCluster::initTestCase()
QVERIFY2(bInit, "ERROR, ddsConnector.init failed!!");
if (!bInit)
{
ERROR_LOG() << " ERROR, ddsConnector.init failed!!";
ERROR_LOG(m_logger) << " ERROR, ddsConnector.init failed!!";
return;
}
INFO_LOG() << " ddsConnector.init successfull";
INFO_LOG(m_logger) << " ddsConnector.init successfull";
// cmd
m_ddsConnector->initPublisherSubscriber();
INFO_LOG() << " ddsConnector.initPublisherSubscriber done";
INFO_LOG(m_logger) << " ddsConnector.initPublisherSubscriber done";
//
// Aes
@@ -802,12 +802,12 @@ void ModuleTestEffectCluster::initTestCase()
m_aesDtc->enableAesItemView();
m_aesDtc->enableChargeEffect();
DEBUG_LOG() << " waitForHistoricalDataAesItemView... ";
DEBUG_LOG(m_logger) << " waitForHistoricalDataAesItemView... ";
m_aesDtc->waitForHistoricalDataAesItemView(2000);
DEBUG_LOG() << " waitForHistoricalDataAesItemView... Done";
DEBUG_LOG(m_logger) << " waitForHistoricalDataAesItemView... Done";
QMap<qint32, AreaEffectSimulation::AesItemView> aesItemViewsCont = m_aesDtc->aesItemViews();
DEBUG_LOG() << " aesItemViewsCont.size() " << aesItemViewsCont.size();
DEBUG_LOG(m_logger) << " aesItemViewsCont.size() " << aesItemViewsCont.size();
//
// PDM
@@ -832,13 +832,13 @@ void ModuleTestEffectCluster::initTestCase()
QVERIFY2(bRet, "ERROR, enableAll m_exmDtc failed!!");
m_exmDtc->waitForHistoricalDataExercise(2000);
DEBUG_LOG() << " waitForHistoricalDataExercise... Done";
DEBUG_LOG(m_logger) << " waitForHistoricalDataExercise... Done";
const ExerciseManagement::Exercise &exercise = m_exmDtc->exercise(m_exerciseId);
QVERIFY2(exercise.id() == m_exerciseId, "ERROR, exercise failed!!");
m_traingAreaId = exercise.trainingAreaId();
DEBUG_LOG() << " ExerciseManagement"
DEBUG_LOG(m_logger) << " ExerciseManagement"
<< ", m_traingAreaId = " << m_traingAreaId;
//
// PPM ParticipantManagement
@@ -861,7 +861,7 @@ void ModuleTestEffectCluster::initTestCase()
bRet = bRet && m_tabDts->enableAll();
QVERIFY2(bRet, "ERROR, m_tabDts enableAll failed!!");
DEBUG_LOG() << "disconnectFromParty";
DEBUG_LOG(m_logger) << "disconnectFromParty";
disconnectFromParty();
// connectToParty();
@@ -896,9 +896,9 @@ void ModuleTestEffectCluster::cleanupTestCase()
// finish last (dds) calls:
waitForData([]() { return false; }, 10);
INFO_LOG() << " ddsConnector destroy...";
INFO_LOG(m_logger) << " ddsConnector destroy...";
m_ddsConnector.reset();
INFO_LOG() << " ddsConnector destroy...DONE";
INFO_LOG(m_logger) << " ddsConnector destroy...DONE";
}
int main(int argc, char *argv[])
@@ -61,6 +61,8 @@ public:
ModuleTestEffectCluster(int domainId, int exerciseId);
protected:
NGL::INGLLogger &m_logger;
void onEffectClusterModifyReply(const Core::FunctionReplyObject &replyObject) override;
void onAcknowledgeExternalAesItemReply(const Core::FunctionReplyObject &replyObject) override;
void onModifyPartyDataReply(const Core::FunctionReplyObject &replyObject) override;
@@ -102,65 +102,65 @@ ModuleTestExplosionCluster::ModuleTestExplosionCluster(int domainId, int exercis
void ModuleTestExplosionCluster::onSetSimulatedPositionReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onSetSimulatedPositionReply : " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onSetSimulatedPositionReply : " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onExplosionClusterModifyReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onExplosionClusterModifyReply: " << replyObject.translated();
}
void ModuleTestExplosionCluster::onSetSimulatedParticipantFormationReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onSetSimulatedParticipantFormationReply : " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onSetSimulatedParticipantFormationReply : " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onSetSimulatedParticipantFormationReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onSetSimulatedParticipantFormationReply: " << replyObject.translated();
}
void ModuleTestExplosionCluster::onExplosionClusterModifyReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onExplosionClusterModifyReply: " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onExplosionClusterModifyReply: " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onExplosionClusterModifyReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onExplosionClusterModifyReply: " << replyObject.translated();
}
void ModuleTestExplosionCluster::onExplosionClusterSingleEffectOnlyModifyReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onExplosionClusterSingleEffectOnlyModifyReply: " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onExplosionClusterSingleEffectOnlyModifyReply: " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onExplosionClusterSingleEffectOnlyModifyReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onExplosionClusterSingleEffectOnlyModifyReply: " << replyObject.translated();
}
void ModuleTestExplosionCluster::onExplosionClusterOcModifyReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onExplosionClusterOcModifyReply: " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onExplosionClusterOcModifyReply: " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onExplosionClusterOcModifyReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onExplosionClusterOcModifyReply: " << replyObject.translated();
}
void ModuleTestExplosionCluster::onExplosionClusterPauseResumeReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onExplosionClusterPauseResumeReply: " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onExplosionClusterPauseResumeReply: " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onExplosionClusterModifyReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onExplosionClusterModifyReply: " << replyObject.translated();
}
void ModuleTestExplosionCluster::onTargetPositionsModifyReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onTargetPositionsModifyReply: " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onTargetPositionsModifyReply: " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onTargetPositionsModifyReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onTargetPositionsModifyReply: " << replyObject.translated();
}
void ModuleTestExplosionCluster::onSetBuildingStatesReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onSetBuildingStatesReply: " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onSetBuildingStatesReply: " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onSetBuildingStatesReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onSetBuildingStatesReply: " << replyObject.translated();
}
void ModuleTestExplosionCluster::onExplosionClusterChanged(const ExplosionCluster &data, DataModification modType)
@@ -177,7 +177,7 @@ void ModuleTestExplosionCluster::onExplosionClusterChanged(const ExplosionCluste
{
long now = time(nullptr) * 1000;
long diff = now - m_objectRequestedTimePointMsec;
DEBUG_LOG() << " got changed - m_data: " << m_data.id() << ", state=" << m_data.effectStateId()
DEBUG_LOG(m_logger) << " got changed - m_data: " << m_data.id() << ", state=" << m_data.effectStateId()
<< ", OBJECT IS NOT Modifiable ANYMORE"
<< " ((diff = " << diff << ")";
}
@@ -187,10 +187,10 @@ void ModuleTestExplosionCluster::onExplosionClusterChanged(const ExplosionCluste
if (m_data.effectStart().is_set())
startTimeMsec = m_data.effectStart().get();
DEBUG_LOG() << " got changed - m_data: " << m_data.id() << ", state=" << m_data.effectStateId()
DEBUG_LOG(m_logger) << " got changed - m_data: " << m_data.id() << ", state=" << m_data.effectStateId()
<< ", startTimeMsec=" << startTimeMsec
<< ", cntExplosionCluster=" << m_counterDds.cntExplosionCluster;
TRACE_LOG() << " got changed - m_data: " << m_data;
TRACE_LOG(m_logger) << " got changed - m_data: " << m_data;
}
void ModuleTestExplosionCluster::onBuildingStateChanged(const Buildings::BuildingState &bldgState, DataModification modType)
@@ -198,7 +198,7 @@ void ModuleTestExplosionCluster::onBuildingStateChanged(const Buildings::Buildin
if (modType == DataModification::eRemoved)
return;
// DEBUG_LOG() << " got changed - BuildingState.id: " << bldgState.id() << ", data.damagePerc " << bldgState.damagePercent() << "m_bldgIdToFilter " << m_bldgIdToFilter;
// DEBUG_LOG(m_logger) << " got changed - BuildingState.id: " << bldgState.id() << ", data.damagePerc " << bldgState.damagePercent() << "m_bldgIdToFilter " << m_bldgIdToFilter;
if (m_bldgIdToFilter == bldgState.id())
m_buildingStateVec.push_back(bldgState);
@@ -210,7 +210,7 @@ void ModuleTestExplosionCluster::onAesItemViewChanged(const AesItemView &aesItem
return;
AreaEffectSimulation::AesType_def::type aesType = aesItemView.aesTypeId().underlying();
DEBUG_LOG() << " got onAesItemViewChanged - m_data: " << m_data.id() << ", aesType=" << aesType;
DEBUG_LOG(m_logger) << " got onAesItemViewChanged - m_data: " << m_data.id() << ", aesType=" << aesType;
switch (aesType) {
case AreaEffectSimulation::AesType_def::AtExplosionCluster:
@@ -233,11 +233,11 @@ void ModuleTestExplosionCluster::onEffectsChanged(const Effects &effects, DataMo
if (modType == DataModification::eRemoved)
return;
AreaEffectSimulation::AesType_def::type aesType = effects.aesTypeId().underlying();
DEBUG_LOG() << " got onEffectsChanged - m_data: " << m_data.id() << ", aesType=" << aesType;
DEBUG_LOG(m_logger) << " got onEffectsChanged - m_data: " << m_data.id() << ", aesType=" << aesType;
++m_counterDds.cntExplosionClusterEffects;
m_effects = effects;
DEBUG_LOG() << " got onEffectsChanged - m_effects: " << m_effects;
DEBUG_LOG(m_logger) << " got onEffectsChanged - m_effects: " << m_effects;
}
void ModuleTestExplosionCluster::onTrajectoryTimeAwareChanged(const TrajectoryTimeAware &data, DataModification modType)
@@ -248,7 +248,7 @@ void ModuleTestExplosionCluster::onTrajectoryTimeAwareChanged(const TrajectoryTi
++m_counterDds.cntTrajectory;
DEBUG_LOG() << " got TrajectoryTimeAwareChanged - data: " << data.id() << ", cntTrajectory=" << m_counterDds.cntTrajectory;
DEBUG_LOG(m_logger) << " got TrajectoryTimeAwareChanged - data: " << data.id() << ", cntTrajectory=" << m_counterDds.cntTrajectory;
}
void ModuleTestExplosionCluster::dumpCnt()
@@ -278,11 +278,11 @@ bool ModuleTestExplosionCluster::setFilterForBldgState(const QString &bldgName)
const int bldgId = getBldgId(bldgName);
if (bldgId<=0)
{
ERROR_LOG() << " getBldgId failed for '" << bldgName << "'";
ERROR_LOG(m_logger) << " getBldgId failed for '" << bldgName << "'";
return false;
}
m_bldgIdToFilter = bldgId;
INFO_LOG() << " setFilterForBldgState for '" << bldgName << "' to " << m_bldgIdToFilter;
INFO_LOG(m_logger) << " setFilterForBldgState for '" << bldgName << "' to " << m_bldgIdToFilter;
return true;
}
@@ -307,13 +307,13 @@ bool ModuleTestExplosionCluster::checkSingleEffects(uint idx, const LtsCoordTran
if (se.singleEffectTime() < 1000)
{
ERROR_LOG() << " bldg: " << context << ", idx = " << idx << ": singleEffectTime failed, SingleEffect = " << se;
ERROR_LOG(m_logger) << " bldg: " << context << ", idx = " << idx << ": singleEffectTime failed, SingleEffect = " << se;
return false;
}
if (se.zPlacement() != zPlace)
{
ERROR_LOG() << " bldg: " << context << ", idx = " << idx << ": zPlacement failed, SingleEffect = " << se;
ERROR_LOG(m_logger) << " bldg: " << context << ", idx = " << idx << ": zPlacement failed, SingleEffect = " << se;
return false;
}
@@ -322,9 +322,9 @@ bool ModuleTestExplosionCluster::checkSingleEffects(uint idx, const LtsCoordTran
if (dist3D > maxDist3D)
{
ERROR_LOG() << " bldg: " << context << ", idx = " << idx << ": position failed, dist3D = " << dist3D;
ERROR_LOG() << " idx = " << idx << ", Impact IST = " << ltsPos;
ERROR_LOG() << " idx = " << idx << ", Impact SHD = " << coord;
ERROR_LOG(m_logger) << " bldg: " << context << ", idx = " << idx << ": position failed, dist3D = " << dist3D;
ERROR_LOG(m_logger) << " idx = " << idx << ", Impact IST = " << ltsPos;
ERROR_LOG(m_logger) << " idx = " << idx << ", Impact SHD = " << coord;
return false;
}
@@ -361,7 +361,7 @@ bool ModuleTestExplosionCluster::waitForData(const std::function<bool ()> &func,
for (int i = 0; i < retryCount; ++i)
{
TRACE_LOG() << " waitForData - i: " << i;
TRACE_LOG(m_logger) << " waitForData - i: " << i;
if (func())
return true;
QTest::qWait(100);
@@ -636,9 +636,9 @@ ExplosionCluster ModuleTestExplosionCluster::getEcFor3101(const QString &eaName)
int ModuleTestExplosionCluster::doExplosionClusterModifyRequest(const ExplosionCluster &eaData)
{
if (eaData.effectStart().is_set())
INFO_LOG() << " explosionClusterModifyRequest with effectStart: " << QDateTime::fromMSecsSinceEpoch(eaData.effectStart().get()).toString();
INFO_LOG(m_logger) << " explosionClusterModifyRequest with effectStart: " << QDateTime::fromMSecsSinceEpoch(eaData.effectStart().get()).toString();
else
INFO_LOG() << " explosionClusterModifyRequest with effectStart: not set ";
INFO_LOG(m_logger) << " explosionClusterModifyRequest with effectStart: not set ";
FlightCurve fc;
if (eaData.flightCurve().is_set())
@@ -686,9 +686,9 @@ int ModuleTestExplosionCluster::doExplosionClusterModifyRequest(const ExplosionC
int ModuleTestExplosionCluster::doExplosionClusterSingleEffectOnlyModifyRequest(const ExplosionClusterSingleEffectOnlyRequest &request)
{
if (request.effectStart().is_set())
INFO_LOG() << " explosionClusterModifyRequest with effectStart: " << QDateTime::fromMSecsSinceEpoch(request.effectStart().get()).toString();
INFO_LOG(m_logger) << " explosionClusterModifyRequest with effectStart: " << QDateTime::fromMSecsSinceEpoch(request.effectStart().get()).toString();
else
INFO_LOG() << " explosionClusterModifyRequest with effectStart: not set ";
INFO_LOG(m_logger) << " explosionClusterModifyRequest with effectStart: not set ";
int ret = m_aesFtc->explosionClusterSingleEffectOnlyModifyRequest(request, this);
return ret;
@@ -711,32 +711,32 @@ void ModuleTestExplosionCluster::waitForEffectStates(int lineNumber, int durPrep
// expected condition:
if (!waitForData([this]() { return m_replyError == false; }, 1))
{
ERROR_LOG() << "Error on request" << ", lineNumber = " << lineNumber;
ERROR_LOG(m_logger) << "Error on request" << ", lineNumber = " << lineNumber;
return;
}
INFO_LOG() << Q_FUNC_INFO << " waiting for EsPrepared...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsPrepared...";
if (!waitForData([this]() { return m_data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsPrepared;}, durPrep))
{
ERROR_LOG() << "Timeout waiting for EsPrepared of explosion cluster with id " << m_data.id()
ERROR_LOG(m_logger) << "Timeout waiting for EsPrepared of explosion cluster with id " << m_data.id()
<< ", lineNumber = " << lineNumber;
QVERIFY2(false, "ERROR, exit");
return;
}
INFO_LOG() << Q_FUNC_INFO << " waiting for EsActivated...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsActivated...";
if (!waitForData([this]() { return m_data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated;}, durAct))
{
ERROR_LOG() << "Timeout waiting for EsActivated of explosion cluster with id " << m_data.id()
ERROR_LOG(m_logger) << "Timeout waiting for EsActivated of explosion cluster with id " << m_data.id()
<< ", lineNumber = " << lineNumber;
QVERIFY2(false, "ERROR, exit");
return;
}
INFO_LOG() << Q_FUNC_INFO << " waiting for EsExpired...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsExpired...";
if (!waitForData([this]() { return m_data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired;}, durExp))
{
ERROR_LOG() << "Timeout waiting for EsExpired of explosion cluster with id " << m_data.id()
ERROR_LOG(m_logger) << "Timeout waiting for EsExpired of explosion cluster with id " << m_data.id()
<< ", lineNumber = " << lineNumber;
QVERIFY2(false, "ERROR, exit");
return;
@@ -762,14 +762,14 @@ void ModuleTestExplosionCluster::setupParticipants()
QPointF pos = utmPos.geographic();
req.position(Core::GeoPosition(pos.x(), pos.y(), 0.0));
INFO_LOG() << " setSimulatedPositionRequest ...";
INFO_LOG(m_logger) << " setSimulatedPositionRequest ...";
m_replyError = true;
m_ppmFtc->setSimulatedPositionRequest(req, this);
// expected condition:
if (!waitForData([this]() { return m_replyError == false; }))
{
ERROR_LOG() << "Error on request";
ERROR_LOG(m_logger) << "Error on request";
}
}
@@ -782,14 +782,14 @@ void ModuleTestExplosionCluster::setupParticipants()
QPointF pos = utmPos.geographic();
req.position(Core::GeoPosition(pos.x(), pos.y(), 0.0));
INFO_LOG() << " setSimulatedPositionRequest ...";
INFO_LOG(m_logger) << " setSimulatedPositionRequest ...";
m_replyError = true;
m_ppmFtc->setSimulatedPositionRequest(req, this);
// expected condition:
if (!waitForData([this]() { return m_replyError == false; }))
{
ERROR_LOG() << "Error on request";
ERROR_LOG(m_logger) << "Error on request";
}
}
@@ -808,14 +808,14 @@ void ModuleTestExplosionCluster::setupParticipants()
QString prop = QString(QStringLiteral("{\"angle\":0,\"distance\":25,\"distanceSets\":{\"Aufgelockert\":50,\"Geschlossen\":25},\"geometry\":\"line\"}"));
req_SSPF.formation( prop.toStdString() );
INFO_LOG() << " SetSimulatedParticipantFormation ... req = " << req_SSPF ;
INFO_LOG(m_logger) << " SetSimulatedParticipantFormation ... req = " << req_SSPF ;
m_replyError = true;
m_ppmFtc->setSimulatedParticipantFormationRequest(req_SSPF, this);
// expected condition:
if (!waitForData([this]() { return m_replyError == false; }))
{
ERROR_LOG() << "Error on request";
ERROR_LOG(m_logger) << "Error on request";
}
}
@@ -832,18 +832,18 @@ void ModuleTestExplosionCluster::setupParticipants()
QString prop = QString(QStringLiteral("{\"angle\":0,\"distance\":25,\"distanceSets\":{\"Aufgelockert\":50,\"Geschlossen\":25},\"geometry\":\"line\"}"));
req_SSPF.formation( prop.toStdString() );
INFO_LOG() << " SetSimulatedParticipantFormation ... req = " << req_SSPF ;
INFO_LOG(m_logger) << " SetSimulatedParticipantFormation ... req = " << req_SSPF ;
m_replyError = true;
m_ppmFtc->setSimulatedParticipantFormationRequest(req_SSPF, this);
// expected condition:
if (!waitForData([this]() { return m_replyError == false; }))
{
ERROR_LOG() << "Error on request";
ERROR_LOG(m_logger) << "Error on request";
}
}
INFO_LOG() << " setSimulatedPositionRequest ...DONE";
INFO_LOG(m_logger) << " setSimulatedPositionRequest ...DONE";
}
bool ModuleTestExplosionCluster::checkParticipant_5()
@@ -852,7 +852,7 @@ bool ModuleTestExplosionCluster::checkParticipant_5()
const int partId = 5;
const ParticipantManagement::ParticipantPosition &pos = m_ppmDtc->participantPosition(partId);
QString mgrsStr = LtsCoordTrans::mgrsFromGeographic(pos.pos().lon(), pos.pos().lat());
INFO_LOG() << " for partId = '" << partId << "', we got position: " << mgrsStr;
INFO_LOG(m_logger) << " for partId = '" << partId << "', we got position: " << mgrsStr;
return mgrsStr == QStringLiteral("32U PD 76900 18000");
}
@@ -863,7 +863,7 @@ bool ModuleTestExplosionCluster::checkParticipant_6()
const int partId = 6;
const ParticipantManagement::ParticipantPosition &pos = m_ppmDtc->participantPosition(partId);
QString mgrsStr = LtsCoordTrans::mgrsFromGeographic(pos.pos().lon(), pos.pos().lat());
INFO_LOG() << " for partId = '" << partId << "', we got position: " << mgrsStr;
INFO_LOG(m_logger) << " for partId = '" << partId << "', we got position: " << mgrsStr;
return mgrsStr == QStringLiteral("32U PD 76000 19000");
}
@@ -877,12 +877,12 @@ bool ModuleTestExplosionCluster::checkParticipant_89()
const LtsUtils::QPoint3D &centerCoordGeo = Polygons::calculateFiringUnitCenterNonRecursive(m_ppmDtc, partId, singlePositionsOut_unused, m_logger);
if (centerCoordGeo.isNull() || std::isnan(centerCoordGeo.x()))
{
WARNING_LOG() << Q_FUNC_INFO << " calculateFiringUnitCenterNonRecursive failed, partId = " << partId;
WARNING_LOG(m_logger) << Q_FUNC_INFO << " calculateFiringUnitCenterNonRecursive failed, partId = " << partId;
return false;
}
QString mgrsStr = LtsCoordTrans::mgrsFromGeographic(centerCoordGeo.x(), centerCoordGeo.y());
INFO_LOG() << " for unit with partId = '" << partId << "', we got position: " << mgrsStr;
INFO_LOG(m_logger) << " for unit with partId = '" << partId << "', we got position: " << mgrsStr;
return mgrsStr == QStringLiteral("32U PD 50000 18000");
}
@@ -896,12 +896,12 @@ bool ModuleTestExplosionCluster::checkParticipant_99()
const LtsUtils::QPoint3D &centerCoordGeo = Polygons::calculateFiringUnitCenterNonRecursive(m_ppmDtc, partId, singlePositionsOut_unused, m_logger);
if (centerCoordGeo.isNull() || std::isnan(centerCoordGeo.x()))
{
WARNING_LOG() << Q_FUNC_INFO << " calculateFiringUnitCenterNonRecursive failed, partId = " << partId;
WARNING_LOG(m_logger) << Q_FUNC_INFO << " calculateFiringUnitCenterNonRecursive failed, partId = " << partId;
return false;
}
QString mgrsStr = LtsCoordTrans::mgrsFromGeographic(centerCoordGeo.x(), centerCoordGeo.y());
INFO_LOG() << " for unit with partId = '" << partId << "', we got position: " << mgrsStr;
INFO_LOG(m_logger) << " for unit with partId = '" << partId << "', we got position: " << mgrsStr;
return mgrsStr == QStringLiteral("32U PD 01000 18000");
}
@@ -954,7 +954,7 @@ void ModuleTestExplosionCluster::resetBldgs()
for (int bldgId : std::as_const(bldgIds))
{
const ProjectDataManagement::VulnerabilityState& bldgState = m_bldDtc->buildingState(bldgId).vulnerabilityState();
INFO_LOG() << "resetBldgs: bldgId " << bldgId
INFO_LOG(m_logger) << "resetBldgs: bldgId " << bldgId
<< ", state= " << bldgState
<< ", bldgName= " << m_bldgIdToName[bldgId];
QVERIFY2(bldgState.underlying()==ProjectDataManagement::VulnerabilityState_def::CombatReady, "ERROR, bldgState failed!!");
@@ -1016,14 +1016,14 @@ void ModuleTestExplosionCluster::initTestCase()
QVERIFY2(bInit, "ERROR, ddsConnector.init failed!!");
if (!bInit)
{
ERROR_LOG() << " ERROR, ddsConnector.init failed!!";
ERROR_LOG(m_logger) << " ERROR, ddsConnector.init failed!!";
return;
}
INFO_LOG() << " ddsConnector.init successfull";
INFO_LOG(m_logger) << " ddsConnector.init successfull";
// cmd
m_ddsConnector->initPublisherSubscriber();
INFO_LOG() << " ddsConnector.initPublisherSubscriber done";
INFO_LOG(m_logger) << " ddsConnector.initPublisherSubscriber done";
//
// Aes
@@ -1215,16 +1215,16 @@ void ModuleTestExplosionCluster::test_TneVerificationBremen_00()
double rot = 0;
INFO_LOG() << " TNE VERIFICATION: CHECK:" << " rot " << rot << ", rotSfmOrg " << compassToMathAngleForSfm(rot) << ", rotSfmPlus90 " << compassToMathAngleForSfm(rot+90);
INFO_LOG(m_logger) << " TNE VERIFICATION: CHECK:" << " rot " << rot << ", rotSfmOrg " << compassToMathAngleForSfm(rot) << ", rotSfmPlus90 " << compassToMathAngleForSfm(rot+90);
rot = 1;
INFO_LOG() << " TNE VERIFICATION: CHECK:" << " rot " << rot << ", rotSfmOrg " << compassToMathAngleForSfm(rot) << ", rotSfmPlus90 " << compassToMathAngleForSfm(rot+90);
INFO_LOG(m_logger) << " TNE VERIFICATION: CHECK:" << " rot " << rot << ", rotSfmOrg " << compassToMathAngleForSfm(rot) << ", rotSfmPlus90 " << compassToMathAngleForSfm(rot+90);
rot = 30;
INFO_LOG() << " TNE VERIFICATION: CHECK:" << " rot " << rot << ", rotSfmOrg " << compassToMathAngleForSfm(rot) << ", rotSfmPlus90 " << compassToMathAngleForSfm(rot+90);
INFO_LOG(m_logger) << " TNE VERIFICATION: CHECK:" << " rot " << rot << ", rotSfmOrg " << compassToMathAngleForSfm(rot) << ", rotSfmPlus90 " << compassToMathAngleForSfm(rot+90);
rot = 60;
INFO_LOG() << " TNE VERIFICATION: CHECK:" << " rot " << rot << ", rotSfmOrg " << compassToMathAngleForSfm(rot) << ", rotSfmPlus90 " << compassToMathAngleForSfm(rot+90);
INFO_LOG(m_logger) << " TNE VERIFICATION: CHECK:" << " rot " << rot << ", rotSfmOrg " << compassToMathAngleForSfm(rot) << ", rotSfmPlus90 " << compassToMathAngleForSfm(rot+90);
rot = -30;
INFO_LOG() << " TNE VERIFICATION: CHECK:" << " rot " << rot << ", rotSfmOrg " << compassToMathAngleForSfm(rot) << ", rotSfmPlus90 " << compassToMathAngleForSfm(rot+90);
INFO_LOG(m_logger) << " TNE VERIFICATION: CHECK:" << " rot " << rot << ", rotSfmOrg " << compassToMathAngleForSfm(rot) << ", rotSfmPlus90 " << compassToMathAngleForSfm(rot+90);
}
void ModuleTestExplosionCluster::test_TneVerificationBremen_01()
@@ -1259,7 +1259,7 @@ void ModuleTestExplosionCluster::test_TneVerificationBremen_01()
QVERIFY2(mhPointsRef.size() == 1, "ERROR, mhPoints().size() failed!!");
const LtsCoordTrans::UtmCoordinate &mhpUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(mhPointsRef.front().lon(), mhPointsRef.front().lat());
DEBUG_LOG() << " TNE VERIFICATION: mhpUtm = " << mhpUtm.mgrs();
DEBUG_LOG(m_logger) << " TNE VERIFICATION: mhpUtm = " << mhpUtm.mgrs();
QVERIFY2(distanceMeter(mhPointsRef.front(), LtsCoordTrans::UtmCoordinate::fromMgrs(QStringLiteral("32U MD 97000 78000"))) < 1, "ERROR, mhPointsRef failed!!");
//
@@ -1269,19 +1269,19 @@ void ModuleTestExplosionCluster::test_TneVerificationBremen_01()
const int simId = m_data.id();
AreaEffectSimulation::AesItemView itemView;
DEBUG_LOG() << " TNE VERIFICATION: simId = " << simId;
DEBUG_LOG(m_logger) << " TNE VERIFICATION: simId = " << simId;
const bool bFound = m_aesDtc->aesItemViewFromEntityId(simId, AreaEffectSimulation::AesType::AtExplosionClusterSingleExplosions, itemView);
QVERIFY2(bFound, "ERROR,aesItemViewFromEntityId failed!!");
QVERIFY2(itemView.aesItemId() == simId, "ERROR,aesItemViewFromEntityId failed!!");
INFO_LOG() << " ddsConnector.initPublisherSubscriber done";
INFO_LOG(m_logger) << " ddsConnector.initPublisherSubscriber done";
const double rot = m_data.area().rotation();
const double rotSfmOrg = compassToMathAngleForSfm(rot);
const double rotSfmPlus90 = compassToMathAngleForSfm(rot+90);
INFO_LOG() << " TNE VERIFICATION: CHECK:"
INFO_LOG(m_logger) << " TNE VERIFICATION: CHECK:"
<< " randomNumber = ????????"
<< ", width=" << m_data.area().width()
<< ", height=" << m_data.area().height()
@@ -1295,7 +1295,7 @@ void ModuleTestExplosionCluster::test_TneVerificationBremen_01()
for (const Core::GeoPosition &geoCoord : std::as_const(formRef))
{
const LtsCoordTrans::UtmCoordinate &utm = LtsCoordTrans::UtmCoordinate::fromGeographic(geoCoord.lon(), geoCoord.lat());
INFO_LOG() << " TNE VERIFICATION: CHECK:" << " utm: " << utm.mgrs() << ", item=" << geoCoord;
INFO_LOG(m_logger) << " TNE VERIFICATION: CHECK:" << " utm: " << utm.mgrs() << ", item=" << geoCoord;
}
size_t i = 0;
@@ -1358,7 +1358,7 @@ void ModuleTestExplosionCluster::test_TneVerificationBremen_02()
QVERIFY2(mhPointsRef.size() == 1, "ERROR, mhPoints().size() failed!!");
const LtsCoordTrans::UtmCoordinate &mhpUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(mhPointsRef.front().lon(), mhPointsRef.front().lat());
DEBUG_LOG() << " TNE VERIFICATION: mhpUtm = " << mhpUtm.mgrs();
DEBUG_LOG(m_logger) << " TNE VERIFICATION: mhpUtm = " << mhpUtm.mgrs();
QVERIFY2(distanceMeter(mhPointsRef.front(), LtsCoordTrans::UtmCoordinate::fromMgrs(QStringLiteral("32U MD 97000 78000"))) < 1, "ERROR, mhPointsRef failed!!");
//
@@ -1368,19 +1368,19 @@ void ModuleTestExplosionCluster::test_TneVerificationBremen_02()
const int simId = m_data.id();
AreaEffectSimulation::AesItemView itemView;
DEBUG_LOG() << " TNE VERIFICATION: simId = " << simId;
DEBUG_LOG(m_logger) << " TNE VERIFICATION: simId = " << simId;
const bool bFound = m_aesDtc->aesItemViewFromEntityId(simId, AreaEffectSimulation::AesType::AtExplosionClusterSingleExplosions, itemView);
QVERIFY2(bFound, "ERROR,aesItemViewFromEntityId failed!!");
QVERIFY2(itemView.aesItemId() == simId, "ERROR,aesItemViewFromEntityId failed!!");
INFO_LOG() << " ddsConnector.initPublisherSubscriber done";
INFO_LOG(m_logger) << " ddsConnector.initPublisherSubscriber done";
const double rot = m_data.area().rotation();
const double rotSfmOrg = compassToMathAngleForSfm(rot);
const double rotSfmPlus90 = compassToMathAngleForSfm(rot+90);
INFO_LOG() << " TNE VERIFICATION: CHECK:"
INFO_LOG(m_logger) << " TNE VERIFICATION: CHECK:"
<< " randomNumber = ????????"
<< ", width=" << m_data.area().width()
<< ", height=" << m_data.area().height()
@@ -1394,7 +1394,7 @@ void ModuleTestExplosionCluster::test_TneVerificationBremen_02()
for (const Core::GeoPosition &geoCoord : std::as_const(formRef))
{
const LtsCoordTrans::UtmCoordinate &utm = LtsCoordTrans::UtmCoordinate::fromGeographic(geoCoord.lon(), geoCoord.lat());
INFO_LOG() << " TNE VERIFICATION: CHECK:" << " utm: " << utm.mgrs() << ", item=" << geoCoord;
INFO_LOG(m_logger) << " TNE VERIFICATION: CHECK:" << " utm: " << utm.mgrs() << ", item=" << geoCoord;
}
size_t i = 0;
@@ -1960,14 +1960,14 @@ void ModuleTestExplosionCluster::test_remove_effect_start()
// expected condition:
if (!waitForData([this]() { return m_replyError == false; }, 1))
{
ERROR_LOG() << "Error on request";
ERROR_LOG(m_logger) << "Error on request";
return;
}
INFO_LOG() << Q_FUNC_INFO << " waiting for EsPrepared...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsPrepared...";
if (!waitForData([this]() { return m_data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsPrepared;}, 2))
{
ERROR_LOG() << "Timeout waiting for EsPrepared of explosion cluster with id " << m_data.id();
ERROR_LOG(m_logger) << "Timeout waiting for EsPrepared of explosion cluster with id " << m_data.id();
return;
}
@@ -1991,15 +1991,15 @@ void ModuleTestExplosionCluster::test_remove_effect_start()
}
INFO_LOG() << Q_FUNC_INFO << " waiting to make sure, that next step is never reached:";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting to make sure, that next step is never reached:";
if (waitForData([this]() { return m_data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated;}, 60))
{
ERROR_LOG() << "Next step is accidentically reached of explosion cluster with id " << m_data.id();
ERROR_LOG(m_logger) << "Next step is accidentically reached of explosion cluster with id " << m_data.id();
QVERIFY2(false, "ERROR, exit");
return;
}
INFO_LOG() << Q_FUNC_INFO << " object effectState: " << m_data.effectStateId();
INFO_LOG(m_logger) << Q_FUNC_INFO << " object effectState: " << m_data.effectStateId();
QVERIFY2(m_data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsCreated, "ERROR, ExplosionCluster in wrong state");
dumpCnt();
@@ -2298,7 +2298,7 @@ void ModuleTestExplosionCluster:: test_point_geometry_bldg_1104_single_effect_on
const QPointF impactPointF(0.20256382834808495, 0.9161105453111705);
request.impactPosition(Core::GeoPosition2D(impactPointF.x(), impactPointF.y()));
INFO_LOG() << Q_FUNC_INFO << " requested impact position = " << LtsCoordTrans::UtmCoordinate::fromGeographic(impactPointF).mgrs();
INFO_LOG(m_logger) << Q_FUNC_INFO << " requested impact position = " << LtsCoordTrans::UtmCoordinate::fromGeographic(impactPointF).mgrs();
request.chargeTypeId(371);
request.externalId(815);
@@ -2701,9 +2701,9 @@ void ModuleTestExplosionCluster::cleanupTestCase()
// finish last (dds) calls:
waitForData([]() { return false; }, 10);
INFO_LOG() << " ddsConnector destroy...";
INFO_LOG(m_logger) << " ddsConnector destroy...";
m_ddsConnector.reset();
INFO_LOG() << " ddsConnector destroy...DONE";
INFO_LOG(m_logger) << " ddsConnector destroy...DONE";
}
@@ -59,6 +59,8 @@ public:
ModuleTestExplosionCluster(int domainId, int exerciseId);
protected:
NGL::INGLLogger &m_logger;
void onSetSimulatedPositionReply(const Core::FunctionReplyObject &replyObject) override;
void onSetSimulatedParticipantFormationReply(const Core::FunctionReplyObject &replyObject) override;
void onExplosionClusterModifyReply(const Core::FunctionReplyObject &replyObject) override;
@@ -596,7 +596,7 @@ bool ModuleTestLimits::waitForData(const std::function<bool ()> &func, int retry
for (int i = 0; i < retryCount; ++i)
{
TRACE_LOG() << " waitForData - i: " << i;
TRACE_LOG(m_logger) << " waitForData - i: " << i;
if (func())
return true;
QTest::qWait(100);
@@ -860,14 +860,14 @@ void ModuleTestLimits::initTestCase()
QVERIFY2(bInit, "ERROR, ddsConnector.init failed!!");
if (!bInit)
{
ERROR_LOG() << " ERROR, ddsConnector.init failed!!";
ERROR_LOG(m_logger) << " ERROR, ddsConnector.init failed!!";
return;
}
INFO_LOG() << " ddsConnector.init successfull";
INFO_LOG(m_logger) << " ddsConnector.init successfull";
// cmd
m_ddsConnector->initPublisherSubscriber();
INFO_LOG() << " ddsConnector.initPublisherSubscriber done";
INFO_LOG(m_logger) << " ddsConnector.initPublisherSubscriber done";
//
// Aes
@@ -1126,9 +1126,9 @@ void ModuleTestLimits::cleanupTestCase()
// finish last (dds) calls:
waitForData([]() { return false; }, 10);
INFO_LOG() << " ddsConnector destroy...";
INFO_LOG(m_logger) << " ddsConnector destroy...";
m_ddsConnector.reset();
INFO_LOG() << " ddsConnector destroy...DONE";
INFO_LOG(m_logger) << " ddsConnector destroy...DONE";
}
/*!
@@ -1147,14 +1147,14 @@ void ModuleTestLimits::setupParticipant()
req.onlyOutdatedParticipants(false);
req.position(Core::GeoPosition(m_partPos.lon(), m_partPos.lat(), 0.0));
INFO_LOG() << " setSimulatedPositionRequest ...";
INFO_LOG(m_logger) << " setSimulatedPositionRequest ...";
m_replyError = true;
m_ppmFtc->setSimulatedPositionRequest(req, this);
// expected condition:
if (!waitForData([this]() { return !m_replyError; }))
{
ERROR_LOG() << "Error on request";
ERROR_LOG(m_logger) << "Error on request";
}
QVERIFY2(m_replyError == false, "ERROR, setupParticipant failed");
@@ -242,9 +242,9 @@ public:
void onSetSimulatedPositionReply(const Core::FunctionReplyObject &reply) override
{
m_replyError = reply.error();
DEBUG_LOG() << " got reply - onSetSimulatedPositionReply : " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onSetSimulatedPositionReply : " << m_replyError;
if (!reply.str().empty())
ERROR_LOG() << " got reply - onExplosionClusterModifyReply: " << reply.translated();
ERROR_LOG(m_logger) << " got reply - onExplosionClusterModifyReply: " << reply.translated();
}
// ChargeAdministrationModifyReplyHandler interface
@@ -79,39 +79,39 @@ ModuleTestAesOthers::ModuleTestAesOthers(int domainId, int exerciseId)
void ModuleTestAesOthers::onSetSimulatedPositionReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onSetSimulatedPositionReply : " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onSetSimulatedPositionReply : " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onExplosionClusterModifyReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onExplosionClusterModifyReply: " << replyObject.translated();
}
void ModuleTestAesOthers::onBoobyTrapModifyReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onBoobyTrapModifyReply : " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onBoobyTrapModifyReply : " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onBoobyTrapModifyReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onBoobyTrapModifyReply: " << replyObject.translated();
}
void ModuleTestAesOthers::onBoobyTrapRemoveReply(const Core::FunctionReplyObject &replyObject)
{
DEBUG_LOG() << " got reply - onBoobyTrapRemoveReply : " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onBoobyTrapRemoveReply : " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onBoobyTrapRemoveReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onBoobyTrapRemoveReply: " << replyObject.translated();
}
void ModuleTestAesOthers::onOffRouteMineModifyReply(const Core::FunctionReplyObject &replyObject)
{
m_replyError = replyObject.error();
DEBUG_LOG() << " got reply - onOffRouteMineModifyReply : " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onOffRouteMineModifyReply : " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onOffRouteMineModifyReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onOffRouteMineModifyReply: " << replyObject.translated();
}
void ModuleTestAesOthers::onOffRouteMineRemoveReply(const Core::FunctionReplyObject &replyObject)
{
DEBUG_LOG() << " got reply - onOffRouteMineRemoveReply : " << m_replyError;
DEBUG_LOG(m_logger) << " got reply - onOffRouteMineRemoveReply : " << m_replyError;
if (!replyObject.str().empty())
ERROR_LOG() << " got reply - onOffRouteMineRemoveReply: " << replyObject.translated();
ERROR_LOG(m_logger) << " got reply - onOffRouteMineRemoveReply: " << replyObject.translated();
}
@@ -128,10 +128,10 @@ void ModuleTestAesOthers::boobyTrapChanged(const BoobyTrap &data, DataModificati
if (m_dataBoobyTrap.effectStart().is_set())
startTimeMsec = m_dataBoobyTrap.effectStart().get();
DEBUG_LOG() << " got changed - m_dataBoobyTrap: " << m_dataBoobyTrap.id() << ", state=" << m_dataBoobyTrap.effectStateId()
DEBUG_LOG(m_logger) << " got changed - m_dataBoobyTrap: " << m_dataBoobyTrap.id() << ", state=" << m_dataBoobyTrap.effectStateId()
<< ", startTimeMsec=" << startTimeMsec
<< ", cntBoobyTrap=" << m_counterDds.cntBoobyTrap;
TRACE_LOG() << " got changed - m_dataBoobyTrap: " << m_dataBoobyTrap;
TRACE_LOG(m_logger) << " got changed - m_dataBoobyTrap: " << m_dataBoobyTrap;
}
void ModuleTestAesOthers::offRouteMineChanged(const OffRouteMine &data, DataModification modType)
@@ -147,10 +147,10 @@ void ModuleTestAesOthers::offRouteMineChanged(const OffRouteMine &data, DataModi
if (m_dataOffRouteMine.effectStart().is_set())
startTimeMsec = m_dataOffRouteMine.effectStart().get();
DEBUG_LOG() << " got changed - m_dataOffRouteMine: " << m_dataOffRouteMine.id() << ", state=" << m_dataOffRouteMine.effectStateId()
DEBUG_LOG(m_logger) << " got changed - m_dataOffRouteMine: " << m_dataOffRouteMine.id() << ", state=" << m_dataOffRouteMine.effectStateId()
<< ", startTimeMsec=" << startTimeMsec
<< ", cntOffRouteMine=" << m_counterDds.cntOffRouteMine;
TRACE_LOG() << " got changed - m_dataOffRouteMine: " << m_dataOffRouteMine;
TRACE_LOG(m_logger) << " got changed - m_dataOffRouteMine: " << m_dataOffRouteMine;
}
@@ -160,7 +160,7 @@ void ModuleTestAesOthers::onAesItemViewChanged(const AesItemView &aesItemView, D
return;
AreaEffectSimulation::AesType_def::type aesType = aesItemView.aesTypeId().underlying();
DEBUG_LOG() << " got onAesItemViewChanged, aesType=" << aesType;
DEBUG_LOG(m_logger) << " got onAesItemViewChanged, aesType=" << aesType;
switch (aesType)
{
@@ -197,7 +197,7 @@ bool ModuleTestAesOthers::waitForData(const std::function<bool ()> &func, int re
for (int i = 0; i < retryCount; ++i)
{
DEBUG_LOG() << " waitForData - i: " << i;
DEBUG_LOG(m_logger) << " waitForData - i: " << i;
if (func())
return true;
QTest::qWait(100);
@@ -210,23 +210,23 @@ void ModuleTestAesOthers::waitForEffectStatesBT(int lineNumber, int durPrep, int
// expected condition:
if (!waitForData([this]() { return m_replyError == false; }, 1))
{
ERROR_LOG() << "Error on request" << ", lineNumber = " << lineNumber;
ERROR_LOG(m_logger) << "Error on request" << ", lineNumber = " << lineNumber;
return;
}
INFO_LOG() << Q_FUNC_INFO << " waiting for EsPrepared...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsPrepared...";
if (!waitForData([this]() { return m_dataBoobyTrap.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsPrepared;}, durPrep))
{
ERROR_LOG() << "Timeout waiting for EsPrepared of m_dataBoobyTrap with id " << m_dataBoobyTrap.id()
ERROR_LOG(m_logger) << "Timeout waiting for EsPrepared of m_dataBoobyTrap with id " << m_dataBoobyTrap.id()
<< ", lineNumber = " << lineNumber;
QVERIFY2(false, "ERROR, exit");
return;
}
INFO_LOG() << Q_FUNC_INFO << " waiting for EsActivated...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsActivated...";
if (!waitForData([this]() { return m_dataBoobyTrap.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated;}, durAct))
{
ERROR_LOG() << "Timeout waiting for EsActivated of m_dataBoobyTrapr with id " << m_dataBoobyTrap.id()
ERROR_LOG(m_logger) << "Timeout waiting for EsActivated of m_dataBoobyTrapr with id " << m_dataBoobyTrap.id()
<< ", lineNumber = " << lineNumber;
QVERIFY2(false, "ERROR, exit");
return;
@@ -234,10 +234,10 @@ void ModuleTestAesOthers::waitForEffectStatesBT(int lineNumber, int durPrep, int
if (durExp > 0)
{
INFO_LOG() << Q_FUNC_INFO << " waiting for EsExpired...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsExpired...";
if (!waitForData([this]() { return m_dataBoobyTrap.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired;}, durExp))
{
ERROR_LOG() << "Timeout waiting for EsExpired of m_dataBoobyTrap with id " << m_dataBoobyTrap.id()
ERROR_LOG(m_logger) << "Timeout waiting for EsExpired of m_dataBoobyTrap with id " << m_dataBoobyTrap.id()
<< ", lineNumber = " << lineNumber;
QVERIFY2(false, "ERROR, exit");
return;
@@ -250,23 +250,23 @@ void ModuleTestAesOthers::waitForEffectStatesORM(int lineNumber, int durPrep, in
// expected condition:
if (!waitForData([this]() { return m_replyError == false; }, 1))
{
ERROR_LOG() << "Error on request" << ", lineNumber = " << lineNumber;
ERROR_LOG(m_logger) << "Error on request" << ", lineNumber = " << lineNumber;
return;
}
INFO_LOG() << Q_FUNC_INFO << " waiting for EsPrepared...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsPrepared...";
if (!waitForData([this]() { return m_dataOffRouteMine.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsPrepared;}, durPrep))
{
ERROR_LOG() << "Timeout waiting for EsPrepared of m_dataOffRouteMine with id " << m_dataOffRouteMine.id()
ERROR_LOG(m_logger) << "Timeout waiting for EsPrepared of m_dataOffRouteMine with id " << m_dataOffRouteMine.id()
<< ", lineNumber = " << lineNumber;
QVERIFY2(false, "ERROR, exit");
return;
}
INFO_LOG() << Q_FUNC_INFO << " waiting for EsActivated...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsActivated...";
if (!waitForData([this]() { return m_dataOffRouteMine.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated;}, durAct))
{
ERROR_LOG() << "Timeout waiting for EsActivated of m_dataOffRouteMine with id " << m_dataOffRouteMine.id()
ERROR_LOG(m_logger) << "Timeout waiting for EsActivated of m_dataOffRouteMine with id " << m_dataOffRouteMine.id()
<< ", lineNumber = " << lineNumber;
QVERIFY2(false, "ERROR, exit");
return;
@@ -274,10 +274,10 @@ void ModuleTestAesOthers::waitForEffectStatesORM(int lineNumber, int durPrep, in
if (durExp > 0)
{
INFO_LOG() << Q_FUNC_INFO << " waiting for EsExpired...";
INFO_LOG(m_logger) << Q_FUNC_INFO << " waiting for EsExpired...";
if (!waitForData([this]() { return m_dataOffRouteMine.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired;}, durExp))
{
ERROR_LOG() << "Timeout waiting for EsExpired of m_dataOffRouteMine with id " << m_dataOffRouteMine.id()
ERROR_LOG(m_logger) << "Timeout waiting for EsExpired of m_dataOffRouteMine with id " << m_dataOffRouteMine.id()
<< ", lineNumber = " << lineNumber;
QVERIFY2(false, "ERROR, exit");
return;
@@ -288,7 +288,7 @@ void ModuleTestAesOthers::waitForEffectStatesORM(int lineNumber, int durPrep, in
void ModuleTestAesOthers::setupParticipants()
{
INFO_LOG() << " setupParticipant ...";
INFO_LOG(m_logger) << " setupParticipant ...";
QVERIFY2(m_ppmFtc, "ERROR, no m_ppmFtc");
@@ -304,18 +304,18 @@ void ModuleTestAesOthers::setupParticipants()
QPointF pos = utmPos.geographic();
req.position(Core::GeoPosition(pos.x(), pos.y(), 0.0));
INFO_LOG() << " setSimulatedPositionRequest ...";
INFO_LOG(m_logger) << " setSimulatedPositionRequest ...";
m_replyError = true;
m_ppmFtc->setSimulatedPositionRequest(req, this);
// expected condition:
if (!waitForData([this]() { return m_replyError == false; }))
{
ERROR_LOG() << "Error on request";
ERROR_LOG(m_logger) << "Error on request";
}
}
}
INFO_LOG() << " setSimulatedPositionRequest ...DONE";
INFO_LOG(m_logger) << " setSimulatedPositionRequest ...DONE";
}
bool ModuleTestAesOthers::checkParticipant_18()
@@ -324,7 +324,7 @@ bool ModuleTestAesOthers::checkParticipant_18()
const int partId = 18;
const ParticipantManagement::ParticipantPosition &pos = m_ppmDtc->participantPosition(partId);
QString mgrsStr = LtsCoordTrans::mgrsFromGeographic(pos.pos().lon(), pos.pos().lat());
INFO_LOG() << " for partId = '" << partId << "', we got position: " << mgrsStr;
INFO_LOG(m_logger) << " for partId = '" << partId << "', we got position: " << mgrsStr;
return mgrsStr == QStringLiteral("32U PD 76900 18100");
}
@@ -392,17 +392,17 @@ int ModuleTestAesOthers::doMoveParticipant(int participantId, const QString &new
QPointF pos = utmPos.geographic();
req.position(Core::GeoPosition(pos.x(), pos.y(), 0.0));
INFO_LOG() << " setSimulatedPositionRequest ...";
INFO_LOG(m_logger) << " setSimulatedPositionRequest ...";
m_replyError = true;
m_ppmFtc->setSimulatedPositionRequest(req, this);
// expected condition:
if (!waitForData([this]() { return m_replyError == false; }))
{
ERROR_LOG() << "Error on request";
ERROR_LOG(m_logger) << "Error on request";
}
}
INFO_LOG() << " doMoveParticipant ...DONE";
INFO_LOG(m_logger) << " doMoveParticipant ...DONE";
return true;
}
@@ -423,14 +423,14 @@ void ModuleTestAesOthers::initTestCase()
QVERIFY2(bInit, "ERROR, ddsConnector.init failed!!");
if (!bInit)
{
ERROR_LOG() << " ERROR, ddsConnector.init failed!!";
ERROR_LOG(m_logger) << " ERROR, ddsConnector.init failed!!";
return;
}
INFO_LOG() << " ddsConnector.init successfull";
INFO_LOG(m_logger) << " ddsConnector.init successfull";
// cmd
m_ddsConnector->initPublisherSubscriber();
INFO_LOG() << " ddsConnector.initPublisherSubscriber done";
INFO_LOG(m_logger) << " ddsConnector.initPublisherSubscriber done";
//
// Aes
@@ -610,7 +610,7 @@ void ModuleTestAesOthers::test_boobyTrap_02_IMPL(const QString &name,
return;
}
INFO_LOG() << Q_FUNC_INFO << " START, m_traingAreaId = " << m_traingAreaId
INFO_LOG(m_logger) << Q_FUNC_INFO << " START, m_traingAreaId = " << m_traingAreaId
<< ", name =" << name << "'"
<< ", impactCoord= " << impactCoord.mgrs()
<< ", rotationAngle = " << rotationAngle
@@ -666,7 +666,7 @@ void ModuleTestAesOthers::test_boobyTrap_02_IMPL(const QString &name,
// wait to let it disappear:
waitForData([]() { return false; }, 15);
INFO_LOG() << Q_FUNC_INFO << " END"
INFO_LOG(m_logger) << Q_FUNC_INFO << " END"
<< ", name =" << name << "'"
<< ", impactCoord= " << impactCoord.mgrs()
<< ", rotationAngle = " << rotationAngle
@@ -713,7 +713,7 @@ void ModuleTestAesOthers::test_offRouteMine_02()
return;
}
INFO_LOG() << Q_FUNC_INFO << " START, m_traingAreaId = " << m_traingAreaId;
INFO_LOG(m_logger) << Q_FUNC_INFO << " START, m_traingAreaId = " << m_traingAreaId;
QVERIFY2(checkParticipant_18(), "ERROR, checkParticipant_5 failed!!");
@@ -767,7 +767,7 @@ void ModuleTestAesOthers::test_offRouteMine_02()
// wait to let it disappear:
waitForData([]() { return false; }, 15);
INFO_LOG() << Q_FUNC_INFO << " END" << ", name =" << orm.name() << "'";
INFO_LOG(m_logger) << Q_FUNC_INFO << " END" << ", name =" << orm.name() << "'";
}
void ModuleTestAesOthers::cleanupTestCase()
@@ -775,9 +775,9 @@ void ModuleTestAesOthers::cleanupTestCase()
// finish last (dds) calls:
waitForData([]() { return false; }, 10);
INFO_LOG() << " ddsConnector destroy...";
INFO_LOG(m_logger) << " ddsConnector destroy...";
m_ddsConnector.reset();
INFO_LOG() << " ddsConnector destroy...DONE";
INFO_LOG(m_logger) << " ddsConnector destroy...DONE";
}
@@ -54,6 +54,8 @@ public:
ModuleTestAesOthers(int domainId, int exerciseId);
protected:
NGL::INGLLogger &m_logger;
void onSetSimulatedPositionReply(const Core::FunctionReplyObject &replyObject) override;
void onBoobyTrapModifyReply(const Core::FunctionReplyObject &replyObject) override;
@@ -54,11 +54,11 @@ bool ConvertMineArea::init(int exerciseId)
if (!ok)
{
ERROR_LOG() << "Error opening db, exiting..";
ERROR_LOG(m_logger) << "Error opening db, exiting..";
return false;
}
ERROR_LOG() << "Database open";
ERROR_LOG(m_logger) << "Database open";
return true;
}
@@ -81,15 +81,15 @@ bool ConvertMineArea::initDBInternal()
QSqlDriver *driver = m_dbConnection.driver();
if (!driver)
{
WARNING_LOG() << "No SQL driver loaded - no database available!";
WARNING_LOG(m_logger) << "No SQL driver loaded - no database available!";
return false;
}
const QString driverName = m_dbConnection.driverName();
DEBUG_LOG() << "Connected to database " << m_dbConnection.databaseName() << "@" << m_dbConnection.hostName()
DEBUG_LOG(m_logger) << "Connected to database " << m_dbConnection.databaseName() << "@" << m_dbConnection.hostName()
<< ", schema: " << schemaName() << ", used driver: " << driverName;
if (!m_dbConnection.isOpen())
{
WARNING_LOG() << "Database connection is no open - can not initialize database interface";
WARNING_LOG(m_logger) << "Database connection is no open - can not initialize database interface";
return false;
}
if (driverName == QLatin1String("QSQLITE"))
@@ -189,9 +189,9 @@ bool ConvertMineArea::tryConvertMineArea()
data.endPosition = endPositionUtm.geographic();
DEBUG_LOG() << "aesId: " << data.mineAreaId << ", id: " << data.id;
DEBUG_LOG() << "EndpositionUtm: x: " << endPositionUtm.x << ", y: " << endPositionUtm.y;
DEBUG_LOG() << "Geographic: x: " << data.endPosition.x() << " y: " << data.endPosition.y();
DEBUG_LOG(m_logger) << "aesId: " << data.mineAreaId << ", id: " << data.id;
DEBUG_LOG(m_logger) << "EndpositionUtm: x: " << endPositionUtm.x << ", y: " << endPositionUtm.y;
DEBUG_LOG(m_logger) << "Geographic: x: " << data.endPosition.x() << " y: " << data.endPosition.y();
vecMineArea.append(data);
}
@@ -204,7 +204,7 @@ bool ConvertMineArea::tryConvertMineArea()
if (!m_query->prepare(stmt3))
{
m_lastError = m_query->lastError();
ERROR_LOG() << "lastError: " << m_lastError.text();
ERROR_LOG(m_logger) << "lastError: " << m_lastError.text();
return false;
}
for ( const Database::AesMineAreaSegment &mineAreaSegment : vecMineArea)
@@ -216,7 +216,7 @@ bool ConvertMineArea::tryConvertMineArea()
if (!m_query->exec(m_bEmitMessageOnError))
{
m_lastError = m_query->lastError();
ERROR_LOG() << "lastError: " << m_lastError.text();
ERROR_LOG(m_logger) << "lastError: " << m_lastError.text();
return false;
}
@@ -47,6 +47,8 @@ public:
QSqlError getLastError() const;
private:
NGL::INGLLogger &m_logger;
QSqlDatabase m_dbConnection;
NSqlQuery *m_query;
QSqlError m_lastError;
@@ -29,7 +29,7 @@ TestBase::TestBase(const char *loggerName, QObject *parent)
bool TestBase::init(int domainId, int exerciseId, int testId)
{
INFO_LOG() << "init begin";
INFO_LOG(m_logger) << "init begin";
m_testId = testId;
// initialize DDS
@@ -38,15 +38,15 @@ bool TestBase::init(int domainId, int exerciseId, int testId)
return false;
m_ddsConnector->initPublisherSubscriber();
INFO_LOG() << "init create ftc";
INFO_LOG(m_logger) << "init create ftc";
m_ftc = AreaEffectSimulation::Interface::Ftc::create(m_ddsConnector);
INFO_LOG() << "init init ftc";
INFO_LOG(m_logger) << "init init ftc";
bool bRet = m_ftc->enableAll();
m_dtc = AreaEffectSimulation::Interface::Dtc::create(m_ddsConnector);
bRet = bRet && m_dtc->enableAll();
INFO_LOG() << "init end - bRet = " << bRet;
INFO_LOG(m_logger) << "init end - bRet = " << bRet;
return bRet;
}
@@ -67,27 +67,27 @@ bool TestBase::checkAesItem(const AreaEffectSimulation::AesItem &a,
{
if (a.name() != b.name())
{
WARNING_LOG() << "name does not match: " << a.name() << " - " << b.name();
WARNING_LOG(m_logger) << "name does not match: " << a.name() << " - " << b.name();
return false;
}
if (a.effectStart() != b.effectStart())
{
WARNING_LOG() << "effectStart does not match: " << a.effectStart() << " - " << b.effectStart();
WARNING_LOG(m_logger) << "effectStart does not match: " << a.effectStart() << " - " << b.effectStart();
return false;
}
if (a.chargeStruct().chargeTypeId() != b.chargeStruct().chargeTypeId())
{
WARNING_LOG() << "chargeTypeId does not match: " << a.chargeStruct().chargeTypeId() << " - " << b.chargeStruct().chargeTypeId();
WARNING_LOG(m_logger) << "chargeTypeId does not match: " << a.chargeStruct().chargeTypeId() << " - " << b.chargeStruct().chargeTypeId();
return false;
}
if (a.partyId() != b.partyId())
{
WARNING_LOG() << "partyId does not match: " << a.partyId() << " - " << b.partyId();
WARNING_LOG(m_logger) << "partyId does not match: " << a.partyId() << " - " << b.partyId();
return false;
}
if (a.participantId() != b.participantId())
{
WARNING_LOG() << "participantId does not match: " << a.participantId() << " - " << b.participantId();
WARNING_LOG(m_logger) << "participantId does not match: " << a.participantId() << " - " << b.participantId();
return false;
}
return true;
@@ -95,19 +95,19 @@ bool TestBase::checkAesItem(const AreaEffectSimulation::AesItem &a,
void TestBase::failExit()
{
ERROR_LOG() << "fail exit!";
ERROR_LOG(m_logger) << "fail exit!";
m_bTestsSuccessful = false;
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
void TestBase::onAesCreateReply(const Core::FunctionReplyObject &replyObject)
{
INFO_LOG() << "Got create " << m_aesTypeName << " reply with id " << replyObject.id()
INFO_LOG(m_logger) << "Got create " << m_aesTypeName << " reply with id " << replyObject.id()
<< ", error = " << replyObject.error()
<< " and errorString = '" << replyObject.translated() << "'";
m_replyError = replyObject.error();
if (m_replyError && !m_bExpectedFailure)
ERROR_LOG() << "Got create " << m_aesTypeName << " reply error: " << replyObject();
ERROR_LOG(m_logger) << "Got create " << m_aesTypeName << " reply error: " << replyObject();
else
m_expectedAesId = replyObject.id(); // only works as expected because reply is sent before publishing data occours
}
@@ -116,34 +116,34 @@ void TestBase::onAesModifyReply(const Core::FunctionReplyObject &replyObject)
{
if (m_expectedAesId != replyObject.id())
return;
INFO_LOG() << "Got modify " << m_aesTypeName << " reply with id " << replyObject.id()
INFO_LOG(m_logger) << "Got modify " << m_aesTypeName << " reply with id " << replyObject.id()
<< ", error = " << replyObject.error()
<< " and errorString = '" << replyObject.translated() << "'";
m_replyError = replyObject.error();
if (m_replyError && !m_bExpectedFailure)
ERROR_LOG() << "Got modify " << m_aesTypeName << " reply error: " << replyObject();
ERROR_LOG(m_logger) << "Got modify " << m_aesTypeName << " reply error: " << replyObject();
else
m_expectedAesId = replyObject.id();
}
void TestBase::onAesRemoveReply(const Core::FunctionReplyObject &replyObject)
{
INFO_LOG() << "Got remove " << m_aesTypeName << " reply with id " << replyObject.id()
INFO_LOG(m_logger) << "Got remove " << m_aesTypeName << " reply with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
m_replyError = replyObject.error();
if (m_replyError && !m_bExpectedFailure)
ERROR_LOG() << "Got remove " << m_aesTypeName << " reply error: " << replyObject();
ERROR_LOG(m_logger) << "Got remove " << m_aesTypeName << " reply error: " << replyObject();
else
m_expectedAesId = replyObject.id();
}
void TestBase::onAesTriggerReply(const Core::FunctionReplyObject &replyObject)
{
INFO_LOG() << "Got trigger " << m_aesTypeName << " reply with id " << replyObject.id()
INFO_LOG(m_logger) << "Got trigger " << m_aesTypeName << " reply with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
m_replyError = replyObject.error();
if (m_replyError && !m_bExpectedFailure)
ERROR_LOG() << "Got remove " << m_aesTypeName << " reply error: " << replyObject();
ERROR_LOG(m_logger) << "Got remove " << m_aesTypeName << " reply error: " << replyObject();
else
m_expectedAesId = replyObject.id();
}
@@ -46,17 +46,17 @@ protected:
template <typename T>
void onAesChanged(const T &dataIn, DataModification modType, T &dataOut)
{
INFO_LOG() << "Got " << m_aesTypeName << " with mod type " << (int)modType
INFO_LOG(m_logger) << "Got " << m_aesTypeName << " with mod type " << (int)modType
<< ", id: " << dataIn.id() << ", chargeType: " << dataIn.chargeStruct().chargeTypeId()
<< ", effectState: " << dataIn.effectStateId();
if (m_expectedAesId == dataIn.id())
{
DEBUG_LOG() << "Expected aes id - updating data for " << m_aesTypeName;
DEBUG_LOG(m_logger) << "Expected aes id - updating data for " << m_aesTypeName;
dataOut = dataIn;
}
if (modType == DataModification::eRemoved && dataOut.id() == dataIn.id())
{
DEBUG_LOG() << "Removed " << m_aesTypeName << " with id " << dataIn.id();
DEBUG_LOG(m_logger) << "Removed " << m_aesTypeName << " with id " << dataIn.id();
m_expectedAesId = dataIn.id();
}
}
@@ -83,8 +83,8 @@ void UnitTestTrajectory::test_duration()
posEnd = LtsUtils::QPoint3D(10000, 0, 0);
duration = TrajectoryHelper::flightDurationSec(posStart, posEnd, heightAbs, &betaOut, &vOut);
INFO_LOG() << "flightDurationSec with posStart " << posStart << ", posEnd " << posEnd << ", heightAbs " << heightAbs;
INFO_LOG() << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "flightDurationSec with posStart " << posStart << ", posEnd " << posEnd << ", heightAbs " << heightAbs;
INFO_LOG(m_logger) << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
QVERIFY2(qFuzzyCompare(duration, 28.55686245854129), "flightDurationSec failed");
QVERIFY2(qFuzzyCompare(betaOut * rad2deg(), 21.80338497797008), "beta failed");
QVERIFY2(qFuzzyCompare(vOut, 377.1213082434484), "v failed");
@@ -93,8 +93,8 @@ void UnitTestTrajectory::test_duration()
posEnd = LtsUtils::QPoint3D(10000, 0, 10);
// ^^
duration = TrajectoryHelper::flightDurationSec(posStart, posEnd, heightAbs, &betaOut, &vOut);
INFO_LOG() << "flightDurationSec with posStart " << posStart << ", posEnd " << posEnd << ", heightAbs " << heightAbs;
INFO_LOG() << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "flightDurationSec with posStart " << posStart << ", posEnd " << posEnd << ", heightAbs " << heightAbs;
INFO_LOG(m_logger) << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
QVERIFY2(qFuzzyCompare(duration, 28.48529092398576), "flightDurationSec failed");
QVERIFY2(qFuzzyCompare(betaOut * rad2deg(), 21.75384726032234), "beta failed");
QVERIFY2(qFuzzyCompare(vOut, 377.9382777961657), "v failed");
@@ -130,8 +130,8 @@ void UnitTestTrajectory::test_calcDuration()
double duration;
duration = TrajectoryHelper::flightDurationSec(posStart, endPos, peakHeightAbs, &betaOut, &vOut);
INFO_LOG() << "flightDurationSec with posStart " << posStart << ", posEnd " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG() << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "flightDurationSec with posStart " << posStart << ", posEnd " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG(m_logger) << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
QVERIFY2(qFuzzyCompare(duration, 4.515236409857309), "flightDurationSec failed");
QVERIFY2(qFuzzyCompare(betaOut * rad2deg(), 45), "beta failed");
@@ -149,15 +149,15 @@ void UnitTestTrajectory::test_calcDuration2()
for (peakHeightAbs = 5; peakHeightAbs < 12; ++peakHeightAbs)
{
duration = TrajectoryHelper::flightDurationSec(posStart, endPos, peakHeightAbs, &betaOut, &vOut);
INFO_LOG() << "flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG() << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG(m_logger) << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
}
{ // Low
peakHeightAbs = 8;
duration = TrajectoryHelper::flightDurationSec(posStart, endPos, peakHeightAbs, &betaOut, &vOut);
INFO_LOG() << "flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG() << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG(m_logger) << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
QVERIFY2(qFuzzyCompare(duration, 2.554203427256403), "flightDurationSec failed");
QVERIFY2(qFuzzyCompare(betaOut * rad2deg(), 17.74467162505693), "beta failed"); // 18.9 ??
@@ -167,14 +167,14 @@ void UnitTestTrajectory::test_calcDuration2()
for (peakHeightAbs = 71; peakHeightAbs < 79; ++peakHeightAbs)
{
duration = TrajectoryHelper::flightDurationSec(posStart, endPos, peakHeightAbs, &betaOut, &vOut);
INFO_LOG() << "flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG() << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG(m_logger) << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
}
{ // High
peakHeightAbs = 73;
duration = TrajectoryHelper::flightDurationSec(posStart, endPos, peakHeightAbs, &betaOut, &vOut);
INFO_LOG() << "flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG() << " -> duration [sec] = " << std::setprecision(16) << duration << ", beta [deg] = " << betaOut * rad2deg() << ", v = " << vOut;
INFO_LOG(m_logger) << "flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG(m_logger) << " -> duration [sec] = " << std::setprecision(16) << duration << ", beta [deg] = " << betaOut * rad2deg() << ", v = " << vOut;
QVERIFY2(qFuzzyCompare(duration, 7.715639359362986), "flightDurationSec failed");
QVERIFY2(qFuzzyCompare(betaOut * rad2deg(), 71.09542415738834), "beta failed");
@@ -195,8 +195,8 @@ void UnitTestTrajectory::test_calcPeak()
double peakHeightAbs;
peakHeightAbs = TrajectoryHelper::peakHeightAbs(posStart, endPos, time, &betaOut, &vOut);
INFO_LOG() << "peakHeight with posStart " << posStart << ", posEnd " << endPos << ", time " << time << " - LOW";
INFO_LOG() << " -> peakHeightAbs " << peakHeightAbs << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "peakHeight with posStart " << posStart << ", posEnd " << endPos << ", time " << time << " - LOW";
INFO_LOG(m_logger) << " -> peakHeightAbs " << peakHeightAbs << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
QVERIFY2(qFuzzyCompare(peakHeightAbs, 25), "peakHeight failed");
QVERIFY2(qFuzzyCompare(betaOut * rad2deg(), 45), "beta failed");
@@ -215,8 +215,8 @@ void UnitTestTrajectory::test_calcPeak2()
double peakHeightAbs;
peakHeightAbs = TrajectoryHelper::peakHeightAbs(posStart, endPos, time, &betaOut, &vOut);
INFO_LOG() << "peakHeight with posStart " << posStart << ", posEnd " << endPos << ", time " << time << " - LOW";
INFO_LOG() << " -> peakHeightAbs " << std::setprecision(16) << peakHeightAbs << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "peakHeight with posStart " << posStart << ", posEnd " << endPos << ", time " << time << " - LOW";
INFO_LOG(m_logger) << " -> peakHeightAbs " << std::setprecision(16) << peakHeightAbs << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
// eightAbs 122.625, beta [deg] 78.47682271026333, v 50.0589902015612 (ctory/trajectory_unit_test.cpp:178)
QVERIFY2(qFuzzyCompare(peakHeightAbs, 122.625), "peakHeight failed");
@@ -241,13 +241,13 @@ void UnitTestTrajectory::test_calcPeak3_continuity()
const int flightDurationMax = 50;
const int flightDurationIncrement = 1;
INFO_LOG() << "peakHeight with posStart " << posStart << ", posEnd " << endPos;
INFO_LOG(m_logger) << "peakHeight with posStart " << posStart << ", posEnd " << endPos;
for (int curFD = flightDurationMin; curFD <= flightDurationMax; curFD += flightDurationIncrement)
{
double time = curFD;
peakHeightAbs = TrajectoryHelper::peakHeightAbs(posStart, endPos, time, &betaOut, &vOut);
INFO_LOG() << " time=" << time << " -> peakHeightAbs=" << std::setprecision(5) << std::setw(10) << std::setfill(' ') << peakHeightAbs << ", beta [deg]=" << betaOut * rad2deg() << ", v=" << std::setw(5) << vOut;
INFO_LOG(m_logger) << " time=" << time << " -> peakHeightAbs=" << std::setprecision(5) << std::setw(10) << std::setfill(' ') << peakHeightAbs << ", beta [deg]=" << betaOut * rad2deg() << ", v=" << std::setw(5) << vOut;
} // for
}
@@ -346,20 +346,20 @@ void UnitTestTrajectory::test_calcDuration_realistic40km()
double duration;
int peakHeightAbs;
INFO_LOG() << "Loop: START";
INFO_LOG(m_logger) << "Loop: START";
for (peakHeightAbs = 500; peakHeightAbs <= 3000; peakHeightAbs+=250)
{
duration = TrajectoryHelper::flightDurationSec(posStart, endPos, peakHeightAbs, &betaOut, &vOut);
INFO_LOG() << "Loop: flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG() << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "Loop: flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG(m_logger) << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
}
INFO_LOG() << "Loop: END";
INFO_LOG(m_logger) << "Loop: END";
// Als realistisch stugen wir mal eine Geschwindigkeit von 1000m/s ein:
peakHeightAbs = 2000;
duration = TrajectoryHelper::flightDurationSec(posStart, endPos, peakHeightAbs, &betaOut, &vOut);
INFO_LOG() << "explicit; flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG() << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "explicit; flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG(m_logger) << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
QVERIFY2(qFuzzyCompare(duration, 40.38550218769218 ), "flightDurationSec failed");
QVERIFY2(qFuzzyCompare(betaOut * rad2deg(), 11.30993247402021), "beta failed");
@@ -380,8 +380,8 @@ void UnitTestTrajectory::test_calcDuration_differentDistances()
// 1000m
{
duration1 = TrajectoryHelper::flightDurationSec(posStart, endPos1, peakHeightAbs, &betaOut, &vOut);
INFO_LOG() << "flightDurationSec with posStart " << posStart << ", endPos " << endPos1 << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG() << " -> duration1 [sec] " << std::setprecision(16) << duration1 << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "flightDurationSec with posStart " << posStart << ", endPos " << endPos1 << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG(m_logger) << " -> duration1 [sec] " << std::setprecision(16) << duration1 << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
QVERIFY2(qFuzzyCompare(duration1, 10.01527884771829), "flightDurationSec failed");
QVERIFY2(qFuzzyCompare(betaOut * rad2deg(), 26.19718605846828), "beta failed");
@@ -391,8 +391,8 @@ void UnitTestTrajectory::test_calcDuration_differentDistances()
// 2000m
{
duration2 = TrajectoryHelper::flightDurationSec(posStart, endPos2, peakHeightAbs, &betaOut, &vOut);
INFO_LOG() << "flightDurationSec with posStart " << posStart << ", endPos " << endPos2 << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG() << " -> duration2 [sec] " << std::setprecision(16) << duration2 << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "flightDurationSec with posStart " << posStart << ", endPos " << endPos2 << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG(m_logger) << " -> duration2 [sec] " << std::setprecision(16) << duration2 << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
QVERIFY2(qFuzzyCompare(duration2, 10.01527884771829), "flightDurationSec failed");
QVERIFY2(qFuzzyCompare(betaOut * rad2deg(), 13.82033952701046), "beta failed");
@@ -403,8 +403,8 @@ void UnitTestTrajectory::test_calcDuration_differentDistances()
// 2000m, 99m
{
duration3 = TrajectoryHelper::flightDurationSec(posStart, endPos3, peakHeightAbs, &betaOut, &vOut);
INFO_LOG() << "flightDurationSec with posStart " << posStart << ", endPos " << endPos3 << ", peakHeight " << peakHeightAbs;
INFO_LOG() << " -> duration3 [sec] " << std::setprecision(16) << duration3 << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "flightDurationSec with posStart " << posStart << ", endPos " << endPos3 << ", peakHeight " << peakHeightAbs;
INFO_LOG(m_logger) << " -> duration3 [sec] " << std::setprecision(16) << duration3 << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
QVERIFY2(qFuzzyCompare(duration3, 7.219644478296471 ), "flightDurationSec failed");
QVERIFY2(qFuzzyCompare(betaOut * rad2deg(), 10.05585466470648 ), "beta failed");
@@ -438,9 +438,9 @@ void UnitTestTrajectory::test_calcDuration_downToZero()
peakHeightAbs = 123;
duration = TrajectoryHelper::flightDurationSec(posStart, endPos, peakHeightAbs, &betaOut, &vOut, &reason);
INFO_LOG() << "flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG() << " -> reason '" << reason << "'";
INFO_LOG() << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
INFO_LOG(m_logger) << "flightDurationSec with posStart " << posStart << ", endPos " << endPos << ", peakHeightAbs " << peakHeightAbs;
INFO_LOG(m_logger) << " -> reason '" << reason << "'";
INFO_LOG(m_logger) << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
QVERIFY2(qFuzzyCompare(duration, 7.347880052033394), "flightDurationSec failed");
QVERIFY2(qFuzzyCompare(betaOut * rad2deg(), 14.18247037775737), "beta failed"); // 18.9 ??
@@ -509,7 +509,7 @@ void UnitTestTrajectory::test_realStartPoint()
LtsUtils::QPoint3D realStartPoint = TrajectoryHelper::realStartPoint(apo, idealHit);
ERROR_LOG() << " apo = " << apo << " idealHit = " << idealHit << " -> = realStartPoint =" << realStartPoint;
ERROR_LOG(m_logger) << " apo = " << apo << " idealHit = " << idealHit << " -> = realStartPoint =" << realStartPoint;
QVERIFY2(qFuzzyCompare(realStartPoint, result), "realStartPoint failed");
// next step:
@@ -517,8 +517,8 @@ void UnitTestTrajectory::test_realStartPoint()
double duration;
const double heightAbs = apo.z();
duration = TrajectoryHelper::flightDurationSec(realStartPoint, idealHit, heightAbs, &betaOut, &vOut);
ERROR_LOG() << "flightDurationSec with realStartPoint " << realStartPoint << ", idealHit " << idealHit << ", heightAbs " << heightAbs;
ERROR_LOG() << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
ERROR_LOG(m_logger) << "flightDurationSec with realStartPoint " << realStartPoint << ", idealHit " << idealHit << ", heightAbs " << heightAbs;
ERROR_LOG(m_logger) << " -> duration [sec] " << std::setprecision(16) << duration << ", beta [deg] " << betaOut * rad2deg() << ", v " << vOut;
QVERIFY2(qFuzzyCompare(betaOut * rad2deg(), betaDeg), "flightDurationSec failed");
}
@@ -581,18 +581,18 @@ void UnitTestTrajectory::test_generateTrajectoryBiedziak()
// check Scheitelpunkt / Apogaeum
{
const auto &item35 = trajectoryOut[35];
INFO_LOG() << "iqtem35 = " << item35;
INFO_LOG(m_logger) << "iqtem35 = " << item35;
QVERIFY2(qFuzzyCompare(item35.z(), 148.044675655973), "TrajectoryGenerator::trajectoryOut failed");
}
{
// Hier ist der Scheitelpunkt:
const auto &item36 = trajectoryOut[36];
INFO_LOG() << "item36 = " << item36;
INFO_LOG(m_logger) << "item36 = " << item36;
QVERIFY2(qFuzzyCompare(item36.z(), 148.087567297406), "TrajectoryGenerator::trajectoryOut failed");
}
{
const auto &item37 = trajectoryOut[37];
INFO_LOG() << "item37 = " << item37;
INFO_LOG(m_logger) << "item37 = " << item37;
QVERIFY2(qFuzzyCompare(item37.z(), 147.905786767084), "TrajectoryGenerator::trajectoryOut failed");
}
}
@@ -611,8 +611,8 @@ void UnitTestTrajectory::test_vulcano_beta_Abschusswinkel()
const double betaRad = XY::calculateBetaRad(v0, height);
const double betaDeg = betaRad * LtsCoordTrans::rad2deg();
INFO_LOG() << "calculateBetaRad with v0 = " << v0 << ", height = " << height;
INFO_LOG() << " -> betaRad = " << betaRad << ", betaDeg = " << betaDeg;
INFO_LOG(m_logger) << "calculateBetaRad with v0 = " << v0 << ", height = " << height;
INFO_LOG(m_logger) << " -> betaRad = " << betaRad << ", betaDeg = " << betaDeg;
QVERIFY2(qFuzzyCompare(betaDeg, 29.99727415506499), "calculateBetaRad failed");
}
@@ -644,13 +644,13 @@ void UnitTestTrajectory::test_vulcano_apogaeumCosmos()
const double betaRad = XY::calculateBetaRad(v0, height);
const double betaDeg = betaRad * LtsCoordTrans::rad2deg();
INFO_LOG() << "calculateBetaRad with v0 = " << v0 << ", height = " << height;
INFO_LOG() << " -> betaRad = " << betaRad << ", betaDeg = " << betaDeg;
INFO_LOG(m_logger) << "calculateBetaRad with v0 = " << v0 << ", height = " << height;
INFO_LOG(m_logger) << " -> betaRad = " << betaRad << ", betaDeg = " << betaDeg;
const QPointF &apo = XY::calculateApogaeum(v0, betaRad);
INFO_LOG() << "calculateApogaeum with v0 = " << v0 << ", betaDeg = " << betaDeg;
INFO_LOG() << " -> apo " << apo;
INFO_LOG(m_logger) << "calculateApogaeum with v0 = " << v0 << ", betaDeg = " << betaDeg;
INFO_LOG(m_logger) << " -> apo " << apo;
QVERIFY2(qFuzzyCompare(apo.x(), 50 ), "calculateBetaRad/calculateApogaeum failed"); // 100m / 2.0
QVERIFY2(qFuzzyCompare(apo.y(), height), "calculateBetaRad/calculateApogaeum failed");
@@ -691,15 +691,15 @@ void UnitTestTrajectory::test_vulcano_apogaeum()
const QPointF &apo = XY::calculateApogaeum(v0, betaDeg*LtsCoordTrans::deg2rad());
const QVector2D apoDiff(apo - expectedAPO);
DEBUG_LOG() << "calculateApogaeum with v0 = " << v0 << ", betaDeg = " << betaDeg;
DEBUG_LOG() << " -> apo " << apo << " diff = "<< apoDiff.length();
DEBUG_LOG(m_logger) << "calculateApogaeum with v0 = " << v0 << ", betaDeg = " << betaDeg;
DEBUG_LOG(m_logger) << " -> apo " << apo << " diff = "<< apoDiff.length();
QVERIFY2(apoDiff.length() < 1, "calculateApogaeum failed");
// und zurück:
const double calcBetaRad = XY::calculateBetaRad(v0, expectedAPO.y());
double betaDiff = fabs(calcBetaRad*LtsCoordTrans::rad2deg() - betaDeg);
DEBUG_LOG() << " zurück: betaDiff = " << betaDiff;
DEBUG_LOG(m_logger) << " zurück: betaDiff = " << betaDiff;
QVERIFY2(betaDiff < 0.001, "calculateBetaRad failed");
}
@@ -784,15 +784,15 @@ void UnitTestTrajectory::test_vulcano_tap()
const QPointF &tapRelToImpact = XY::calculateTapRelToIdealHit(vFall, alphaDeg*LtsCoordTrans::deg2rad(), tapT);
INFO_LOG() << "calculateTapRelToIdealHit with vFall = " << vFall
INFO_LOG(m_logger) << "calculateTapRelToIdealHit with vFall = " << vFall
<< ", alphaDeg = " << alphaDeg
<< ", tapT = " << tapT;
INFO_LOG() << " -> tapRelToImpact " << tapRelToImpact
INFO_LOG(m_logger) << " -> tapRelToImpact " << tapRelToImpact
<< " , lenght = " << QVector2D(tapRelToImpact).length();
QVERIFY2((expectedLength - QVector2D(tapRelToImpact).length()) < 1, "calculateTapRelToIdealHit abs failed");
const QVector2D diff(tapRelToImpact - expectedTAP);
INFO_LOG() << " -> diff.QVector2D.length = " << diff.length();
INFO_LOG(m_logger) << " -> diff.QVector2D.length = " << diff.length();
QVERIFY2(diff.length() < 0.1, "calculateTapRelToIdealHit rel failed");
}
@@ -821,10 +821,10 @@ void UnitTestTrajectory::test_vulcano_ballisticCurve()
QFETCH(double, expectedDeltaTime);
const QPointF &apo = XY::calculateApogaeum(v0, betaDeg*LtsCoordTrans::deg2rad());
INFO_LOG() << ", apo " << apo;
INFO_LOG(m_logger) << ", apo " << apo;
const QVector2D diff(apo - expectedAPO);
INFO_LOG() << ", diff " << diff.length();
INFO_LOG(m_logger) << ", diff " << diff.length();
QVERIFY2(diff.length() < 0.1, "calculateApogaeum rel failed");
//
@@ -839,7 +839,7 @@ void UnitTestTrajectory::test_vulcano_ballisticCurve()
const QVector<QPointF> &phase1_bal = XY::generateBallisticCurveUntil(v0, betaDeg*LtsCoordTrans::deg2rad(),
x_distancePhase1, secPerIntervall,
&deltaXperStep_out, &secPerIntervall_out);
INFO_LOG() << "generateBallisticCurveUntil: "
INFO_LOG(m_logger) << "generateBallisticCurveUntil: "
<< ", phase1_bal.size() = " << phase1_bal.size()
<< ", phase1_bal.last() = " << std::setprecision(16) << phase1_bal.last()
<< ", deltaXperStep_out = " << std::setprecision(16) << deltaXperStep_out
@@ -957,10 +957,10 @@ void UnitTestTrajectory::test_vulcano_trajectory()
&reasonOut);
if (!reasonOut.isEmpty())
ERROR_LOG() << " trajectoryVulcano failed, reasonOut = '" << reasonOut << "'";
ERROR_LOG(m_logger) << " trajectoryVulcano failed, reasonOut = '" << reasonOut << "'";
INFO_LOG() << "trajectoryVulcano: "
INFO_LOG(m_logger) << "trajectoryVulcano: "
<< ", ret = " << ret
<< ", trajectoryOut.size() = " << trajectoryOut.size();
@@ -968,7 +968,7 @@ void UnitTestTrajectory::test_vulcano_trajectory()
QVERIFY2(trajectoryOut.size() == expectedSize, "trajectoryVulcano2 failed");
// const QPoint3D &apo3D = trajectoryOut[40]; // more or less wellknown
// INFO_LOG() << "trajectoryVulcano: "
// INFO_LOG(m_logger) << "trajectoryVulcano: "
// << ", ret = " << ret
// << ", trajectoryOut.size() = " << trajectoryOut.size()
// << ", apo3D = " << apo3D;
@@ -976,7 +976,7 @@ void UnitTestTrajectory::test_vulcano_trajectory()
// // recalculate to distance between apo and origin (on flat xy)
// LtsUtils::QPoint3D apoToOrigin = apo3D - origin;
// double xyDist = QVector2D(apoToOrigin.toPointF()).length();
// INFO_LOG() << " -> apoToOrigin.length = " << std::setprecision(16) << xyDist;
// INFO_LOG(m_logger) << " -> apoToOrigin.length = " << std::setprecision(16) << xyDist;
// QVERIFY2(fabs( 12248.0 - xyDist ) < 1, "generateBallisticCurveUntil3 failed");
// QVERIFY2(fabs( 8127.0 + origin.z() - apo3D.z() ) < 1, "generateBallisticCurveUntil4 failed");
@@ -993,7 +993,7 @@ void UnitTestTrajectory::test_vulcano_trajectory()
int i=0;
for (auto &item : std::as_const(trajectoryOut))
INFO_LOG() << "i = " << i++ << ", item " << item;
INFO_LOG(m_logger) << "i = " << i++ << ", item " << item;
}
@@ -77,4 +77,6 @@ private Q_SLOTS:
// void cleanup();
private:
NGL::INGLLogger &m_logger;
};
@@ -85,22 +85,22 @@ void TrajectoryGenerator::cleanup()
void TrajectoryGenerator::initElevation(LtsElevation::LtsElevationManager *ltsElevationManager)
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
m_ltsElevationManager = ltsElevationManager;
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
LtsElevation::LtsElevationManager *TrajectoryGenerator::getElevationManager()
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
return m_ltsElevationManager;
}
bool TrajectoryGenerator::hasElevationManager() const
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
return m_ltsElevationManager;
}
@@ -268,14 +268,14 @@ bool TrajectoryGenerator::generateTrajectoryBiedziak(const LtsUtils::QPoint3D &o
CONT_T &trajectoryOut)
{
// use zone of impact:
INFO_LOG() << " oPosition geo " << originatorPosition_geo.x() << " - " << originatorPosition_geo.y();
INFO_LOG() << " iPosition geo " << impactPosition_geo.x() << " - " << impactPosition_geo.y();
INFO_LOG(m_logger) << " oPosition geo " << originatorPosition_geo.x() << " - " << originatorPosition_geo.y();
INFO_LOG(m_logger) << " iPosition geo " << impactPosition_geo.x() << " - " << impactPosition_geo.y();
const LtsCoordTrans::UtmCoordinate &iPosition = LtsCoordTrans::UtmCoordinate::fromGeographic(impactPosition_geo.toPointF());
const LtsCoordTrans::UtmCoordinate &oPosition = LtsCoordTrans::UtmCoordinate::fromGeographic(originatorPosition_geo.toPointF(), iPosition.zone);
INFO_LOG() << " oPosition " << oPosition.mgrs();
INFO_LOG() << " iPosition " << iPosition.mgrs();
INFO_LOG(m_logger) << " oPosition " << oPosition.mgrs();
INFO_LOG(m_logger) << " iPosition " << iPosition.mgrs();
const double distance = sqrt(pow(iPosition.x - oPosition.x, 2.) + pow(iPosition.y - oPosition.y, 2.));
@@ -287,18 +287,18 @@ bool TrajectoryGenerator::generateTrajectoryBiedziak(const LtsUtils::QPoint3D &o
oHeight = m_ltsElevationManager ? m_ltsElevationManager->elevation(originatorPosition_geo.x(), originatorPosition_geo.y()) : 0;
if (oHeight < 300)
oHeight = 100;
INFO_LOG() << " oPosition " << oPosition << " has no zValue provided (NaN), update via ltsElevationManager...";
INFO_LOG(m_logger) << " oPosition " << oPosition << " has no zValue provided (NaN), update via ltsElevationManager...";
}
if (std::isnan(iHeight) && m_ltsElevationManager)
{
iHeight = m_ltsElevationManager ? m_ltsElevationManager->elevation(impactPosition_geo.x(), impactPosition_geo.y()) : 0;
if (iHeight < 300)
iHeight = 100;
INFO_LOG() << " iPosition " << iPosition << " has no zValue provided (NaN), update via ltsElevationManager.. ";
INFO_LOG(m_logger) << " iPosition " << iPosition << " has no zValue provided (NaN), update via ltsElevationManager.. ";
}
INFO_LOG() << " oPosition " << oPosition << " ; oHeight=" << oHeight;
INFO_LOG() << " iPosition " << iPosition << " ; iHeight=" << iHeight;
INFO_LOG(m_logger) << " oPosition " << oPosition << " ; oHeight=" << oHeight;
INFO_LOG(m_logger) << " iPosition " << iPosition << " ; iHeight=" << iHeight;
// z-Values:
const QVector<double> &zValues = this->trajectoryBiedziak(distance, iHeight - oHeight, elevation_angle_degree);
@@ -324,7 +324,7 @@ bool TrajectoryGenerator::generateTrajectoryBiedziak(const LtsUtils::QPoint3D &o
p2D.x(), p2D.y(), oHeight + zValues[i]); // x, y, z
} // for
//// DEBUG_LOG() << string4poly(geo);
//// DEBUG_LOG(m_logger) << string4poly(geo);
return true;
}
@@ -89,6 +89,7 @@ class TRAJECTORY_EXPORT TrajectoryGenerator : public QObject
QString *reasonOut);
protected:
NGL::INGLLogger &m_logger;
/*! \name Ideal trajectory */
template <typename CONT_T>
bool generateTrajectoryBiedziak(const LtsUtils::QPoint3D &originatorPosition_geo,
@@ -97,6 +98,7 @@ class TRAJECTORY_EXPORT TrajectoryGenerator : public QObject
CONT_T &trajectoryOut);
protected:
NGL::INGLLogger &m_logger;
explicit TrajectoryGenerator();
public:
@@ -45,31 +45,31 @@ bool FireAutomaton::init(int32_t time, TimeType type, int32_t rounds, const QVec
{
if(m_state != State::Stopped && m_state != State::Uninitialized)
{
ERROR_LOG() << " init failed - fire automaton must be in state unitialized or stopped.";
ERROR_LOG(m_logger) << " init failed - fire automaton must be in state unitialized or stopped.";
return false;
}
if(time < 0)
{
ERROR_LOG() << " init failed - time invalid.";
ERROR_LOG(m_logger) << " init failed - time invalid.";
return false;
}
if(effectorIds.isEmpty())
{
ERROR_LOG() << " init failed - effector Ids invalid.";
ERROR_LOG(m_logger) << " init failed - effector Ids invalid.";
return false;
}
if(rounds <= 0)
{
ERROR_LOG() << " init failed - number of rounds invalid.";
ERROR_LOG(m_logger) << " init failed - number of rounds invalid.";
return false;
}
if(pattern.isEmpty())
{
ERROR_LOG() << " init failed - invalid fire pattern.";
ERROR_LOG(m_logger) << " init failed - invalid fire pattern.";
return false;
}
@@ -80,13 +80,13 @@ bool FireAutomaton::init(int32_t time, TimeType type, int32_t rounds, const QVec
if(!readPattern(pattern))
{
ERROR_LOG() << " init failed - firing pattern invalid.";
ERROR_LOG(m_logger) << " init failed - firing pattern invalid.";
return false;
}
if(!calculateSchedule(rounds))
{
ERROR_LOG() << " init failed - firing schedule invalid.";
ERROR_LOG(m_logger) << " init failed - firing schedule invalid.";
return false;
}
@@ -166,7 +166,7 @@ bool FireAutomaton::start()
{
if(m_state != State::Stopped)
{
ERROR_LOG() << " start failed - fire automaton must be in state stopped.";
ERROR_LOG(m_logger) << " start failed - fire automaton must be in state stopped.";
return false;
}
@@ -187,7 +187,7 @@ bool FireAutomaton::resume()
{
if(m_state != State::Paused)
{
ERROR_LOG() << " resume failed - fire automaton must be in state paused.";
ERROR_LOG(m_logger) << " resume failed - fire automaton must be in state paused.";
return false;
}
@@ -207,7 +207,7 @@ bool FireAutomaton::pause()
{
if(m_state != State::Running)
{
ERROR_LOG() << " pause failed - fire automaton must be in state running.";
ERROR_LOG(m_logger) << " pause failed - fire automaton must be in state running.";
return false;
}
@@ -242,7 +242,7 @@ bool FireAutomaton::performStep()
{
if(m_state != State::Stopped && m_state != State::Stepping)
{
ERROR_LOG() << " performStep failed - fire automaton must be in state stepping or stopped.";
ERROR_LOG(m_logger) << " performStep failed - fire automaton must be in state stepping or stopped.";
return false;
}
@@ -278,7 +278,7 @@ bool FireAutomaton::readPattern(const QString& pattern)
if(!patternElementFromString(element, patternElement))
{
WARNING_LOG() << " skipped invalid firing pattern elements.";
WARNING_LOG(m_logger) << " skipped invalid firing pattern elements.";
continue;
}
@@ -290,7 +290,7 @@ bool FireAutomaton::readPattern(const QString& pattern)
}
else
{
ERROR_LOG() << " a pattern may contain at most one fill element.";
ERROR_LOG(m_logger) << " a pattern may contain at most one fill element.";
return false;
}
}
@@ -300,7 +300,7 @@ bool FireAutomaton::readPattern(const QString& pattern)
if(m_pattern.empty())
{
ERROR_LOG() << " error occured reading firing pattern.";
ERROR_LOG(m_logger) << " error occured reading firing pattern.";
return false;
}
@@ -412,7 +412,7 @@ bool FireAutomaton::calculateSchedule(int32_t rounds)
if(rounds > 0)
{
ERROR_LOG() << " scheduling error - fire pattern does not provide sufficient slots to schedule all rounds. " << rounds;
ERROR_LOG(m_logger) << " scheduling error - fire pattern does not provide sufficient slots to schedule all rounds. " << rounds;
return false;
}
@@ -72,6 +72,7 @@ private slots:
void nextTick();
private:
NGL::INGLLogger &m_logger;
enum class PatternElement {
All,
AllFill,
@@ -89,6 +90,7 @@ private:
QVector<int32_t> getEffectorIds(int32_t tick) const;
private:
NGL::INGLLogger &m_logger;
QVector<int32_t> m_effectorIds;
QVector<FireAutomaton::PatternElement> m_pattern;
QVector<QVector<int32_t>> m_schedule;
@@ -132,18 +132,18 @@ FiringTimer::FiringTimer(const QString &debugInfo)
{
++s_counter;
d->m_debugInfo = debugInfo;
DEBUG_LOG() << MY_Q_FUNC_INFO << " START, s_counter=" << s_counter << " this=" << this;
DEBUG_LOG() << MY_Q_FUNC_INFO << " END, s_counter=" << s_counter << " this=" << this;
DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " START, s_counter=" << s_counter << " this=" << this;
DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " END, s_counter=" << s_counter << " this=" << this;
}
FiringTimer::~FiringTimer()
{
--s_counter;
DEBUG_LOG() << MY_Q_FUNC_INFO << " START, s_counter=" << s_counter << " this=" << this;
DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " START, s_counter=" << s_counter << " this=" << this;
QString debugInfoSave = d->m_debugInfo;
delete d;
//DEBUG_LOG() << MY_Q_FUNC_INFO << " END, s_counter=" << s_counter << " this=" << this;
DEBUG_LOG() << "debugInfo='" << debugInfoSave << "'" << Q_FUNC_INFO << " END, s_counter=" << s_counter << " this=" << this;
//DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " END, s_counter=" << s_counter << " this=" << this;
DEBUG_LOG(m_logger) << "debugInfo='" << debugInfoSave << "'" << Q_FUNC_INFO << " END, s_counter=" << s_counter << " this=" << this;
}
void FiringTimer::setDebugInfo(const QString &debugInfo)
@@ -153,14 +153,14 @@ void FiringTimer::setDebugInfo(const QString &debugInfo)
void FiringTimer::reset()
{
TRACE_LOG() << MY_Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << MY_Q_FUNC_INFO << " START";
d->reset();
TRACE_LOG() << MY_Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << MY_Q_FUNC_INFO << " END";
}
bool FiringTimer::init(long effectDurationMsec, int ammoCount, long ammoFlightDurationMsec)
{
TRACE_LOG() << MY_Q_FUNC_INFO << " START,"
TRACE_LOG(m_logger) << MY_Q_FUNC_INFO << " START,"
<< ", effectDurationMsec=" << effectDurationMsec
<< ", ammoCount=" << ammoCount
<< ", ammoFlightDurationMsec=" << ammoFlightDurationMsec;
@@ -170,7 +170,7 @@ bool FiringTimer::init(long effectDurationMsec, int ammoCount, long ammoFlightDu
d->m_ammoCount = ammoCount;
d->m_ammoFlightDurationMsec = ammoFlightDurationMsec;
d->m_intervallMsec = static_cast<double>(d->m_effectDurationMsec) / d->m_ammoCount; // ensure float calculation
DEBUG_LOG() << MY_Q_FUNC_INFO << " m_intervallMsec " << d->m_intervallMsec;
DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " m_intervallMsec " << d->m_intervallMsec;
d->m_firingTimer->stop();
d->m_firingTimer->setSingleShot(false);
@@ -178,24 +178,24 @@ bool FiringTimer::init(long effectDurationMsec, int ammoCount, long ammoFlightDu
connect(d->m_firingTimer, &QTimer::timeout,
this, &FiringTimer::onFiringTimout, Qt::UniqueConnection);
TRACE_LOG() << MY_Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << MY_Q_FUNC_INFO << " END";
return true;
}
bool FiringTimer::startFiring()
{
TRACE_LOG() << MY_Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << MY_Q_FUNC_INFO << " START";
if ((d->m_currentFiringMode != FiringMode::FM_Undefined) &&
(d->m_currentFiringMode != FiringMode::FM_Paused))
{
ERROR_LOG() << MY_Q_FUNC_INFO << " wrong firingMode, cur = " << (int)d->m_currentFiringMode;
ERROR_LOG(m_logger) << MY_Q_FUNC_INFO << " wrong firingMode, cur = " << (int)d->m_currentFiringMode;
return false;
}
if (remainingAmmoCount() <= 0)
{
ERROR_LOG() << MY_Q_FUNC_INFO << " no ammo left"
ERROR_LOG(m_logger) << MY_Q_FUNC_INFO << " no ammo left"
<< " (total ammoCount was: " << d->m_ammoCount
<< " cur firingMode = " << (int)d->m_currentFiringMode;
return false;
@@ -213,7 +213,7 @@ bool FiringTimer::startFiring()
#endif // SUPPORT_STATE_CHANGE_DELAYED
DEBUG_LOG() << MY_Q_FUNC_INFO << " start firing with m_firedAmmoCount = " << d->m_firedAmmoCount;
DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " start firing with m_firedAmmoCount = " << d->m_firedAmmoCount;
d->m_firingTimer->start();
d->m_currentFiringMode = FiringMode::FM_Active;
@@ -227,7 +227,7 @@ bool FiringTimer::startFiring()
d->m_pausedMsec += pausedElapsedMsec;
d->m_etPaused->invalidate();
}
DEBUG_LOG() << MY_Q_FUNC_INFO << " start firing after [ms]: " << pausedElapsedMsec
DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " start firing after [ms]: " << pausedElapsedMsec
<< ", m_activeMsec in total = " << d->m_activeMsec
<< ", m_pausedMsec in total = " << d->m_pausedMsec;
@@ -256,7 +256,7 @@ bool FiringTimer::startFiring()
// to fire at the beginning of the interval:
onFiringTimout();
TRACE_LOG() << MY_Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << MY_Q_FUNC_INFO << " END";
return true;
}
@@ -270,17 +270,17 @@ bool FiringTimer::startFiringDelay(qint64 delayMsec)
bool FiringTimer::pauseFiring()
{
TRACE_LOG() << MY_Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << MY_Q_FUNC_INFO << " START";
if (d->m_currentFiringMode != FiringMode::FM_Active)
{
ERROR_LOG() << MY_Q_FUNC_INFO << " wrong firingMode";
ERROR_LOG(m_logger) << MY_Q_FUNC_INFO << " wrong firingMode";
return false;
}
if (remainingAmmoCount() <= 0)
{
ERROR_LOG() << MY_Q_FUNC_INFO << " no ammo left"
ERROR_LOG(m_logger) << MY_Q_FUNC_INFO << " no ammo left"
<< " (total ammoCount was: " << d->m_ammoCount;
return false;
}
@@ -293,7 +293,7 @@ bool FiringTimer::pauseFiring()
#endif // SUPPORT_STATE_CHANGE_DELAYED
DEBUG_LOG() << MY_Q_FUNC_INFO << " stop firing at m_firedAmmoCount = " << d->m_firedAmmoCount;
DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " stop firing at m_firedAmmoCount = " << d->m_firedAmmoCount;
d->m_firingTimer->stop();
d->m_currentFiringMode = FiringMode::FM_Paused;
d->m_etPaused->start();
@@ -305,14 +305,14 @@ bool FiringTimer::pauseFiring()
const qint64 activeElapsedMsec = d->m_etActive->elapsed();
d->m_activeMsec += activeElapsedMsec;
d->m_etActive->invalidate();
DEBUG_LOG() << MY_Q_FUNC_INFO << " stop firing after [ms]: " << activeElapsedMsec
DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " stop firing after [ms]: " << activeElapsedMsec
<< ", m_activeMsec in total = " << d->m_activeMsec
<< ", m_pausedMsec in total = " << d->m_pausedMsec;
QString log = QString(QStringLiteral("pauseFiring_at_%1")).arg(QDateTime::currentMSecsSinceEpoch()) ;
d->m_logHistorie.append(log);
TRACE_LOG() << MY_Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << MY_Q_FUNC_INFO << " END";
return true;
}
@@ -346,7 +346,7 @@ long FiringTimer::intervallMsec() const
#ifdef SUPPORT_STATE_CHANGE_DELAYED
void FiringTimer::emitStateChangeDelayed(AreaEffectSimulation::FiringTimer::CMD cmd, int firedAmmoCount)
{
DEBUG_LOG() << MY_Q_FUNC_INFO << " SUPPORT_STATE_CHANGE_DELAYED: " << cmd
DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " SUPPORT_STATE_CHANGE_DELAYED: " << cmd
<< ", firedAmmoCount = " << firedAmmoCount;
emit stateChangeDelayedAsInt(static_cast<int>(cmd), firedAmmoCount);
}
@@ -380,11 +380,11 @@ QString FiringTimer::toString(const CMD cmd)
void FiringTimer::onFiringTimout()
{
TRACE_LOG() << MY_Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << MY_Q_FUNC_INFO << " START";
++d->m_firedAmmoCount;
INFO_LOG() << MY_Q_FUNC_INFO << " emit firing with: " << d->m_firedAmmoCount
INFO_LOG(m_logger) << MY_Q_FUNC_INFO << " emit firing with: " << d->m_firedAmmoCount
<< " of total ammoCount = " << d->m_ammoCount;
emit firing(d->m_firedAmmoCount, d->m_ammoCount);
@@ -396,7 +396,7 @@ void FiringTimer::onFiringTimout()
int currentFiringNumber = d->m_firedAmmoCount;
int totalFiringNumber = d->m_ammoCount;
DEBUG_LOG() << MY_Q_FUNC_INFO << " XXXXXXXXX schedule 'emit impact' " << currentFiringNumber;
DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " XXXXXXXXX schedule 'emit impact' " << currentFiringNumber;
QTimer::singleShot(d->m_ammoFlightDurationMsec, this, [this, currentFiringNumber, totalFiringNumber]()
{
@@ -408,7 +408,7 @@ void FiringTimer::onFiringTimout()
}
#endif // SUPPORT_STATE_CHANGE_DELAYED
INFO_LOG() << MY_Q_FUNC_INFO << " emit impact " << currentFiringNumber
INFO_LOG(m_logger) << MY_Q_FUNC_INFO << " emit impact " << currentFiringNumber
<< " of total = " << totalFiringNumber;
emit impact(currentFiringNumber, totalFiringNumber);
@@ -430,7 +430,7 @@ void FiringTimer::onFiringTimout()
if (d->m_firedAmmoCount >= d->m_ammoCount)
{
INFO_LOG() << MY_Q_FUNC_INFO << " no ammo left, finishing firing"
INFO_LOG(m_logger) << MY_Q_FUNC_INFO << " no ammo left, finishing firing"
<< ", " << d->m_firedAmmoCount << " of total ammoCount = " << d->m_ammoCount << " are fired";
d->m_firingTimer->stop();
@@ -440,7 +440,7 @@ void FiringTimer::onFiringTimout()
// !! Attention: do pauseFiring() WITHIN the intervall will reduce amount of time the firing is active !!
DEBUG_LOG() << MY_Q_FUNC_INFO << " stop firing after [ms]: " << activeElapsedMsec
DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " stop firing after [ms]: " << activeElapsedMsec
<< ", m_activeMsec in total = " << d->m_activeMsec
<< ", m_pausedMsec in total = " << d->m_pausedMsec
<< " now FiringTimoutExpiredPlus ...";
@@ -465,12 +465,12 @@ void FiringTimer::onFiringTimout()
d->m_firingTimer->start();
}
TRACE_LOG() << MY_Q_FUNC_INFO << " END" << ", m_firedAmmoCount " << d->m_firedAmmoCount;
TRACE_LOG(m_logger) << MY_Q_FUNC_INFO << " END" << ", m_firedAmmoCount " << d->m_firedAmmoCount;
}
void FiringTimer::onFiringTimoutExpiredPlus()
{
TRACE_LOG() << MY_Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << MY_Q_FUNC_INFO << " START";
d->m_currentFiringMode = FiringMode::FM_ExpiredPlus;
@@ -480,7 +480,7 @@ void FiringTimer::onFiringTimoutExpiredPlus()
// !! Attention: do pauseFiring() WITHIN the intervall will reduce amount of time the firing is active !!
DEBUG_LOG() << MY_Q_FUNC_INFO << " stop firing2 after [ms]: " << activeElapsedMsec
DEBUG_LOG(m_logger) << MY_Q_FUNC_INFO << " stop firing2 after [ms]: " << activeElapsedMsec
<< ", m_activeMsec in total = " << d->m_activeMsec
<< ", m_pausedMsec in total = " << d->m_pausedMsec;
@@ -488,7 +488,7 @@ void FiringTimer::onFiringTimoutExpiredPlus()
emit firingFinishedPlus();
TRACE_LOG() << MY_Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << MY_Q_FUNC_INFO << " END";
}
@@ -18,12 +18,11 @@
namespace AreaEffectSimulation
{
DdsHandler::DdsHandler(int domainId, int exerciseId, QObject *parent)
: QObject(parent)
DdsHandler::DdsHandler(int domainId, int exerciseId, QObject *parent) : QObject(parent)
, m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Exercise, exerciseId))
, m_currentTimeMSec(-1)
{
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
, m_currentTimeMSec(-1),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
}
DdsHandler::~DdsHandler()
@@ -45,7 +44,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
{
if (!m_ddsConnector->init(qosFileList))
{
ERROR_LOG() << "Error initializing dds connections - aborting";
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
return false;
}
@@ -84,7 +83,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
m_ddsDts = AreaEffectSimulation::Interface::Dts::create(m_ddsConnector);
m_ddsFts = AreaEffectSimulation::Interface::Fts::create(m_ddsConnector);
bRet &= m_ddsDts->enableAll();
DEBUG_LOG() << "initialized Dts: " << bRet;
DEBUG_LOG(m_logger) << "initialized Dts: " << bRet;
bRet &= m_ddsFts->enableAll();
bRet &= m_ddsFts->enableTargetPositionsModify();
@@ -95,7 +94,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
bRet &= m_ddsFts->enableAcknowledgeExternalAesItem();
bRet &= m_ddsFts->enableSetAesItemEffectorState();
DEBUG_LOG() << "initialized Fts: " << bRet;
DEBUG_LOG(m_logger) << "initialized Fts: " << bRet;
m_pdmDtc = ProjectDataManagement::Interface::Dtc::create(m_ddsConnector);
m_pdmDtc->enableChargeType();
@@ -78,6 +78,7 @@ private slots:
void onPartitionTimeChanged(const Core::PartitionTime &currentTime);
private:
NGL::INGLLogger &m_logger;
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<Core::Interface::Dtc> m_dtcCore;
std::shared_ptr<Core::Pacemaker> m_pacemaker;
@@ -26,31 +26,31 @@ EffectorStateMachine::~EffectorStateMachine() { stopAllTimer(); }
int EffectorStateMachine::intervalFire()
{
DEBUG_LOG() << "intervalFire";
DEBUG_LOG(m_logger) << "intervalFire";
return QRandomGenerator::global()->bounded(Settings::getEffectorIntervalFireMin(), Settings::getEffectorIntervalFireMax() + 1);
}
int EffectorStateMachine::intervalReportFired()
{
DEBUG_LOG() << "intervalReportFired";
DEBUG_LOG(m_logger) << "intervalReportFired";
return QRandomGenerator::global()->bounded(Settings::getEffectorIntervalReportFiredMin(), Settings::getEffectorIntervalReportFiredMax() + 1);
}
int EffectorStateMachine::intervalReportFireReadiness()
{
DEBUG_LOG() << "intervalReportFireReadiness";
DEBUG_LOG(m_logger) << "intervalReportFireReadiness";
return QRandomGenerator::global()->bounded(m_intervalReportFireReadinessMin, m_intervalReportFireReadinessMax + 1);
}
int EffectorStateMachine::intervalInitialFireReadiness()
{
DEBUG_LOG() << "intervalInitialFireReadiness";
DEBUG_LOG(m_logger) << "intervalInitialFireReadiness";
return QRandomGenerator::global()->bounded(Settings::getEffectorInitialReportFireReadinessMin(), Settings::getEffectorInitialReportFireReadinessMax() + 1);
}
void EffectorStateMachine::init()
{
DEBUG_LOG() << "EffectorStateMachine::init";
DEBUG_LOG(m_logger) << "EffectorStateMachine::init";
emit logMessage(
QStringLiteral("intervalFire min=%1 max=%2, intervalReportFired min=%3 max=%4, intervalReportFireReadiness min=%5 max=%6 , initialFireReadiness min=%7 max=%8")
.arg(
@@ -109,7 +109,7 @@ QString EffectorStateMachine::getStateStr(AreaEffectSimulation::AesEffectorState
bool EffectorStateMachine::overrideReportFireReadinessMinMax(int newMin, int newMax)
{
DEBUG_LOG() << "Override ReadinessMinMax min: " << newMin << " max: " << newMax;
DEBUG_LOG(m_logger) << "Override ReadinessMinMax min: " << newMin << " max: " << newMax;
m_intervalReportFireReadinessMin = newMin;
m_intervalReportFireReadinessMax = newMax;
@@ -118,7 +118,7 @@ bool EffectorStateMachine::overrideReportFireReadinessMinMax(int newMin, int new
bool EffectorStateMachine::resetReportFireReadinessMinMax()
{
DEBUG_LOG() << "Reset ReadinessMinMax min:" << Settings::getEffectorIntervalReportFireReadinessMin()
DEBUG_LOG(m_logger) << "Reset ReadinessMinMax min:" << Settings::getEffectorIntervalReportFireReadinessMin()
<< " max: " << Settings::getEffectorIntervalReportFireReadinessMax();
m_intervalReportFireReadinessMin = Settings::getEffectorIntervalReportFireReadinessMin();
@@ -156,7 +156,7 @@ bool EffectorStateMachine::reportNotFireReadiness()
}
QString timestamp = QDateTime::currentDateTime().toString(QStringLiteral("hh:mm:ss"));
emit logMessage(QStringLiteral("[%1] change effect state: %2 -> %3").arg(timestamp, oldStateStr, newStateStr));
DEBUG_LOG() << QStringLiteral("[%1] change effect state: %2 -> %3").arg(timestamp, oldStateStr, newStateStr);
DEBUG_LOG(m_logger) << QStringLiteral("[%1] change effect state: %2 -> %3").arg(timestamp, oldStateStr, newStateStr);
emit signalNotReadyToFire();
return true;
}
@@ -199,7 +199,7 @@ bool EffectorStateMachine::reportFireReadiness()
bool EffectorStateMachine::fireOrder()
{
DEBUG_LOG() << "fireOrder";
DEBUG_LOG(m_logger) << "fireOrder";
AreaEffectSimulation::AesEffectorState newState = AreaEffectSimulation::AesEffectorState::EsReceivedOrder;
@@ -209,7 +209,7 @@ bool EffectorStateMachine::fireOrder()
if (m_currentState == newState)
{
emit logMessage(QStringLiteral("Same State from %1 -> %2").arg(oldStateStr, newStateStr));
DEBUG_LOG() << QStringLiteral("Same State from %1 -> %2").arg(oldStateStr, newStateStr);
DEBUG_LOG(m_logger) << QStringLiteral("Same State from %1 -> %2").arg(oldStateStr, newStateStr);
return false;
}
@@ -220,7 +220,7 @@ bool EffectorStateMachine::fireOrder()
if (Settings::getEffectorIntervalFireMin() >= 0)
{
emit logMessage(QStringLiteral("m_timerFire.start()"));
DEBUG_LOG() << QStringLiteral("m_timerFire.start()");
DEBUG_LOG(m_logger) << QStringLiteral("m_timerFire.start()");
m_timerFire.setInterval(intervalFire());
m_timerFire.start();
}
@@ -228,12 +228,12 @@ bool EffectorStateMachine::fireOrder()
else
{
emit logMessage(QStringLiteral("No Statechange possible from %1 -> %2").arg(oldStateStr, newStateStr));
DEBUG_LOG() << QStringLiteral("No Statechange possible from %1 -> %2").arg(oldStateStr, newStateStr);
DEBUG_LOG(m_logger) << QStringLiteral("No Statechange possible from %1 -> %2").arg(oldStateStr, newStateStr);
return false;
}
QString timestamp = QDateTime::currentDateTime().toString(QStringLiteral("hh:mm:ss"));
emit logMessage(QStringLiteral("[%1] change effect state: %2 -> %3").arg(timestamp, oldStateStr, newStateStr));
DEBUG_LOG() << QStringLiteral("[%1] change effect state: %2 -> %3").arg(timestamp, oldStateStr, newStateStr);
DEBUG_LOG(m_logger) << QStringLiteral("[%1] change effect state: %2 -> %3").arg(timestamp, oldStateStr, newStateStr);
emit signalReceivedOrder();
return true;
}
@@ -37,7 +37,7 @@ bool HandlerChargeEffect::init()
if (!m_mainHandler)
{
ERROR_LOG() << QStringLiteral("Not possible to init HandlerChargeEffect --> No MainHandler present.");
ERROR_LOG(m_logger) << QStringLiteral("Not possible to init HandlerChargeEffect --> No MainHandler present.");
return false;
}
@@ -46,7 +46,7 @@ bool HandlerChargeEffect::init()
if (!m_mainHandler->db()->select(chargeEffectDbData))
{
ERROR_LOG() << QStringLiteral("Not possible to init HandlerChargeEffect --> Not possible to get database data.");
ERROR_LOG(m_logger) << QStringLiteral("Not possible to init HandlerChargeEffect --> Not possible to get database data.");
return false;
}
@@ -82,7 +82,7 @@ void HandlerChargeEffect::onChargeEffectModifyRequest(const rti::core::SampleIde
{
if (!m_mainHandler)
{
ERROR_LOG() << QStringLiteral("Not possible to process ChargeEffectModifyRequest --> No MainHandler present.");
ERROR_LOG(m_logger) << QStringLiteral("Not possible to process ChargeEffectModifyRequest --> No MainHandler present.");
return;
}
@@ -117,13 +117,13 @@ void HandlerChargeEffect::onChargeEffectFinished(qint32 chargeEffectId)
if (chargeEffect == nullptr)
{
ERROR_LOG() << "onChargeEffectExpired: got invalid chargeEffectId " << chargeEffectId;
ERROR_LOG(m_logger) << "onChargeEffectExpired: got invalid chargeEffectId " << chargeEffectId;
return;
}
if (!chargeEffect->remove())
{
ERROR_LOG() << "onChargeEffectExpired: failed to remove ChargeEffect with id " << chargeEffectId;
ERROR_LOG(m_logger) << "onChargeEffectExpired: failed to remove ChargeEffect with id " << chargeEffectId;
return;
}
@@ -135,7 +135,7 @@ void HandlerChargeEffect::onChargeEffectFinished(qint32 chargeEffectId)
const int trajId = m_trajObjIds.value(chargeEffectId, -1);
if (!m_trajectoryHandler->remove(trajId))
{
ERROR_LOG() << "onChargeEffectExpired: failed to remove trajectory from chargeEffect id " << chargeEffectId;
ERROR_LOG(m_logger) << "onChargeEffectExpired: failed to remove trajectory from chargeEffect id " << chargeEffectId;
return;
}
m_trajObjIds.remove(chargeEffectId);
@@ -143,7 +143,7 @@ void HandlerChargeEffect::onChargeEffectFinished(qint32 chargeEffectId)
void HandlerChargeEffect::onChargeEffectStateChanged(const int id, AesEffectState newState)
{
DEBUG_LOG() << " [CHARGE EFFECT STATE] state changed !! id: " << id << " state: " << newState;
DEBUG_LOG(m_logger) << " [CHARGE EFFECT STATE] state changed !! id: " << id << " state: " << newState;
if (id <= 0)
return;
@@ -165,8 +165,8 @@ Core::FunctionReplyObject HandlerChargeEffect::createChargeEffect(const ChargeEf
m_chargeEffects.insert(newChargeEffect->id(), newChargeEffect);
// Create ChargeAdministration Entry for reports
DEBUG_LOG() << "newChargeEffect id: " << newChargeEffect->id();
DEBUG_LOG() << "request.originatorTypeId: " << request.originatorTypeId();
DEBUG_LOG(m_logger) << "newChargeEffect id: " << newChargeEffect->id();
DEBUG_LOG(m_logger) << "request.originatorTypeId: " << request.originatorTypeId();
if (request.originatorTypeId() == ProjectDataManagement::StateChangeOriginator::AreaEffectSimulation)
{
int amount = 1;
@@ -185,7 +185,7 @@ Core::FunctionReplyObject HandlerChargeEffect::createChargeEffect(const ChargeEf
{
int trajId = m_trajectoryHandler->create(trajectoryData(newChargeEffect->id(), request.trajectoryTimeAware().get()));
if (trajId < 0)
ERROR_LOG() << " Couldn't create trajectory for chargeEffect id: " << newChargeEffect->id();
ERROR_LOG(m_logger) << " Couldn't create trajectory for chargeEffect id: " << newChargeEffect->id();
else
m_trajObjIds.insert(newChargeEffect->id(), trajId);
}
@@ -233,7 +233,7 @@ Core::FunctionReplyObject HandlerChargeEffect::updateChargeEffect(const ChargeEf
{
reply.setStr("Not possible to update ChargeEffect --> No MainHandler present.");
ERROR_LOG() << reply.str();
ERROR_LOG(m_logger) << reply.str();
return reply;
}
@@ -243,7 +243,7 @@ Core::FunctionReplyObject HandlerChargeEffect::updateChargeEffect(const ChargeEf
reply.setStr("Not possible to update ChargeEffect --> Got invalid id.");
ERROR_LOG() << reply.str();
ERROR_LOG(m_logger) << reply.str();
return reply;
}
@@ -257,7 +257,7 @@ Core::FunctionReplyObject HandlerChargeEffect::updateChargeEffect(const ChargeEf
{
// update failed should the trajectory be created again?
reply.setStr("Not possible to update ChargeEffect --> Got invalid trajectory id.");
ERROR_LOG() << " Couldn't update trajectory: unknown chargeEffect id: " << chargeEffetObj->id();
ERROR_LOG(m_logger) << " Couldn't update trajectory: unknown chargeEffect id: " << chargeEffetObj->id();
}
return reply;
@@ -39,6 +39,8 @@ public:
void onChargeEffectStateChanged(const int id, AesEffectState newState);
private: // methods
NGL::INGLLogger &m_logger;
Core::FunctionReplyObject updateChargeEffect(const ChargeEffectModifyRequest &request);
private: // attributes
@@ -28,7 +28,7 @@ HandlerEffector::HandlerEffector(AreaEffectSimulation::MainHandler *mainhandler,
bool HandlerEffector::init()
{
DEBUG_LOG() << "HandlerEffector::init";
DEBUG_LOG(m_logger) << "HandlerEffector::init";
connect(m_ppmDtc.get(), &ParticipantManagement::Interface::Dtc::participantChanged,
this, &HandlerEffector::onParticipantChanged);
@@ -48,7 +48,7 @@ void HandlerEffector::createEffector(int participantId)
{
if (m_effectors.contains(participantId))
return;
DEBUG_LOG()<<"createEffector participantId:" << participantId;
DEBUG_LOG(m_logger)<<"createEffector participantId:" << participantId;
ObjectEffector* objectEffector = new ObjectEffector(m_mainHandler, this);
objectEffector->init(participantId);
@@ -58,17 +58,17 @@ void HandlerEffector::createEffector(int participantId)
// TODO Wird aufgerufen, wenn zur Laufzeit ein Effektor geloescht wird. (Topic?)
void HandlerEffector::deleteEffector(int participantId)
{
DEBUG_LOG()<<"deleteEffector participantId:" << participantId;
DEBUG_LOG(m_logger)<<"deleteEffector participantId:" << participantId;
delete m_effectors[participantId];
m_effectors.remove(participantId);
}
void HandlerEffector::onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType)
{
//DEBUG_LOG()<<"onParticipantChanged participantId:" << data.id();
//DEBUG_LOG(m_logger)<<"onParticipantChanged participantId:" << data.id();
if (modType == DataModification::eRemoved)
{
DEBUG_LOG() << "m_participantsOutsideMap.remove participantId: " << data.id();
DEBUG_LOG(m_logger) << "m_participantsOutsideMap.remove participantId: " << data.id();
if (m_effectors.contains(data.id()))
deleteEffector(data.id());
return;
@@ -29,6 +29,8 @@ namespace AreaEffectSimulation
ObjectEffector* getObjectEffector (int participantId) {return m_effectors.value(participantId);};
private: // methods
NGL::INGLLogger &m_logger;
void createEffector(int participantId);
void deleteEffector(int participantId);
@@ -36,21 +36,21 @@ HandlerTrajectory::HandlerTrajectory(MainHandler *mainHandler)
HandlerTrajectory::~HandlerTrajectory()
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
delete d;
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
int HandlerTrajectory::create(const TrajectoryData &providedData)
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
int newId = -1;
auto *ifs = new ObjectTrajectory(d->m_mainHandler);
if (!ifs)
{
ERROR_LOG()<<" couldn't create ObjectTrajectory!";
TRACE_LOG() << Q_FUNC_INFO << " END";
ERROR_LOG(m_logger)<<" couldn't create ObjectTrajectory!";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
return -1;
}
@@ -66,17 +66,17 @@ int HandlerTrajectory::create(const TrajectoryData &providedData)
ifs->publish();
}
TRACE_LOG() << Q_FUNC_INFO << " END, newId = " << newId;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, newId = " << newId;
return newId;
}
bool HandlerTrajectory::update(const TrajectoryData &providedData)
{
TRACE_LOG() << Q_FUNC_INFO << " START, id = " << providedData.id;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, id = " << providedData.id;
bool success = false;
if (!providedData.isIdValid())
{
TRACE_LOG() << Q_FUNC_INFO << " END ";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END ";
return false;
}
@@ -87,25 +87,25 @@ bool HandlerTrajectory::update(const TrajectoryData &providedData)
success = true;
}
TRACE_LOG() << Q_FUNC_INFO << " END, success = " << success;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, success = " << success;
return success;
}
bool HandlerTrajectory::remove(const int trajId)
{
TRACE_LOG() << Q_FUNC_INFO << " START, id = " << trajId;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, id = " << trajId;
if (trajId <= 0)
{
ERROR_LOG() << " remove topic: got Invalid trajectory Id: "<<trajId;
TRACE_LOG() << Q_FUNC_INFO << " END ";
ERROR_LOG(m_logger) << " remove topic: got Invalid trajectory Id: "<<trajId;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END ";
return false;
}
auto *ifs = d->m_objectMap[trajId];
if (!ifs->removeTopic())
{
ERROR_LOG() << "failed to remove trajectory with id " << trajId;
ERROR_LOG(m_logger) << "failed to remove trajectory with id " << trajId;
return false;
}
@@ -113,13 +113,13 @@ bool HandlerTrajectory::remove(const int trajId)
delete ifs;
ifs = nullptr;
TRACE_LOG() << Q_FUNC_INFO << " END ";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END ";
return true;
}
int HandlerTrajectory::createUpdate(const TrajectoryData &providedData)
{
TRACE_LOG() << Q_FUNC_INFO << " START, id = " << providedData.id;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, id = " << providedData.id;
int ret = -1;
@@ -130,7 +130,7 @@ int HandlerTrajectory::createUpdate(const TrajectoryData &providedData)
} else {
ret = create(providedData);
}
TRACE_LOG() << Q_FUNC_INFO << " END, id ret " << ret;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, id ret " << ret;
return ret;
}
@@ -35,6 +35,7 @@ public:
int createUpdate(const TrajectoryData& providedData);
private:
NGL::INGLLogger &m_logger;
int count() const;
class Private;
@@ -46,9 +46,8 @@
namespace AreaEffectSimulation
{
MainHandler::MainHandler(QObject *parent)
: QObject(parent)
{
MainHandler::MainHandler(QObject *parent) : QObject(parent),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
QRandomGenerator(time(nullptr));
#else
@@ -95,7 +94,7 @@ bool MainHandler::init(int domainId, int exerciseId)
m_dbHandler = std::make_shared<DbHandler>();
if(!m_dbHandler->init(exerciseId, Settings::settings()))
{
ERROR_LOG() << "Initialisation DbHandler failed.";
ERROR_LOG(m_logger) << "Initialisation DbHandler failed.";
return false;
}
@@ -104,7 +103,7 @@ bool MainHandler::init(int domainId, int exerciseId)
m_dbHandlerEx0 = std::make_shared<DbHandler>();
if (!m_dbHandlerEx0->init(0, Settings::settings())) // need a second db connection due to username/password
{
ERROR_LOG() << "Could not init DbHandler";
ERROR_LOG(m_logger) << "Could not init DbHandler";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError,
QStringLiteral("Could not init DbHandler"));
return false;
@@ -120,7 +119,7 @@ bool MainHandler::init(int domainId, int exerciseId)
m_ddsHandler = std::make_shared<DdsHandler>(domainId, exerciseId);
if (!m_ddsHandler->init())
{
ERROR_LOG() << "Initialisation DdsHandler failed.";
ERROR_LOG(m_logger) << "Initialisation DdsHandler failed.";
return false;
}
@@ -158,7 +157,7 @@ bool MainHandler::initAESHandler()
// prepare some basics for HandlerExplosionCluster
// - TrajectoryGenerator
// - LtsElevationManager
DEBUG_LOG() << Q_FUNC_INFO << " ****** std::make_shared<HandlerExplosionCluster...";
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " ****** std::make_shared<HandlerExplosionCluster...";
const int exerciseId = dds()->exerciseId();
LtsElevation::LTS_ELEVATION_MANAGER_TYPE ltsElevationManager = LtsElevation::LtsElevationManager::createInstance(exerciseId,
dds()->exmDtc(),
@@ -176,7 +175,7 @@ bool MainHandler::initAESHandler()
#ifndef Q_OS_WIN // GUEZE-2195
if (!ltsElevationManager)
{
ERROR_LOG() << Q_FUNC_INFO << " LtsElevation::createInstance failed.";
ERROR_LOG(m_logger) << Q_FUNC_INFO << " LtsElevation::createInstance failed.";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::StoppedError);
return false;
}
@@ -188,7 +187,7 @@ bool MainHandler::initAESHandler()
this->dds()->asmDtc());
if (!trajectoryGenerator)
{
ERROR_LOG() << Q_FUNC_INFO << " TrajectoryGenerator::getInstance failed.";
ERROR_LOG(m_logger) << Q_FUNC_INFO << " TrajectoryGenerator::getInstance failed.";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::StoppedError);
return false;
}
@@ -196,7 +195,7 @@ bool MainHandler::initAESHandler()
m_handlerExplosionCluster = std::make_shared<HandlerExplosionCluster>(this);
if (!m_handlerExplosionCluster->init())
return false;
DEBUG_LOG() << Q_FUNC_INFO << " ****** std::make_shared<HandlerExplosionCluster... DONE";
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " ****** std::make_shared<HandlerExplosionCluster... DONE";
m_handlerFunctionalArea = std::make_shared<HandlerFunctionalArea>(this);
if (!m_handlerFunctionalArea->init())
@@ -248,7 +247,7 @@ bool MainHandler::initAESHandler()
m_handlerBorderline = std::make_shared<HandlerBorderline>(this);
if (!m_handlerBorderline->init())
{
ERROR_LOG() << Q_FUNC_INFO << " Initialisation HandlerBorderline failed.";
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Initialisation HandlerBorderline failed.";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::StoppedError);
return false;
}
@@ -257,7 +256,7 @@ bool MainHandler::initAESHandler()
m_handlerGasPipe = std::make_shared<HandlerGasPipe>(this);
if (!m_handlerGasPipe->init())
{
ERROR_LOG() << Q_FUNC_INFO << " Initialisation HandlerGasPipe failed.";
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Initialisation HandlerGasPipe failed.";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::StoppedError);
return false;
}
@@ -266,7 +265,7 @@ bool MainHandler::initAESHandler()
m_handlerChargeEffect = std::make_shared<HandlerChargeEffect>(this);
if (!m_handlerChargeEffect->init())
{
ERROR_LOG() << Q_FUNC_INFO << " Initialisation HandlerChargeEffect failed.";
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Initialisation HandlerChargeEffect failed.";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::StoppedError);
return false;
}
@@ -279,7 +278,7 @@ bool MainHandler::initAESHandler()
m_handlerEffector = std::make_shared<HandlerEffector>(this);
if (!m_handlerEffector->init())
{
ERROR_LOG() << Q_FUNC_INFO << " Initialisation HandlerChargeEffect failed.";
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Initialisation HandlerChargeEffect failed.";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::StoppedError);
return false;
}
@@ -115,8 +115,10 @@ public:
private:
NGL::INGLLogger &m_logger;
bool initAESHandler();
private:
NGL::INGLLogger &m_logger;
std::shared_ptr<HandlerAirSupportImpact> m_handlerAirSupportImpact;
std::shared_ptr<HandlerExplosionSingle> m_handlerExplosionSingle;
std::shared_ptr<HandlerExplosionArea> m_handlerExplosionArea;
@@ -21,12 +21,11 @@ namespace AreaEffectSimulation
static const int s_samePointDistance = 10; // 10m
static const int s_smoothDistance = 10; // 10m
static const int s_timeoutInterval = 10 * 60 * 1000; // 10min
MineCorridorCreator::MineCorridorCreator(int equipNo, ObjectMineCorridor *omc)
: m_timer(new QTimer(this))
MineCorridorCreator::MineCorridorCreator(int equipNo, ObjectMineCorridor *omc) : m_timer(new QTimer(this))
, m_timeoutTimer(new QTimer(this))
, m_omc(omc)
, m_equipNo(equipNo)
{
, m_equipNo(equipNo),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
m_timeoutTimer->setInterval(s_timeoutInterval);
m_timeoutTimer->setSingleShot(true);
connect(m_timeoutTimer, &QTimer::timeout, this, &MineCorridorCreator::timeout, Qt::QueuedConnection);
@@ -54,7 +53,7 @@ void MineCorridorCreator::addPosition(const Core::GeoPosition2D &pos, qint64 ts)
const auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon(), pos.lat(), last.zone);
if (isSamePoint(last, utm, s_samePointDistance))
{
DEBUG_LOG() << "got duplicated point (" << last.x << "/" << last.y
DEBUG_LOG(m_logger) << "got duplicated point (" << last.x << "/" << last.y
<< " - " << utm.x << "/" << utm.y << " from " << m_equipNo << " - ignoring";
return;
}
@@ -69,7 +68,7 @@ void MineCorridorCreator::creationFinished()
if (m_sortedCorridorData.size() < 2)
{
WARNING_LOG() << "To few points to create mine corridor for " << m_equipNo;
WARNING_LOG(m_logger) << "To few points to create mine corridor for " << m_equipNo;
return;
}
checkCorridorData(true);
@@ -94,13 +93,13 @@ static void outputCoords(NGL::INGLLogger &logger, NGL::LogLevel level, const std
void MineCorridorCreator::checkCorridorData(bool bFinished)
{
DEBUG_LOG() << "Checking corridor data (finished: " << bFinished << ") for equipment " << m_equipNo;
DEBUG_LOG(m_logger) << "Checking corridor data (finished: " << bFinished << ") for equipment " << m_equipNo;
std::vector<LtsCoordTrans::UtmCoordinate> coords;
coords.reserve(m_sortedCorridorData.size());
for (const auto &c : std::as_const(m_sortedCorridorData))
coords.push_back(c);
const auto coordsSmoothed = ramerDouglasPeucker(coords, s_smoothDistance);
DEBUG_LOG() << "Calculated points:";
DEBUG_LOG(m_logger) << "Calculated points:";
outputCoords(m_logger, NGL::LogLevel::Debug, coordsSmoothed);
if (coordsSmoothed.size() < 2)
return;
@@ -108,7 +107,7 @@ void MineCorridorCreator::checkCorridorData(bool bFinished)
segments.reserve(coordsSmoothed.size());
for (const LtsCoordTrans::UtmCoordinate &utm : coordsSmoothed)
{
DEBUG_LOG() << "Mine Corridor calculated point: " << qRound(utm.x) << "/" << qRound(utm.y);
DEBUG_LOG(m_logger) << "Mine Corridor calculated point: " << qRound(utm.x) << "/" << qRound(utm.y);
const QPointF geo(utm.geographic());
segments.emplace_back(Core::GeoPosition2D(geo.x(), geo.y()));
}
@@ -181,7 +180,7 @@ std::vector<LtsCoordTrans::UtmCoordinate> MineCorridorCreator::ramerDouglasPeuck
// If max distance is greater than epsilon, recursively simplify
if (dmax > epsilon)
{
TRACE_LOG() << "Input points, split index = " << index;
TRACE_LOG(m_logger) << "Input points, split index = " << index;
outputCoords(m_logger, NGL::LogLevel::Trace, pointList);
// Recursive call
const std::vector<LtsCoordTrans::UtmCoordinate> firstLine(pointList.begin(), pointList.begin() + index + 1);
@@ -191,9 +190,9 @@ std::vector<LtsCoordTrans::UtmCoordinate> MineCorridorCreator::ramerDouglasPeuck
out.erase(--out.end());
const auto recResults2 = ramerDouglasPeucker(lastLine, epsilon);
TRACE_LOG() << "Output points left:";
TRACE_LOG(m_logger) << "Output points left:";
outputCoords(m_logger, NGL::LogLevel::Trace, out);
TRACE_LOG() << "Output points right:";
TRACE_LOG(m_logger) << "Output points right:";
outputCoords(m_logger, NGL::LogLevel::Trace, recResults2);
out.insert(out.end(), recResults2.begin(), recResults2.end());
@@ -33,6 +33,7 @@ Q_SIGNALS:
private Q_SLOTS:
void onCheckCorridorData();
private:
NGL::INGLLogger &m_logger;
void checkCorridorData(bool bFinished);
static bool isSamePoint(const LtsCoordTrans::UtmCoordinate &p1, const LtsCoordTrans::UtmCoordinate &p2, double epsilon);
static double perpendicularDistance(const LtsCoordTrans::UtmCoordinate &pt,
@@ -41,6 +42,7 @@ private:
std::vector<LtsCoordTrans::UtmCoordinate> ramerDouglasPeucker(const std::vector<LtsCoordTrans::UtmCoordinate> &pointList,
double epsilon) const;
private:
NGL::INGLLogger &m_logger;
QMap<qint64, LtsCoordTrans::UtmCoordinate> m_sortedCorridorData;
QTimer *m_timer;
QTimer *m_timeoutTimer;
@@ -44,7 +44,7 @@ void ObjectBase::setEffectState(AesEffectState newState)
Q_UNUSED(newState)
m_publishDataTimer->start();
AesEffectState es = checkEnterNewState(); // can create loop because checkEnterNewState is calling trySwitchFoo() but it's ok
DEBUG_LOG() << id() << " New effect state is " << es;
DEBUG_LOG(m_logger) << id() << " New effect state is " << es;
emit effectStateChanged();
}
@@ -91,7 +91,7 @@ bool ObjectBase::isObjectInTrainingArea() const
AesEffectState ObjectBase::checkEnterNewState()
{
DEBUG_LOG() << id() << " checkEnterNewState - cur effect state is " << effectState();
DEBUG_LOG(m_logger) << id() << " checkEnterNewState - cur effect state is " << effectState();
bool bNeedToPublishNewData = false;
switch (effectState().underlying())
{
@@ -147,13 +147,13 @@ AesEffectState ObjectBase::checkEnterNewState()
{
timeToTickMsec = activationTime().toMSecsSinceEpoch() - partitionTimeMSec() - flightDurationMsec();
DEBUG_LOG() << id() << " timeUntilFiredMSec: " << timeToTickMsec;
DEBUG_LOG(m_logger) << id() << " timeUntilFiredMSec: " << timeToTickMsec;
}
else // setup EsAvtivated
{
timeToTickMsec = activationTime().toMSecsSinceEpoch() - partitionTimeMSec(); // time until activation
DEBUG_LOG() << id() << " timeUntilActivationMSec: " << timeToTickMsec
DEBUG_LOG(m_logger) << id() << " timeUntilActivationMSec: " << timeToTickMsec
<< " cur: " << partitionTimeMSec()
<< " activation: " << activationTime().toMSecsSinceEpoch();
}
@@ -172,7 +172,7 @@ AesEffectState ObjectBase::checkEnterNewState()
{
if (!trySwitchToActivated())
{
WARNING_LOG() << id() << " Error switching to active ...";
WARNING_LOG(m_logger) << id() << " Error switching to active ...";
QTimer::singleShot(100, this, &ObjectBase::checkEnterNewState); // maybe some timing
}
}
@@ -193,7 +193,7 @@ AesEffectState ObjectBase::checkEnterNewState()
// start timer for done
m_aesTriggerTimer->stop(); // if it is called directly by someone
qint64 timeUntilFinishedMSec = endTime().toMSecsSinceEpoch() - partitionTimeMSec();
DEBUG_LOG() << id() << " timeUntilFinishedMSec: " << timeUntilFinishedMSec
DEBUG_LOG(m_logger) << id() << " timeUntilFinishedMSec: " << timeUntilFinishedMSec
<< " cur: " << partitionTimeMSec()
<< " activation: " << activationTime().toMSecsSinceEpoch();
if (timeUntilFinishedMSec > 0)
@@ -208,7 +208,7 @@ AesEffectState ObjectBase::checkEnterNewState()
{
if (!trySwitchToExpired())
{
WARNING_LOG() << id() << " Error switching from active to expired ...";
WARNING_LOG(m_logger) << id() << " Error switching from active to expired ...";
QTimer::singleShot(100, this, &ObjectBase::checkEnterNewState); // maybe some timing
}
}
@@ -220,7 +220,7 @@ AesEffectState ObjectBase::checkEnterNewState()
case AesEffectState::EsRemoved:
break;
default:
ERROR_LOG() << id() << " Unknown new state " << effectState();
ERROR_LOG(m_logger) << id() << " Unknown new state " << effectState();
break;
}
if (bNeedToPublishNewData)
@@ -239,7 +239,7 @@ bool ObjectBase::trySwitchToReceived()
if (!isUsingEffectStateReceived())
return false;
DEBUG_LOG() << id() << " trySwitchToReceived succeeded";
DEBUG_LOG(m_logger) << id() << " trySwitchToReceived succeeded";
setEffectState(AesEffectState::EsReceived);
return true;
}
@@ -261,7 +261,7 @@ bool ObjectBase::trySwitchToCreated()
isUsingEffectStateReceived())
return false;
DEBUG_LOG() << id() << " trySwitchToCreated succeeded";
DEBUG_LOG(m_logger) << id() << " trySwitchToCreated succeeded";
setEffectState(AesEffectState::EsCreated);
return true;
}
@@ -280,7 +280,7 @@ bool ObjectBase::trySwitchToPrepared()
if (!isActivationTimeSet())
return false;
DEBUG_LOG() << id() << " trySwitchToPrepared succeeded";
DEBUG_LOG(m_logger) << id() << " trySwitchToPrepared succeeded";
setEffectState(AesEffectState::EsPrepared);
return true;
}
@@ -290,29 +290,29 @@ bool ObjectBase::trySwitchToFired()
{
if (effectState() != AesEffectState::EsPrepared)
{
DEBUG_LOG() << id() << " trySwitchToFired failed - not prepared: " << effectState();
DEBUG_LOG(m_logger) << id() << " trySwitchToFired failed - not prepared: " << effectState();
return false;
}
if (aesType() != AesType::AtExplosionArea && aesType() != AesType::AtEffectCluster)
{
DEBUG_LOG() << id() << " trySwitchToFired failed - not AtExplosionArea: " << aesType();
DEBUG_LOG(m_logger) << id() << " trySwitchToFired failed - not AtExplosionArea: " << aesType();
return false;
}
if (!isFiringTimeReached())
{
DEBUG_LOG() << id() << " trySwitchToFired failed - firing time is not reached";
DEBUG_LOG(m_logger) << id() << " trySwitchToFired failed - firing time is not reached";
return false;
}
if (isActivationTimeReached())
{
DEBUG_LOG() << id() << " trySwitchToFired failed - activation time already reached!";
DEBUG_LOG(m_logger) << id() << " trySwitchToFired failed - activation time already reached!";
return false;
}
DEBUG_LOG() << id() << " trySwitchToFired succeeded";
DEBUG_LOG(m_logger) << id() << " trySwitchToFired succeeded";
setEffectState(AesEffectState::EsFired);
return true;
}
@@ -324,17 +324,17 @@ bool ObjectBase::trySwitchToActivated()
effectState() != AesEffectState::EsPaused &&
effectState() != AesEffectState::EsFired)
{
DEBUG_LOG() << id() << " trySwitchToActivated failed - not prepared/fired/paused: " << effectState();
DEBUG_LOG(m_logger) << id() << " trySwitchToActivated failed - not prepared/fired/paused: " << effectState();
return false;
}
if (!isActivationTimeReached())
{
DEBUG_LOG() << id() << " trySwitchToActivated failed - activation time not reached: "
DEBUG_LOG(m_logger) << id() << " trySwitchToActivated failed - activation time not reached: "
<< isActivationTimeSet() << " - " << time(nullptr) << " - " << activationTime().toSecsSinceEpoch();
return false;
}
DEBUG_LOG() << id() << " trySwitchToActivated succeeded";
DEBUG_LOG(m_logger) << id() << " trySwitchToActivated succeeded";
setEffectState(AesEffectState::EsActivated);
return true;
}
@@ -347,7 +347,7 @@ bool ObjectBase::trySwitchToPaused()
if (!isPausingSupported())
return false;
DEBUG_LOG() << id() << " trySwitchToPaused succeeded";
DEBUG_LOG(m_logger) << id() << " trySwitchToPaused succeeded";
setEffectState(AesEffectState::EsPaused);
return true;
}
@@ -358,24 +358,24 @@ bool ObjectBase::trySwitchToExpired()
if (effectState() != AesEffectState::EsActivated &&
effectState() != AesEffectState::EsPaused)
{
DEBUG_LOG() << id() << " trySwitchToExpired failed - not active or paused: " << effectState();
DEBUG_LOG(m_logger) << id() << " trySwitchToExpired failed - not active or paused: " << effectState();
return false;
}
if (!isEndTimeReached())
{
DEBUG_LOG() << id() << " trySwitchToExpired failed - end time not reached: "
DEBUG_LOG(m_logger) << id() << " trySwitchToExpired failed - end time not reached: "
<< isEndTimeSet() << " - " << time(nullptr) << " - " << endTime().toSecsSinceEpoch();
return false;
}
DEBUG_LOG() << id() << " trySwitchToExpired succeeded";
DEBUG_LOG(m_logger) << id() << " trySwitchToExpired succeeded";
setEffectState(AesEffectState::EsExpired);
return true;
}
bool ObjectBase::trySwitchToRemoved()
{
DEBUG_LOG() << id() << " trySwitchToRemoved: " << effectState();
DEBUG_LOG(m_logger) << id() << " trySwitchToRemoved: " << effectState();
switch (effectState().underlying())
{
case AesEffectState::EsReceived:
@@ -204,7 +204,7 @@ template <typename T> class ObjectBaseTmpl : public ObjectBase
// check effect start for new elements if not OC
if ((0 == m_data.id) && (isActivationTimeSet() && activationTime() < QDateTime::currentDateTimeUtc()) && !ignoreActivationTimeCheck)
{
DEBUG_LOG() << "m_data.id : " << m_data.id << ", isActivationTimeSet :" << isActivationTimeSet()
DEBUG_LOG(m_logger) << "m_data.id : " << m_data.id << ", isActivationTimeSet :" << isActivationTimeSet()
<< ", activationTime :" << activationTime().toMSecsSinceEpoch() << ", ignoreActivationTimeCheck :" << ignoreActivationTimeCheck;
// << ", QDateTime::currentDateTimeUtc() :" << QDateTime::currentDateTimeUtc().msecsTo();
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Effect start is in the past."));
@@ -331,7 +331,7 @@ template <typename T> class ObjectBaseTmpl : public ObjectBase
void onPublishData() override
{
DEBUG_LOG() << id() << " Publishing data for " << m_typeName << " with name '" << m_data.name << "'"
DEBUG_LOG(m_logger) << id() << " Publishing data for " << m_typeName << " with name '" << m_data.name << "'"
<< " isCentral=" << m_data.isCentral;
ObjectBase::onPublishData();
}
@@ -53,7 +53,7 @@ Core::FunctionReplyObject ObjectChargeAdministration::updateObject(const Databas
Core::FunctionReplyObject ObjectChargeAdministration::claimPlannedCharge(int count)
{
DEBUG_LOG() << "claimPlannedCharge for id : " << m_data.chargeTypeId << ", count: " << count;
DEBUG_LOG(m_logger) << "claimPlannedCharge for id : " << m_data.chargeTypeId << ", count: " << count;
// Works both directions, can "claim" negative count!
if (m_data.amount - m_data.planned < count)
@@ -81,11 +81,11 @@ Core::FunctionReplyObject ObjectChargeAdministration::consumeCharge(int count, b
if (m_data.planned < count)
{
// consume what is possible
WARNING_LOG() << "Cannot consume " << count << ", consuming instead " << m_data.planned << " planned";
WARNING_LOG(m_logger) << "Cannot consume " << count << ", consuming instead " << m_data.planned << " planned";
count = m_data.planned;
}
DEBUG_LOG() << "consumeCharge for id : " << m_data.chargeTypeId << ", count: " << count;
DEBUG_LOG(m_logger) << "consumeCharge for id : " << m_data.chargeTypeId << ", count: " << count;
if (wasPlanned && m_data.planned < count)
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Wanted to consume %1 planned charges, but only %2 had been planned.")).arg(count).arg(m_data.planned);
@@ -32,6 +32,7 @@ class ObjectChargeAdministration final : public QObject
void onPublishData();
protected:
NGL::INGLLogger &m_logger;
private:
MainHandler *m_mainHandler;
Database::AesChargeAdministration m_data;
@@ -58,7 +58,7 @@ Core::FunctionReplyObject ObjectChargeEffect::create(const ChargeEffectModifyReq
}
if (reply.error())
ERROR_LOG() << reply.str();
ERROR_LOG(m_logger) << reply.str();
if (reply.id() == 0)
reply.setId(m_data.id);
return reply;
@@ -96,7 +96,7 @@ Core::FunctionReplyObject ObjectChargeEffect::update(const ChargeEffectModifyReq
}
if (reply.error())
ERROR_LOG() << reply.str();
ERROR_LOG(m_logger) << reply.str();
return reply;
}
@@ -111,13 +111,13 @@ Core::FunctionReplyObject ObjectChargeEffect::update(const ChargeEffectModifyReq
void ObjectChargeEffect::updatedProperties(const Database::AesChargeEffect &dbData)
{
// update properties // "used": true/false
DEBUG_LOG()<<" !!! update charge effect when not EsPrepared !!! ";
DEBUG_LOG(m_logger)<<" !!! update charge effect when not EsPrepared !!! ";
const QString tmpProps = m_data.properties;
m_data.properties = dbData.properties; // update properties is allowed!!
if (!m_mainHandler->db()->update(m_data))
{
m_data.properties = tmpProps;
ERROR_LOG()<<" Couldn't update charge effect when not EsPrepared!!!";
ERROR_LOG(m_logger)<<" Couldn't update charge effect when not EsPrepared!!!";
}
}
@@ -127,14 +127,14 @@ bool ObjectChargeEffect::remove()
{
if (!m_mainHandler)
{
ERROR_LOG() << "Not possible to remove ChargeEffect --> No MainHandler present.";
ERROR_LOG(m_logger) << "Not possible to remove ChargeEffect --> No MainHandler present.";
return false;
}
if (!m_mainHandler->dds()->dts()->removeChargeEffectByKey(m_data.id))
{
ERROR_LOG() << "Not possible to remove ChargeEffect --> Could not remove from DDS.";
ERROR_LOG(m_logger) << "Not possible to remove ChargeEffect --> Could not remove from DDS.";
return false;
}
@@ -198,14 +198,14 @@ void ObjectChargeEffect::publish()
{
if (!m_mainHandler)
{
ERROR_LOG() << QStringLiteral("Not possible to publish ChargeEffect --> Could not remove from DDS.");
ERROR_LOG(m_logger) << QStringLiteral("Not possible to publish ChargeEffect --> Could not remove from DDS.");
return;
}
if (!m_mainHandler->dds()->dts()->publish(dataBaseToDataTopic(m_data)))
{
ERROR_LOG() << QStringLiteral("Not possible to publish ChargeEffect --> DDS publish failed.");
ERROR_LOG(m_logger) << QStringLiteral("Not possible to publish ChargeEffect --> DDS publish failed.");
return;
}
@@ -295,7 +295,7 @@ void ObjectChargeEffect::setNextState()
if (oldState != m_state)
m_stateChanged = true;
DEBUG_LOG() << "Switching from " << oldState << "to " << m_state;
DEBUG_LOG(m_logger) << "Switching from " << oldState << "to " << m_state;
}
//-----------------------------------------------------------------------------
@@ -317,7 +317,7 @@ void ObjectChargeEffect::calculateInitEffectState()
if (oldState != m_state)
m_stateChanged = true;
DEBUG_LOG() << "Setting init state: " << m_state;
DEBUG_LOG(m_logger) << "Setting init state: " << m_state;
}
//-----------------------------------------------------------------------------
@@ -330,7 +330,7 @@ void ObjectChargeEffect::startStateTimer()
{
qint64 timeToActivatedMsecs = m_data.effectStart.toMSecsSinceEpoch() - QDateTime::currentMSecsSinceEpoch();
DEBUG_LOG() << "Time to Avtivated [ms]: " << timeToActivatedMsecs;
DEBUG_LOG(m_logger) << "Time to Avtivated [ms]: " << timeToActivatedMsecs;
m_stateTimer->start(timeToActivatedMsecs);
@@ -340,7 +340,7 @@ void ObjectChargeEffect::startStateTimer()
{
qint64 timeToExpiredMsecs = m_data.effectStart.toMSecsSinceEpoch() + m_data.effectDuration - QDateTime::currentMSecsSinceEpoch();
DEBUG_LOG() << "Time to Expired [ms]: " << timeToExpiredMsecs;
DEBUG_LOG(m_logger) << "Time to Expired [ms]: " << timeToExpiredMsecs;
m_stateTimer->start(timeToExpiredMsecs);
@@ -350,7 +350,7 @@ void ObjectChargeEffect::startStateTimer()
{
qint64 timeToFinishMsecs = m_data.effectStart.toMSecsSinceEpoch() + m_data.effectDuration + s_afterglowMsecs - QDateTime::currentMSecsSinceEpoch();
DEBUG_LOG() << "Time to finish/deletion [ms]: " << timeToFinishMsecs;
DEBUG_LOG(m_logger) << "Time to finish/deletion [ms]: " << timeToFinishMsecs;
m_stateTimer->start(timeToFinishMsecs);
@@ -65,7 +65,7 @@ EffectorData ObjectEffector::effectorData() const
void ObjectEffector::assignAesItemRequest(int aesItemId)
{
DEBUG_LOG() << "assignAesItemRequest aesItemId=" << aesItemId;
DEBUG_LOG(m_logger) << "assignAesItemRequest aesItemId=" << aesItemId;
m_aesItemId = aesItemId;
// Statemachine mit new anlegen
if (m_effectorStateMachine)
@@ -101,7 +101,7 @@ void ObjectEffector::assignAesItemRequest(int aesItemId)
void ObjectEffector::deleteAssignmentAesItem()
{
DEBUG_LOG() << "deleteAssignmentAesItem";
DEBUG_LOG(m_logger) << "deleteAssignmentAesItem";
if (m_effectorStateMachine)
{
delete m_effectorStateMachine;
@@ -119,7 +119,7 @@ bool ObjectEffector::reportFireReadinessRequest() // Feuerbereitschaft melden
void ObjectEffector::fireOrderRequest() // Feuerbefehl erhalten
{
DEBUG_LOG() << "fireOrderRequest";
DEBUG_LOG(m_logger) << "fireOrderRequest";
if (!m_effectorStateMachine)
return;
@@ -128,7 +128,7 @@ void ObjectEffector::fireOrderRequest() // Feuerbefehl erhalten
void ObjectEffector::fireRequest() // Feuern
{
DEBUG_LOG() << "fireRequest";
DEBUG_LOG(m_logger) << "fireRequest";
if (!m_effectorStateMachine)
return;
m_effectorStateMachine->fire();
@@ -136,7 +136,7 @@ void ObjectEffector::fireRequest() // Feuern
bool ObjectEffector::reportFiredRequest() // Abgefeuert melden
{
DEBUG_LOG() << "reportFiredRequest";
DEBUG_LOG(m_logger) << "reportFiredRequest";
if (!m_effectorStateMachine)
return false;
return m_effectorStateMachine->reportFired();
@@ -144,7 +144,7 @@ bool ObjectEffector::reportFiredRequest() // Abgefeuert melden
void ObjectEffector::reportEmptyChargeRequest(bool emptyCharge) // Munition leer
{
DEBUG_LOG() << "reportEmptyChargeRequest";
DEBUG_LOG(m_logger) << "reportEmptyChargeRequest";
if (!m_effectorStateMachine)
return;
m_effectorStateMachine->setEmptyCharge(emptyCharge);
@@ -166,7 +166,7 @@ void ObjectEffector::resetReadynessTimer()
void ObjectEffector::sendEffectorToDds()
{
// Effector Effector;
DEBUG_LOG() << "sendEffectorToDds NewState= " << m_effectorStateMachine->getCurrentStateStr() << ", participantId=" << m_participantId
DEBUG_LOG(m_logger) << "sendEffectorToDds NewState= " << m_effectorStateMachine->getCurrentStateStr() << ", participantId=" << m_participantId
<< ", aesItemId=" << m_aesItemId;
AreaEffectSimulation::Effector effector;
effector.id(m_participantId);
@@ -178,11 +178,11 @@ void ObjectEffector::sendEffectorToDds()
void ObjectEffector::onEffectorFired()
{
DEBUG_LOG() << "onEffectorFired";
DEBUG_LOG(m_logger) << "onEffectorFired";
if (m_firingStrategy == nullptr)
{
ERROR_LOG() << "Not possible to fire. No firing strategy specified.";
ERROR_LOG(m_logger) << "Not possible to fire. No firing strategy specified.";
return;
}
@@ -195,7 +195,7 @@ void ObjectEffector::onEffectorFired()
// Input: SAA-Format, relativ zum Geschoss in metern und die Zeit relativ zur Abschusszeit
void ObjectEffector::setIndendedTrajectory(const std::vector<Core::RelativePositionRelativeTime> &geometryRelativeToLaunchOrigin)
{
DEBUG_LOG() << "setTrajectory #points=" << geometryRelativeToLaunchOrigin.size();
DEBUG_LOG(m_logger) << "setTrajectory #points=" << geometryRelativeToLaunchOrigin.size();
m_intendendTrajectory.clear();
for (const Core::RelativePositionRelativeTime &geoPosRelTime : geometryRelativeToLaunchOrigin)
{
@@ -209,7 +209,7 @@ void ObjectEffector::setIndendedTrajectory(const std::vector<Core::RelativePosit
void ObjectEffector::setEffectorData(const EffectorData &effectorData)
{
DEBUG_LOG() << "setEffectorData";
DEBUG_LOG(m_logger) << "setEffectorData";
m_effectorData = effectorData;
setIndendedTrajectory(effectorData.trajectoryRelative());
delete m_firingStrategy;
@@ -221,7 +221,7 @@ void ObjectEffector::setEffectorData(const EffectorData &effectorData)
void ObjectEffector::logMessage(QString message)
{
DEBUG_LOG() << "EffectorStateMachine logMessage=" << message << ", aesItemId=" << m_aesItemId << ", m_participantId=" << m_participantId;
DEBUG_LOG(m_logger) << "EffectorStateMachine logMessage=" << message << ", aesItemId=" << m_aesItemId << ", m_participantId=" << m_participantId;
}
} // namespace AreaEffectSimulation
@@ -41,6 +41,8 @@ protected Q_SLOTS:
private:
NGL::INGLLogger &m_logger;
Core::FunctionReplyObject createObject(const Database::AesMineCorridor &data,
const std::vector<Core::GeoPosition2D> &segmentsDds,
const QVector<Database::AesMineCorridorSegment> &segmentsDb);