Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+26
-26
@@ -59,7 +59,7 @@ TgtTests::TgtTests(QObject *parent)
|
||||
// ------------------------------------------------------------------
|
||||
bool TgtTests::init(int domainId, int testId, int operatorId, int shootbackAreaId)
|
||||
{
|
||||
INFO_LOG() << "init begin";
|
||||
INFO_LOG(m_logger) << "init begin";
|
||||
|
||||
m_testId = testId;
|
||||
m_operatorId = operatorId;
|
||||
@@ -89,7 +89,7 @@ bool TgtTests::init(int domainId, int testId, int operatorId, int shootbackAreaI
|
||||
// ------------------------------------------------------------------
|
||||
void TgtTests::startTest()
|
||||
{
|
||||
INFO_LOG() << "startTest m_testId=" << m_testId;
|
||||
INFO_LOG(m_logger) << "startTest m_testId=" << m_testId;
|
||||
if (m_testId == 1) // Send FTC ConfigureAlarms and EEM Event
|
||||
{
|
||||
QTimer::singleShot(0, this, &TgtTests::tryCreateParticipant);
|
||||
@@ -132,7 +132,7 @@ void TgtTests::tryCreateShootbackArea()
|
||||
|
||||
if (!m_ftcTgt->shootbackAreaModifyRequest(request, this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting create Shootback Area";
|
||||
ERROR_LOG(m_logger) << "Error requesting create Shootback Area";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ void TgtTests::tryUpdateShootbackArea()
|
||||
|
||||
if (!m_ftcTgt->shootbackAreaModifyRequest(request, this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting modify Shootback Area";
|
||||
ERROR_LOG(m_logger) << "Error requesting modify Shootback Area";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ void TgtTests::tryRemoveShootbackArea()
|
||||
|
||||
if (!m_ftcTgt->shootbackAreaRemoveRequest(request, this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting remove Shootback Area";
|
||||
ERROR_LOG(m_logger) << "Error requesting remove Shootback Area";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ void TgtTests::tryRemoveShootbackArea()
|
||||
// ------------------------------------------------------------------
|
||||
void TgtTests::tryRequestTechnicalState()
|
||||
{
|
||||
INFO_LOG() << "trying to send createRequest Operator Message";
|
||||
INFO_LOG(m_logger) << "trying to send createRequest Operator Message";
|
||||
|
||||
ConfigureTargetRequest request;
|
||||
|
||||
@@ -182,7 +182,7 @@ void TgtTests::tryRequestTechnicalState()
|
||||
|
||||
if (!m_ftcTgt->configureTargetRequest(request, this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting create data";
|
||||
ERROR_LOG(m_logger) << "Error requesting create data";
|
||||
failExit();
|
||||
}
|
||||
} // tryRequestTechnicalState
|
||||
@@ -190,7 +190,7 @@ void TgtTests::tryRequestTechnicalState()
|
||||
// ------------------------------------------------------------------
|
||||
void TgtTests::tryConfigureTargetMode()
|
||||
{
|
||||
INFO_LOG() << "trying to send createRequest Operator Message";
|
||||
INFO_LOG(m_logger) << "trying to send createRequest Operator Message";
|
||||
|
||||
ConfigureTargetRequest request;
|
||||
|
||||
@@ -203,7 +203,7 @@ void TgtTests::tryConfigureTargetMode()
|
||||
|
||||
if (!m_ftcTgt->configureTargetRequest(request, this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting create data";
|
||||
ERROR_LOG(m_logger) << "Error requesting create data";
|
||||
failExit();
|
||||
}
|
||||
} // tryConfigureTargetMode
|
||||
@@ -211,7 +211,7 @@ void TgtTests::tryConfigureTargetMode()
|
||||
// ------------------------------------------------------------------
|
||||
void TgtTests::tryConfigureTargetWeapon()
|
||||
{
|
||||
INFO_LOG() << "trying to send createRequest Operator Message";
|
||||
INFO_LOG(m_logger) << "trying to send createRequest Operator Message";
|
||||
|
||||
ConfigureTargetRequest request;
|
||||
|
||||
@@ -222,7 +222,7 @@ void TgtTests::tryConfigureTargetWeapon()
|
||||
|
||||
if (!m_ftcTgt->configureTargetRequest(request, this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting create data";
|
||||
ERROR_LOG(m_logger) << "Error requesting create data";
|
||||
failExit();
|
||||
}
|
||||
} // tryConfigureTargetWeapon
|
||||
@@ -241,7 +241,7 @@ void TgtTests::tryCreateTargetData()
|
||||
|
||||
if (!m_dtsTab->publish(targetData))
|
||||
{
|
||||
ERROR_LOG() << "Error publish targetData";
|
||||
ERROR_LOG(m_logger) << "Error publish targetData";
|
||||
failExit();
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ void TgtTests::tryCreateTargetData()
|
||||
// ------------------------------------------------------------------
|
||||
void TgtTests::tryCreateParticipant()
|
||||
{
|
||||
INFO_LOG() << "trying to create Participant index = " << m_participantIndex;
|
||||
INFO_LOG(m_logger) << "trying to create Participant index = " << m_participantIndex;
|
||||
ParticipantManagement::Participant participant;
|
||||
participant.id(5);
|
||||
participant.superiorId(0);
|
||||
@@ -258,10 +258,10 @@ void TgtTests::tryCreateParticipant()
|
||||
participant.inferiorIds().at(1) = 3;
|
||||
participant.partyId(5);
|
||||
participant.equipmentNumber(1001);
|
||||
DEBUG_LOG() << "Publishing Participant";
|
||||
DEBUG_LOG(m_logger) << "Publishing Participant";
|
||||
if (!m_dtsPpm->publish(participant))
|
||||
{
|
||||
ERROR_LOG() << "Error publish Participant";
|
||||
ERROR_LOG(m_logger) << "Error publish Participant";
|
||||
failExit();
|
||||
}
|
||||
m_participantIndex++;
|
||||
@@ -271,11 +271,11 @@ void TgtTests::tryCreateParticipant()
|
||||
// ------------------------------------------------------------------
|
||||
void TgtTests::onShootbackAreaModifyReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
INFO_LOG() << "onShootbackAreaModifyReply on id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "onShootbackAreaModifyReply on id " << replyObject.id()
|
||||
<< " and error = " << replyObject.error();
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Error onShoobackAreaModifyReply - aborting";
|
||||
ERROR_LOG(m_logger) << "Error onShoobackAreaModifyReply - aborting";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -286,11 +286,11 @@ void TgtTests::onShootbackAreaModifyReply(const Core::FunctionReplyObject &reply
|
||||
// ------------------------------------------------------------------
|
||||
void TgtTests::onShootbackAreaRemoveReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
INFO_LOG() << "onShootbackAreaModifyReply on id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "onShootbackAreaModifyReply on id " << replyObject.id()
|
||||
<< " and error = " << replyObject.error();
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Error onShootbackAreaRemoveReply - aborting";
|
||||
ERROR_LOG(m_logger) << "Error onShootbackAreaRemoveReply - aborting";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -300,10 +300,10 @@ void TgtTests::onShootbackAreaRemoveReply(const Core::FunctionReplyObject &reply
|
||||
// ------------------------------------------------------------------
|
||||
void TgtTests::onConfigureTargetReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
INFO_LOG() << "onConfigureTargetReply, error = " << replyObject.error();
|
||||
INFO_LOG(m_logger) << "onConfigureTargetReply, error = " << replyObject.error();
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Error ConfigureTargets - aborting";
|
||||
ERROR_LOG(m_logger) << "Error ConfigureTargets - aborting";
|
||||
failExit();
|
||||
}
|
||||
} // onConfigureTargetReply
|
||||
@@ -311,11 +311,11 @@ void TgtTests::onConfigureTargetReply(const Core::FunctionReplyObject &replyObje
|
||||
// ------------------------------------------------------------------
|
||||
void TgtTests::checkAlarm()
|
||||
{
|
||||
INFO_LOG() << "checkAlarm";
|
||||
INFO_LOG(m_logger) << "checkAlarm";
|
||||
m_dtcTgt->waitForHistoricalDataTargetConfig();
|
||||
//qint32 id = 0;
|
||||
/*TargetManagement::Notification notification = m_dtcTgt->notification(id);
|
||||
INFO_LOG() << "Recived TargetManagement::Notification: " << notification
|
||||
INFO_LOG(m_logger) << "Recived TargetManagement::Notification: " << notification
|
||||
<< " testId: " << m_testId;
|
||||
|
||||
switch (m_testId)
|
||||
@@ -323,12 +323,12 @@ void TgtTests::checkAlarm()
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
INFO_LOG() << "ExitSuccess";
|
||||
INFO_LOG(m_logger) << "ExitSuccess";
|
||||
ExitSuccess();
|
||||
break;
|
||||
default:
|
||||
// nothing
|
||||
INFO_LOG() << "failExit";
|
||||
INFO_LOG(m_logger) << "failExit";
|
||||
failExit();
|
||||
break;
|
||||
}*/
|
||||
@@ -344,7 +344,7 @@ void TgtTests::failExit()
|
||||
// ------------------------------------------------------------------
|
||||
void TgtTests::ExitSuccess()
|
||||
{
|
||||
DEBUG_LOG() << "SUCCESS";
|
||||
DEBUG_LOG(m_logger) << "SUCCESS";
|
||||
m_bTestsSuccessful = true;
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
} // ExitSuccess
|
||||
|
||||
@@ -53,6 +53,7 @@ protected Q_SLOTS:
|
||||
void ExitSuccess();
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onConfigureTargetReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
void onShootbackAreaModifyReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
void onShootbackAreaRemoveReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
|
||||
+16
-16
@@ -169,7 +169,7 @@ void tgtTestShootbackTarget::testShootbackArea()
|
||||
// verify mod
|
||||
{
|
||||
TargetManagement::ShootbackArea modData = m_dtcTgt->shootbackArea(m_replyShootbackAreaId);
|
||||
INFO_LOG() << Q_FUNC_INFO << "modData=" << modData;
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << "modData=" << modData;
|
||||
QVERIFY2((modData.id() == m_replyShootbackAreaId), " shootbackArea failed");
|
||||
QVERIFY2((modData.name().compare(request.name()) == 0), " verify name failed");
|
||||
}
|
||||
@@ -220,13 +220,13 @@ void tgtTestShootbackTarget::testShootbackTarget()
|
||||
QSignalSpy spy(m_dtcTgt.get(), &TargetManagement::Interface::Dtc::shootbackTargetChanged);
|
||||
if (spy.count() == 0)
|
||||
spy.wait(2000);
|
||||
INFO_LOG() << Q_FUNC_INFO << "spy.count()=" << spy.count();
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << "spy.count()=" << spy.count();
|
||||
QVERIFY2((spy.count() == 1), " spy failed");
|
||||
|
||||
// verify mod
|
||||
{
|
||||
TargetManagement::ShootbackTarget modData = m_dtcTgt->shootbackTarget(m_replyShootbackTargetId);
|
||||
INFO_LOG() << Q_FUNC_INFO << "modData=" << modData;
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << "modData=" << modData;
|
||||
QVERIFY2((modData.id() == m_replyShootbackTargetId), " shootbackTarget failed");
|
||||
QVERIFY2((modData.name().compare(request.name()) == 0), " verify name failed");
|
||||
}
|
||||
@@ -268,7 +268,7 @@ void tgtTestShootbackTarget::testTargetAreaAssignment()
|
||||
QSignalSpy spy(m_dtcTgt.get(), &TargetManagement::Interface::Dtc::targetAreaAssignmentChanged);
|
||||
if (spy.count() == 0)
|
||||
spy.wait(2000);
|
||||
INFO_LOG() << Q_FUNC_INFO << "spy.count()=" << spy.count();
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << "spy.count()=" << spy.count();
|
||||
QVERIFY2((spy.count() == 1), " spy failed");
|
||||
|
||||
// time to process reply
|
||||
@@ -288,13 +288,13 @@ void tgtTestShootbackTarget::testTargetAreaAssignment()
|
||||
QSignalSpy spy(m_dtcTgt.get(), &TargetManagement::Interface::Dtc::targetAreaAssignmentChanged);
|
||||
if (spy.count() == 0)
|
||||
spy.wait(2000);
|
||||
INFO_LOG() << Q_FUNC_INFO << "spy.count()=" << spy.count();
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << "spy.count()=" << spy.count();
|
||||
QVERIFY2((spy.count() == 1), " spy failed");
|
||||
|
||||
// verify mod
|
||||
{
|
||||
TargetManagement::TargetAreaAssignment modData = m_dtcTgt->targetAreaAssignment(m_replyTargetAreaAssignmentId);
|
||||
INFO_LOG() << Q_FUNC_INFO << "modData=" << modData;
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << "modData=" << modData;
|
||||
QVERIFY2((modData.id() == m_replyTargetAreaAssignmentId), " targetAreaAssignment failed");
|
||||
QVERIFY2((modData.name().compare(request.name()) == 0), " verify name failed");
|
||||
}
|
||||
@@ -387,7 +387,7 @@ void tgtTestShootbackTarget::createArea(int &areaIdInOut, const QString &name, d
|
||||
|
||||
// time to process reply
|
||||
QTest::qWait(100);
|
||||
INFO_LOG() << Q_FUNC_INFO << " got m_replyShootbackAreaId: " << m_replyShootbackAreaId;
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << " got m_replyShootbackAreaId: " << m_replyShootbackAreaId;
|
||||
|
||||
areaIdInOut = m_replyShootbackAreaId;
|
||||
}
|
||||
@@ -447,7 +447,7 @@ void tgtTestShootbackTarget::createTarget(int &targetIdOut, int targetParticipan
|
||||
|
||||
// time to process reply
|
||||
QTest::qWait(100);
|
||||
INFO_LOG() << Q_FUNC_INFO << " got m_replyShootbackTargetId: " << m_replyShootbackTargetId;
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << " got m_replyShootbackTargetId: " << m_replyShootbackTargetId;
|
||||
|
||||
targetIdOut = m_replyShootbackTargetId;
|
||||
}
|
||||
@@ -515,7 +515,7 @@ void tgtTestShootbackTarget::createAssignment(int areaId, int targetParticipantI
|
||||
|
||||
// time to process reply
|
||||
QTest::qWait(100);
|
||||
INFO_LOG() << Q_FUNC_INFO << " got m_replyTargetAreaAssignmentId: " << m_replyTargetAreaAssignmentId;
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << " got m_replyTargetAreaAssignmentId: " << m_replyTargetAreaAssignmentId;
|
||||
|
||||
assignmentIdOut = m_replyTargetAreaAssignmentId;
|
||||
}
|
||||
@@ -572,7 +572,7 @@ void tgtTestShootbackTarget::moveParticipant(int participantId, double lon, doub
|
||||
posReq.partyId(2); // 0 and 1 will be skipped
|
||||
if (!m_dtsPpm->publish(posReq))
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << " Error publish posReq";
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Error publish posReq";
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -878,7 +878,7 @@ void tgtTestShootbackTarget::onShootbackAreaModifyReply(const Core::FunctionRepl
|
||||
m_replyShootbackAreaId = reply.id();
|
||||
if (reply.error())
|
||||
{
|
||||
ERROR_LOG() << "Error onShootbackAreaRemoveReply - aborting: '" << reply.str() << "'";
|
||||
ERROR_LOG(m_logger) << "Error onShootbackAreaRemoveReply - aborting: '" << reply.str() << "'";
|
||||
m_replyShootbackAreaId = -1;
|
||||
}
|
||||
}
|
||||
@@ -888,7 +888,7 @@ void tgtTestShootbackTarget::onShootbackAreaRemoveReply(const Core::FunctionRepl
|
||||
m_replyShootbackAreaId = reply.id();
|
||||
if (reply.error())
|
||||
{
|
||||
ERROR_LOG() << "Error onShootbackAreaRemoveReply - aborting: '" << reply.str() << "'"
|
||||
ERROR_LOG(m_logger) << "Error onShootbackAreaRemoveReply - aborting: '" << reply.str() << "'"
|
||||
<< ", id="<< reply.id();
|
||||
m_replyShootbackAreaId = -1;
|
||||
}
|
||||
@@ -901,7 +901,7 @@ void tgtTestShootbackTarget::onShootbackTargetModifyReply(const Core::FunctionRe
|
||||
m_replyShootbackTargetId = reply.id();
|
||||
if (reply.error())
|
||||
{
|
||||
ERROR_LOG() << "Error onShootbackAreaRemoveReply - aborting: '" << reply.str() << "'";
|
||||
ERROR_LOG(m_logger) << "Error onShootbackAreaRemoveReply - aborting: '" << reply.str() << "'";
|
||||
m_replyShootbackTargetId = -1;
|
||||
}
|
||||
}
|
||||
@@ -911,7 +911,7 @@ void tgtTestShootbackTarget::onShootbackTargetRemoveReply(const Core::FunctionRe
|
||||
m_replyShootbackTargetId = reply.id();
|
||||
if (reply.error())
|
||||
{
|
||||
ERROR_LOG() << "Error onShootbackAreaRemoveReply - aborting: '" << reply.str() << "'"
|
||||
ERROR_LOG(m_logger) << "Error onShootbackAreaRemoveReply - aborting: '" << reply.str() << "'"
|
||||
<< ", id="<< reply.id();
|
||||
m_replyShootbackTargetId = -1;
|
||||
}
|
||||
@@ -924,7 +924,7 @@ void tgtTestShootbackTarget::onTargetAreaAssignmentModifyReply(const Core::Funct
|
||||
m_replyTargetAreaAssignmentId = reply.id();
|
||||
if (reply.error())
|
||||
{
|
||||
ERROR_LOG() << "Error onShootbackAreaRemoveReply - aborting: '" << reply.str() << "'";
|
||||
ERROR_LOG(m_logger) << "Error onShootbackAreaRemoveReply - aborting: '" << reply.str() << "'";
|
||||
m_replyTargetAreaAssignmentId = -1;
|
||||
}
|
||||
}
|
||||
@@ -934,7 +934,7 @@ void tgtTestShootbackTarget::onTargetAreaAssignmentRemoveReply(const Core::Funct
|
||||
m_replyTargetAreaAssignmentId = reply.id();
|
||||
if (reply.error())
|
||||
{
|
||||
ERROR_LOG() << "Error onShootbackAreaRemoveReply - aborting: '" << reply.str() << "'"
|
||||
ERROR_LOG(m_logger) << "Error onShootbackAreaRemoveReply - aborting: '" << reply.str() << "'"
|
||||
<< ", id="<< reply.id();
|
||||
m_replyTargetAreaAssignmentId = -1;
|
||||
}
|
||||
|
||||
+2
@@ -70,6 +70,8 @@ private Q_SLOTS:
|
||||
void cleanupTestCase(); // one time at the end
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onShootbackAreaModifyReply(const Core::FunctionReplyObject &reply) override final;
|
||||
void onShootbackAreaRemoveReply(const Core::FunctionReplyObject &reply) override final;
|
||||
|
||||
|
||||
@@ -17,14 +17,14 @@ namespace TargetManagement
|
||||
DdsHandler::DdsHandler(int domainId, int exerciseId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Exercise, exerciseId))
|
||||
{
|
||||
DEBUG_LOG() << "DdsHandler(" << m_ddsConnector->getDomainId() << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << m_ddsConnector->getDomainId() << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -43,18 +43,18 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
// DTS Target
|
||||
m_dtsTgt = TargetManagement::Interface::Dts::create(m_ddsConnector);
|
||||
bool bRet = m_dtsTgt->enableAll();
|
||||
INFO_LOG() << "Dts initialised";
|
||||
INFO_LOG(m_logger) << "Dts initialised";
|
||||
|
||||
// FTS Target
|
||||
m_ftsTgt = TargetManagement::Interface::Fts::create(m_ddsConnector);
|
||||
bRet &= m_ftsTgt->enableAll();
|
||||
INFO_LOG() << "Fts initialised";
|
||||
INFO_LOG(m_logger) << "Fts initialised";
|
||||
|
||||
// DTC TrainingAreaBase
|
||||
m_dtcTab = TrainingAreaBase::Interface::Dtc::create(m_ddsConnector);
|
||||
if (!m_dtcTab->enableTargetData())
|
||||
{
|
||||
ERROR_LOG() << "Could not enable receive TAB";
|
||||
ERROR_LOG(m_logger) << "Could not enable receive TAB";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
m_ftcTab = TrainingAreaBase::Interface::Ftc::create(m_ddsConnector);
|
||||
if (!m_ftcTab->enableSendTargetData())
|
||||
{
|
||||
ERROR_LOG() << "Could not enable Send TAB";
|
||||
ERROR_LOG(m_logger) << "Could not enable Send TAB";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
m_dtcPpm->enableEquipmentType()
|
||||
))
|
||||
{
|
||||
ERROR_LOG() << "Could not initialize ParticipantManagement enableXXX data topic client";
|
||||
ERROR_LOG(m_logger) << "Could not initialize ParticipantManagement enableXXX data topic client";
|
||||
return false;
|
||||
}
|
||||
// Get 'static' data for all participants (playerdata)
|
||||
@@ -103,7 +103,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
int DdsHandler::participantId2EquipNo(const int participantId) const
|
||||
{
|
||||
int ret = m_partId2EquipNoMap.value(participantId, 0);
|
||||
INFO_LOG() << "participantId2EquipNo participantId=" << participantId
|
||||
INFO_LOG(m_logger) << "participantId2EquipNo participantId=" << participantId
|
||||
<< " EquipmentNumber=" << ret;
|
||||
return ret;
|
||||
} // end of participantId2EquipNo()
|
||||
@@ -111,7 +111,7 @@ int DdsHandler::participantId2EquipNo(const int participantId) const
|
||||
int DdsHandler::equipNo2participantId(const int equipmentNumber) const
|
||||
{
|
||||
int ret = m_equipNo2partIdMap.value(equipmentNumber, 0);
|
||||
INFO_LOG() << "EquipNo2participantId equipmentNumber=" << equipmentNumber
|
||||
INFO_LOG(m_logger) << "EquipNo2participantId equipmentNumber=" << equipmentNumber
|
||||
<< " ParticipantId=" << ret;
|
||||
return ret;
|
||||
} // end of EquipNo2participantId()
|
||||
@@ -121,7 +121,7 @@ int DdsHandler::equipNo2participantId(const int equipmentNumber) const
|
||||
// ///////////////////////////////////
|
||||
void DdsHandler::onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG() << "onParticipantChanged";
|
||||
DEBUG_LOG(m_logger) << "onParticipantChanged";
|
||||
if (modType == DataModification::eRemoved)
|
||||
m_partId2EquipNoMap.remove(data.id());
|
||||
else
|
||||
@@ -135,7 +135,7 @@ void DdsHandler::onParticipantChanged(const ParticipantManagement::Participant &
|
||||
{
|
||||
for (auto i = m_partId2EquipNoMap.begin(); i != m_partId2EquipNoMap.end(); ++i)
|
||||
{
|
||||
TRACE_LOG() << " partId2EquipNoMap.size(): " << m_partId2EquipNoMap.size()
|
||||
TRACE_LOG(m_logger) << " partId2EquipNoMap.size(): " << m_partId2EquipNoMap.size()
|
||||
<< " partId: " << i.key()
|
||||
<< " eqNo: " << i.value();
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ private Q_SLOTS:
|
||||
void onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType);
|
||||
|
||||
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;
|
||||
|
||||
+14
-14
@@ -20,21 +20,21 @@ HandlerShootbackArea::HandlerShootbackArea(MainHandler *mainHandler)
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_dtsTgt(m_mainHandler->dds()->dtsTgt())
|
||||
{
|
||||
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";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
HandlerShootbackArea::~HandlerShootbackArea()
|
||||
{
|
||||
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";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
bool HandlerShootbackArea::init()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
|
||||
// connect(m_dtcTab.get(), &TrainingAreaBase::Interface::Dtc::targetDataChanged,
|
||||
// this, &HandlerShootbackArea::onTargetDataChanged);
|
||||
@@ -43,13 +43,13 @@ bool HandlerShootbackArea::init()
|
||||
// create objects
|
||||
auto cb = [this, &bRet](const Database::TgtShootbackArea & data)
|
||||
{
|
||||
DEBUG_LOG() << "Reading from DB ShootbackArea with id = " << data.id;
|
||||
DEBUG_LOG(m_logger) << "Reading from DB ShootbackArea with id = " << data.id;
|
||||
ObjectShootbackArea *ifs(new ObjectShootbackArea(m_mainHandler));
|
||||
Core::FunctionReplyObject ret = ifs->createObject(ObjectShootbackArea::toDdsData(data));
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
bRet = false;
|
||||
return;
|
||||
}
|
||||
@@ -57,10 +57,10 @@ bool HandlerShootbackArea::init()
|
||||
};
|
||||
if (!m_mainHandler->db()->select(cb) || !bRet)
|
||||
{
|
||||
ERROR_LOG() << "Error reading data from database!";
|
||||
ERROR_LOG(m_logger) << "Error reading data from database!";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "m_objectMap.size() = " << m_objectMap.size();
|
||||
DEBUG_LOG(m_logger) << "m_objectMap.size() = " << m_objectMap.size();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ void HandlerShootbackArea::onShootbackAreaModifyRequest(const rti::core::SampleI
|
||||
{
|
||||
const auto ret = shootbackAreaModifyRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
|
||||
// For ShootbackController
|
||||
emit objectChanged(ret.id(), false);
|
||||
@@ -90,7 +90,7 @@ void HandlerShootbackArea::onShootbackAreaModifyRequest(const rti::core::SampleI
|
||||
//--------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject HandlerShootbackArea::shootbackAreaModifyRequest(const ShootbackArea &request)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
// modify
|
||||
if (request.id() > 0)
|
||||
{
|
||||
@@ -109,7 +109,7 @@ Core::FunctionReplyObject HandlerShootbackArea::shootbackAreaModifyRequest(const
|
||||
}
|
||||
else
|
||||
m_objectMap.insert(ifs->getId(), ifs);
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ Core::FunctionReplyObject HandlerShootbackArea::shootbackAreaModifyRequest(const
|
||||
void HandlerShootbackArea::onShootbackAreaRemoveRequest(const rti::core::SampleIdentity &cookie,
|
||||
const Core::RemoveElementRequest &request)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " request=" << request;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " request=" << request;
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectShootbackArea *ifs = m_objectMap.value(request.id());
|
||||
@@ -149,7 +149,7 @@ void HandlerShootbackArea::onShootbackAreaRemoveRequest(const rti::core::SampleI
|
||||
ret = ifs->removeObject();
|
||||
|
||||
if (ret.error())
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
else
|
||||
{
|
||||
// delete Object
|
||||
|
||||
@@ -56,6 +56,8 @@ Q_SIGNALS:
|
||||
private Q_SLOTS:
|
||||
|
||||
private: // methods
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onShootbackAreaModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ShootbackArea &request) override;
|
||||
Core::FunctionReplyObject shootbackAreaModifyRequest(const ShootbackArea &request);
|
||||
|
||||
+14
-14
@@ -21,21 +21,21 @@ HandlerShootbackTarget::HandlerShootbackTarget(MainHandler *mainHandler)
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_dtsTgt(m_mainHandler->dds()->dtsTgt())
|
||||
{
|
||||
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";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
HandlerShootbackTarget::~HandlerShootbackTarget()
|
||||
{
|
||||
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";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
bool HandlerShootbackTarget::init()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
|
||||
// connect(m_dtcTab.get(), &TrainingAreaBase::Interface::Dtc::targetDataChanged,
|
||||
// this, &HandlerShootbackTarget::onTargetDataChanged);
|
||||
@@ -44,13 +44,13 @@ bool HandlerShootbackTarget::init()
|
||||
// create objects
|
||||
auto cb = [this, &bRet](const Database::TgtShootbackTarget & data)
|
||||
{
|
||||
DEBUG_LOG() << "Reading from DB ShootbackTarget with id = " << data.id;
|
||||
DEBUG_LOG(m_logger) << "Reading from DB ShootbackTarget with id = " << data.id;
|
||||
ObjectShootbackTarget *ifs(new ObjectShootbackTarget(m_mainHandler));
|
||||
Core::FunctionReplyObject ret = ifs->createObject(ObjectShootbackTarget::toDdsData(data));
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
bRet = false;
|
||||
return;
|
||||
}
|
||||
@@ -58,10 +58,10 @@ bool HandlerShootbackTarget::init()
|
||||
};
|
||||
if (!m_mainHandler->db()->select(cb) || !bRet)
|
||||
{
|
||||
ERROR_LOG() << "Error reading data from database!";
|
||||
ERROR_LOG(m_logger) << "Error reading data from database!";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "m_objectMap.size() = " << m_objectMap.size();
|
||||
DEBUG_LOG(m_logger) << "m_objectMap.size() = " << m_objectMap.size();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ void HandlerShootbackTarget::onShootbackTargetModifyRequest(const rti::core::Sam
|
||||
{
|
||||
const auto ret = shootbackTargetModifyRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
else
|
||||
emit objectChanged(ret.id(), false); // For ShootbackController
|
||||
|
||||
@@ -103,7 +103,7 @@ void HandlerShootbackTarget::onShootbackTargetModifyRequest(const rti::core::Sam
|
||||
//--------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject HandlerShootbackTarget::shootbackTargetModifyRequest(const ShootbackTarget &request)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
// modify
|
||||
if (request.id() > 0)
|
||||
{
|
||||
@@ -127,7 +127,7 @@ Core::FunctionReplyObject HandlerShootbackTarget::shootbackTargetModifyRequest(c
|
||||
}
|
||||
else
|
||||
m_objectMap.insert(ifs->getId(), ifs);
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ Core::FunctionReplyObject HandlerShootbackTarget::shootbackTargetModifyRequest(c
|
||||
void HandlerShootbackTarget::onShootbackTargetRemoveRequest(const rti::core::SampleIdentity &cookie,
|
||||
const Core::RemoveElementRequest &request)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " request=" << request;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " request=" << request;
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectShootbackTarget *ifs = m_objectMap.value(request.id());
|
||||
@@ -166,7 +166,7 @@ void HandlerShootbackTarget::onShootbackTargetRemoveRequest(const rti::core::Sam
|
||||
ret = ifs->removeObject();
|
||||
|
||||
if (ret.error())
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
else
|
||||
{
|
||||
// delete Object
|
||||
|
||||
+2
@@ -54,6 +54,8 @@ Q_SIGNALS:
|
||||
private Q_SLOTS:
|
||||
|
||||
private: // methods
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onShootbackTargetModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ShootbackTarget &request) override;
|
||||
Core::FunctionReplyObject shootbackTargetModifyRequest(const ShootbackTarget &request);
|
||||
|
||||
+14
-14
@@ -20,21 +20,21 @@ HandlerTargetAreaAssignment::HandlerTargetAreaAssignment(MainHandler *mainHandle
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_dtsTgt(m_mainHandler->dds()->dtsTgt())
|
||||
{
|
||||
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";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
HandlerTargetAreaAssignment::~HandlerTargetAreaAssignment()
|
||||
{
|
||||
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";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
bool HandlerTargetAreaAssignment::init()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
|
||||
// connect(m_dtcTab.get(), &TrainingAreaBase::Interface::Dtc::targetDataChanged,
|
||||
// this, &HandlerTargetAreaAssignment::onTargetDataChanged);
|
||||
@@ -43,13 +43,13 @@ bool HandlerTargetAreaAssignment::init()
|
||||
// create objects
|
||||
auto cb = [this, &bRet](const Database::TgtTargetAreaAssignment & data)
|
||||
{
|
||||
DEBUG_LOG() << "Reading from DB TargetAreaAssignment with id = " << data.id;
|
||||
DEBUG_LOG(m_logger) << "Reading from DB TargetAreaAssignment with id = " << data.id;
|
||||
ObjectTargetAreaAssignment *ifs(new ObjectTargetAreaAssignment(m_mainHandler));
|
||||
Core::FunctionReplyObject ret = ifs->createObject(ObjectTargetAreaAssignment::toDdsData(data));
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
bRet = false;
|
||||
return;
|
||||
}
|
||||
@@ -57,10 +57,10 @@ bool HandlerTargetAreaAssignment::init()
|
||||
};
|
||||
if (!m_mainHandler->db()->select(cb) || !bRet)
|
||||
{
|
||||
ERROR_LOG() << "Error reading data from database!";
|
||||
ERROR_LOG(m_logger) << "Error reading data from database!";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "m_objectMap.size() = " << m_objectMap.size();
|
||||
DEBUG_LOG(m_logger) << "m_objectMap.size() = " << m_objectMap.size();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ void HandlerTargetAreaAssignment::onTargetAreaAssignmentModifyRequest(const rti:
|
||||
{
|
||||
const auto ret = TargetAreaAssignmentModifyRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
else
|
||||
emit objectChanged(ret.id(), false); // For ShootbackController
|
||||
|
||||
@@ -97,7 +97,7 @@ void HandlerTargetAreaAssignment::onTargetAreaAssignmentModifyRequest(const rti:
|
||||
//--------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject HandlerTargetAreaAssignment::TargetAreaAssignmentModifyRequest(const TargetAreaAssignment &request)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
// modify
|
||||
if (request.id() > 0)
|
||||
{
|
||||
@@ -116,7 +116,7 @@ Core::FunctionReplyObject HandlerTargetAreaAssignment::TargetAreaAssignmentModif
|
||||
}
|
||||
else
|
||||
m_objectMap.insert(ifs->getId(), ifs);
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ Core::FunctionReplyObject HandlerTargetAreaAssignment::TargetAreaAssignmentModif
|
||||
void HandlerTargetAreaAssignment::onTargetAreaAssignmentRemoveRequest(const rti::core::SampleIdentity &cookie,
|
||||
const Core::RemoveElementRequest &request)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " request=" << request;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " request=" << request;
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectTargetAreaAssignment *ifs = m_objectMap.value(request.id());
|
||||
@@ -146,7 +146,7 @@ void HandlerTargetAreaAssignment::onTargetAreaAssignmentRemoveRequest(const rti:
|
||||
ret = ifs->removeObject();
|
||||
|
||||
if (ret.error())
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
else
|
||||
{
|
||||
// delete Object
|
||||
|
||||
+2
@@ -48,6 +48,8 @@ Q_SIGNALS:
|
||||
private Q_SLOTS:
|
||||
|
||||
private: // methods
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onTargetAreaAssignmentModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
const TargetAreaAssignment &request) override;
|
||||
Core::FunctionReplyObject TargetAreaAssignmentModifyRequest(const TargetAreaAssignment &request);
|
||||
|
||||
+13
-13
@@ -25,7 +25,7 @@ HandlerTargetConfig::HandlerTargetConfig(const std::shared_ptr<DdsHandler> &ddsH
|
||||
|
||||
bool HandlerTargetConfig::init()
|
||||
{
|
||||
INFO_LOG() << "init";
|
||||
INFO_LOG(m_logger) << "init";
|
||||
connect(m_dtcTab.get(), &TrainingAreaBase::Interface::Dtc::targetDataChanged,
|
||||
this, &HandlerTargetConfig::onTargetDataChanged);
|
||||
|
||||
@@ -40,10 +40,10 @@ void HandlerTargetConfig::onTargetDataChanged(const TrainingAreaBase::TargetData
|
||||
|
||||
uint8_t responseCmd = 100;
|
||||
TargetManagement::TargetConfig tgtTargetData;
|
||||
INFO_LOG() << "onTargetDataChanged payload.size=" << targetData.payload().size();
|
||||
INFO_LOG(m_logger) << "onTargetDataChanged payload.size=" << targetData.payload().size();
|
||||
tgtTargetData.participantId(m_ddsHandler->equipNo2participantId(targetData.equipmentNumber()));
|
||||
for (size_t i = 0; i < targetData.payload().size(); i++)
|
||||
INFO_LOG() << "payload[" << i << "]=" << targetData.payload()[i];
|
||||
INFO_LOG(m_logger) << "payload[" << i << "]=" << targetData.payload()[i];
|
||||
|
||||
if (targetData.payload().size() < 6)
|
||||
return;
|
||||
@@ -51,29 +51,29 @@ void HandlerTargetConfig::onTargetDataChanged(const TrainingAreaBase::TargetData
|
||||
tgtTargetData.tgtCommand(static_cast <TargetManagement::TgtCommand_def::type>(targetData.payload()[0] - responseCmd));
|
||||
tgtTargetData.mode(static_cast <TargetManagement::Mode_def::type>(targetData.payload()[1]));
|
||||
tgtTargetData.weapon(targetData.payload()[2]);
|
||||
INFO_LOG() << "tgtTargetData.tgtCommand =" << tgtTargetData.tgtCommand()
|
||||
INFO_LOG(m_logger) << "tgtTargetData.tgtCommand =" << tgtTargetData.tgtCommand()
|
||||
<< " mode=" << tgtTargetData.mode()
|
||||
<< " weapon=" << tgtTargetData.weapon();
|
||||
if (!m_dtsTgt->publish(tgtTargetData))
|
||||
ERROR_LOG() << "Error publish targetData";
|
||||
ERROR_LOG(m_logger) << "Error publish targetData";
|
||||
} // end of onTargetDataChanged
|
||||
|
||||
void HandlerTargetConfig::onSendTargetDataReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
if (replyObject.error())
|
||||
WARNING_LOG() << "Can not send target data to target participant : " << replyObject();
|
||||
WARNING_LOG(m_logger) << "Can not send target data to target participant : " << replyObject();
|
||||
else
|
||||
DEBUG_LOG() << "onSendTargetDataReply for id " << replyObject.id() << " success";
|
||||
DEBUG_LOG(m_logger) << "onSendTargetDataReply for id " << replyObject.id() << " success";
|
||||
}
|
||||
|
||||
// Send to TAB
|
||||
void HandlerTargetConfig::onConfigureTargetRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ConfigureTargetRequest &request)
|
||||
{
|
||||
INFO_LOG() << "onConfigureTargetRequest";
|
||||
INFO_LOG(m_logger) << "onConfigureTargetRequest";
|
||||
Core::FunctionReplyObject reply = Core::FunctionReplyObject(request.id());
|
||||
|
||||
DEBUG_LOG() << "HandlerTargetConfig onTargetConfigChanged participantId=" << request.participantId();
|
||||
DEBUG_LOG(m_logger) << "HandlerTargetConfig onTargetConfigChanged participantId=" << request.participantId();
|
||||
|
||||
TrainingAreaBase::SendTargetDataRequest tgt;
|
||||
const int participantId = request.participantId();
|
||||
@@ -87,7 +87,7 @@ void HandlerTargetConfig::onConfigureTargetRequest(const rti::core::SampleIdenti
|
||||
case TargetManagement::TgtCommand_def::Unknown:
|
||||
case TargetManagement::TgtCommand_def::PlaySound:
|
||||
{
|
||||
WARNING_LOG() << "onTargetConfigChanged Command =" << request.tgtCommand() << " not handled.";
|
||||
WARNING_LOG(m_logger) << "onTargetConfigChanged Command =" << request.tgtCommand() << " not handled.";
|
||||
m_ddsHandler->ftsTgt()->configureTargetReply(cookie, reply);
|
||||
return;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ void HandlerTargetConfig::onConfigureTargetRequest(const rti::core::SampleIdenti
|
||||
{
|
||||
if (!request.mode().is_set())
|
||||
{
|
||||
ERROR_LOG() << "Set mode requested, but mode ist not set";
|
||||
ERROR_LOG(m_logger) << "Set mode requested, but mode ist not set";
|
||||
m_ddsHandler->ftsTgt()->configureTargetReply(cookie, Core::FunctionReplyObject(request.participantId(), tr_lts("dds", "Set mode requested, but mode is not set")));
|
||||
return;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ void HandlerTargetConfig::onConfigureTargetRequest(const rti::core::SampleIdenti
|
||||
{
|
||||
if (!request.weapon().is_set())
|
||||
{
|
||||
ERROR_LOG() << "Set weapon requested, but weapon ist not set";
|
||||
ERROR_LOG(m_logger) << "Set weapon requested, but weapon ist not set";
|
||||
m_ddsHandler->ftsTgt()->configureTargetReply(cookie, Core::FunctionReplyObject(request.participantId(), tr_lts("dds", "Set weapon requested, but weapon is not set")));
|
||||
return;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ void HandlerTargetConfig::onConfigureTargetRequest(const rti::core::SampleIdenti
|
||||
{
|
||||
if (!request.parameterSet().is_set())
|
||||
{
|
||||
ERROR_LOG() << "Set parameterset requested, but parameterset ist not set";
|
||||
ERROR_LOG(m_logger) << "Set parameterset requested, but parameterset ist not set";
|
||||
m_ddsHandler->ftsTgt()->configureTargetReply(cookie, Core::FunctionReplyObject(request.participantId(), tr_lts("dds", "Set parameterset requested, but parameterset is not set")));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,8 @@ private Q_SLOTS:
|
||||
void onTargetDataChanged(const TrainingAreaBase::TargetData &targetData, DataModification modType);
|
||||
|
||||
private: // methoden
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onConfigureTargetRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ConfigureTargetRequest &request) override;
|
||||
Core::FunctionReplyObject configureTargetRequest(const ConfigureTargetRequest &request);
|
||||
|
||||
@@ -18,11 +18,10 @@
|
||||
namespace TargetManagement
|
||||
{
|
||||
|
||||
MainHandler::MainHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
MainHandler::MainHandler(QObject *parent) : QObject(parent)
|
||||
, m_ddsHandler(nullptr)
|
||||
, m_dbHandler(nullptr)
|
||||
{}
|
||||
, m_dbHandler(nullptr),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
{
|
||||
@@ -42,7 +41,7 @@ MainHandler::~MainHandler()
|
||||
|
||||
bool MainHandler::init(int domainId, int exerciseId)
|
||||
{
|
||||
INFO_LOG() << "MainHandler::init";
|
||||
INFO_LOG(m_logger) << "MainHandler::init";
|
||||
|
||||
// initialize database
|
||||
m_dbHandler = std::make_shared<DbHandler>();
|
||||
@@ -53,10 +52,10 @@ 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;
|
||||
}
|
||||
DEBUG_LOG() << "Initialisation ddsHandler succesful.";
|
||||
DEBUG_LOG(m_logger) << "Initialisation ddsHandler succesful.";
|
||||
|
||||
NOTICE_LOG(m_logger) << "setNewState Core::RunningState::Starting ";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Starting);
|
||||
@@ -66,7 +65,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
|
||||
if (!m_handlerTargetConfig->init())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation HandlerTargetConfig failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerTargetConfig failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
@@ -84,7 +83,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
QFileInfo fi(elevationFileAbs);
|
||||
if (!fi.exists(elevationFileAbs))
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << ", elevationFile '" << elevationFileAbs << "' doesn't exists";
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << ", elevationFile '" << elevationFileAbs << "' doesn't exists";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -98,7 +97,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
|
||||
if (!m_handlerShootbackArea->init())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation HandlerShootbackArea failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerShootbackArea failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
@@ -108,7 +107,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
|
||||
if (!m_handlerShootbackTarget->init())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation HandlerShootbackTarget failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerShootbackTarget failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
@@ -118,7 +117,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
|
||||
if (!m_handlerTargetAreaAssignment->init())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation HandlerTargetAreaAssignment failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerTargetAreaAssignment failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
@@ -132,7 +131,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
|
||||
if (!(initLos && initDds))
|
||||
{
|
||||
ERROR_LOG() << "Initialisation ShootbackController failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation ShootbackController failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<DbHandler> m_dbHandler;
|
||||
|
||||
|
||||
+16
-17
@@ -13,20 +13,19 @@
|
||||
//------------------------------------------------------------------------------
|
||||
namespace TargetManagement
|
||||
{
|
||||
ObjectShootbackArea::ObjectShootbackArea(MainHandler *mainHandler)
|
||||
: m_mainHandler(mainHandler)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
ObjectShootbackArea::ObjectShootbackArea(MainHandler *mainHandler) : m_mainHandler(mainHandler),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ObjectShootbackArea::~ObjectShootbackArea()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
if (isValid())
|
||||
m_mainHandler->dds()->dtsTgt()->removeShootbackAreaByKey(m_data.id());
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -44,7 +43,7 @@ bool ObjectShootbackArea::isUsed() const
|
||||
//------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectShootbackArea::createObject(const ShootbackArea &data)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
m_data = data;
|
||||
|
||||
if (m_data.id() <= 0)
|
||||
@@ -57,20 +56,20 @@ Core::FunctionReplyObject ObjectShootbackArea::createObject(const ShootbackArea
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting ShootbackArea-data into database"));
|
||||
|
||||
m_data.id(dbData.id);
|
||||
DEBUG_LOG() << "New TgtShootbackArea: " << m_data.id();
|
||||
DEBUG_LOG(m_logger) << "New TgtShootbackArea: " << m_data.id();
|
||||
}
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectShootbackArea::updateObject(const ShootbackArea &data)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
if (!isValid())
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Object not valid/blocked"));
|
||||
|
||||
@@ -81,12 +80,12 @@ Core::FunctionReplyObject ObjectShootbackArea::updateObject(const ShootbackArea
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Error updating ShootbackArea-data into database"));
|
||||
|
||||
m_data = data;
|
||||
DEBUG_LOG() << "Data changed for ShootbackAreaId: " << m_data.id();
|
||||
DEBUG_LOG(m_logger) << "Data changed for ShootbackAreaId: " << m_data.id();
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
}
|
||||
|
||||
@@ -107,7 +106,7 @@ Core::FunctionReplyObject ObjectShootbackArea::setUsed(bool isUsed)
|
||||
//------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectShootbackArea::removeObject()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
if (isUsed())
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "ShootbackArea still in use"));
|
||||
|
||||
@@ -117,17 +116,17 @@ Core::FunctionReplyObject ObjectShootbackArea::removeObject()
|
||||
if (!m_mainHandler->dds()->dtsTgt()->removeShootbackAreaByKey(m_data.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "ShootbackArea with id %1 can not be removed from DDS")).arg(m_data.id());
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void ObjectShootbackArea::onPublishData()
|
||||
{
|
||||
TRACE_LOG() << "Publish ShootbackArea-data to dds (" << m_data.id() << ") ...";
|
||||
TRACE_LOG(m_logger) << "Publish ShootbackArea-data to dds (" << m_data.id() << ") ...";
|
||||
|
||||
if (!m_mainHandler->dds()->dtsTgt()->publish(m_data))
|
||||
ERROR_LOG() << "Error publishing ShootbackArea-data to dds";
|
||||
ERROR_LOG(m_logger) << "Error publishing ShootbackArea-data to dds";
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
static ShootbackArea toDdsData(const Database::TgtShootbackArea &dbData); // db -> dds
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onPublishData();
|
||||
|
||||
private:
|
||||
|
||||
+16
-17
@@ -13,20 +13,19 @@
|
||||
//------------------------------------------------------------------------------
|
||||
namespace TargetManagement
|
||||
{
|
||||
ObjectShootbackTarget::ObjectShootbackTarget(MainHandler *mainHandler)
|
||||
: m_mainHandler(mainHandler)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
ObjectShootbackTarget::ObjectShootbackTarget(MainHandler *mainHandler) : m_mainHandler(mainHandler),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ObjectShootbackTarget::~ObjectShootbackTarget()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
if (isValid())
|
||||
m_mainHandler->dds()->dtsTgt()->removeShootbackTargetByKey(m_data.id());
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -44,7 +43,7 @@ bool ObjectShootbackTarget::isUsed() const
|
||||
//------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectShootbackTarget::createObject(const ShootbackTarget &data)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
m_data = data;
|
||||
|
||||
if (m_data.id() <= 0)
|
||||
@@ -57,20 +56,20 @@ Core::FunctionReplyObject ObjectShootbackTarget::createObject(const ShootbackTar
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting ShootbackTarget-data into database"));
|
||||
|
||||
m_data.id(dbData.id);
|
||||
DEBUG_LOG() << "New TgtShootbackTarget: " << m_data.id();
|
||||
DEBUG_LOG(m_logger) << "New TgtShootbackTarget: " << m_data.id();
|
||||
}
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectShootbackTarget::updateObject(const ShootbackTarget &data)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START, id=" << data.id()
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, id=" << data.id()
|
||||
<< " size =" << data.visibleParticipants().size();
|
||||
if (!isValid())
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Object not valid/blocked"));
|
||||
@@ -85,12 +84,12 @@ Core::FunctionReplyObject ObjectShootbackTarget::updateObject(const ShootbackTar
|
||||
}
|
||||
|
||||
m_data = data;
|
||||
DEBUG_LOG() << "Data changed for ShootbackTargetId: " << m_data.id();
|
||||
DEBUG_LOG(m_logger) << "Data changed for ShootbackTargetId: " << m_data.id();
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END, id=" << data.id()
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, id=" << data.id()
|
||||
<< " size =" << data.visibleParticipants().size();
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
}
|
||||
@@ -112,7 +111,7 @@ Core::FunctionReplyObject ObjectShootbackTarget::setUsed(bool isUsed)
|
||||
//------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectShootbackTarget::removeObject()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
if (isUsed())
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "ShootbackTarget still in use"));
|
||||
|
||||
@@ -122,7 +121,7 @@ Core::FunctionReplyObject ObjectShootbackTarget::removeObject()
|
||||
if (!m_mainHandler->dds()->dtsTgt()->removeShootbackTargetByKey(m_data.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "ShootbackTarget with id %1 can not be removed from DDS")).arg(m_data.id());
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
}
|
||||
|
||||
@@ -145,10 +144,10 @@ void ObjectShootbackTarget::updateVolatileData(const Core::GeoPosition &position
|
||||
//------------------------------------------------------------------------------
|
||||
void ObjectShootbackTarget::onPublishData()
|
||||
{
|
||||
TRACE_LOG() << "Publish ShootbackTarget-data to dds (" << m_data.id() << ") ...";
|
||||
TRACE_LOG(m_logger) << "Publish ShootbackTarget-data to dds (" << m_data.id() << ") ...";
|
||||
|
||||
if (!m_mainHandler->dds()->dtsTgt()->publish(m_data))
|
||||
ERROR_LOG() << "Error publishing ShootbackTarget-data to dds";
|
||||
ERROR_LOG(m_logger) << "Error publishing ShootbackTarget-data to dds";
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
bool isDifferent(const Database::TgtShootbackTarget &dbData);
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onPublishData();
|
||||
|
||||
private:
|
||||
|
||||
+17
-18
@@ -13,20 +13,19 @@
|
||||
//------------------------------------------------------------------------------
|
||||
namespace TargetManagement
|
||||
{
|
||||
ObjectTargetAreaAssignment::ObjectTargetAreaAssignment(MainHandler *mainHandler)
|
||||
: m_mainHandler(mainHandler)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
ObjectTargetAreaAssignment::ObjectTargetAreaAssignment(MainHandler *mainHandler) : m_mainHandler(mainHandler),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ObjectTargetAreaAssignment::~ObjectTargetAreaAssignment()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
if (isValid())
|
||||
m_mainHandler->dds()->dtsTgt()->removeTargetAreaAssignmentByKey(m_data.id());
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -44,7 +43,7 @@ bool ObjectTargetAreaAssignment::isUsed() const
|
||||
//------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectTargetAreaAssignment::createObject(const TargetAreaAssignment &data)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
m_data = data;
|
||||
|
||||
if (m_data.id() <= 0)
|
||||
@@ -56,7 +55,7 @@ Core::FunctionReplyObject ObjectTargetAreaAssignment::createObject(const TargetA
|
||||
if (!m_mainHandler->db()->insert(dbData))
|
||||
{
|
||||
QString errText = m_mainHandler->db()->getLastError().nativeErrorCode();
|
||||
ERROR_LOG() << "Error inserting TargetAreaAssignment into database: " << m_mainHandler->db()->getLastError().text();
|
||||
ERROR_LOG(m_logger) << "Error inserting TargetAreaAssignment into database: " << m_mainHandler->db()->getLastError().text();
|
||||
if (errText.contains(QStringLiteral("23505")))
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting TargetAreaAssignment into database: unique key violation for '%1'")).arg(m_data.name());
|
||||
else
|
||||
@@ -64,20 +63,20 @@ Core::FunctionReplyObject ObjectTargetAreaAssignment::createObject(const TargetA
|
||||
}
|
||||
|
||||
m_data.id(dbData.id);
|
||||
DEBUG_LOG() << "New TgtTargetAreaAssignment: " << m_data.id();
|
||||
DEBUG_LOG(m_logger) << "New TgtTargetAreaAssignment: " << m_data.id();
|
||||
}
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectTargetAreaAssignment::updateObject(const TargetAreaAssignment &data)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
if (!isValid())
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Object not valid/blocked"));
|
||||
|
||||
@@ -88,12 +87,12 @@ Core::FunctionReplyObject ObjectTargetAreaAssignment::updateObject(const TargetA
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Error updating TargetAreaAssignment-data into database"));
|
||||
|
||||
m_data = data;
|
||||
DEBUG_LOG() << "Data changed for TargetAreaAssignmentId: " << m_data.id();
|
||||
DEBUG_LOG(m_logger) << "Data changed for TargetAreaAssignmentId: " << m_data.id();
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
}
|
||||
|
||||
@@ -114,7 +113,7 @@ Core::FunctionReplyObject ObjectTargetAreaAssignment::setUsed(bool isUsed)
|
||||
//------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectTargetAreaAssignment::removeObject()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
if (isUsed())
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "TargetAreaAssignment still in use"));
|
||||
|
||||
@@ -124,17 +123,17 @@ Core::FunctionReplyObject ObjectTargetAreaAssignment::removeObject()
|
||||
if (!m_mainHandler->dds()->dtsTgt()->removeTargetAreaAssignmentByKey(m_data.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "TargetAreaAssignment with id %1 can not be removed from DDS")).arg(m_data.id());
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void ObjectTargetAreaAssignment::onPublishData()
|
||||
{
|
||||
TRACE_LOG() << "Publish TargetAreaAssignment-data to dds (" << m_data.id() << ") ...";
|
||||
TRACE_LOG(m_logger) << "Publish TargetAreaAssignment-data to dds (" << m_data.id() << ") ...";
|
||||
|
||||
if (!m_mainHandler->dds()->dtsTgt()->publish(m_data))
|
||||
ERROR_LOG() << "Error publishing TargetAreaAssignment-data to dds";
|
||||
ERROR_LOG(m_logger) << "Error publishing TargetAreaAssignment-data to dds";
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
|
||||
+1
@@ -48,6 +48,7 @@ public:
|
||||
static TargetAreaAssignment toDdsData(const Database::TgtTargetAreaAssignment &dbData); // db -> dds
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onPublishData();
|
||||
|
||||
private:
|
||||
|
||||
+68
-69
@@ -67,19 +67,18 @@ QString toString(const std::vector<int> &cont)
|
||||
//
|
||||
// class ShootbackController
|
||||
//
|
||||
ShootbackController::ShootbackController(MainHandler *mainHandler)
|
||||
: BaseClass(mainHandler)
|
||||
ShootbackController::ShootbackController(MainHandler *mainHandler) : BaseClass(mainHandler)
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_elevationMap(nullptr)
|
||||
, m_losCalculation(nullptr)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
, m_losCalculation(nullptr),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
ShootbackController::~ShootbackController()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
|
||||
// disconnect external "signals"..
|
||||
disconnect(m_mainHandler->dds()->dtcPpm().get());
|
||||
@@ -91,27 +90,27 @@ ShootbackController::~ShootbackController()
|
||||
delete m_losCalculation;
|
||||
m_losCalculation = nullptr;
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
bool ShootbackController::initLOS(SituationMap::ElevationMap *elevationMap)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START, elevationMap = " << elevationMap
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, elevationMap = " << elevationMap
|
||||
<< " isValid = " << elevationMap->isValid();
|
||||
|
||||
if (!elevationMap->isValid())
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << " elevationMap not valid -> return";
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " elevationMap not valid -> return";
|
||||
return false;
|
||||
}
|
||||
|
||||
delete m_losCalculation;
|
||||
m_elevationMap = elevationMap;
|
||||
|
||||
INFO_LOG() << Q_FUNC_INFO << " m_elevationMap.isValid() =" << m_elevationMap->isValid();
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << " m_elevationMap.isValid() =" << m_elevationMap->isValid();
|
||||
m_losCalculation = new SituationMap::LineOfSightCalculation(m_elevationMap);
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -151,7 +150,7 @@ bool ShootbackController::initDds(std::shared_ptr<HandlerShootbackArea> handlerA
|
||||
|
||||
void ShootbackController::onShootbackAreaChanged1(qint32 areaId, bool removed)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START" << " shootbackAreaId=" << areaId << " removed=" << removed;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << " shootbackAreaId=" << areaId << " removed=" << removed;
|
||||
|
||||
if (removed)
|
||||
{
|
||||
@@ -168,7 +167,7 @@ void ShootbackController::onShootbackAreaChanged1(qint32 areaId, bool removed)
|
||||
auto it = areaMap.find(areaId);
|
||||
if (it == areaMap.end())
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << " obj changes, but connot be found" << " shootbackAreaId=" << areaId;
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " obj changes, but connot be found" << " shootbackAreaId=" << areaId;
|
||||
return;
|
||||
}
|
||||
onShootbackAreaChanged2(*(it.value()));
|
||||
@@ -176,13 +175,13 @@ void ShootbackController::onShootbackAreaChanged1(qint32 areaId, bool removed)
|
||||
}
|
||||
|
||||
syncExternal();
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END" << " shootbackAreaId=" << areaId << " removed=" << removed;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << " shootbackAreaId=" << areaId << " removed=" << removed;
|
||||
}
|
||||
|
||||
void ShootbackController::onShootbackAreaChanged2(const TargetManagement::ObjectShootbackArea &area)
|
||||
{
|
||||
const int areaId = area.getId();
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START" << " shootbackAreaId=" << areaId;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << " shootbackAreaId=" << areaId;
|
||||
|
||||
// handle new/modified area and check all participants:
|
||||
const QMap<qint32, ParticipantManagement::ParticipantPosition> &participantPositions =
|
||||
@@ -193,12 +192,12 @@ void ShootbackController::onShootbackAreaChanged2(const TargetManagement::Object
|
||||
updateInternal_participantPerArea(area, posData);
|
||||
} // for
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END" << " shootbackAreaId=" << areaId;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << " shootbackAreaId=" << areaId;
|
||||
}
|
||||
|
||||
void ShootbackController::onShootbackTargetChanged(qint32 targetId, bool removed)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START" << ", targetId=" << targetId << ", removed=" << removed;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << ", targetId=" << targetId << ", removed=" << removed;
|
||||
|
||||
// Note:
|
||||
// updateInternalLos is not required if (removed == true)
|
||||
@@ -214,12 +213,12 @@ void ShootbackController::onShootbackTargetChanged(qint32 targetId, bool removed
|
||||
updateInternalLos({}, {}, {targetId});
|
||||
syncExternal();
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END" << " targetId=" << targetId << " removed=" << removed;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << " targetId=" << targetId << " removed=" << removed;
|
||||
}
|
||||
|
||||
void ShootbackController::onTargetAreaAssignmentChanged(qint32 assignmentId, bool removed)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START" << " assignmentId=" << assignmentId << " removed=" << removed;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << " assignmentId=" << assignmentId << " removed=" << removed;
|
||||
|
||||
// Note:
|
||||
// updateInternalLos is not required on removed == true
|
||||
@@ -231,16 +230,16 @@ void ShootbackController::onTargetAreaAssignmentChanged(qint32 assignmentId, boo
|
||||
updateInternalLos({assignmentId}, {}, {});
|
||||
syncExternal();
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END" << " assignmentId=" << assignmentId << " removed=" << removed;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << " assignmentId=" << assignmentId << " removed=" << removed;
|
||||
}
|
||||
|
||||
void ShootbackController::onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &posData, DataModification modType)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " participantId changed, participantId=" << posData << " mod=" << modType;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " participantId changed, participantId=" << posData << " mod=" << modType;
|
||||
|
||||
if (!participantPositionTopicIsValid(posData))
|
||||
{
|
||||
// DEBUG_LOG() << Q_FUNC_INFO << " NOT VALID, participantId=" << posData.participantId();
|
||||
// DEBUG_LOG(m_logger) << Q_FUNC_INFO << " NOT VALID, participantId=" << posData.participantId();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -249,30 +248,30 @@ void ShootbackController::onParticipantPositionChanged(const ParticipantManageme
|
||||
bool bIsTarget = false;
|
||||
if (isTarget(participantId, bIsTarget) && bIsTarget)
|
||||
{
|
||||
INFO_LOG() << Q_FUNC_INFO << " TARGET, participantId=" << participantId;
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << " TARGET, participantId=" << participantId;
|
||||
|
||||
ObjectShootbackTarget *osbTarget = m_handlerShootbackTarget->dataForTargetParticipantId(participantId);
|
||||
if (!osbTarget)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << " ObjectShootbackTarget not found for participantId=" << participantId;
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " ObjectShootbackTarget not found for participantId=" << participantId;
|
||||
return;
|
||||
}
|
||||
osbTarget->updateVolatileData(posData.pos());
|
||||
}
|
||||
|
||||
INFO_LOG() << Q_FUNC_INFO << " participantId=" << participantId << ", isTarget=" << bIsTarget;
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << " participantId=" << participantId << ", isTarget=" << bIsTarget;
|
||||
|
||||
if ((modType == DataModification::eAdded) || (modType == DataModification::eModified))
|
||||
{
|
||||
// update
|
||||
const QHash<int, ObjectShootbackArea *> &objMap = m_handlerShootbackArea->getObjectMap();
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " objMap.size" << objMap.size();
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " objMap.size" << objMap.size();
|
||||
|
||||
QMapIterator< int, QSet<int>> it(m_participantsPerArea);
|
||||
while (it.hasNext())
|
||||
{
|
||||
it.next();
|
||||
DEBUG_LOG() << " areaId = " << it.key() << "-> partIdRef VORHERXX" << toString(it.value());
|
||||
DEBUG_LOG(m_logger) << " areaId = " << it.key() << "-> partIdRef VORHERXX" << toString(it.value());
|
||||
}
|
||||
|
||||
for (const auto &area : std::as_const(objMap))
|
||||
@@ -286,7 +285,7 @@ void ShootbackController::onParticipantPositionChanged(const ParticipantManageme
|
||||
while (it_inner.hasNext())
|
||||
{
|
||||
it_inner.next();
|
||||
DEBUG_LOG() << " areaId = " << it_inner.key() << "-> partIdRef NACHHERXX" << toString(it_inner.value());
|
||||
DEBUG_LOG(m_logger) << " areaId = " << it_inner.key() << "-> partIdRef NACHHERXX" << toString(it_inner.value());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +321,7 @@ bool ShootbackController::isTarget(qint32 participantId, bool &bIsTarget) const
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> dtcPpm = m_mainHandler->dds()->dtcPpm();
|
||||
if (!dtcPpm)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << " no dtcPpm, return";
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " no dtcPpm, return";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -372,9 +371,9 @@ void ShootbackController::updateInternal_participantPerArea(const ObjectShootbac
|
||||
QSet<int> &partIdRef = m_participantsPerArea[areaId];
|
||||
bool alreadyInCont = partIdRef.contains(participantId);
|
||||
|
||||
DEBUG_LOG() << " areaId = " << area.getId() << " ---> partIdRef VORHER" << toString(partIdRef);
|
||||
DEBUG_LOG(m_logger) << " areaId = " << area.getId() << " ---> partIdRef VORHER" << toString(partIdRef);
|
||||
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " "
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " "
|
||||
<< " shootbackAreaId=" << areaId
|
||||
<< " shootbackAreaName=" << area.getName()
|
||||
<< " area.position=" << area.getData().position()
|
||||
@@ -387,17 +386,17 @@ void ShootbackController::updateInternal_participantPerArea(const ObjectShootbac
|
||||
{
|
||||
// ENTER
|
||||
partIdRef.insert(participantId);
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " ENTER: participantId=" << participantId << " areaId=" << areaId;
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " ENTER: participantId=" << participantId << " areaId=" << areaId;
|
||||
|
||||
}
|
||||
else if (!contains && alreadyInCont)
|
||||
{
|
||||
// LEAVE
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " ENTER: participantId=" << participantId << " areaId=" << areaId;
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " ENTER: participantId=" << participantId << " areaId=" << areaId;
|
||||
partIdRef.remove(participantId);
|
||||
}
|
||||
|
||||
DEBUG_LOG() << " areaId = " << area.getId() << " ---> partIdRef NACHER" << toString(partIdRef);
|
||||
DEBUG_LOG(m_logger) << " areaId = " << area.getId() << " ---> partIdRef NACHER" << toString(partIdRef);
|
||||
}
|
||||
|
||||
bool ShootbackController::areaContainsPosition(const TargetManagement::ObjectShootbackArea &area,
|
||||
@@ -453,7 +452,7 @@ QSet<int> ShootbackController::areasWithParticipant(qint32 participantId) const
|
||||
|
||||
QSet<int> ShootbackController::assignmentsWithTargetParticipantId(qint32 targetParticipantId) const
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START" << " targetParticipantId=" << targetParticipantId;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << " targetParticipantId=" << targetParticipantId;
|
||||
|
||||
QSet<int> ret;
|
||||
// all assignments
|
||||
@@ -467,7 +466,7 @@ QSet<int> ShootbackController::assignmentsWithTargetParticipantId(qint32 targetP
|
||||
ret += targetAreaAssignment->getId();
|
||||
} // for
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END" << " areaId=" << targetParticipantId;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << " areaId=" << targetParticipantId;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -483,7 +482,7 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
|
||||
const QSet<int> &changingTartgetIds, // ~dynamic
|
||||
int changedParticipantId) // ~dynamic
|
||||
{
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START"
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " START"
|
||||
<< ", changingAssigmentIds=" << toString(changingAssignmentIds)
|
||||
<< ", changingAreaIds=" << toString(changingAreaIds)
|
||||
<< ", changingTartgetIds=" << toString(changingTartgetIds)
|
||||
@@ -491,13 +490,13 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
|
||||
|
||||
// loop over every assignment
|
||||
const QHash<int, ObjectTargetAreaAssignment *> &allAssignments = m_handlerTargetAreaAssignment->getObjectMap();
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " allAssignments.size() " << allAssignments.size();
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " allAssignments.size() " << allAssignments.size();
|
||||
|
||||
for (ObjectTargetAreaAssignment *assignment : allAssignments)
|
||||
{
|
||||
if (!assignment)
|
||||
{
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId();
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -505,7 +504,7 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
|
||||
const int assignmentId = assignment->getId();
|
||||
if (!idIsRelevantHelper(changingAssignmentIds, assignmentId))
|
||||
{
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId();
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -515,7 +514,7 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
|
||||
const int areaId = assignmentData.areaId();
|
||||
if (!idIsRelevantHelper(changingAreaIds, areaId))
|
||||
{
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId();
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -524,7 +523,7 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
|
||||
const int targetDataId = m_handlerShootbackTarget->targetDataIdForTargetParticipantId(targetParticpantId);
|
||||
if (!idIsRelevantHelper(changingTartgetIds, targetDataId))
|
||||
{
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId()
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId()
|
||||
<< ", changingTartgetIds=" << toString(changingTartgetIds)
|
||||
<< ", targetParticpantId=" << targetParticpantId
|
||||
<< ", targetDataId=" << targetDataId;
|
||||
@@ -536,13 +535,13 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
|
||||
{
|
||||
// Note: m_participantsPerArea is up-to-date
|
||||
QSet<int> areasWithPart = areasWithParticipant(changedParticipantId);
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " areasWithPart=" << areasWithPart.size();
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " areasWithPart=" << areasWithPart.size();
|
||||
for (auto curAreaId : std::as_const(areasWithPart))
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " -> curAreaId=" << curAreaId;
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " -> curAreaId=" << curAreaId;
|
||||
|
||||
if (!idIsRelevantHelper(areasWithPart, areaId))
|
||||
{
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId();
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -551,11 +550,11 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
|
||||
// one assignment -> single target, single area, some participants (which are in that single area):
|
||||
|
||||
if (!updateInternalLosSingleAssignment(assignment))
|
||||
ERROR_LOG() << Q_FUNC_INFO << " updateInternalLosSingleAssignment failed, assignmentId=" << assignment->getId();
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " updateInternalLosSingleAssignment failed, assignmentId=" << assignment->getId();
|
||||
|
||||
} // for
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END"
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END"
|
||||
<< ", changingAssigmentIds=" << changingAssignmentIds.size()
|
||||
<< ", changingAreaIds=" << changingAreaIds.size()
|
||||
<< ", changingTartgetIds=" << changingTartgetIds.size()
|
||||
@@ -567,14 +566,14 @@ bool ShootbackController::updateInternalLosSingleAssignment(ObjectTargetAreaAssi
|
||||
if (!assignment)
|
||||
return false;
|
||||
const int assignmentId = assignment->getId();
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START, assignmentId=" << assignmentId;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, assignmentId=" << assignmentId;
|
||||
|
||||
|
||||
const TargetAreaAssignment &assignmentData = assignment->getData();
|
||||
const int areaId = assignmentData.areaId();
|
||||
const int targetParticipantId = assignmentData.targetParticipantId();
|
||||
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START, assignmentId=" << assignmentId
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " START, assignmentId=" << assignmentId
|
||||
<< ", areaId = " << areaId
|
||||
<< ", targetParticipantId = " << targetParticipantId;
|
||||
|
||||
@@ -585,14 +584,14 @@ bool ShootbackController::updateInternalLosSingleAssignment(ObjectTargetAreaAssi
|
||||
// Neverless, for this assignment -> area there are no participants visible:
|
||||
// clear container:
|
||||
m_visibleParticipantsPerAssignment[assignmentId] = {};
|
||||
ERROR_LOG() << Q_FUNC_INFO << " no area for areaId=" << areaId;
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " no area for areaId=" << areaId;
|
||||
return false;
|
||||
}
|
||||
|
||||
ObjectShootbackTarget *target = m_handlerShootbackTarget->dataForTargetParticipantId(targetParticipantId);
|
||||
if (!target)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << " no target for targetParticipantId=" << targetParticipantId;
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " no target for targetParticipantId=" << targetParticipantId;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -604,7 +603,7 @@ bool ShootbackController::updateInternalLosSingleAssignment(ObjectTargetAreaAssi
|
||||
for (auto participantId : std::as_const(partIdRef))
|
||||
{
|
||||
// check lineOfSight:
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " check lineOfSight for: assignmentId=" << assignmentId
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " check lineOfSight for: assignmentId=" << assignmentId
|
||||
<< ", areaId = " << areaId
|
||||
<< ", targetParticipantId = " << targetParticipantId
|
||||
<< ", participantId=" << participantId;
|
||||
@@ -619,13 +618,13 @@ bool ShootbackController::updateInternalLosSingleAssignment(ObjectTargetAreaAssi
|
||||
|
||||
if (participantPos.participantId() != participantId)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << " no position for participantId=" << participantId;
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " no position for participantId=" << participantId;
|
||||
return false;
|
||||
}
|
||||
const Core::GeoPosition &participantGeoPos = participantPos.pos();
|
||||
|
||||
bool visi = lineOfSight(sbTargetGeoPos, participantGeoPos);
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " current targetId = " << target->getId() << " visi = " << visi;
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " current targetId = " << target->getId() << " visi = " << visi;
|
||||
|
||||
if (visi)
|
||||
visiPartCont.insert(participantId);
|
||||
@@ -635,19 +634,19 @@ bool ShootbackController::updateInternalLosSingleAssignment(ObjectTargetAreaAssi
|
||||
|
||||
} // if (m_participantsPerArea.contains(areaId))
|
||||
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " assignmentId = " << assignmentId
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " assignmentId = " << assignmentId
|
||||
<< " visiPartCont.size() " << visiPartCont.size();
|
||||
|
||||
// store at member
|
||||
m_visibleParticipantsPerAssignment[assignmentId] = visiPartCont;
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END, assignmentId=" << assignmentId;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, assignmentId=" << assignmentId;
|
||||
return true;
|
||||
}
|
||||
|
||||
QSet<int> ShootbackController::visibleParticipantsPerTargetParticipantId(int targetParticipantId)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START, targetParticipantId = " << targetParticipantId;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, targetParticipantId = " << targetParticipantId;
|
||||
|
||||
QSet<int> visiPartPerTarget;
|
||||
|
||||
@@ -658,19 +657,19 @@ QSet<int> ShootbackController::visibleParticipantsPerTargetParticipantId(int tar
|
||||
visiPartPerTarget += m_visibleParticipantsPerAssignment[assignmentId];
|
||||
}
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END, targetParticipantId = " << targetParticipantId
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, targetParticipantId = " << targetParticipantId
|
||||
<< ", visiPartPerTarget = " << toString(visiPartPerTarget);
|
||||
return visiPartPerTarget;
|
||||
}
|
||||
|
||||
void ShootbackController::syncExternal()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
|
||||
// loop over all targets
|
||||
const QHash<int, ObjectShootbackTarget *> &allTargets = m_handlerShootbackTarget->getObjectMap();
|
||||
|
||||
INFO_LOG() << Q_FUNC_INFO << " allTargets.size() " << allTargets.size();
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << " allTargets.size() " << allTargets.size();
|
||||
|
||||
for (ObjectShootbackTarget *target : allTargets)
|
||||
{
|
||||
@@ -680,7 +679,7 @@ void ShootbackController::syncExternal()
|
||||
const QSet<int> &visiPartPerTarget = visibleParticipantsPerTargetParticipantId(target->getTargetParticipantId()); // QSet -> unique and sorted
|
||||
std::vector<int32_t> visiPartPerTargetStd;
|
||||
visiPartPerTargetStd.reserve(visiPartPerTarget.size());
|
||||
INFO_LOG() << Q_FUNC_INFO << " targetId " << target->getId() << ", visiPartPerTarget = " << toString(visiPartPerTarget);
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << " targetId " << target->getId() << ", visiPartPerTarget = " << toString(visiPartPerTarget);
|
||||
for (auto id : std::as_const(visiPartPerTarget))
|
||||
visiPartPerTargetStd.push_back(id);
|
||||
|
||||
@@ -689,26 +688,26 @@ void ShootbackController::syncExternal()
|
||||
if (visiPartPerTargetStd != sbTarget.visibleParticipants())
|
||||
{
|
||||
// data has changed
|
||||
INFO_LOG() << Q_FUNC_INFO << " targetId differ -> updateObject..";
|
||||
INFO_LOG() << Q_FUNC_INFO << " visiOld =" << toString(sbTarget.visibleParticipants());
|
||||
INFO_LOG() << Q_FUNC_INFO << " visiNew =" << toString(visiPartPerTargetStd);
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << " targetId differ -> updateObject..";
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << " visiOld =" << toString(sbTarget.visibleParticipants());
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO << " visiNew =" << toString(visiPartPerTargetStd);
|
||||
target->updateVolatileData(visiPartPerTargetStd); // update and publish
|
||||
}
|
||||
} // for
|
||||
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
|
||||
bool ShootbackController::lineOfSight(const Core::GeoPosition &observerPos, const Core::GeoPosition &targetPos) const
|
||||
{
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " calculate m_losCalculation = " << m_losCalculation
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " calculate m_losCalculation = " << m_losCalculation
|
||||
<< ", observerPos=" << observerPos
|
||||
<< ", targetPos=" << targetPos;
|
||||
|
||||
if (!m_losCalculation)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << " Error: no m_losCalculation";
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Error: no m_losCalculation";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -720,7 +719,7 @@ bool ShootbackController::lineOfSight(const Core::GeoPosition &observerPos, cons
|
||||
|
||||
if (!success)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << " calculate failed:"
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " calculate failed:"
|
||||
<< " observerPos=" << observerPos
|
||||
<< " targetPos=" << targetPos;
|
||||
return false;
|
||||
|
||||
@@ -61,6 +61,7 @@ protected Q_SLOTS:
|
||||
void onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &posData, DataModification modType);
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool participantPositionTopicIsValid(const ParticipantManagement::ParticipantPosition &posData);
|
||||
bool isTarget(qint32 participantId, bool &bIsTarget) const;
|
||||
|
||||
|
||||
Reference in new issue
Block a user