Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+8
-8
@@ -32,7 +32,7 @@ bool BiteHandler::init()
|
||||
void BiteHandler::onDemandBiteReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
if (replyObject.error())
|
||||
WARNING_LOG() << "Got an demandBiteError: " << replyObject();
|
||||
WARNING_LOG(m_logger) << "Got an demandBiteError: " << replyObject();
|
||||
|
||||
auto it = m_demandedBiteParticipantRequests.find(replyObject.id());
|
||||
if (it != m_demandedBiteParticipantRequests.end())
|
||||
@@ -45,17 +45,17 @@ void BiteHandler::onDemandBiteReply(const Core::FunctionReplyObject &replyObject
|
||||
m_demandedBiteParticipantRequests.erase(it);
|
||||
}
|
||||
else
|
||||
WARNING_LOG() << "Bite request with request id " << replyObject.id() << " was not replied to by the proxy";
|
||||
WARNING_LOG(m_logger) << "Bite request with request id " << replyObject.id() << " was not replied to by the proxy";
|
||||
}
|
||||
|
||||
void BiteHandler::onCallBiteRequest(const rti::core::SampleIdentity &cookie,
|
||||
const CallBiteRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onCallBiteRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onCallBiteRequest: " << request;
|
||||
auto ret = callBiteRequest(cookie, request);
|
||||
if (ret.error() || ret.id())
|
||||
{
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->fts()->callBiteReply(cookie, ret);
|
||||
}
|
||||
// delayed answer in non-error case
|
||||
@@ -75,7 +75,7 @@ Core::FunctionReplyObject BiteHandler::callBiteRequest(const rti::core::SampleId
|
||||
{
|
||||
if (m_demandedBiteParticipants.contains(participantId))
|
||||
{
|
||||
DEBUG_LOG() << "demandBiteRequest for participant Id "
|
||||
DEBUG_LOG(m_logger) << "demandBiteRequest for participant Id "
|
||||
<< participantId
|
||||
<< " already triggered - reply is still to be done";
|
||||
bAlreadyDemandedFound = true;
|
||||
@@ -85,12 +85,12 @@ Core::FunctionReplyObject BiteHandler::callBiteRequest(const rti::core::SampleId
|
||||
const ParticipantHandling::Participant *participant = m_mainHandler->participantHandler()->participantById(participantId);
|
||||
if (participant == nullptr)
|
||||
{
|
||||
WARNING_LOG() << "Got BITE request for non existing participant id " << participantId;
|
||||
WARNING_LOG(m_logger) << "Got BITE request for non existing participant id " << participantId;
|
||||
continue;
|
||||
}
|
||||
if (participant->equipmentNumber() == 0)
|
||||
{
|
||||
WARNING_LOG() << "Got BITE request participant id " << participantId << " but has no equipment number set";
|
||||
WARNING_LOG(m_logger) << "Got BITE request participant id " << participantId << " but has no equipment number set";
|
||||
continue;
|
||||
}
|
||||
bOneFound = true;
|
||||
@@ -134,7 +134,7 @@ Core::FunctionReplyObject BiteHandler::callBiteRequest(const rti::core::SampleId
|
||||
|
||||
void BiteHandler::onBiteRequestTimeout(int requestId)
|
||||
{
|
||||
INFO_LOG() << "onBiteRequestTimeout for " << requestId;
|
||||
INFO_LOG(m_logger) << "onBiteRequestTimeout for " << requestId;
|
||||
|
||||
onDemandBiteReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
|
||||
}
|
||||
|
||||
+7
-7
@@ -26,13 +26,13 @@ bool ParticipantManagement::EquipmentEventHandling::EquipmentEventHandler::init(
|
||||
{
|
||||
if (!m_mainHandler->tabDtc()->enableEquipmentEvent())
|
||||
{
|
||||
ERROR_LOG() << " TAB Dtc enableEquipmentEvent() failed !";
|
||||
ERROR_LOG(m_logger) << " TAB Dtc enableEquipmentEvent() failed !";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_mainHandler->dts()->enableEquipmentSystemEventFtcReply())
|
||||
{
|
||||
ERROR_LOG() << " Dts enableEquipmentSystemEventDataFtcReply() failed !";
|
||||
ERROR_LOG(m_logger) << " Dts enableEquipmentSystemEventDataFtcReply() failed !";
|
||||
return false;
|
||||
}
|
||||
connect(m_mainHandler->tabDtc().get(), &TrainingAreaBase::Interface::Dtc::equipmentEventChanged, this, &EquipmentEventHandler::onEquipmentEventChanged);
|
||||
@@ -43,7 +43,7 @@ bool ParticipantManagement::EquipmentEventHandling::EquipmentEventHandler::init(
|
||||
void ParticipantManagement::EquipmentEventHandling::EquipmentEventHandler::onEquipmentSystemEventDataRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ParticipantManagement::EquipmentSystemEventDataRequest &request)
|
||||
{
|
||||
INFO_LOG() << "IN onEquipmentSystemEventDataRequest";
|
||||
INFO_LOG(m_logger) << "IN onEquipmentSystemEventDataRequest";
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
|
||||
@@ -58,13 +58,13 @@ void ParticipantManagement::EquipmentEventHandling::EquipmentEventHandler::onEqu
|
||||
if (request.deviceSpecificEventCode() > -1)
|
||||
stmt += QStringLiteral(" AND device_specific_event_code=") + QString::number(request.deviceSpecificEventCode());
|
||||
|
||||
INFO_LOG() << "stmt: " << stmt;
|
||||
INFO_LOG(m_logger) << "stmt: " << stmt;
|
||||
|
||||
NSqlQuery q(m_mainHandler->db()->database());
|
||||
if (!q.exec(stmt))
|
||||
{
|
||||
ERROR_LOG() << "Error while selecting event-data ";
|
||||
ERROR_LOG() << "stmt : " << stmt;
|
||||
ERROR_LOG(m_logger) << "Error while selecting event-data ";
|
||||
ERROR_LOG(m_logger) << "stmt : " << stmt;
|
||||
ret.setStr("Error while selecting data");
|
||||
m_mainHandler->fts()->equipmentSystemEventDataReply(cookie, ret);
|
||||
return;
|
||||
@@ -132,7 +132,7 @@ void ParticipantManagement::EquipmentEventHandling::EquipmentEventHandler::onEqu
|
||||
|
||||
if (!m_mainHandler->dts()->publish(event))
|
||||
{
|
||||
ERROR_LOG() << "Error publishing equipment event to dds from eqnr: " << event.equipmentNumber() ;
|
||||
ERROR_LOG(m_logger) << "Error publishing equipment event to dds from eqnr: " << event.equipmentNumber() ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+57
-57
@@ -37,7 +37,7 @@ ParticipantManagement::PpmTests::~PpmTests()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::startTest()
|
||||
{
|
||||
INFO_LOG() << "********* startTest **************";
|
||||
INFO_LOG(m_logger) << "********* startTest **************";
|
||||
switch (m_testId)
|
||||
{
|
||||
case 1:
|
||||
@@ -83,14 +83,14 @@ void ParticipantManagement::PpmTests::startTest()
|
||||
failExit();
|
||||
break;
|
||||
}
|
||||
INFO_LOG() << "********* endTest **************";
|
||||
INFO_LOG(m_logger) << "********* endTest **************";
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
bool ParticipantManagement::PpmTests::init(int domainId, int exerciseId, int testId, int partyId, int typeId, int equipmentId, int participantId)
|
||||
{
|
||||
INFO_LOG() << "init begin";
|
||||
INFO_LOG(m_logger) << "init begin";
|
||||
|
||||
m_testId = testId;
|
||||
m_partyId = partyId;
|
||||
@@ -107,22 +107,22 @@ bool ParticipantManagement::PpmTests::init(int domainId, int exerciseId, int tes
|
||||
return false;
|
||||
m_ddsConnector->initPublisherSubscriber();
|
||||
|
||||
DEBUG_LOG() << "create DTC PPM";
|
||||
DEBUG_LOG(m_logger) << "create DTC PPM";
|
||||
m_dtc = ParticipantManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
DEBUG_LOG() << "init DTC PPM";
|
||||
DEBUG_LOG(m_logger) << "init DTC PPM";
|
||||
bool bRet = m_dtc->enableAll();
|
||||
|
||||
DEBUG_LOG() << "create FTC PPM";
|
||||
DEBUG_LOG(m_logger) << "create FTC PPM";
|
||||
m_ftc = ParticipantManagement::Interface::Ftc::create(m_ddsConnector);
|
||||
DEBUG_LOG() << "init FTC PPM";
|
||||
DEBUG_LOG(m_logger) << "init FTC PPM";
|
||||
bRet &= m_ftc->enableAll();
|
||||
DEBUG_LOG() << "init end PPM - bRet = " << bRet;
|
||||
DEBUG_LOG(m_logger) << "init end PPM - bRet = " << bRet;
|
||||
|
||||
DEBUG_LOG() << "Domain Id = " << domainId;
|
||||
DEBUG_LOG() << "Test Id = " << testId;
|
||||
DEBUG_LOG() << "Party Id = " << partyId;
|
||||
DEBUG_LOG() << "Type Id = " << typeId;
|
||||
DEBUG_LOG() << "Equipment Id = " << equipmentId;
|
||||
DEBUG_LOG(m_logger) << "Domain Id = " << domainId;
|
||||
DEBUG_LOG(m_logger) << "Test Id = " << testId;
|
||||
DEBUG_LOG(m_logger) << "Party Id = " << partyId;
|
||||
DEBUG_LOG(m_logger) << "Type Id = " << typeId;
|
||||
DEBUG_LOG(m_logger) << "Equipment Id = " << equipmentId;
|
||||
|
||||
return bRet;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ bool ParticipantManagement::PpmTests::init(int domainId, int exerciseId, int tes
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::tryCreateTemplate()
|
||||
{
|
||||
INFO_LOG() << "Trying to send Create Template";
|
||||
INFO_LOG(m_logger) << "Trying to send Create Template";
|
||||
|
||||
std::vector<ParticipantManagement::TemplateData> data;
|
||||
|
||||
@@ -148,13 +148,13 @@ void ParticipantManagement::PpmTests::tryCreateTemplate()
|
||||
m_dtc->waitForHistoricalDataTemplateParticipant();
|
||||
ParticipantManagement::TemplateParticipant tp = m_dtc->templateParticipant(1);
|
||||
const ParticipantManagement::TemplateData tdSup(m_dtc->convertFromParticipantTemplateToTemplateData(tp));
|
||||
DEBUG_LOG() << "SuperiorModId: " << tdSup.modId();
|
||||
DEBUG_LOG(m_logger) << "SuperiorModId: " << tdSup.modId();
|
||||
|
||||
data.push_back(tdSup);
|
||||
|
||||
if (!m_ftc->modifyTemplateDataRequest(ModifyTemplateDataRequest(data),this))
|
||||
{
|
||||
ERROR_LOG() << "Error creating template data";
|
||||
ERROR_LOG(m_logger) << "Error creating template data";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(1000);
|
||||
@@ -164,7 +164,7 @@ void ParticipantManagement::PpmTests::tryCreateTemplate()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::tryCreateParticipant()
|
||||
{
|
||||
INFO_LOG() << "Trying to send Create ParticipantData per ModifyParticipantData";
|
||||
INFO_LOG(m_logger) << "Trying to send Create ParticipantData per ModifyParticipantData";
|
||||
|
||||
ParticipantManagement::ParticipantData ptd;
|
||||
ptd.modId(1);
|
||||
@@ -182,7 +182,7 @@ void ParticipantManagement::PpmTests::tryCreateParticipant()
|
||||
|
||||
if (!m_ftc->modifyParticipantDataRequest(req,this))
|
||||
{
|
||||
ERROR_LOG() << "Error creating participant data";
|
||||
ERROR_LOG(m_logger) << "Error creating participant data";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(1000);
|
||||
@@ -192,7 +192,7 @@ void ParticipantManagement::PpmTests::tryCreateParticipant()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::tryUpdateInfoParticipant()
|
||||
{
|
||||
INFO_LOG() << "Trying to send update info per registerForParticantRequest";
|
||||
INFO_LOG(m_logger) << "Trying to send update info per registerForParticantRequest";
|
||||
|
||||
ParticipantManagement::RegisterParticipantRequest rpr;
|
||||
rpr.participantId(m_participantId);
|
||||
@@ -203,7 +203,7 @@ void ParticipantManagement::PpmTests::tryUpdateInfoParticipant()
|
||||
|
||||
if (!m_ftc->registerParticipantRequest(rpr,this))
|
||||
{
|
||||
ERROR_LOG() << "Error updating info/identification for participant";
|
||||
ERROR_LOG(m_logger) << "Error updating info/identification for participant";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(1000);
|
||||
@@ -212,7 +212,7 @@ void ParticipantManagement::PpmTests::tryUpdateInfoParticipant()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::tryRegisterParticipant()
|
||||
{
|
||||
INFO_LOG() << "Trying to send registerForParticantRequest";
|
||||
INFO_LOG(m_logger) << "Trying to send registerForParticantRequest";
|
||||
|
||||
ParticipantManagement::RegisterParticipantRequest rpr;
|
||||
rpr.participantId(m_participantId);
|
||||
@@ -223,7 +223,7 @@ void ParticipantManagement::PpmTests::tryRegisterParticipant()
|
||||
|
||||
if (!m_ftc->registerParticipantRequest(rpr,this))
|
||||
{
|
||||
ERROR_LOG() << "Error updating info/identification for participant";
|
||||
ERROR_LOG(m_logger) << "Error updating info/identification for participant";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(1000);
|
||||
@@ -232,7 +232,7 @@ void ParticipantManagement::PpmTests::tryRegisterParticipant()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
{
|
||||
INFO_LOG() << "Trying to Create Party per ModifyPartyData";
|
||||
INFO_LOG(m_logger) << "Trying to Create Party per ModifyPartyData";
|
||||
|
||||
ParticipantManagement::Party party;
|
||||
|
||||
@@ -251,7 +251,7 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
ERROR_LOG() << "Error creating party data";
|
||||
ERROR_LOG(m_logger) << "Error creating party data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
ERROR_LOG() << "Error creating party data";
|
||||
ERROR_LOG(m_logger) << "Error creating party data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
ERROR_LOG() << "Error creating party data";
|
||||
ERROR_LOG(m_logger) << "Error creating party data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
ERROR_LOG() << "Error creating party data";
|
||||
ERROR_LOG(m_logger) << "Error creating party data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::tryModifyParty()
|
||||
{
|
||||
INFO_LOG() << "Trying to send Modify PartyData per ModifyPartyData";
|
||||
INFO_LOG(m_logger) << "Trying to send Modify PartyData per ModifyPartyData";
|
||||
|
||||
ParticipantManagement::Party party;
|
||||
|
||||
@@ -324,7 +324,7 @@ void ParticipantManagement::PpmTests::tryModifyParty()
|
||||
party = m_dtc->party(m_partyId);
|
||||
if (party.id() < 0)
|
||||
{
|
||||
ERROR_LOG() << "Party not found: id = " << m_partyId;
|
||||
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ void ParticipantManagement::PpmTests::tryModifyParty()
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
ERROR_LOG() << "Error modifying party data";
|
||||
ERROR_LOG(m_logger) << "Error modifying party data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ void ParticipantManagement::PpmTests::tryModifyParty()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::tryRemoveParty()
|
||||
{
|
||||
INFO_LOG() << "Trying to send RemoveParty";
|
||||
INFO_LOG(m_logger) << "Trying to send RemoveParty";
|
||||
|
||||
ParticipantManagement::Party party;
|
||||
|
||||
@@ -356,7 +356,7 @@ void ParticipantManagement::PpmTests::tryRemoveParty()
|
||||
party = m_dtc->party(m_partyId);
|
||||
if (party.id() < 0)
|
||||
{
|
||||
ERROR_LOG() << "Party not found: id = " << m_partyId;
|
||||
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -367,12 +367,12 @@ void ParticipantManagement::PpmTests::tryRemoveParty()
|
||||
{
|
||||
if (party.isUsedBy())
|
||||
{
|
||||
INFO_LOG() << "Not possible to delete used party!" ;
|
||||
INFO_LOG(m_logger) << "Not possible to delete used party!" ;
|
||||
successExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG() << "Failed to delete not used party with id " << m_partyId;
|
||||
ERROR_LOG(m_logger) << "Failed to delete not used party with id " << m_partyId;
|
||||
failExit();
|
||||
}
|
||||
}
|
||||
@@ -383,14 +383,14 @@ void ParticipantManagement::PpmTests::tryRemoveParty()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::trySyncParties()
|
||||
{
|
||||
INFO_LOG() << "Trying to sync parties with Ex 0";
|
||||
INFO_LOG(m_logger) << "Trying to sync parties with Ex 0";
|
||||
|
||||
SyncPartiesRequest req;
|
||||
req.exerciseId(42);
|
||||
|
||||
if (!m_ftc->syncPartiesRequest(req, this))
|
||||
{
|
||||
ERROR_LOG() << "Error sync parties";
|
||||
ERROR_LOG(m_logger) << "Error sync parties";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ void ParticipantManagement::PpmTests::trySyncParties()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::tryChangeUsed()
|
||||
{
|
||||
INFO_LOG() << "Trying to send change used";
|
||||
INFO_LOG(m_logger) << "Trying to send change used";
|
||||
|
||||
ParticipantManagement::Party party;
|
||||
|
||||
@@ -408,7 +408,7 @@ void ParticipantManagement::PpmTests::tryChangeUsed()
|
||||
party = m_dtc->party(m_partyId);
|
||||
if (party.id() < 0)
|
||||
{
|
||||
ERROR_LOG() << "Party not found: id = " << m_partyId;
|
||||
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ void ParticipantManagement::PpmTests::tryChangeUsed()
|
||||
|
||||
if (!m_ftc->changePartyUsedStateRequest(req, this))
|
||||
{
|
||||
ERROR_LOG() << "Error modifying used party";
|
||||
ERROR_LOG(m_logger) << "Error modifying used party";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ void ParticipantManagement::PpmTests::tryChangeUsed()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::tryCreateEquipmentType()
|
||||
{
|
||||
INFO_LOG() << "Trying to send Create EquipmentType per ModifyEquipmentTypeDataRequest";
|
||||
INFO_LOG(m_logger) << "Trying to send Create EquipmentType per ModifyEquipmentTypeDataRequest";
|
||||
|
||||
ParticipantManagement::EquipmentType etd;
|
||||
etd.id(1);
|
||||
@@ -446,7 +446,7 @@ void ParticipantManagement::PpmTests::tryCreateEquipmentType()
|
||||
|
||||
if (!m_ftc->modifyEquipmentTypeDataRequest(ModifyEquipmentTypeDataRequest(data, false),this))
|
||||
{
|
||||
ERROR_LOG() << "Error creating equipment type data";
|
||||
ERROR_LOG(m_logger) << "Error creating equipment type data";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(1000);
|
||||
@@ -456,7 +456,7 @@ void ParticipantManagement::PpmTests::tryCreateEquipmentType()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::tryCreateType()
|
||||
{
|
||||
INFO_LOG() << "Trying to send CreateTypeRequest";
|
||||
INFO_LOG(m_logger) << "Trying to send CreateTypeRequest";
|
||||
|
||||
if (!m_ftc->modifyTypeRequest(Type(0,
|
||||
ParticipantManagement::TypeClass::SupportEntity,
|
||||
@@ -469,7 +469,7 @@ void ParticipantManagement::PpmTests::tryCreateType()
|
||||
{}, std::string()),
|
||||
this))
|
||||
{
|
||||
ERROR_LOG() << "Error creating type data";
|
||||
ERROR_LOG(m_logger) << "Error creating type data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ void ParticipantManagement::PpmTests::tryCreateType()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::tryModifyType()
|
||||
{
|
||||
INFO_LOG() << "Trying to send ModifyTypeRequest";
|
||||
INFO_LOG(m_logger) << "Trying to send ModifyTypeRequest";
|
||||
|
||||
if (!m_ftc->modifyTypeRequest(Type(m_typeId,
|
||||
ParticipantManagement::TypeClass::SupportEntity,
|
||||
@@ -492,7 +492,7 @@ void ParticipantManagement::PpmTests::tryModifyType()
|
||||
{}, std::string()),
|
||||
this))
|
||||
{
|
||||
ERROR_LOG() << "Error modifying type data";
|
||||
ERROR_LOG(m_logger) << "Error modifying type data";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(1000);
|
||||
@@ -501,11 +501,11 @@ void ParticipantManagement::PpmTests::tryModifyType()
|
||||
//--------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::tryRemoveType()
|
||||
{
|
||||
INFO_LOG() << "Trying to send RemoveTypeRequest";
|
||||
INFO_LOG(m_logger) << "Trying to send RemoveTypeRequest";
|
||||
|
||||
if (!m_ftc->removeTypeRequest(RemoveTypeRequest(m_typeId), this))
|
||||
{
|
||||
ERROR_LOG() << "Error modifying type data";
|
||||
ERROR_LOG(m_logger) << "Error modifying type data";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(1000);
|
||||
@@ -515,7 +515,7 @@ void ParticipantManagement::PpmTests::tryRemoveType()
|
||||
// ------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::onError(const QString &reason)
|
||||
{
|
||||
ERROR_LOG() << "Got Reply error: " << reason;
|
||||
ERROR_LOG(m_logger) << "Got Reply error: " << reason;
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -527,7 +527,7 @@ void ParticipantManagement::PpmTests::onCreateReply(const Core::FunctionReplyObj
|
||||
onError(replyObject.translated());
|
||||
return;
|
||||
}
|
||||
INFO_LOG() << "Got createReply with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got createReply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
@@ -540,7 +540,7 @@ void ParticipantManagement::PpmTests::onModifyReply(const Core::FunctionReplyObj
|
||||
onError(replyObject.translated());
|
||||
return;
|
||||
}
|
||||
INFO_LOG() << "Got modifyRequest with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got modifyRequest with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
@@ -553,7 +553,7 @@ void ParticipantManagement::PpmTests::onRemoveReply(const Core::FunctionReplyObj
|
||||
onError(replyObject.translated());
|
||||
return;
|
||||
}
|
||||
INFO_LOG() << "Got removeReply with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got removeReply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
@@ -566,7 +566,7 @@ void ParticipantManagement::PpmTests::onSyncPartiesReply(const Core::FunctionRep
|
||||
onError(replyObject.translated());
|
||||
return;
|
||||
}
|
||||
INFO_LOG() << "Got syncParties with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got syncParties with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
@@ -585,22 +585,22 @@ void ParticipantManagement::PpmTests::onRemovePartyReply(const Core::FunctionRep
|
||||
onError(replyObject.translated());
|
||||
return;
|
||||
}
|
||||
INFO_LOG() << "Got removeReply with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got removeReply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
|
||||
void ParticipantManagement::PpmTests::onRegisterParticipantReply(const RegisterReply &reply)
|
||||
{
|
||||
ERROR_LOG() << "onRegisterParticipantReply " << reply.errorString() << "exerciseId: " << reply.exerciseId();
|
||||
ERROR_LOG(m_logger) << "onRegisterParticipantReply " << reply.errorString() << "exerciseId: " << reply.exerciseId();
|
||||
for ( std::string str : reply.errorParams())
|
||||
ERROR_LOG() << "error params: " << str;
|
||||
ERROR_LOG(m_logger) << "error params: " << str;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::failExit()
|
||||
{
|
||||
ERROR_LOG() << "FAIL EXIT !";
|
||||
ERROR_LOG(m_logger) << "FAIL EXIT !";
|
||||
m_bTestsSuccessful = false;
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
@@ -608,7 +608,7 @@ void ParticipantManagement::PpmTests::failExit()
|
||||
// ------------------------------------------------------------------------------
|
||||
void ParticipantManagement::PpmTests::successExit()
|
||||
{
|
||||
INFO_LOG() << "SUCCESS EXIT !";
|
||||
INFO_LOG(m_logger) << "SUCCESS EXIT !";
|
||||
m_bTestsSuccessful = true;
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ GetParticipants::~GetParticipants()
|
||||
void GetParticipants::onGetParticipantsRequest(const rti::core::SampleIdentity &cookie,
|
||||
const GetParticipantsRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onGetParticipantsRequest" << request;
|
||||
DEBUG_LOG(m_logger) << "onGetParticipantsRequest" << request;
|
||||
|
||||
|
||||
// Initialize RecordReplay to get initial participants
|
||||
@@ -54,7 +54,7 @@ void GetParticipants::onGetParticipantsRequest(const rti::core::SampleIdentity &
|
||||
participants[p.id()] = std::move(p);
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "Starting to read participant from record replay. Size: "
|
||||
DEBUG_LOG(m_logger) << "Starting to read participant from record replay. Size: "
|
||||
<< participants.size();
|
||||
|
||||
GetParticipantsReply reply;
|
||||
|
||||
+2
@@ -21,10 +21,12 @@ public:
|
||||
~GetParticipants();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onGetParticipantsRequest(const rti::core::SampleIdentity &cookie,
|
||||
const GetParticipantsRequest &request) override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
MainHandler *m_mainHandler;
|
||||
};
|
||||
}
|
||||
+23
-23
@@ -124,7 +124,7 @@ bool Participant::setPosition(const TrainingAreaBase::EquipmentPosition &newPosi
|
||||
|
||||
if (!mountedParticipant)
|
||||
{
|
||||
WARNING_LOG() << "Mounted Participant with equipNo " << mountedEqId << " not found - ignoring";
|
||||
WARNING_LOG(m_logger) << "Mounted Participant with equipNo " << mountedEqId << " not found - ignoring";
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ bool Participant::setPosition(const TrainingAreaBase::EquipmentPosition &newPosi
|
||||
mountedParticipant->publishPosition();
|
||||
|
||||
newMountedParticipantIds.push_back(mountedParticipant->id());
|
||||
INFO_LOG() << "Mounting Participant with id: " << mountedParticipant->id() << " to id: " << id();
|
||||
INFO_LOG(m_logger) << "Mounting Participant with id: " << mountedParticipant->id() << " to id: " << id();
|
||||
}
|
||||
|
||||
// unmount current mounted participants that are not in the list anymore
|
||||
@@ -164,7 +164,7 @@ bool Participant::setPosition(const ParticipantPosition &newPosition, bool bForc
|
||||
{
|
||||
if (!bForce && !isValidPosition(newPosition.sampleTime(), newPosition.pos(), newPosition.reportingSource()))
|
||||
{
|
||||
WARNING_LOG() << "position for participant " << m_participantData.id()
|
||||
WARNING_LOG(m_logger) << "position for participant " << m_participantData.id()
|
||||
<< " is outdated: " << newPosition
|
||||
<< " , cur pos sample time: " << m_positionPublished.sampleTime();
|
||||
return false;
|
||||
@@ -188,7 +188,7 @@ bool Participant::setPosition(const TrainingAreaBase::EquipmentPosition &newPosi
|
||||
{
|
||||
if (mountedToId == id())
|
||||
{
|
||||
WARNING_LOG() << "Trying to mount to ourself: " << id();
|
||||
WARNING_LOG(m_logger) << "Trying to mount to ourself: " << id();
|
||||
return false;
|
||||
}
|
||||
TrainingAreaBase::EquipmentPosition mountedPosition = newPosition;
|
||||
@@ -213,7 +213,7 @@ void Participant::unmountParticipantById(const TrainingAreaBase::EquipmentPositi
|
||||
Participant *unmountedParticipant = particpantHandler()->participantById(id);
|
||||
unmountedParticipant->setPosition(newPosition, 0);
|
||||
unmountedParticipant->publishPosition();
|
||||
INFO_LOG() << "Unmounting Participant with ID: " << unmountedParticipant->id() << "from ID: " << this->id();
|
||||
INFO_LOG(m_logger) << "Unmounting Participant with ID: " << unmountedParticipant->id() << "from ID: " << this->id();
|
||||
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ bool Participant::setState(const TrainingAreaBase::EquipmentState &newState, int
|
||||
if (bits.test(i))
|
||||
{
|
||||
mainVulState = static_cast<ProjectDataManagement::VulnerabilityState_def::type>(i);
|
||||
//WARNING_LOG() << "mainVulState was manipulated into: " << i;
|
||||
//WARNING_LOG(m_logger) << "mainVulState was manipulated into: " << i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -267,9 +267,9 @@ bool Participant::setState(const TrainingAreaBase::EquipmentState &newState, int
|
||||
|
||||
// if mainVulnState *still* is BC (VBG12), something went wrong on the sender side (TNE?)
|
||||
if (mainVulState == ProjectDataManagement::VulnerabilityState::VulnerabilityBitsChanged)
|
||||
WARNING_LOG() << "Sending a BC (VBG12) if the last vuln is CR (VBG0) is not allowed! Something went wrong on the sender side (TNE?)";
|
||||
WARNING_LOG(m_logger) << "Sending a BC (VBG12) if the last vuln is CR (VBG0) is not allowed! Something went wrong on the sender side (TNE?)";
|
||||
|
||||
DEBUG_LOG() << "setState for eqid: " << newState.equipmentNumber()
|
||||
DEBUG_LOG(m_logger) << "setState for eqid: " << newState.equipmentNumber()
|
||||
<< "\nvuln was: " << (int)newState.vulnerabilityState().underlying()
|
||||
<< "\nvuln now: " << (int)mainVulState.underlying()
|
||||
<< "\nbits (DEC): " << newState.vulnerabilityBits()
|
||||
@@ -283,7 +283,7 @@ bool Participant::setState(const TrainingAreaBase::EquipmentState &newState, int
|
||||
{
|
||||
const int idx = static_cast<int>(mainVulState.underlying());
|
||||
vulnerabilityBits = (1 << idx);
|
||||
WARNING_LOG() << "Missing vulnerabilityBits! bailing by supplementing by adding this vuln state to the bits";
|
||||
WARNING_LOG(m_logger) << "Missing vulnerabilityBits! bailing by supplementing by adding this vuln state to the bits";
|
||||
}
|
||||
|
||||
// check if it is a (younger) CombatReady state - remove older
|
||||
@@ -318,7 +318,7 @@ bool Participant::setState(const TrainingAreaBase::EquipmentState &newState, int
|
||||
if (newState.originatorId() > 255)
|
||||
{
|
||||
|
||||
WARNING_LOG() << "Participant with EqNo "
|
||||
WARNING_LOG(m_logger) << "Participant with EqNo "
|
||||
<< m_participantData.equipmentNumber()
|
||||
<< " sent wrong Enum Values (Sanitation Eval / ~ Result): "
|
||||
<< newState.originatorId()
|
||||
@@ -330,12 +330,12 @@ bool Participant::setState(const TrainingAreaBase::EquipmentState &newState, int
|
||||
|
||||
if (sanEvaluationVal > 2) // Todo: Check against valid enum values in a better way!
|
||||
{
|
||||
WARNING_LOG() << "Cannot cast upper 2 Bits to SanEvaluation! Defaulting to Okay";
|
||||
WARNING_LOG(m_logger) << "Cannot cast upper 2 Bits to SanEvaluation! Defaulting to Okay";
|
||||
sanEvaluationVal = 0;
|
||||
}
|
||||
if (sanResultVal > 4) // Todo: Check against valid enum values in a better way!
|
||||
{
|
||||
WARNING_LOG() << "Cannot cast lower 6 Bits to SanResult! Defaulting to Unhandled";
|
||||
WARNING_LOG(m_logger) << "Cannot cast lower 6 Bits to SanResult! Defaulting to Unhandled";
|
||||
sanResultVal = 1;
|
||||
}
|
||||
sanEvaluation = static_cast<SanitationEvaluation::inner_enum>(sanEvaluationVal);
|
||||
@@ -408,7 +408,7 @@ bool Participant::setSpecialSensorData(const TrainingAreaBase::SpecialSensorData
|
||||
|
||||
bool Participant::setGear(const TrainingAreaBase::EquipmentGearAssignment &gearAssignment)
|
||||
{
|
||||
DEBUG_LOG() << "Gear Assignment";
|
||||
DEBUG_LOG(m_logger) << "Gear Assignment";
|
||||
// outdated?
|
||||
if (m_lastGearUsage > gearAssignment.sampleTime())
|
||||
return false;
|
||||
@@ -426,7 +426,7 @@ bool Participant::setGear(const TrainingAreaBase::EquipmentGearAssignment &gearA
|
||||
{
|
||||
if (gear.gearId() == 0)
|
||||
{
|
||||
WARNING_LOG() << "Got a gear assignment but gear id is 0 - old Saab AGDUS? - ignoring";
|
||||
WARNING_LOG(m_logger) << "Got a gear assignment but gear id is 0 - old Saab AGDUS? - ignoring";
|
||||
continue;
|
||||
}
|
||||
newGearIds += gear.gearId();
|
||||
@@ -444,7 +444,7 @@ bool Participant::setGear(const TrainingAreaBase::EquipmentGearAssignment &gearA
|
||||
++it;
|
||||
else
|
||||
{
|
||||
DEBUG_LOG() << "Gear Assignment: Removing Designation with gearId: " << it->gearId();
|
||||
DEBUG_LOG(m_logger) << "Gear Assignment: Removing Designation with gearId: " << it->gearId();
|
||||
it = m_dynamicData.designations().erase(it);
|
||||
}
|
||||
}
|
||||
@@ -649,10 +649,10 @@ bool Participant::setGearCharge(const GearInformation &gearInfo)
|
||||
if (bAdjustTurretInfo)
|
||||
{
|
||||
int substr = m_dynamicData.gear()[index_wanne].remain();
|
||||
INFO_LOG() << "Adjust Turret - substracting index wanne " << substr;
|
||||
INFO_LOG(m_logger) << "Adjust Turret - substracting index wanne " << substr;
|
||||
if (gi.remain() >= substr)
|
||||
gi.remain() = gi.remain() - m_dynamicData.gear()[index_wanne].remain();
|
||||
INFO_LOG() << "Turret remain " << gi.remain();
|
||||
INFO_LOG(m_logger) << "Turret remain " << gi.remain();
|
||||
gi.gearId(2);
|
||||
}
|
||||
if (gearInfo.chargeCounting())
|
||||
@@ -705,7 +705,7 @@ bool Participant::isNewAssignStateValid(const ParticipantAssignState &newAssignS
|
||||
case ParticipantAssignState::NotAssigned:
|
||||
if (equipmentNumber)
|
||||
{
|
||||
WARNING_LOG() << "Not assigned, but equipmentnumber is set";
|
||||
WARNING_LOG(m_logger) << "Not assigned, but equipmentnumber is set";
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@@ -715,7 +715,7 @@ bool Participant::isNewAssignStateValid(const ParticipantAssignState &newAssignS
|
||||
// equipment number changed -> allow
|
||||
if (oldAssignState == ParticipantAssignState::AssignedWms && equipmentNumber != 0)
|
||||
return true;
|
||||
WARNING_LOG() << "Now assigned from WMS, but no equipmentnumber or old assign state != NotAssigned: "
|
||||
WARNING_LOG(m_logger) << "Now assigned from WMS, but no equipmentnumber or old assign state != NotAssigned: "
|
||||
<< equipmentNumber << ", " << newAssignState << ", " << oldAssignState;
|
||||
return false;
|
||||
}
|
||||
@@ -730,7 +730,7 @@ bool Participant::isNewAssignStateValid(const ParticipantAssignState &newAssignS
|
||||
// equipment number changed -> allow
|
||||
if (oldAssignState == ParticipantAssignState::HandoutWms && equipmentNumber != 0)
|
||||
return true;
|
||||
WARNING_LOG() << "Now assigned from WMS (handout), but no equipmentnumber or old assign state != NotAssigned/AssignedWms: "
|
||||
WARNING_LOG(m_logger) << "Now assigned from WMS (handout), but no equipmentnumber or old assign state != NotAssigned/AssignedWms: "
|
||||
<< equipmentNumber << ", " << newAssignState << ", " << oldAssignState;
|
||||
return false;
|
||||
}
|
||||
@@ -747,7 +747,7 @@ bool Participant::isNewAssignStateValid(const ParticipantAssignState &newAssignS
|
||||
// Assign state HandoutExcon + equipmentNumber = 0 -> reserved participant for EXCON in WH (WH must not touch it)
|
||||
if (equipmentNumber == 0)
|
||||
return true;
|
||||
WARNING_LOG() << "Now assigned from EXCON, but no equipmentnumber or old assign state != NotAssigned: "
|
||||
WARNING_LOG(m_logger) << "Now assigned from EXCON, but no equipmentnumber or old assign state != NotAssigned: "
|
||||
<< equipmentNumber << ", " << newAssignState << ", " << oldAssignState;
|
||||
return false;
|
||||
}
|
||||
@@ -762,7 +762,7 @@ bool Participant::isNewAssignStateValid(const ParticipantAssignState &newAssignS
|
||||
oldAssignState != ParticipantAssignState::HandoutWms &&
|
||||
equipmentNumber != 0)
|
||||
{
|
||||
WARNING_LOG() << "Now assigned from ExconWmsOverruled, old assign state != AssignedWms or != HandoutWms or equipment number is set: "
|
||||
WARNING_LOG(m_logger) << "Now assigned from ExconWmsOverruled, old assign state != AssignedWms or != HandoutWms or equipment number is set: "
|
||||
<< equipmentNumber << ", " << newAssignState << ", " << oldAssignState;
|
||||
return false;
|
||||
}
|
||||
@@ -789,7 +789,7 @@ bool Participant::hasToBeChanged(const ParticipantManagement::Participant &data)
|
||||
|
||||
bool Participant::hasToBeChanged(const ParticipantManagement::ParticipantBase &data)
|
||||
{
|
||||
DEBUG_LOG() << "hasToBeChanged: " << data;
|
||||
DEBUG_LOG(m_logger) << "hasToBeChanged: " << data;
|
||||
ParticipantManagement::ParticipantBase &curData = m_participantData;
|
||||
bool hasChanges = (curData != data);
|
||||
|
||||
|
||||
+70
-70
@@ -62,7 +62,7 @@ bool ParticipantHandler::init()
|
||||
|
||||
if (!m_webSocketHandler->init(Settings::getWebSocketServerPortRange(2)))
|
||||
{
|
||||
ERROR_LOG() << "could not init websockethandler";
|
||||
ERROR_LOG(m_logger) << "could not init websockethandler";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -71,14 +71,14 @@ bool ParticipantHandler::init()
|
||||
|
||||
void ParticipantHandler::setEquipmentNumberForParticipant(int oldEqNo, int newEqNo, int participantId)
|
||||
{
|
||||
DEBUG_LOG() << "setEquipmentNumberForParticipant, old: " << oldEqNo << ", new: " << newEqNo << ", participant: " << participantId;
|
||||
DEBUG_LOG(m_logger) << "setEquipmentNumberForParticipant, old: " << oldEqNo << ", new: " << newEqNo << ", participant: " << participantId;
|
||||
if (oldEqNo > 0)
|
||||
m_equipNumber2ParticipantId.remove(oldEqNo);
|
||||
if (newEqNo > 0)
|
||||
{
|
||||
int &val = m_equipNumber2ParticipantId[newEqNo];
|
||||
if (val != 0 && val != participantId)
|
||||
WARNING_LOG() << "Another participant (" << val << ") already has the equipment number " << newEqNo << " - overriding it with participant "
|
||||
WARNING_LOG(m_logger) << "Another participant (" << val << ") already has the equipment number " << newEqNo << " - overriding it with participant "
|
||||
<< participantId;
|
||||
val = participantId;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ Participant *ParticipantHandler::participantById(int32_t participantId) const {
|
||||
Participant *ParticipantHandler::participantByEquipmentNumber(int32_t equipmentNumber)
|
||||
{
|
||||
const int participantId = m_equipNumber2ParticipantId.value(equipmentNumber);
|
||||
DEBUG_LOG() << " >>>>>> [ParticipantHandler] participantByEquipmentNumber participantId: " << participantId << " | equipNumb: " << equipmentNumber;
|
||||
DEBUG_LOG(m_logger) << " >>>>>> [ParticipantHandler] participantByEquipmentNumber participantId: " << participantId << " | equipNumb: " << equipmentNumber;
|
||||
return participantById(participantId);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ void ParticipantHandler::onNewGearEvent(const TrainingAreaBase::EquipmentGearEve
|
||||
{
|
||||
if (isTelegramInFuture(gearEvent))
|
||||
{
|
||||
WARNING_LOG() << "Got an EquipmentGearEvent which has a timestamp in the future: " << gearEvent.sampleTime();
|
||||
WARNING_LOG(m_logger) << "Got an EquipmentGearEvent which has a timestamp in the future: " << gearEvent.sampleTime();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ void ParticipantHandler::onNewGearEvent(const TrainingAreaBase::EquipmentGearEve
|
||||
Participant *participantToBeChanged = participantByEquipmentNumber(gearEvent.equipmentNumber());
|
||||
if (!participantToBeChanged)
|
||||
{
|
||||
WARNING_LOG() << "Got gear charge state for unknown equipment number " << gearEvent.equipmentNumber();
|
||||
WARNING_LOG(m_logger) << "Got gear charge state for unknown equipment number " << gearEvent.equipmentNumber();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ void ParticipantHandler::onNewGearChargeStateFromProxy(const TrainingAreaBase::E
|
||||
{
|
||||
if (isTelegramInFuture(chargeState))
|
||||
{
|
||||
WARNING_LOG() << "Got an EquipmentGearChargeState which has a timestamp in the future: " << chargeState.sampleTime();
|
||||
WARNING_LOG(m_logger) << "Got an EquipmentGearChargeState which has a timestamp in the future: " << chargeState.sampleTime();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ void ParticipantHandler::onNewGearChargeStateFromProxy(const TrainingAreaBase::E
|
||||
|
||||
if (!participantToBeChanged)
|
||||
{
|
||||
WARNING_LOG() << "Got gear charge state for unknown equipment number " << chargeState.equipmentNumber();
|
||||
WARNING_LOG(m_logger) << "Got gear charge state for unknown equipment number " << chargeState.equipmentNumber();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -149,13 +149,13 @@ void ParticipantHandler::onNewGearAssignmentFromProxy(const TrainingAreaBase::Eq
|
||||
{
|
||||
if (isTelegramInFuture(gearAssignment))
|
||||
{
|
||||
WARNING_LOG() << "Got an EquipmentGearAssignment which has a timestamp in the future: " << gearAssignment.sampleTime();
|
||||
WARNING_LOG(m_logger) << "Got an EquipmentGearAssignment which has a timestamp in the future: " << gearAssignment.sampleTime();
|
||||
return;
|
||||
}
|
||||
Participant *participantToBeChanged = participantByEquipmentNumber(gearAssignment.equipmentNumber());
|
||||
if (!participantToBeChanged)
|
||||
{
|
||||
WARNING_LOG() << "Got gear assignment for unknown equipment number " << gearAssignment.equipmentNumber();
|
||||
WARNING_LOG(m_logger) << "Got gear assignment for unknown equipment number " << gearAssignment.equipmentNumber();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ void ParticipantHandler::onNewStateFromProxy(const TrainingAreaBase::EquipmentSt
|
||||
{
|
||||
if (isTelegramInFuture(data))
|
||||
{
|
||||
WARNING_LOG() << "Got an EquipmentState which has a timestamp in the future: " << data.sampleTime();
|
||||
WARNING_LOG(m_logger) << "Got an EquipmentState which has a timestamp in the future: " << data.sampleTime();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ void ParticipantHandler::onNewStateFromProxy(const TrainingAreaBase::EquipmentSt
|
||||
Participant *participantToBeChanged = participantByEquipmentNumber(data.equipmentNumber());
|
||||
if (!participantToBeChanged)
|
||||
{
|
||||
WARNING_LOG() << "Got equipment state for unknown equipment number " << data.equipmentNumber();
|
||||
WARNING_LOG(m_logger) << "Got equipment state for unknown equipment number " << data.equipmentNumber();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -242,15 +242,15 @@ void ParticipantHandler::onNewPositionFromProxy(const TrainingAreaBase::Equipmen
|
||||
{
|
||||
if (isTelegramInFuture(position))
|
||||
{
|
||||
WARNING_LOG() << "Got an EquipmentPosition which has a timestamp in the future: " << position.sampleTime();
|
||||
WARNING_LOG(m_logger) << "Got an EquipmentPosition which has a timestamp in the future: " << position.sampleTime();
|
||||
return;
|
||||
}
|
||||
if (isTelegramOutdated(position) && position.position().reportingSource() != Core::PositionReportingSource::SetByOperator)
|
||||
{
|
||||
INFO_LOG() << "position is outdated: " << position;
|
||||
INFO_LOG(m_logger) << "position is outdated: " << position;
|
||||
return;
|
||||
}
|
||||
DEBUG_LOG() << "Got new position from proxy: " << position;
|
||||
DEBUG_LOG(m_logger) << "Got new position from proxy: " << position;
|
||||
|
||||
const int equipNo = position.equipmentNumber();
|
||||
// negative - treat as participantId
|
||||
@@ -258,7 +258,7 @@ void ParticipantHandler::onNewPositionFromProxy(const TrainingAreaBase::Equipmen
|
||||
|
||||
if (!participantWithNewPosition)
|
||||
{
|
||||
WARNING_LOG() << "Got EquipmentPosition " << position << " for unknown equipment number: " << equipNo;
|
||||
WARNING_LOG(m_logger) << "Got EquipmentPosition " << position << " for unknown equipment number: " << equipNo;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -270,14 +270,14 @@ void ParticipantHandler::onNewEquipmentOperationalStateFromProxy(const TrainingA
|
||||
{
|
||||
if (isTelegramInFuture(operationalState))
|
||||
{
|
||||
WARNING_LOG() << "Got an EquipmentOperationalState which has a timestamp in the future: " << operationalState.sampleTime();
|
||||
WARNING_LOG(m_logger) << "Got an EquipmentOperationalState which has a timestamp in the future: " << operationalState.sampleTime();
|
||||
return;
|
||||
}
|
||||
|
||||
Participant *participantToUpdate = participantByEquipmentNumber(operationalState.equipmentNumber());
|
||||
if (!participantToUpdate)
|
||||
{
|
||||
WARNING_LOG() << "Got EquipmentOperationalState for unknown equipment number: " << operationalState;
|
||||
WARNING_LOG(m_logger) << "Got EquipmentOperationalState for unknown equipment number: " << operationalState;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -289,12 +289,12 @@ void ParticipantHandler::onNewBiteFromProxy(const TrainingAreaBase::EquipmentBit
|
||||
{
|
||||
if (isTelegramInFuture(bite))
|
||||
{
|
||||
WARNING_LOG() << "Got an EquipmentBite which has a timestamp in the future: " << bite.sampleTime();
|
||||
WARNING_LOG(m_logger) << "Got an EquipmentBite which has a timestamp in the future: " << bite.sampleTime();
|
||||
return;
|
||||
}
|
||||
if (isTelegramOutdated(bite))
|
||||
{
|
||||
WARNING_LOG() << "Got an EquipmentBite which has a timestamp in the past: " << bite.sampleTime();
|
||||
WARNING_LOG(m_logger) << "Got an EquipmentBite which has a timestamp in the past: " << bite.sampleTime();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -334,19 +334,19 @@ void ParticipantHandler::onNewParticipantModeReport(const TrainingAreaBase::Part
|
||||
{
|
||||
if (isTelegramInFuture(report))
|
||||
{
|
||||
WARNING_LOG() << "Got a ParticipantModeReport which has a timestamp in the future: " << report.sampleTime();
|
||||
WARNING_LOG(m_logger) << "Got a ParticipantModeReport which has a timestamp in the future: " << report.sampleTime();
|
||||
return;
|
||||
}
|
||||
if (isTelegramOutdated(report))
|
||||
{
|
||||
WARNING_LOG() << "Got a ParticipantModeReport which has a timestamp in the past: " << report.sampleTime();
|
||||
WARNING_LOG(m_logger) << "Got a ParticipantModeReport which has a timestamp in the past: " << report.sampleTime();
|
||||
return;
|
||||
}
|
||||
|
||||
Participant *participant = participantByEquipmentNumber(report.equipmentNumber());
|
||||
if (!participant)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with equipment number " << report.equipmentNumber();
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << report.equipmentNumber();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -375,12 +375,12 @@ void ParticipantHandler::onNewSpecialSensorData(const TrainingAreaBase::SpecialS
|
||||
{
|
||||
if (isTelegramInFuture(data))
|
||||
{
|
||||
WARNING_LOG() << "Got a SpecialSensorData which has a timestamp in the future: " << data.sampleTime();
|
||||
WARNING_LOG(m_logger) << "Got a SpecialSensorData which has a timestamp in the future: " << data.sampleTime();
|
||||
return;
|
||||
}
|
||||
if (isTelegramOutdated(data))
|
||||
{
|
||||
WARNING_LOG() << "Got a SpecialSensorData which has a timestamp in the past: " << data.sampleTime();
|
||||
WARNING_LOG(m_logger) << "Got a SpecialSensorData which has a timestamp in the past: " << data.sampleTime();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ void ParticipantHandler::onNewSpecialSensorData(const TrainingAreaBase::SpecialS
|
||||
|
||||
if (!participant)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -409,54 +409,54 @@ void ParticipantHandler::onNewSpecialSensorData(const TrainingAreaBase::SpecialS
|
||||
|
||||
void ParticipantHandler::onNewLaserDesignation(const TrainingAreaBase::LaserDesignation &data)
|
||||
{
|
||||
DEBUG_LOG() << "New Laser Designation: "
|
||||
DEBUG_LOG(m_logger) << "New Laser Designation: "
|
||||
<< "Code: " << data.code() << ", GearID: " << data.gearId() << ", EqNo: " << data.equipmentNumber() << ", Lon: " << data.spotLocation().lon()
|
||||
<< ", Lat: " << data.spotLocation().lat() << ", Power: " << data.outputPower();
|
||||
Participant *participant = participantByEquipmentNumber(data.equipmentNumber());
|
||||
|
||||
if (!participant)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
|
||||
return;
|
||||
}
|
||||
|
||||
DynamicParticipantData dpd = participant->dynamicParticipantData();
|
||||
|
||||
DEBUG_LOG() << "Begin Update Laser Designation: ";
|
||||
DEBUG_LOG(m_logger) << "Begin Update Laser Designation: ";
|
||||
updateLaserDesignation(dpd, data);
|
||||
|
||||
DEBUG_LOG() << "End Update Laser Designation: ";
|
||||
DEBUG_LOG(m_logger) << "End Update Laser Designation: ";
|
||||
|
||||
DEBUG_LOG() << "Set DPD and publish ";
|
||||
DEBUG_LOG(m_logger) << "Set DPD and publish ";
|
||||
participant->setDynamicData(dpd);
|
||||
participant->publishDynamicData();
|
||||
}
|
||||
|
||||
void ParticipantHandler::onLaserDesignationRemoved(int equipmentNumber, int gearId)
|
||||
{
|
||||
DEBUG_LOG() << "On Remove Laser Designation: ";
|
||||
DEBUG_LOG(m_logger) << "On Remove Laser Designation: ";
|
||||
|
||||
Participant *participant = participantByEquipmentNumber(equipmentNumber);
|
||||
|
||||
if (!participant)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with equipment number " << equipmentNumber;
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << equipmentNumber;
|
||||
return;
|
||||
}
|
||||
DynamicParticipantData dpd = participant->dynamicParticipantData();
|
||||
|
||||
DEBUG_LOG() << "Begin Remove Laser Designation: ";
|
||||
DEBUG_LOG(m_logger) << "Begin Remove Laser Designation: ";
|
||||
removeLaserDesignation(dpd, gearId);
|
||||
DEBUG_LOG() << "End Remove Laser Designation: ";
|
||||
DEBUG_LOG(m_logger) << "End Remove Laser Designation: ";
|
||||
|
||||
DEBUG_LOG() << "Set DPD and publish ";
|
||||
DEBUG_LOG(m_logger) << "Set DPD and publish ";
|
||||
participant->setDynamicData(dpd);
|
||||
participant->publishDynamicData();
|
||||
}
|
||||
|
||||
void ParticipantHandler::onBuildingHitLineInfo(const Buildings::BuildingHitLineInfo &data)
|
||||
{
|
||||
DEBUG_LOG() << "onBuildingHitLineInfo "
|
||||
DEBUG_LOG(m_logger) << "onBuildingHitLineInfo "
|
||||
<< "BuildingId=" << data.buildingId() << " originatorParticipantId=" << data.originatorParticipantId();
|
||||
auto dtcPdm = m_bdp->pdmDtc();
|
||||
// NOTE: igniterTypeId/IgniterFunction = 0 as long as BuildingHitLineInfo does not contain values
|
||||
@@ -467,36 +467,36 @@ void ParticipantHandler::onBuildingHitLineInfo(const Buildings::BuildingHitLineI
|
||||
|
||||
if (!participant)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with participantId: " << data.originatorParticipantId();
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with participantId: " << data.originatorParticipantId();
|
||||
return;
|
||||
}
|
||||
|
||||
DynamicParticipantData dpd = participant->dynamicParticipantData();
|
||||
|
||||
DEBUG_LOG() << "Begin Update Laser Designation: ";
|
||||
DEBUG_LOG(m_logger) << "Begin Update Laser Designation: ";
|
||||
updateLaserDesignation(dpd, data);
|
||||
DEBUG_LOG() << "End Update Laser Designation: ";
|
||||
DEBUG_LOG(m_logger) << "End Update Laser Designation: ";
|
||||
|
||||
DEBUG_LOG() << "setDynamicData";
|
||||
DEBUG_LOG(m_logger) << "setDynamicData";
|
||||
participant->setDynamicData(dpd);
|
||||
DEBUG_LOG() << "publishDynamicData"
|
||||
DEBUG_LOG(m_logger) << "publishDynamicData"
|
||||
<< " dpd.designations().size()=" << dpd.designations().size();
|
||||
participant->publishDynamicData();
|
||||
}
|
||||
|
||||
void ParticipantHandler::onSanitaryMaterialStockReport(const TrainingAreaBase::ParticipantSanitaryMaterialStockReport &data)
|
||||
{
|
||||
DEBUG_LOG() << "onSanitaryMaterialStockReport";
|
||||
DEBUG_LOG(m_logger) << "onSanitaryMaterialStockReport";
|
||||
Participant *participant = participantByEquipmentNumber(data.equipmentNumber());
|
||||
if (!participant)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
|
||||
return;
|
||||
}
|
||||
if (data.qualification() == TrainingAreaBase::Qualification::NotDefined)
|
||||
{
|
||||
DEBUG_LOG() << "!!! Clear Materials : equipment number " << data.equipmentNumber();
|
||||
DEBUG_LOG() << "!!! Clear Materials : sample time " << data.sampleTime();
|
||||
DEBUG_LOG(m_logger) << "!!! Clear Materials : equipment number " << data.equipmentNumber();
|
||||
DEBUG_LOG(m_logger) << "!!! Clear Materials : sample time " << data.sampleTime();
|
||||
participant->setSanitationMaterial(0,
|
||||
std::vector<int>(),
|
||||
data.uniqueId(),
|
||||
@@ -506,8 +506,8 @@ void ParticipantHandler::onSanitaryMaterialStockReport(const TrainingAreaBase::P
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG() << "!!! Set Materials : equipment number " << data.equipmentNumber();
|
||||
DEBUG_LOG() << "!!! Set Materials : sample time " << data.sampleTime();
|
||||
DEBUG_LOG(m_logger) << "!!! Set Materials : equipment number " << data.equipmentNumber();
|
||||
DEBUG_LOG(m_logger) << "!!! Set Materials : sample time " << data.sampleTime();
|
||||
participant->setSanitationMaterial(data.sanitaryMaterialCount(),
|
||||
data.sanitaryMaterialStock(),
|
||||
data.uniqueId(),
|
||||
@@ -524,7 +524,7 @@ void ParticipantHandler::onParticipantSanitation(const TrainingAreaBase::Partici
|
||||
Participant *participantOrig = participantByEquipmentNumber(data.originatorEquipmentNumber());
|
||||
if (!participant)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
|
||||
return;
|
||||
}
|
||||
int participantOrigId = data.originatorEquipmentNumber();
|
||||
@@ -533,14 +533,14 @@ void ParticipantHandler::onParticipantSanitation(const TrainingAreaBase::Partici
|
||||
|
||||
if (data.qualification() == TrainingAreaBase::Qualification::NotDefined && data.proceduresTaken() == 0)
|
||||
{
|
||||
DEBUG_LOG() << "!!! Clear Sanitation = " << data.sampleTime();
|
||||
DEBUG_LOG() << "!!! Clear Sanitation: equipNo = " << data.equipmentNumber();
|
||||
DEBUG_LOG(m_logger) << "!!! Clear Sanitation = " << data.sampleTime();
|
||||
DEBUG_LOG(m_logger) << "!!! Clear Sanitation: equipNo = " << data.equipmentNumber();
|
||||
participant->setSanitationMaterial(0, std::vector<int>(), 0, data.sampleTime(), Qualification::NotAssigned, 0); // this is a deassociation so clear material
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG() << "!!! SetSanitation: sample time = " << data.sampleTime();
|
||||
DEBUG_LOG() << "!!! SetSanitation: equipNo = " << data.equipmentNumber();
|
||||
DEBUG_LOG(m_logger) << "!!! SetSanitation: sample time = " << data.sampleTime();
|
||||
DEBUG_LOG(m_logger) << "!!! SetSanitation: equipNo = " << data.equipmentNumber();
|
||||
participant->setSanitation(data.proceduresTaken(), data.sanitationResult(), data.sanitationEvaluation(), participantOrigId, data.qualification(), data.sampleTime());
|
||||
}
|
||||
participant->publishDynamicData();
|
||||
@@ -555,7 +555,7 @@ void ParticipantHandler::onOperatorAction(const TrainingAreaBase::OperatorAction
|
||||
Participant *participant = participantByEquipmentNumber(data.equipmentNumber());
|
||||
if (!participant)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -586,7 +586,7 @@ void ParticipantHandler::onNewFunctionalAreaEntryChanged(const TrainingAreaBase:
|
||||
|
||||
if (!participant)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ void ParticipantHandler::setPosition(const ParticipantManagement::ParticipantPos
|
||||
|
||||
if (!participant)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with id " << data.participantId();
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with id " << data.participantId();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -685,14 +685,14 @@ quint16 ParticipantHandler::getWebSocketPort() const { return m_webSocketHandler
|
||||
void ParticipantHandler::updateLaserDesignation(DynamicParticipantData &data, const TrainingAreaBase::LaserDesignation &newLaserDesignation)
|
||||
{
|
||||
LOGGER_T m_logger = getLogger("ParticipantHandler.Laser");
|
||||
DEBUG_LOG() << "-Update Laser Designation - Start ";
|
||||
DEBUG_LOG(m_logger) << "-Update Laser Designation - Start ";
|
||||
|
||||
for (LaserDesignation &laserDesignation : data.designations())
|
||||
{
|
||||
if (laserDesignation.gearId() != newLaserDesignation.gearId())
|
||||
continue;
|
||||
|
||||
DEBUG_LOG() << "-Update Laser Designation - Gear with id " << laserDesignation.gearId() << " found in designations";
|
||||
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << laserDesignation.gearId() << " found in designations";
|
||||
laserDesignation.code(newLaserDesignation.code());
|
||||
|
||||
if (!qFuzzyIsNull(laserDesignation.outputPower()) && !qFuzzyIsNull(newLaserDesignation.spotLocation().lat())
|
||||
@@ -704,22 +704,22 @@ void ParticipantHandler::updateLaserDesignation(DynamicParticipantData &data, co
|
||||
laserDesignation.spotLocation(Core::GeoPosition(0.0, 0.0, 0.0));
|
||||
|
||||
laserDesignation.outputPower(newLaserDesignation.outputPower());
|
||||
DEBUG_LOG() << "-Update Laser Designation - Data updated, returning";
|
||||
DEBUG_LOG(m_logger) << "-Update Laser Designation - Data updated, returning";
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " NOT found in designations";
|
||||
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " NOT found in designations";
|
||||
|
||||
int gearId = newLaserDesignation.gearId();
|
||||
auto it = std::find_if(data.gear().cbegin(), data.gear().cend(), [gearId](const GearInformation &gi) { return gearId == gi.gearId(); });
|
||||
if (it == data.gear().cend()) // No gear, no designation...
|
||||
{
|
||||
DEBUG_LOG() << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " NOT found in Gears";
|
||||
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " NOT found in Gears";
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " found in Gears";
|
||||
DEBUG_LOG() << "-Update Laser Designation - Adding new designation";
|
||||
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " found in Gears";
|
||||
DEBUG_LOG(m_logger) << "-Update Laser Designation - Adding new designation";
|
||||
data.designations().emplace_back(newLaserDesignation.gearId(),
|
||||
Core::GeoPosition(newLaserDesignation.spotLocation().lon(), newLaserDesignation.spotLocation().lat(), 0.0),
|
||||
newLaserDesignation.code(),
|
||||
@@ -731,11 +731,11 @@ void ParticipantHandler::updateLaserDesignation(DynamicParticipantData &dataInOu
|
||||
LOGGER_T m_logger = getLogger("ParticipantHandler.Laser");
|
||||
// Todo: Die erste vorhandene LaserDesignation wird angepasst. Ein Laser On muss vorher gekommen sein, damit das Element da ist.
|
||||
// Mehrere Designatoren pro Teilnehmer werden nicht unterstützt.
|
||||
DEBUG_LOG() << "-Update Laser Designation by Building Hitline Info";
|
||||
DEBUG_LOG(m_logger) << "-Update Laser Designation by Building Hitline Info";
|
||||
|
||||
for (LaserDesignation &laserDesignation : dataInOut.designations())
|
||||
{
|
||||
DEBUG_LOG() << "-Update Laser Designation by Building Hitline Info - Updating (first) Designation with GearId " << laserDesignation.gearId();
|
||||
DEBUG_LOG(m_logger) << "-Update Laser Designation by Building Hitline Info - Updating (first) Designation with GearId " << laserDesignation.gearId();
|
||||
laserDesignation.outputPower(1.0);
|
||||
laserDesignation.spotLocation(newLaserDesignation.buildingPos());
|
||||
return;
|
||||
@@ -751,9 +751,9 @@ void ParticipantHandler::updateLaserDesignation(DynamicParticipantData &dataInOu
|
||||
ld.spotLocation() = newLaserDesignation.buildingPos();
|
||||
ld.outputPower(1.0);
|
||||
dataInOut.designations().emplace_back(ld);
|
||||
ERROR_LOG() << "-Update Laser Designation by Building Hitline Info - Added Designation";
|
||||
ERROR_LOG(m_logger) << "-Update Laser Designation by Building Hitline Info - Added Designation";
|
||||
}
|
||||
ERROR_LOG() << "-Update Laser Designation by Building Hitline Info - No laserDesignation available participantId="
|
||||
ERROR_LOG(m_logger) << "-Update Laser Designation by Building Hitline Info - No laserDesignation available participantId="
|
||||
<< newLaserDesignation.originatorParticipantId();
|
||||
}
|
||||
|
||||
@@ -761,17 +761,17 @@ void ParticipantHandler::removeLaserDesignation(DynamicParticipantData &data, qi
|
||||
{
|
||||
LOGGER_T m_logger = getLogger("ParticipantHandler.Laser");
|
||||
|
||||
DEBUG_LOG() << "-Remove Laser Designation: Start";
|
||||
DEBUG_LOG(m_logger) << "-Remove Laser Designation: Start";
|
||||
auto validationFunction = [gearId](ParticipantManagement::LaserDesignation laserDesignation) { return laserDesignation.gearId() == gearId; };
|
||||
auto eraseIterator = std::find_if(data.designations().begin(), data.designations().end(), validationFunction);
|
||||
|
||||
if (eraseIterator == data.designations().end())
|
||||
{
|
||||
DEBUG_LOG() << "-Remove Laser Designation: GearId NOT found";
|
||||
DEBUG_LOG(m_logger) << "-Remove Laser Designation: GearId NOT found";
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "-Remove Laser Designation: Removing Designation";
|
||||
DEBUG_LOG(m_logger) << "-Remove Laser Designation: Removing Designation";
|
||||
data.designations().erase(eraseIterator);
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -135,6 +135,7 @@ class ParticipantHandler
|
||||
quint16 getWebSocketPort() const;
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
static void updateLaserDesignation(DynamicParticipantData &data, const TrainingAreaBase::LaserDesignation &newLaserDesignation);
|
||||
void updateLaserDesignation(DynamicParticipantData &dataInOut, const Buildings::BuildingHitLineInfo &newLaserDesignation);
|
||||
static void removeLaserDesignation(DynamicParticipantData &data, qint32 gearId);
|
||||
@@ -158,6 +159,7 @@ class ParticipantHandler
|
||||
virtual bool isSampleTimeInFuture(qint64 sampleTime) const;
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::unique_ptr<UnitPositionCalculator> m_unitPositionCalculator;
|
||||
QHash<int, int> m_equipNumber2ParticipantId;
|
||||
QHash<int, Participant *> m_participants;
|
||||
|
||||
+39
-39
@@ -29,7 +29,7 @@ bool ProxyListener::init()
|
||||
this, &ProxyListener::onProxyEquipmentBiteChanged);
|
||||
if (!m_tabDtc->enableEquipmentBite())
|
||||
{
|
||||
ERROR_LOG() << "Could not initialize TraininAreaBase data topic client";
|
||||
ERROR_LOG(m_logger) << "Could not initialize TraininAreaBase data topic client";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ bool ProxyListener::init()
|
||||
!m_tabDtc->enableUASMissionStatus() ||
|
||||
!m_bldDtc->enableBuildingHitLineInfo())
|
||||
{
|
||||
ERROR_LOG() << "Could not initialize TraininAreaBase data topic client";
|
||||
ERROR_LOG(m_logger) << "Could not initialize TraininAreaBase data topic client";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ void ProxyListener::onProxyEquipmentPositionChanged(const TrainingAreaBase::Equi
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new position data from proxy " << data;
|
||||
DEBUG_LOG(m_logger) << "Got new position data from proxy " << data;
|
||||
|
||||
emit newPosition(data);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ void ProxyListener::onProxyEquipmentGearAssignmentChanged(const TrainingAreaBase
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new gear assignment from proxy " << data;
|
||||
DEBUG_LOG(m_logger) << "Got new gear assignment from proxy " << data;
|
||||
|
||||
emit newGearAssignment(data);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ void ProxyListener::onProxyEquipmentGearEventChanged(const TrainingAreaBase::Equ
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new gear event " << data;
|
||||
DEBUG_LOG(m_logger) << "Got new gear event " << data;
|
||||
|
||||
emit newGearEvent(data);
|
||||
}
|
||||
@@ -134,19 +134,19 @@ void ProxyListener::onProxyEquipmentGearChargeStateChanged(const TrainingAreaBas
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new gear charge state " << data;
|
||||
DEBUG_LOG(m_logger) << "Got new gear charge state " << data;
|
||||
|
||||
emit newGearChargeState(data);
|
||||
}
|
||||
|
||||
void ProxyListener::onProxyParticipantSanitaryMaterialStockReportChanged(const TrainingAreaBase::ParticipantSanitaryMaterialStockReport &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG() << "FUCKING FUCK FUCK" << data;
|
||||
DEBUG_LOG(m_logger) << "FUCKING FUCK FUCK" << data;
|
||||
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new material stock report" << data;
|
||||
DEBUG_LOG(m_logger) << "Got new material stock report" << data;
|
||||
|
||||
emit newSanitaryMaterialStockReport(data);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ void ProxyListener::onProxyEquipmentStateChanged(const TrainingAreaBase::Equipme
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new equipment state " << data;
|
||||
DEBUG_LOG(m_logger) << "Got new equipment state " << data;
|
||||
|
||||
emit newState(data);
|
||||
}
|
||||
@@ -166,7 +166,7 @@ void ProxyListener::onProxyEquipmentOperationalStateChanged(const TrainingAreaBa
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new equipment operational state " << data;
|
||||
DEBUG_LOG(m_logger) << "Got new equipment operational state " << data;
|
||||
|
||||
emit newEquipmentOperationalState(data);
|
||||
}
|
||||
@@ -176,7 +176,7 @@ void ProxyListener::onProxyEquipmentBiteChanged(const TrainingAreaBase::Equipmen
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new equipment bite " << data;
|
||||
DEBUG_LOG(m_logger) << "Got new equipment bite " << data;
|
||||
|
||||
emit newEquipmentBite(data);
|
||||
}
|
||||
@@ -186,7 +186,7 @@ void ProxyListener::onProxyCtaDataErrorChanged(const TrainingAreaBase::CtaDataEr
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new Combat Training Area Data error: " << data;
|
||||
DEBUG_LOG(m_logger) << "Got new Combat Training Area Data error: " << data;
|
||||
|
||||
emit newCtaDataError(data);
|
||||
}
|
||||
@@ -196,7 +196,7 @@ void ProxyListener::onSpecialSensorDataChanged(const TrainingAreaBase::SpecialSe
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new Special Sensor data: " << data;
|
||||
DEBUG_LOG(m_logger) << "Got new Special Sensor data: " << data;
|
||||
|
||||
emit newSpecialSensorData(data);
|
||||
}
|
||||
@@ -206,7 +206,7 @@ void ProxyListener::onFunctionalAreaEntryChanged(const TrainingAreaBase::Functio
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got functional area entry: " << data;
|
||||
DEBUG_LOG(m_logger) << "Got functional area entry: " << data;
|
||||
|
||||
emit newFunctionalAreaEntryChanged(data);
|
||||
}
|
||||
@@ -215,12 +215,12 @@ void ProxyListener::onLaserDesignationChanged(const TrainingAreaBase::LaserDesig
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "Got no laser designation data: " << data;
|
||||
DEBUG_LOG(m_logger) << "Got no laser designation data: " << data;
|
||||
emit laserDesignationRemoved(data.equipmentNumber(), data.gearId());
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "Got laser designation data: " << data;
|
||||
DEBUG_LOG(m_logger) << "Got laser designation data: " << data;
|
||||
|
||||
emit newLaserDesignationData(data);
|
||||
}
|
||||
@@ -230,7 +230,7 @@ void ProxyListener::onProxyParticipantSanitationChanged(const TrainingAreaBase::
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new Participant Sanitation" << data;
|
||||
DEBUG_LOG(m_logger) << "Got new Participant Sanitation" << data;
|
||||
|
||||
emit newParticipantSanitation(data);
|
||||
}
|
||||
@@ -240,7 +240,7 @@ void ProxyListener::onOperatorActionChanged(const TrainingAreaBase::OperatorActi
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new Operator Action" << data;
|
||||
DEBUG_LOG(m_logger) << "Got new Operator Action" << data;
|
||||
|
||||
emit newOperatorAction(data);
|
||||
}
|
||||
@@ -250,7 +250,7 @@ void ProxyListener::onEquipmentEventChanged(const TrainingAreaBase::EquipmentEve
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new Operator Action" << data;
|
||||
DEBUG_LOG(m_logger) << "Got new Operator Action" << data;
|
||||
|
||||
emit newEquipmentEvent(data);
|
||||
|
||||
@@ -275,13 +275,13 @@ void ProxyListener::onUASStatusChanged(const TrainingAreaBase::UASStatus &data,
|
||||
UASRadioLinkConnectionStatus newState;
|
||||
newState.id(uas.id());
|
||||
newState.uasState(data.uasState());
|
||||
DEBUG_LOG() << "Publish new UAS State " << newState;
|
||||
DEBUG_LOG(m_logger) << "Publish new UAS State " << newState;
|
||||
m_mainHandler->ddsHandler()->exAnyDts()->publish(newState);
|
||||
}
|
||||
|
||||
void ProxyListener::onUASMissionStatusChanged(const TrainingAreaBase::UASMissionStatus &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG() << "currentTask = " << (int)data.currentTask().underlying() << ", currentMissionName = " << data.currentMissionName() << ", name of ended mission: " << data.missionEnded();
|
||||
DEBUG_LOG(m_logger) << "currentTask = " << (int)data.currentTask().underlying() << ", currentMissionName = " << data.currentMissionName() << ", name of ended mission: " << data.missionEnded();
|
||||
/*
|
||||
was wenn random mehrfach hintereinander loiter gesendet wird??
|
||||
dann überspringt er eine action! der tab darf also nur senden wenn wirklich ein state change kam
|
||||
@@ -290,14 +290,14 @@ void ProxyListener::onUASMissionStatusChanged(const TrainingAreaBase::UASMission
|
||||
*/
|
||||
if (modType == DataModification::eRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "removed - stop";
|
||||
DEBUG_LOG(m_logger) << "removed - stop";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.currentMissionName().empty() || data.currentTask().underlying() != ProjectDataManagement::UasActionTask::Loiter || data.missionEnded().empty())
|
||||
{
|
||||
//DEBUG As this will happen a lot
|
||||
DEBUG_LOG() << "not fulfilling current mission ("<<data.currentMissionName()<<") action because either a mission is still active or current task ("<<(int)data.currentTask().underlying()<<") is not Loiter or mission not ended ("<< data.missionEnded() << (data.missionEnded().empty() ? " [NOT ENDED]" : " [ ENDED ]")<<")";
|
||||
DEBUG_LOG(m_logger) << "not fulfilling current mission ("<<data.currentMissionName()<<") action because either a mission is still active or current task ("<<(int)data.currentTask().underlying()<<") is not Loiter or mission not ended ("<< data.missionEnded() << (data.missionEnded().empty() ? " [NOT ENDED]" : " [ ENDED ]")<<")";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ void ProxyListener::onUASMissionStatusChanged(const TrainingAreaBase::UASMission
|
||||
const int participantId = m_mainHandler->ddsHandler()->dtc()->participantIdByEquipmentNumber(data.equipmentNumber());
|
||||
if (participantId <= 0)
|
||||
{
|
||||
ERROR_LOG() << "participant for eqid " << data.equipmentNumber() << " not found - unable to fulfill current mission action";
|
||||
ERROR_LOG(m_logger) << "participant for eqid " << data.equipmentNumber() << " not found - unable to fulfill current mission action";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -314,11 +314,11 @@ void ProxyListener::onUASMissionStatusChanged(const TrainingAreaBase::UASMission
|
||||
// mission empty & task = loiter? mission done, run next mission (by setting current mission's current action as fulfilled, which will trigger the next action automatically (see ces))
|
||||
if (!m_mainHandler->missionPlanHandler()->setCurrentMissionActionFulfilled(participantId, QString::fromStdString(data.missionEnded())))
|
||||
{
|
||||
ERROR_LOG() << "setCurrentMissionActionFulfilled didn't work out";
|
||||
ERROR_LOG(m_logger) << "setCurrentMissionActionFulfilled didn't work out";
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "setCurrentMissionActionFulfilled done !";
|
||||
DEBUG_LOG(m_logger) << "setCurrentMissionActionFulfilled done !";
|
||||
});
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ void ProxyListener::onBuildingHitLineInfoChanged(const Buildings::BuildingHitLin
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new Building Hitline Info" << data;
|
||||
DEBUG_LOG(m_logger) << "Got new Building Hitline Info" << data;
|
||||
|
||||
emit newBuildingHitLineInfo(data);
|
||||
|
||||
@@ -338,7 +338,7 @@ void ProxyListener::onProxyParticipantModeReportChanged(const TrainingAreaBase::
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Got new Participant Mode Report Training Area Data error " << data;
|
||||
DEBUG_LOG(m_logger) << "Got new Participant Mode Report Training Area Data error " << data;
|
||||
|
||||
emit newParticipantModeReport(data);
|
||||
}
|
||||
@@ -353,7 +353,7 @@ Core::FunctionReplyObject ProxyListener::demandVulnerabilityStateChange(const rt
|
||||
const int requestId = req.requestId();
|
||||
auto cb = [this, requestId]()
|
||||
{
|
||||
INFO_LOG() << "VulnerabilityStateChange timeout for " << requestId;
|
||||
INFO_LOG(m_logger) << "VulnerabilityStateChange timeout for " << requestId;
|
||||
onDemandVulnerabilityStateChangeReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
|
||||
};
|
||||
addToTrainingAreaRequests(cb, req.requestId(), cookie);
|
||||
@@ -373,14 +373,14 @@ void ProxyListener::onDemandVulnerabilityStateChangeReply(const Core::FunctionRe
|
||||
Core::FunctionReplyObject ProxyListener::sendModifyUasStateRequest(const rti::core::SampleIdentity &cookie,
|
||||
const TrainingAreaBase::SendModifyUasStateRequest &req)
|
||||
{
|
||||
DEBUG_LOG() << " -- [ProxyListener] sendModifyUasStateRequest uasId: " << req.uasId();
|
||||
DEBUG_LOG(m_logger) << " -- [ProxyListener] sendModifyUasStateRequest uasId: " << req.uasId();
|
||||
if (!m_mainHandler->tabFtc()->sendModifyUasStateRequest(req, this))
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Error passing the UAS state change request to the proxy"));
|
||||
|
||||
const int requestId = req.requestId();
|
||||
auto cb = [this, requestId]()
|
||||
{
|
||||
INFO_LOG() << "ModifyUasState timeout for " << requestId;
|
||||
INFO_LOG(m_logger) << "ModifyUasState timeout for " << requestId;
|
||||
onSendModifyUasStateReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
|
||||
};
|
||||
addToTrainingAreaRequests(cb, req.requestId(), cookie);
|
||||
@@ -406,7 +406,7 @@ Core::FunctionReplyObject ProxyListener::demandInitRequest(const rti::core::Samp
|
||||
const int requestId = req.requestId();
|
||||
auto cb = [this, requestId]()
|
||||
{
|
||||
INFO_LOG() << "DemandInit timeout for " << requestId;
|
||||
INFO_LOG(m_logger) << "DemandInit timeout for " << requestId;
|
||||
onDemandInitReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
|
||||
};
|
||||
addToTrainingAreaRequests(cb, req.requestId(), cookie);
|
||||
@@ -433,7 +433,7 @@ Core::FunctionReplyObject ProxyListener::sendEquipmentMessage(const rti::core::S
|
||||
const int requestId = req.requestId();
|
||||
auto cb = [this, requestId]()
|
||||
{
|
||||
INFO_LOG() << "SendMessage timeout for " << requestId;
|
||||
INFO_LOG(m_logger) << "SendMessage timeout for " << requestId;
|
||||
onSendEquipmentMessageReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
|
||||
};
|
||||
addToTrainingAreaRequests(cb, req.requestId(), cookie);
|
||||
@@ -460,7 +460,7 @@ Core::FunctionReplyObject ProxyListener::sendParticipantModeRequest(const rti::c
|
||||
const int requestId = req.requestId();
|
||||
auto cb = [this, requestId]()
|
||||
{
|
||||
INFO_LOG() << "SendParticipantMode timeout for " << requestId;
|
||||
INFO_LOG(m_logger) << "SendParticipantMode timeout for " << requestId;
|
||||
onSendParticipantModeReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
|
||||
};
|
||||
addToTrainingAreaRequests(cb, req.requestId(), cookie);
|
||||
@@ -484,7 +484,7 @@ Core::FunctionReplyObject ProxyListener::sendSetSanitationRequest(const rti::cor
|
||||
const int requestId = req.requestId();
|
||||
auto cb = [this, requestId]()
|
||||
{
|
||||
INFO_LOG() << "sendSetSanitationRequest timeout for " << requestId;
|
||||
INFO_LOG(m_logger) << "sendSetSanitationRequest timeout for " << requestId;
|
||||
onSendSetSanitationReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
|
||||
};
|
||||
addToTrainingAreaRequests(cb, req.requestId(), cookie);
|
||||
@@ -507,7 +507,7 @@ Core::FunctionReplyObject ProxyListener::selectiveReammunitionRequest(const rti:
|
||||
const int requestId = req.requestId();
|
||||
auto cb = [this, requestId]()
|
||||
{
|
||||
INFO_LOG() << "selectiveReammunitionRequest timeout for " << requestId;
|
||||
INFO_LOG(m_logger) << "selectiveReammunitionRequest timeout for " << requestId;
|
||||
onSendSelectiveReammunitionReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
|
||||
};
|
||||
addToTrainingAreaRequests(cb, req.requestId(), cookie);
|
||||
@@ -533,7 +533,7 @@ Core::FunctionReplyObject ProxyListener::sendOcCommandRequest(const rti::core::S
|
||||
const int requestId = req.requestId();
|
||||
auto cb = [this, requestId]()
|
||||
{
|
||||
INFO_LOG() << "SendOcCommand timeout for " << requestId;
|
||||
INFO_LOG(m_logger) << "SendOcCommand timeout for " << requestId;
|
||||
onSendOcCommandReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
|
||||
};
|
||||
addToTrainingAreaRequests(cb, req.requestId(), cookie);
|
||||
@@ -567,7 +567,7 @@ void ProxyListener::handleReply(const std::function<void(const rti::core::Sample
|
||||
const char *requestType)
|
||||
{
|
||||
if (replyObject.error())
|
||||
WARNING_LOG() << requestType << ": " << replyObject();
|
||||
WARNING_LOG(m_logger) << requestType << ": " << replyObject();
|
||||
|
||||
auto it = m_trainingAreaRequests.find(replyObject.id());
|
||||
if (it != m_trainingAreaRequests.end())
|
||||
@@ -580,7 +580,7 @@ void ProxyListener::handleReply(const std::function<void(const rti::core::Sample
|
||||
m_trainingAreaRequests.erase(it);
|
||||
}
|
||||
else
|
||||
WARNING_LOG() << requestType << " with request id " << replyObject.id() << " was not replied to by the proxy";
|
||||
WARNING_LOG(m_logger) << requestType << " with request id " << replyObject.id() << " was not replied to by the proxy";
|
||||
}
|
||||
|
||||
|
||||
|
||||
+11
-12
@@ -21,13 +21,12 @@ namespace ParticipantManagement
|
||||
{
|
||||
namespace ParticipantHandling
|
||||
{
|
||||
UnitPositionCalculator::UnitPositionCalculator(ParticipantHandler *participantHandler, QObject *parent)
|
||||
: QObject(parent)
|
||||
UnitPositionCalculator::UnitPositionCalculator(ParticipantHandler *participantHandler, QObject *parent) : QObject(parent)
|
||||
, m_participantHandler(participantHandler)
|
||||
, m_bSomethingChangedSinceLastCalculation(false)
|
||||
, m_timer(new QTimer(this))
|
||||
, m_bRunning(true)
|
||||
{
|
||||
, m_bRunning(true),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
connect(m_timer, &QTimer::timeout, this, &UnitPositionCalculator::calculate);
|
||||
m_timer->setSingleShot(true);
|
||||
|
||||
@@ -45,7 +44,7 @@ UnitPositionCalculator::~UnitPositionCalculator()
|
||||
|
||||
void UnitPositionCalculator::startCalculation()
|
||||
{
|
||||
DEBUG_LOG() << "Starting calculation timer";
|
||||
DEBUG_LOG(m_logger) << "Starting calculation timer";
|
||||
m_timer->start();
|
||||
m_bRunning = true;
|
||||
}
|
||||
@@ -67,7 +66,7 @@ void UnitPositionCalculator::waitForCalculationFinished()
|
||||
|
||||
void UnitPositionCalculator::onParticipantDeleted(int participantId)
|
||||
{
|
||||
DEBUG_LOG() << "Participant " << participantId << " deleted";
|
||||
DEBUG_LOG(m_logger) << "Participant " << participantId << " deleted";
|
||||
auto it = m_participantData.find(participantId);
|
||||
if (it == m_participantData.end())
|
||||
return;
|
||||
@@ -76,7 +75,7 @@ void UnitPositionCalculator::onParticipantDeleted(int participantId)
|
||||
|
||||
void UnitPositionCalculator::onPositionChanged(int participantId, int64_t positionTime, const Core::GeoPosition &pos)
|
||||
{
|
||||
DEBUG_LOG() << "Position for participant " << participantId << " changed to "
|
||||
DEBUG_LOG(m_logger) << "Position for participant " << participantId << " changed to "
|
||||
<< pos << " (" << positionTime / 1000 << "s)";
|
||||
CalculatedUnitPosition &data = getParticipant(participantId);
|
||||
if (data.sampleTimeLeader() >= positionTime)
|
||||
@@ -91,7 +90,7 @@ void UnitPositionCalculator::onPositionChanged(int participantId, int64_t positi
|
||||
|
||||
void UnitPositionCalculator::onSuperiorChanged(int participantId, int superiorId)
|
||||
{
|
||||
DEBUG_LOG() << "Superior for participant " << participantId << " changed to " << superiorId;
|
||||
DEBUG_LOG(m_logger) << "Superior for participant " << participantId << " changed to " << superiorId;
|
||||
CalculatedUnitPosition &data = getParticipant(participantId);
|
||||
data.superiorId = superiorId;
|
||||
m_bSomethingChangedSinceLastCalculation = true;
|
||||
@@ -105,7 +104,7 @@ void UnitPositionCalculator::onInferiorChanged(int participantId, const std::vec
|
||||
slIds.reserve(inferiorIds.size());
|
||||
for (int id : inferiorIds)
|
||||
slIds += QString::number(id);
|
||||
DEBUG_LOG() << "Inferior for participant " << participantId << " changed, size: " << slIds.join(QLatin1Char(' '));
|
||||
DEBUG_LOG(m_logger) << "Inferior for participant " << participantId << " changed, size: " << slIds.join(QLatin1Char(' '));
|
||||
}
|
||||
|
||||
CalculatedUnitPosition &data = getParticipant(participantId);
|
||||
@@ -118,7 +117,7 @@ UnitPositionCalculator::CalculatedUnitPosition &UnitPositionCalculator::getParti
|
||||
auto it = m_participantData.find(participantId);
|
||||
if (it == m_participantData.end())
|
||||
{
|
||||
DEBUG_LOG() << "No information for participant " << participantId << " - creating dummy data";
|
||||
DEBUG_LOG(m_logger) << "No information for participant " << participantId << " - creating dummy data";
|
||||
|
||||
CalculatedUnitPosition data;
|
||||
data.participantId(participantId);
|
||||
@@ -138,7 +137,7 @@ void UnitPositionCalculator::calculate()
|
||||
if (!m_bSomethingChangedSinceLastCalculation)
|
||||
{
|
||||
if (!s_bDebugOnce)
|
||||
DEBUG_LOG() << "Nothing changed - no calculation needed -> waiting for new data";
|
||||
DEBUG_LOG(m_logger) << "Nothing changed - no calculation needed -> waiting for new data";
|
||||
s_bDebugOnce = true;
|
||||
m_timer->start(1000);
|
||||
return;
|
||||
@@ -310,7 +309,7 @@ void UnitPositionCalculator::onCalculationDone()
|
||||
if (it != m_publishedPositionData.end())
|
||||
{
|
||||
ParticipantManagement::UnitPosition &up = it->second;
|
||||
DEBUG_LOG() << "old: " << up << ", new: " << pos << ", equal: " << (up == pos);
|
||||
DEBUG_LOG(m_logger) << "old: " << up << ", new: " << pos << ", equal: " << (up == pos);
|
||||
if (up == pos)
|
||||
continue;
|
||||
// nan == nan is always false, have to check it on our own
|
||||
|
||||
+3
@@ -36,6 +36,7 @@ public:
|
||||
void onInferiorChanged(int participantId, const std::vector<int> &inferiorIds);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
struct CalculatedUnitPosition : public ParticipantManagement::UnitPosition
|
||||
{
|
||||
int superiorId = 0;
|
||||
@@ -43,6 +44,7 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
CalculatedUnitPosition &getParticipant(int participantId);
|
||||
void calculate();
|
||||
// no const ref - must be a copy since this is running in a different thread
|
||||
@@ -61,6 +63,7 @@ private Q_SLOTS:
|
||||
void onCalculationDone();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::unordered_map<int, CalculatedUnitPosition> m_participantData;
|
||||
std::unordered_map<int, CalculatedUnitPosition> m_publishedPositionData;
|
||||
|
||||
|
||||
+27
-27
@@ -48,7 +48,7 @@ bool PartyHandling::PartyHandler::init()
|
||||
// read parties from db
|
||||
if (!m_mainHandler->db()->select(partyVec))
|
||||
{
|
||||
ERROR_LOG() << "Error while reading party data from database";
|
||||
ERROR_LOG(m_logger) << "Error while reading party data from database";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ bool PartyHandling::PartyHandler::init()
|
||||
|
||||
if (partyVec.isEmpty())
|
||||
{
|
||||
ERROR_LOG() << "Error while reading party data from database";
|
||||
ERROR_LOG(m_logger) << "Error while reading party data from database";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ bool PartyHandling::PartyHandler::init()
|
||||
//------------------------------------------------------------------------------------------
|
||||
void PartyHandling::PartyHandler::resetAdlerProperties( QString &properties, const int partyId)
|
||||
{
|
||||
DEBUG_LOG() << "properties: " << properties;
|
||||
DEBUG_LOG(m_logger) << "properties: " << properties;
|
||||
QJsonObject obj = QJsonDocument::fromJson(properties.toUtf8()).object();
|
||||
|
||||
if (!obj.contains(QStringLiteral("Adler")))
|
||||
@@ -87,7 +87,7 @@ void PartyHandling::PartyHandler::resetAdlerProperties( QString &properties, con
|
||||
if (connectState == ParticipantManagement::ConnectState::Undefined)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "connectState: " << connectState;
|
||||
DEBUG_LOG(m_logger) << "connectState: " << connectState;
|
||||
|
||||
if (connectState != ParticipantManagement::ConnectState::Disconnected)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ void PartyHandling::PartyHandler::resetAdlerProperties( QString &properties, con
|
||||
const QByteArray propertiesStr = QJsonDocument(obj).toJson(QJsonDocument::Compact);
|
||||
properties = QString::fromStdString(propertiesStr.data());
|
||||
|
||||
INFO_LOG() << "isSaaConnected set to false";
|
||||
INFO_LOG(m_logger) << "isSaaConnected set to false";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ QVector<Database::PpmParty> PartyHandling::PartyHandler::loadDefaultParties(bool
|
||||
QVector<Database::PpmParty> partyVec;
|
||||
|
||||
if (!m_mainHandler->dbEx0()->select(partyVec))
|
||||
ERROR_LOG() << "Error while reading party data from database (ex_0)";
|
||||
ERROR_LOG(m_logger) << "Error while reading party data from database (ex_0)";
|
||||
|
||||
auto cb = [](const Database::PpmParty &p1,const Database::PpmParty &p2) -> bool
|
||||
{
|
||||
@@ -139,7 +139,7 @@ void PartyHandling::PartyHandler::onModifyPartyDataRequest(const rti::core::Samp
|
||||
{
|
||||
auto ret = modifyPartyDataRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
|
||||
m_mainHandler->fts()->modifyPartyDataReply(cookie, ret);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ void PartyHandling::PartyHandler::onModifyPartyDataRequest(const rti::core::Samp
|
||||
//------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject PartyHandling::PartyHandler::modifyPartyDataRequest(const ParticipantManagement::Party &request)
|
||||
{
|
||||
DEBUG_LOG() << "onModifyPartyDataRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onModifyPartyDataRequest: " << request;
|
||||
Party *partyToPublish = m_parties.value(request.id());
|
||||
|
||||
if (!partyToPublish && request.id() >= 0)
|
||||
@@ -156,7 +156,7 @@ Core::FunctionReplyObject PartyHandling::PartyHandler::modifyPartyDataRequest(co
|
||||
|
||||
if (!partyToPublish) // create new party
|
||||
{
|
||||
DEBUG_LOG() << "Creating new party";
|
||||
DEBUG_LOG(m_logger) << "Creating new party";
|
||||
|
||||
// insert into database
|
||||
Database::PpmParty newDbParty;
|
||||
@@ -172,7 +172,7 @@ Core::FunctionReplyObject PartyHandling::PartyHandler::modifyPartyDataRequest(co
|
||||
if (!m_mainHandler->db()->insert(newDbParty))
|
||||
{
|
||||
QString errText = m_mainHandler->db()->getLastError().databaseText();
|
||||
ERROR_LOG() << "Error inserting Party into database: " << errText;
|
||||
ERROR_LOG(m_logger) << "Error inserting Party into database: " << errText;
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Error inserting new party to database: %1")).arg(errText);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ Core::FunctionReplyObject PartyHandling::PartyHandler::modifyPartyDataRequest(co
|
||||
}
|
||||
else // modify existing party
|
||||
{
|
||||
DEBUG_LOG() << "Modifying party with id " << partyToPublish->id();
|
||||
DEBUG_LOG(m_logger) << "Modifying party with id " << partyToPublish->id();
|
||||
|
||||
if (!partyToPublish->hasChanges(request, true))
|
||||
partyToPublish = nullptr; // so it will not be published at the end of this method ...
|
||||
@@ -203,10 +203,10 @@ Core::FunctionReplyObject PartyHandling::PartyHandler::modifyPartyDataRequest(co
|
||||
void PartyHandling::PartyHandler::onRemovePartyRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ParticipantManagement::RemovePartyRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onRemovePartyRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onRemovePartyRequest: " << request;
|
||||
auto ret = removePartyRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
|
||||
m_mainHandler->fts()->removePartyReply(cookie, ret);
|
||||
}
|
||||
@@ -214,7 +214,7 @@ void PartyHandling::PartyHandler::onRemovePartyRequest(const rti::core::SampleId
|
||||
//------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject PartyHandling::PartyHandler::removePartyRequest(const ParticipantManagement::RemovePartyRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onRemovePartyRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onRemovePartyRequest " << request;
|
||||
|
||||
if (request.partyId() < 0)
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Got request to delete a party, but no valid party id to delete"));
|
||||
@@ -227,7 +227,7 @@ Core::FunctionReplyObject PartyHandling::PartyHandler::removePartyRequest(const
|
||||
if (partyToDelete->isUsedBy() == true)
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Not possible to delete a party in use"));
|
||||
|
||||
DEBUG_LOG() << "Removing party with ID " << request.partyId();
|
||||
DEBUG_LOG(m_logger) << "Removing party with ID " << request.partyId();
|
||||
|
||||
return removeParty(partyToDelete);
|
||||
}
|
||||
@@ -253,7 +253,7 @@ Core::FunctionReplyObject PartyHandling::PartyHandler::removeParty(Party *partyT
|
||||
void PartyHandling::PartyHandler::onSyncPartiesRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ParticipantManagement::SyncPartiesRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onSyncPartiesRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onSyncPartiesRequest: " << request;
|
||||
|
||||
Core::FunctionReplyObject rep;
|
||||
QVector<Database::PpmParty> partyVec = loadDefaultParties(false);
|
||||
@@ -261,7 +261,7 @@ void PartyHandling::PartyHandler::onSyncPartiesRequest(const rti::core::SampleId
|
||||
for (auto it = partyVec.begin(); it != partyVec.end(); ++it)
|
||||
{
|
||||
int partyId = (*it).id;
|
||||
DEBUG_LOG() << "Checking Party Id: " << partyId;
|
||||
DEBUG_LOG(m_logger) << "Checking Party Id: " << partyId;
|
||||
|
||||
Database::PpmParty partyEx0 = (*it);
|
||||
|
||||
@@ -272,12 +272,12 @@ void PartyHandling::PartyHandler::onSyncPartiesRequest(const rti::core::SampleId
|
||||
if (!m_mainHandler->db()->insert(partyEx0))
|
||||
{
|
||||
QString errText = m_mainHandler->db()->getLastError().databaseText();
|
||||
WARNING_LOG() << "Error inserting new party with id " << partyId << " to database: " << errText;
|
||||
WARNING_LOG(m_logger) << "Error inserting new party with id " << partyId << " to database: " << errText;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG() << "Inserting Party Id: " << partyId;
|
||||
DEBUG_LOG(m_logger) << "Inserting Party Id: " << partyId;
|
||||
PartyHandling::Party *newParty = new PartyHandling::Party(partyEx0);
|
||||
m_parties.insert(partyEx0.id, newParty);
|
||||
m_mainHandler->dts()->publish(newParty->toDdsParty());
|
||||
@@ -293,7 +293,7 @@ void PartyHandling::PartyHandler::onSyncPartiesRequest(const rti::core::SampleId
|
||||
|| partyEx0.hlaForceIdentifier != partyEx->toDbParty().hlaForceIdentifier
|
||||
|| partyEx0.roleId != partyEx->toDbParty().roleId;
|
||||
|
||||
DEBUG_LOG() << "Has changes = " << hasChanges;
|
||||
DEBUG_LOG(m_logger) << "Has changes = " << hasChanges;
|
||||
|
||||
if (hasChanges)
|
||||
{
|
||||
@@ -312,7 +312,7 @@ void PartyHandling::PartyHandler::onSyncPartiesRequest(const rti::core::SampleId
|
||||
|
||||
auto ret = modifyPartyDataRequest(req);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -332,14 +332,14 @@ void PartyHandling::PartyHandler::onSyncPartiesRequest(const rti::core::SampleId
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
DEBUG_LOG() << "Party id to be deleted = " << curParty->id();
|
||||
DEBUG_LOG(m_logger) << "Party id to be deleted = " << curParty->id();
|
||||
if (curParty->isUsedBy())
|
||||
INFO_LOG() << "Party with id " << curParty->id() << " cannot be deleted, is in use";
|
||||
INFO_LOG(m_logger) << "Party with id " << curParty->id() << " cannot be deleted, is in use";
|
||||
else
|
||||
{
|
||||
auto ret = removeParty(curParty); // removed from map etc
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -352,10 +352,10 @@ void PartyHandling::PartyHandler::onSyncPartiesRequest(const rti::core::SampleId
|
||||
void PartyHandling::PartyHandler::onChangePartyUsedStateRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ParticipantManagement::ChangePartyUsedStateRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onChangePartyUsedStateRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onChangePartyUsedStateRequest: " << request;
|
||||
auto ret = changePartyUsedStateRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->fts()->changePartyUsedStateReply(cookie, ret);
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ Core::FunctionReplyObject PartyHandling::PartyHandler::changePartyUsedStateReque
|
||||
if (!m_mainHandler->db()->update(party->toDbParty()))
|
||||
return Core::FunctionReplyObject(request.partyId(), tr_lts("dds", "Error updating party used state in database"));
|
||||
|
||||
DEBUG_LOG() << "Change used state for party " << party->id() << " to " << party->isUsedBy();
|
||||
DEBUG_LOG(m_logger) << "Change used state for party " << party->id() << " to " << party->isUsedBy();
|
||||
m_mainHandler->dts()->publish(party->toDdsParty());
|
||||
}
|
||||
return Core::FunctionReplyObject(request.partyId());
|
||||
|
||||
+17
-17
@@ -18,33 +18,33 @@ HandlerTargetInformation::HandlerTargetInformation(MainHandler *mainHandler)
|
||||
, RemoveTargetInformationRequestHandler(mainHandler->fts())
|
||||
, m_mainHandler(mainHandler)
|
||||
{
|
||||
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";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
HandlerTargetInformation::~HandlerTargetInformation()
|
||||
{
|
||||
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 HandlerTargetInformation::init()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
|
||||
bool bRet = true;
|
||||
// create objects
|
||||
auto cb = [this, &bRet](const Database::PpmTargetInformation & data)
|
||||
{
|
||||
DEBUG_LOG() << "Reading from DB PpmTargetInformation with id = " << data.id;
|
||||
DEBUG_LOG(m_logger) << "Reading from DB PpmTargetInformation with id = " << data.id;
|
||||
ObjectTargetInformation *ifs(new ObjectTargetInformation(m_mainHandler));
|
||||
Core::FunctionReplyObject ret = ifs->createObject(ObjectTargetInformation::toDdsData(data));
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
bRet = false;
|
||||
return;
|
||||
}
|
||||
@@ -52,11 +52,11 @@ bool HandlerTargetInformation::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();
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
DEBUG_LOG(m_logger) << "m_objectMap.size() = " << m_objectMap.size();
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -66,19 +66,19 @@ bool HandlerTargetInformation::init()
|
||||
void HandlerTargetInformation::onModifyTargetInformationRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ModifyTargetInformationRequest &request)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
const auto ret = targetInformationModifyRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
|
||||
m_mainHandler->fts()->modifyTargetInformationReply(cookie, ret);
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject HandlerTargetInformation::targetInformationModifyRequest(const ModifyTargetInformationRequest &request)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
const int requestId = request.targetInfo().id();
|
||||
// modify
|
||||
if (requestId > 0)
|
||||
@@ -100,7 +100,7 @@ Core::FunctionReplyObject HandlerTargetInformation::targetInformationModifyReque
|
||||
}
|
||||
else
|
||||
m_objectMap.insert(ifs->getId(), ifs);
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ Core::FunctionReplyObject HandlerTargetInformation::targetInformationModifyReque
|
||||
void HandlerTargetInformation::onRemoveTargetInformationRequest(const rti::core::SampleIdentity &cookie,
|
||||
const RemoveTargetInformationRequest &request)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " request=" << request;
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " request=" << request;
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectTargetInformation *ifs = m_objectMap.value(request.id());
|
||||
@@ -122,7 +122,7 @@ void HandlerTargetInformation::onRemoveTargetInformationRequest(const rti::core:
|
||||
|
||||
ret = ifs->removeObject();
|
||||
if (ret.error())
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
else
|
||||
{
|
||||
// delete Object
|
||||
|
||||
+2
@@ -44,6 +44,8 @@ public:
|
||||
}
|
||||
|
||||
private: // methods
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onModifyTargetInformationRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ModifyTargetInformationRequest &request) override;
|
||||
Core::FunctionReplyObject targetInformationModifyRequest(const ModifyTargetInformationRequest &request);
|
||||
|
||||
+16
-17
@@ -108,20 +108,19 @@ std::vector<ShootbackArea> vecfromJson(const QJsonValue &val)
|
||||
}
|
||||
|
||||
|
||||
ObjectTargetInformation::ObjectTargetInformation(MainHandler *mainHandler)
|
||||
: m_mainHandler(mainHandler)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
ObjectTargetInformation::ObjectTargetInformation(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";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ObjectTargetInformation::~ObjectTargetInformation()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
if (isValid())
|
||||
m_mainHandler->dts()->removeTargetInformationByKey(m_data.id());
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -133,7 +132,7 @@ bool ObjectTargetInformation::isValid() const
|
||||
//------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectTargetInformation::createObject(const TargetInformation &data)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
m_data = data;
|
||||
|
||||
if (m_data.id() <= 0)
|
||||
@@ -144,20 +143,20 @@ Core::FunctionReplyObject ObjectTargetInformation::createObject(const TargetInfo
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting TargetInformation-data into database"));
|
||||
|
||||
m_data.id(dbData.id);
|
||||
DEBUG_LOG() << "New PpmTargetInformation: " /*<< m_data.id()*/;
|
||||
DEBUG_LOG(m_logger) << "New PpmTargetInformation: " /*<< 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 ObjectTargetInformation::updateObject(const TargetInformation &data)
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START, participantId=" << data.participantId()
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, participantId=" << data.participantId()
|
||||
<< " size =" << data.shootbackAreas().size();
|
||||
Database::PpmTargetInformation dbData;
|
||||
dbData = toDbData(data);
|
||||
@@ -166,12 +165,12 @@ Core::FunctionReplyObject ObjectTargetInformation::updateObject(const TargetInfo
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Error updating TargetInformation-data into database"));
|
||||
|
||||
m_data = data;
|
||||
DEBUG_LOG() << "Data changed for TargetInformation: " << m_data.participantId();
|
||||
DEBUG_LOG(m_logger) << "Data changed for TargetInformation: " << m_data.participantId();
|
||||
|
||||
// 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.shootbackAreas().size();
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
}
|
||||
@@ -179,7 +178,7 @@ Core::FunctionReplyObject ObjectTargetInformation::updateObject(const TargetInfo
|
||||
//------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectTargetInformation::removeObject()
|
||||
{
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
|
||||
if (!m_mainHandler->db()->removePpmTargetInformation(m_data.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "TargetInformation with id %1 can not be removed from DB")).arg(m_data.id());
|
||||
@@ -187,7 +186,7 @@ Core::FunctionReplyObject ObjectTargetInformation::removeObject()
|
||||
if (!m_mainHandler->dts()->removeTargetInformationByKey(m_data.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "TargetInformation 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());
|
||||
}
|
||||
|
||||
@@ -195,10 +194,10 @@ Core::FunctionReplyObject ObjectTargetInformation::removeObject()
|
||||
//------------------------------------------------------------------------------
|
||||
void ObjectTargetInformation::onPublishData()
|
||||
{
|
||||
TRACE_LOG() << "Publish TargetInformation-data to dds (" << m_data.id() << ") ...";
|
||||
TRACE_LOG(m_logger) << "Publish TargetInformation-data to dds (" << m_data.id() << ") ...";
|
||||
|
||||
if (!m_mainHandler->dts()->publish(m_data))
|
||||
ERROR_LOG() << "Error publishing TargetInformation-data to dds";
|
||||
ERROR_LOG(m_logger) << "Error publishing TargetInformation-data to dds";
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
|
||||
+1
@@ -46,6 +46,7 @@ public:
|
||||
static TargetInformation toDdsData(const Database::PpmTargetInformation &dbData); // db -> dds
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onPublishData();
|
||||
|
||||
private:
|
||||
|
||||
+20
-20
@@ -40,7 +40,7 @@ bool TemplateHandler::init()
|
||||
};
|
||||
if (!m_mainHandler->db()->select(cb))
|
||||
{
|
||||
ERROR_LOG() << "Error while reading template data from database";
|
||||
ERROR_LOG(m_logger) << "Error while reading template data from database";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,10 +58,10 @@ bool TemplateHandler::init()
|
||||
void TemplateHandler::onModifyTemplateDataRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ParticipantManagement::ModifyTemplateDataRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onModifyTemplateDataRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onModifyTemplateDataRequest: " << request;
|
||||
const auto ret = modifyTemplateDataRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->fts()->modifyTemplateDataReply(cookie, ret);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
|
||||
}
|
||||
removeTransaction.commit();
|
||||
|
||||
DEBUG_LOG() << "Starting validating ModifyTemplateDataRequest";
|
||||
DEBUG_LOG(m_logger) << "Starting validating ModifyTemplateDataRequest";
|
||||
if (templatesToBeCreatedOrModified.size() >= 1000) // concurrent validation for big requests
|
||||
{
|
||||
QVector<QFuture<Core::FunctionReplyObject>> futureVec;
|
||||
@@ -125,7 +125,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
|
||||
{
|
||||
for (const ParticipantManagement::TemplateData ¤tTemplate : std::as_const(templatesToBeCreatedOrModified))
|
||||
{
|
||||
DEBUG_LOG() << "Validating template: " << currentTemplate;
|
||||
DEBUG_LOG(m_logger) << "Validating template: " << currentTemplate;
|
||||
auto ret = validateTemplateData(templatesToBeCreatedOrModified, modIdToTemplateId, currentTemplate);
|
||||
if (ret.error())
|
||||
return ret;
|
||||
@@ -134,17 +134,17 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
|
||||
|
||||
DBTransaction trans(m_mainHandler->db()->database());
|
||||
// only continue if there was no error detected
|
||||
DEBUG_LOG() << "ModifyTemplateDataRequest has valid data";
|
||||
DEBUG_LOG(m_logger) << "ModifyTemplateDataRequest has valid data";
|
||||
|
||||
// create new and update existing templates
|
||||
DEBUG_LOG() << "Creating new and updating existing templates ...";
|
||||
DEBUG_LOG(m_logger) << "Creating new and updating existing templates ...";
|
||||
|
||||
for (const TemplateData ¤tData : std::as_const(templatesToBeCreatedOrModified))
|
||||
{
|
||||
Template *templateToUpdate = m_templates.value(modIdToTemplateId.value(currentData.modId()));
|
||||
if (!templateToUpdate)
|
||||
{
|
||||
DEBUG_LOG() << "Creating new template: " << currentData;
|
||||
DEBUG_LOG(m_logger) << "Creating new template: " << currentData;
|
||||
const auto ret = createNewTemplate(currentData, modIdToTemplateId, templatesWithChanges);
|
||||
if (ret.error())
|
||||
return ret;
|
||||
@@ -155,13 +155,13 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
|
||||
if (templateToUpdate->hasToBeChanged(currentData) &&
|
||||
!templatesWithChanges.contains(templateToUpdate))
|
||||
{
|
||||
DEBUG_LOG() << "Template changed: " << templateToUpdate->toDdsTemplateParticipant();
|
||||
DEBUG_LOG(m_logger) << "Template changed: " << templateToUpdate->toDdsTemplateParticipant();
|
||||
templatesWithChanges.append(templateToUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "New templates created and existing templates updated";
|
||||
DEBUG_LOG(m_logger) << "New templates created and existing templates updated";
|
||||
|
||||
// build hierarchy
|
||||
for (const TemplateData ¤tData : std::as_const(templatesToBeCreatedOrModified)) // first set superiorIds
|
||||
@@ -179,7 +179,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
|
||||
if (!currentTemplate->hasNewInferiorStructure(inferiorIdsForTemplate(currentTemplate->id())) ||
|
||||
templatesWithChanges.contains(currentTemplate))
|
||||
continue;
|
||||
DEBUG_LOG() << "Template got new inferiors: " << currentTemplate->toDdsTemplateParticipant();
|
||||
DEBUG_LOG(m_logger) << "Template got new inferiors: " << currentTemplate->toDdsTemplateParticipant();
|
||||
templatesWithChanges.append(currentTemplate);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ std::vector<int32_t> TemplateHandler::inferiorIdsForTemplate(int32_t superiorTem
|
||||
{
|
||||
if (currentTemplate->superiorId() == superiorTemplateId)
|
||||
{
|
||||
DEBUG_LOG() << "Building hierarchy, parentId: " << superiorTemplateId << " has child " << currentTemplate->id();
|
||||
DEBUG_LOG(m_logger) << "Building hierarchy, parentId: " << superiorTemplateId << " has child " << currentTemplate->id();
|
||||
result.push_back(currentTemplate->id());
|
||||
}
|
||||
}
|
||||
@@ -254,14 +254,14 @@ Core::FunctionReplyObject TemplateHandler::validateTemplateData(const QVector<Te
|
||||
{
|
||||
if (templateToValidate.templateId() != 0)
|
||||
{
|
||||
DEBUG_LOG() << "Checking template id";
|
||||
DEBUG_LOG(m_logger) << "Checking template id";
|
||||
Template *existingTemplate = m_templates.value(templateToValidate.templateId(), nullptr);
|
||||
if (existingTemplate == nullptr)
|
||||
return Core::FunctionReplyObject(tr_lts("dds",
|
||||
"Could not execute ModifyTemplateDataRequest, because an invalid template ID (%1) was given"))
|
||||
.arg(templateToValidate.templateId());
|
||||
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
{
|
||||
QMutexLocker l(&m_mutex);
|
||||
modIdToTemplateId.insert(templateToValidate.modId(), existingTemplate->id()); /* register template to indicate that this template
|
||||
@@ -272,7 +272,7 @@ Core::FunctionReplyObject TemplateHandler::validateTemplateData(const QVector<Te
|
||||
// superior ids valid?
|
||||
if (templateToValidate.superiorModId() > 0)
|
||||
{
|
||||
DEBUG_LOG() << "checking superiorIds";
|
||||
DEBUG_LOG(m_logger) << "checking superiorIds";
|
||||
// superior exists?
|
||||
bool isExistingSuperiorId = false;
|
||||
for (const TemplateData &dat : dataVec)
|
||||
@@ -289,14 +289,14 @@ Core::FunctionReplyObject TemplateHandler::validateTemplateData(const QVector<Te
|
||||
.arg(templateToValidate.modId())
|
||||
.arg(templateToValidate.superiorModId());
|
||||
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
if (templateToValidate.hierarchyNumber() <= 0)
|
||||
return Core::FunctionReplyObject(tr_lts("dds",
|
||||
"Could not execute ModifyTemplateDataRequest, because a data set has a superior but no hierarchyNumber set"));
|
||||
|
||||
// all hierarchy numbers with same superior unique?
|
||||
DEBUG_LOG() << "Checking hierarchyNumbers";
|
||||
DEBUG_LOG(m_logger) << "Checking hierarchyNumbers";
|
||||
for (const TemplateData &dat : dataVec)
|
||||
{
|
||||
// operator==() on optionals returns false if not set ...
|
||||
@@ -308,18 +308,18 @@ Core::FunctionReplyObject TemplateHandler::validateTemplateData(const QVector<Te
|
||||
.arg(dat.superiorModId())
|
||||
.arg(dat.hierarchyNumber());
|
||||
}
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
}
|
||||
|
||||
// typeId valid?
|
||||
DEBUG_LOG() << "Checking typeId";
|
||||
DEBUG_LOG(m_logger) << "Checking typeId";
|
||||
if (m_mainHandler->typeHandler()->typeById(templateToValidate.typeId()) == nullptr)
|
||||
return Core::FunctionReplyObject(tr_lts("dds",
|
||||
"Could not execute ModifyTemplateDataRequest, because data set with modId %1 has invalid typeId %2"))
|
||||
.arg(templateToValidate.modId())
|
||||
.arg(templateToValidate.typeId());
|
||||
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
+2
@@ -39,6 +39,8 @@ public:
|
||||
static std::shared_ptr<TypeHandler> createInstance(MainHandler *mainHandler, NGL::INGLLogger &logger);
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool isArtilleryType(int typeId) const;
|
||||
explicit TypeHandler(MainHandler *mainHandler, LOGGER_T logger);
|
||||
protected:
|
||||
|
||||
+19
-19
@@ -35,7 +35,7 @@ ParticipantManagement::UasHandling::MissionPlanHandler::~MissionPlanHandler()
|
||||
|
||||
bool MissionPlanHandler::init()
|
||||
{
|
||||
DEBUG_LOG()<<" -- MissionPlanHandler init...";
|
||||
DEBUG_LOG(m_logger)<<" -- MissionPlanHandler init...";
|
||||
qDeleteAll(m_objMissionPlans);
|
||||
m_objMissionPlans.clear();
|
||||
if (!loadMissionPlansFromDb())
|
||||
@@ -59,7 +59,7 @@ void MissionPlanHandler::onRemoveMissionPlanRequest(const rti::core::SampleIdent
|
||||
|
||||
void MissionPlanHandler::onSetMissionActionFulfilledRequest(const rti::core::SampleIdentity &cookie, const SetMissionActionFulfilledRequest &request)
|
||||
{
|
||||
//DEBUG_LOG()<<">> -- onSetMissionActionFulfilledRequest -- ";
|
||||
//DEBUG_LOG(m_logger)<<">> -- onSetMissionActionFulfilledRequest -- ";
|
||||
Core::FunctionReplyObject reply = setMissionActionFulfilledRequest(request);
|
||||
m_mainHandler->ddsHandler()->fts()->setMissionActionFulfilledReply(cookie, reply);
|
||||
}
|
||||
@@ -71,22 +71,22 @@ bool MissionPlanHandler::loadMissionPlansFromDb()
|
||||
QVector<ParticipantManagement::Database::PpmMissionAction> missionActionVec;
|
||||
if (!m_mainHandler->db()->select(missionActionVec))
|
||||
{
|
||||
ERROR_LOG()<<"Error reading data from database >> PpmMissionAction: "<<missionActionVec.size();
|
||||
ERROR_LOG(m_logger)<<"Error reading data from database >> PpmMissionAction: "<<missionActionVec.size();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_mainHandler->db()->select(missionItemVec))
|
||||
{
|
||||
ERROR_LOG()<<"Error reading data from database >> missionItemVec"<<missionItemVec.size();
|
||||
ERROR_LOG(m_logger)<<"Error reading data from database >> missionItemVec"<<missionItemVec.size();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_mainHandler->db()->select(missionPlanVec))
|
||||
{
|
||||
ERROR_LOG()<<"Error reading data from database >> missionPlanVec"<<missionPlanVec.size();
|
||||
ERROR_LOG(m_logger)<<"Error reading data from database >> missionPlanVec"<<missionPlanVec.size();
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "load MissionPlans From Db Plans size = " << missionPlanVec.size()
|
||||
DEBUG_LOG(m_logger) << "load MissionPlans From Db Plans size = " << missionPlanVec.size()
|
||||
<<" Items size = "<<missionItemVec.size()
|
||||
<<" Actions size = "<<missionActionVec.size();
|
||||
// add to internal buffer
|
||||
@@ -169,7 +169,7 @@ bool MissionPlanHandler::loadMissionPlansFromDb()
|
||||
m_mainHandler->ddsHandler()->dts()->publish(missionPlan);
|
||||
|
||||
}
|
||||
DEBUG_LOG()<<" -- END load mission plan From Db -- ";
|
||||
DEBUG_LOG(m_logger)<<" -- END load mission plan From Db -- ";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -180,11 +180,11 @@ bool MissionPlanHandler::isUasInAutoMode(int participantId)
|
||||
|
||||
if (uas.id() < 1)
|
||||
{
|
||||
ERROR_LOG() << "no uas for pid " << participantId;
|
||||
ERROR_LOG(m_logger) << "no uas for pid " << participantId;
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "uas with pid " << participantId << " is in mode: " << (int)uas.uasState().underlying();
|
||||
DEBUG_LOG(m_logger) << "uas with pid " << participantId << " is in mode: " << (int)uas.uasState().underlying();
|
||||
|
||||
return (uas.uasState() == ProjectDataManagement::UasState::Auto);
|
||||
}
|
||||
@@ -215,7 +215,7 @@ bool MissionPlanHandler::isUasCombatReady(int participantId)
|
||||
youngestState.stateTime(0);
|
||||
for (const auto &si : history)
|
||||
{
|
||||
DEBUG_LOG() << "StateInformation "
|
||||
DEBUG_LOG(m_logger) << "StateInformation "
|
||||
<< " time=" << si.stateTime()
|
||||
<< " vulnerabilityBits=" << si.vulnerabilityBits()
|
||||
<< " vulnerabilityKindId=" << si.vulnerabilityKindId();
|
||||
@@ -228,7 +228,7 @@ bool MissionPlanHandler::isUasCombatReady(int participantId)
|
||||
|
||||
Core::FunctionReplyObject MissionPlanHandler::createMissionPlanRequest(const ModifyMissionPlanRequest &request)
|
||||
{
|
||||
DEBUG_LOG() <<" >> -- createMissionPlanRequest -- ";
|
||||
DEBUG_LOG(m_logger) <<" >> -- createMissionPlanRequest -- ";
|
||||
if (request.participantId() > 0 && !isUasParticipant(request.participantId()))
|
||||
{
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Participant with id %1 is not a Uas participant.")).arg(request.participantId());
|
||||
@@ -267,7 +267,7 @@ Core::FunctionReplyObject MissionPlanHandler::createMissionPlanRequest(const Mod
|
||||
|
||||
Core::FunctionReplyObject MissionPlanHandler::modifyMissionPlanRequest(const ModifyMissionPlanRequest &request)
|
||||
{
|
||||
DEBUG_LOG()<<" >> -- modifyMissionPlanRequest -- ";
|
||||
DEBUG_LOG(m_logger)<<" >> -- modifyMissionPlanRequest -- ";
|
||||
/// 1- update Mission plan Table
|
||||
/// 2- remove first all mission items and their actions
|
||||
/// 3- add New mission items
|
||||
@@ -285,7 +285,7 @@ Core::FunctionReplyObject MissionPlanHandler::modifyMissionPlanRequest(const Mod
|
||||
|
||||
Core::FunctionReplyObject MissionPlanHandler::removeMissionPlanRequest(int id)
|
||||
{
|
||||
DEBUG_LOG()<<" >> -- removeMissionPlanRequest -- ";
|
||||
DEBUG_LOG(m_logger)<<" >> -- removeMissionPlanRequest -- ";
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectMissionPlan *obj = m_objMissionPlans.value(id, nullptr);
|
||||
if (!obj)
|
||||
@@ -317,7 +317,7 @@ bool MissionPlanHandler::setCurrentMissionActionFulfilled(int participantId, con
|
||||
{
|
||||
const QString thisMissionName(QStringLiteral("%1_%2_%3").arg(missionPlan->missionPlan().id()).arg(QString::fromStdString(missionPlan->missionPlan().name()), QString::fromStdString(item.name())));
|
||||
|
||||
INFO_LOG() << ">> mission item: this mission name: " << thisMissionName << ", fulfilled: " << msa.fulfilled();
|
||||
INFO_LOG(m_logger) << ">> mission item: this mission name: " << thisMissionName << ", fulfilled: " << msa.fulfilled();
|
||||
|
||||
if (msa.fulfilled() > 0)
|
||||
{
|
||||
@@ -329,7 +329,7 @@ bool MissionPlanHandler::setCurrentMissionActionFulfilled(int participantId, con
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << ">> ######### setMissionActionFulfilledRequest !!! item = " << item.itemNumber() << ", name = " << item.name() << ", missionPlan = " << missionPlan->missionPlan().id();
|
||||
DEBUG_LOG(m_logger) << ">> ######### setMissionActionFulfilledRequest !!! item = " << item.itemNumber() << ", name = " << item.name() << ", missionPlan = " << missionPlan->missionPlan().id();
|
||||
SetMissionActionFulfilledRequest req;
|
||||
req.actionNumber(msa.actionNumber());
|
||||
req.fulfilled(true);
|
||||
@@ -338,7 +338,7 @@ bool MissionPlanHandler::setCurrentMissionActionFulfilled(int participantId, con
|
||||
const auto res = setMissionActionFulfilledRequest(req);
|
||||
if (res.error())
|
||||
{
|
||||
ERROR_LOG() << "failed to set current mission action as fulfilled: " << res.str();
|
||||
ERROR_LOG(m_logger) << "failed to set current mission action as fulfilled: " << res.str();
|
||||
}
|
||||
|
||||
found = true;
|
||||
@@ -364,13 +364,13 @@ bool MissionPlanHandler::setCurrentMissionActionFulfilled(int participantId, con
|
||||
}
|
||||
|
||||
// maybe okay? last mission action was already fulfilled? is this even possible at this point?
|
||||
DEBUG_LOG() << "failed to set current mission action as fulfilled: no action found for pId " << participantId;
|
||||
DEBUG_LOG(m_logger) << "failed to set current mission action as fulfilled: no action found for pId " << participantId;
|
||||
return false;
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject MissionPlanHandler::setMissionActionFulfilledRequest(const SetMissionActionFulfilledRequest &request)
|
||||
{
|
||||
DEBUG_LOG()<<" -- [setMissionActionFulfilledRequest] req.missionId: "<<request.missionId();
|
||||
DEBUG_LOG(m_logger)<<" -- [setMissionActionFulfilledRequest] req.missionId: "<<request.missionId();
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectMissionPlan *obj = m_objMissionPlans.value(request.missionId(), nullptr);
|
||||
if (!obj)
|
||||
@@ -391,7 +391,7 @@ bool MissionPlanHandler::isUasParticipant(int participantId) const
|
||||
|
||||
if (PARTICIPANT == nullptr)
|
||||
{
|
||||
WARNING_LOG() << "Got invalid participantId " << participantId;
|
||||
WARNING_LOG(m_logger) << "Got invalid participantId " << participantId;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -42,6 +42,7 @@ public:
|
||||
bool setCurrentMissionActionFulfilled(int participantId, const QString &nameOfTheMissionThatEnded);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool isUasCombatReady(int participantId);
|
||||
bool isUasInAutoMode(int participantId);
|
||||
Core::FunctionReplyObject createMissionPlanRequest(const ModifyMissionPlanRequest &request);
|
||||
|
||||
+18
-19
@@ -18,13 +18,12 @@ namespace UasHandling
|
||||
ObjectMissionPlan::ObjectMissionPlan(const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<DatabaseInterface> &db,
|
||||
const ParticipantManagement::MissionPlan & missionPlan,
|
||||
QObject *parent)
|
||||
: QObject(parent)
|
||||
QObject *parent) : QObject(parent)
|
||||
, m_ddsHandler(ddsHandler)
|
||||
, m_db(db)
|
||||
, m_missionplan(missionPlan)
|
||||
{
|
||||
DEBUG_LOG()<<" - ctor ObjectMissionPlan: planId: "<<m_missionplan.id();
|
||||
, m_missionplan(missionPlan),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
DEBUG_LOG(m_logger)<<" - ctor ObjectMissionPlan: planId: "<<m_missionplan.id();
|
||||
|
||||
}
|
||||
|
||||
@@ -125,7 +124,7 @@ Core::FunctionReplyObject ObjectMissionPlan::createMissionPlan(Database::PpmMiss
|
||||
if (!m_db->insert(newMissionPlan))
|
||||
{
|
||||
QString error = QStringLiteral("Could not insert mission plan into database");
|
||||
ERROR_LOG()<< error;
|
||||
ERROR_LOG(m_logger)<< error;
|
||||
return Core::FunctionReplyObject(error.toStdString().c_str());
|
||||
}
|
||||
|
||||
@@ -181,11 +180,11 @@ Core::FunctionReplyObject ObjectMissionPlan::createMissionPlan(Database::PpmMiss
|
||||
for (auto &item : m_missionplan.items())
|
||||
{
|
||||
for (auto &action : item.actions())
|
||||
DEBUG_LOG()<<"[CREATE] itemIdx: "<<item.itemNumber()
|
||||
DEBUG_LOG(m_logger)<<"[CREATE] itemIdx: "<<item.itemNumber()
|
||||
<<" act.Num: "<<action.actionNumber()<<" act.ItemNum: "<<action.itemNumber()<<" itemFul:"<<action.fulfilled();
|
||||
}
|
||||
trans.commit();
|
||||
DEBUG_LOG()<< ">> [NEW] mission plan with id( "<<newMissionPlan.id<<" ) inserted !!";
|
||||
DEBUG_LOG(m_logger)<< ">> [NEW] mission plan with id( "<<newMissionPlan.id<<" ) inserted !!";
|
||||
return Core::FunctionReplyObject(newMissionPlan.id);
|
||||
}
|
||||
|
||||
@@ -205,7 +204,7 @@ Core::FunctionReplyObject ObjectMissionPlan::updateMissionPlan(Database::PpmMiss
|
||||
if (!m_db->update(newMissionPlan))
|
||||
{
|
||||
QString error = QStringLiteral("Could not update mission plan! ");
|
||||
ERROR_LOG()<< error;
|
||||
ERROR_LOG(m_logger)<< error;
|
||||
return Core::FunctionReplyObject(error.toStdString().c_str());
|
||||
}
|
||||
|
||||
@@ -215,7 +214,7 @@ Core::FunctionReplyObject ObjectMissionPlan::updateMissionPlan(Database::PpmMiss
|
||||
if (!m_db->removePpmMissionItem(itemId))
|
||||
{
|
||||
QString error = QStringLiteral("Could not remove mission plan from database");
|
||||
ERROR_LOG()<< error;
|
||||
ERROR_LOG(m_logger)<< error;
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Could not update mission plan into!"));
|
||||
}
|
||||
}
|
||||
@@ -269,7 +268,7 @@ Core::FunctionReplyObject ObjectMissionPlan::updateMissionPlan(Database::PpmMiss
|
||||
m_missionplan.itemsFulfilled(0); // on update items and action entries will be cleared
|
||||
m_missionplan.fulfilled(0);
|
||||
|
||||
DEBUG_LOG()<< ">> [UPDATE] mission plan with id( "<<m_missionplan.id()<<" ) Updated !!";
|
||||
DEBUG_LOG(m_logger)<< ">> [UPDATE] mission plan with id( "<<m_missionplan.id()<<" ) Updated !!";
|
||||
|
||||
return Core::FunctionReplyObject(m_missionplan.id());
|
||||
}
|
||||
@@ -280,13 +279,13 @@ Core::FunctionReplyObject ObjectMissionPlan::removeMissionPlan(int id)
|
||||
if (!m_db->removePpmMissionPlan(id))
|
||||
{
|
||||
QString error = QStringLiteral("Could not remove mission plan ! ");
|
||||
ERROR_LOG()<< error;
|
||||
ERROR_LOG(m_logger)<< error;
|
||||
return Core::FunctionReplyObject(error.toStdString().c_str());
|
||||
}
|
||||
trans.commit();
|
||||
m_dbMissionActions.clear();
|
||||
m_mapMissionItems.clear();
|
||||
DEBUG_LOG()<< ">> [REMOVE] mission Action with id( "<<id<<" ) deleted !!";
|
||||
DEBUG_LOG(m_logger)<< ">> [REMOVE] mission Action with id( "<<id<<" ) deleted !!";
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
@@ -300,14 +299,14 @@ Core::FunctionReplyObject ObjectMissionPlan::setMissionActionFulfilled(SetMissio
|
||||
|
||||
if (!m_db)
|
||||
{
|
||||
ERROR_LOG() << "no init yet....";
|
||||
ERROR_LOG(m_logger) << "no init yet....";
|
||||
return Core::FunctionReplyObject("");
|
||||
}
|
||||
|
||||
if (req.missionId() != m_missionplan.id())
|
||||
{
|
||||
QString error = QStringLiteral("Wrong missionPlan Object caught Request: %1 / currPlanId: %2").arg(req.missionId()).arg(m_missionplan.id());
|
||||
ERROR_LOG()<< error;
|
||||
ERROR_LOG(m_logger)<< error;
|
||||
return Core::FunctionReplyObject(error.toStdString().c_str());
|
||||
}
|
||||
|
||||
@@ -326,7 +325,7 @@ Core::FunctionReplyObject ObjectMissionPlan::setMissionActionFulfilled(SetMissio
|
||||
|| req.itemNumber() < 0) // actionNumber start by 0
|
||||
{
|
||||
QString error = QStringLiteral("Could not set mission action with id: %1 ! ").arg(req.actionNumber());
|
||||
ERROR_LOG()<< error;
|
||||
ERROR_LOG(m_logger)<< error;
|
||||
return Core::FunctionReplyObject(error.toStdString().c_str());
|
||||
}
|
||||
|
||||
@@ -336,7 +335,7 @@ Core::FunctionReplyObject ObjectMissionPlan::setMissionActionFulfilled(SetMissio
|
||||
if (!m_db->update(dbAction))
|
||||
{
|
||||
QString error = QStringLiteral("Could not update mission action! ");
|
||||
ERROR_LOG()<< error;
|
||||
ERROR_LOG(m_logger)<< error;
|
||||
return Core::FunctionReplyObject(error.toStdString().c_str());
|
||||
}
|
||||
|
||||
@@ -371,7 +370,7 @@ Core::FunctionReplyObject ObjectMissionPlan::setMissionActionFulfilled(SetMissio
|
||||
|
||||
Core::FunctionReplyObject ObjectMissionPlan::setMissionPlanAborted(bool state)
|
||||
{
|
||||
DEBUG_LOG()<<" -- [setMissionPlanAborted] abort mission plan: "<<m_missionplan.id();
|
||||
DEBUG_LOG(m_logger)<<" -- [setMissionPlanAborted] abort mission plan: "<<m_missionplan.id();
|
||||
Database::PpmMissionPlan dbMissionPlan;
|
||||
// m_db->selectPpmMissionPlan(m_missionplan.id(),dbMissionPlan);
|
||||
dbMissionPlan.missionStart = QDateTime::fromMSecsSinceEpoch(m_missionplan.missionStart());
|
||||
@@ -387,7 +386,7 @@ Core::FunctionReplyObject ObjectMissionPlan::setMissionPlanAborted(bool state)
|
||||
if (!m_db->update(dbMissionPlan))
|
||||
{
|
||||
QString error = QStringLiteral("Could not update mission plan! ");
|
||||
ERROR_LOG()<< error;
|
||||
ERROR_LOG(m_logger)<< error;
|
||||
return Core::FunctionReplyObject(error.toStdString().c_str());
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ public:
|
||||
Core::FunctionReplyObject setMissionActionFulfilled(SetMissionActionFulfilledRequest req, qint64 currentTimeMSec);
|
||||
Core::FunctionReplyObject setMissionPlanAborted(bool state);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<ParticipantManagement::DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<ParticipantManagement::DatabaseInterface> m_db;
|
||||
ParticipantManagement::MissionPlan m_missionplan;
|
||||
|
||||
+13
-13
@@ -49,7 +49,7 @@ bool UasHandler::init()
|
||||
// read parties from db
|
||||
if (!m_mainHandler->db()->select(uasVec))
|
||||
{
|
||||
ERROR_LOG() << "Error while reading Uas data from database";
|
||||
ERROR_LOG(m_logger) << "Error while reading Uas data from database";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ bool UasHandler::init()
|
||||
this, &UasHandler::onExerciseChanged);
|
||||
if (!m_exmDtc->enableExercise())
|
||||
{
|
||||
ERROR_LOG() << "Could not enable Topic 'Exercise' of EXM DTC";
|
||||
ERROR_LOG(m_logger) << "Could not enable Topic 'Exercise' of EXM DTC";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -89,16 +89,16 @@ void UasHandler::onCreateModifyUasRequest(const rti::core::SampleIdentity &cooki
|
||||
|
||||
void UasHandler::onRemoveUasRequest(const rti::core::SampleIdentity &cookie, const RemoveUasRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onRemoveUasRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onRemoveUasRequest: " << request;
|
||||
auto ret = removeUas(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->exAnyFts()->removeUasReply(cookie, ret);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject UasHandler::removeUas(const RemoveUasRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onRemoveUasRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onRemoveUasRequest " << request;
|
||||
|
||||
if (request.id() < 0)
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Got request to delete an UAS, but no valid UAS id to delete"));
|
||||
@@ -111,7 +111,7 @@ Core::FunctionReplyObject UasHandler::removeUas(const RemoveUasRequest &request)
|
||||
if (uasToDelete->participantId() > 0)
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Not possible to delete a UAS in use"));
|
||||
|
||||
DEBUG_LOG() << "Removing UAS with ID " << request.id();
|
||||
DEBUG_LOG(m_logger) << "Removing UAS with ID " << request.id();
|
||||
|
||||
return removeUas(uasToDelete);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ Core::FunctionReplyObject UasHandler::removeUas(UasHandling::Uas *uasToDelete)
|
||||
//------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject UasHandler::createUas(const CreateModifyUasRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << Q_FUNC_INFO;
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO;
|
||||
|
||||
// cant check here as we dont have access to all party participants
|
||||
/*
|
||||
@@ -145,7 +145,7 @@ Core::FunctionReplyObject UasHandler::createUas(const CreateModifyUasRequest &re
|
||||
{
|
||||
QString error = QStringLiteral("Participant with id %1 is no Uas participant.").arg(request.participantId());
|
||||
|
||||
ERROR_LOG() << error;
|
||||
ERROR_LOG(m_logger) << error;
|
||||
|
||||
return Core::FunctionReplyObject(error.toStdString().c_str());
|
||||
}*/
|
||||
@@ -168,7 +168,7 @@ Core::FunctionReplyObject UasHandler::createUas(const CreateModifyUasRequest &re
|
||||
{
|
||||
QString error = QStringLiteral("Could not insert Uas into database");
|
||||
|
||||
ERROR_LOG() << error;
|
||||
ERROR_LOG(m_logger) << error;
|
||||
|
||||
return Core::FunctionReplyObject(error.toStdString().c_str());
|
||||
}
|
||||
@@ -188,7 +188,7 @@ Core::FunctionReplyObject UasHandler::modifyUas(const CreateModifyUasRequest &re
|
||||
{
|
||||
QString error = QStringLiteral("Uas topic with id %1 not present. Not possible to modify it.").arg(request.id());
|
||||
|
||||
ERROR_LOG() << error;
|
||||
ERROR_LOG(m_logger) << error;
|
||||
|
||||
return Core::FunctionReplyObject(error.toStdString().c_str());
|
||||
}
|
||||
@@ -204,7 +204,7 @@ Core::FunctionReplyObject UasHandler::modifyUas(const CreateModifyUasRequest &re
|
||||
{
|
||||
QString error = QStringLiteral("There are no changes in modify request.");
|
||||
|
||||
ERROR_LOG() << error;
|
||||
ERROR_LOG(m_logger) << error;
|
||||
|
||||
return Core::FunctionReplyObject(error.toStdString().c_str());
|
||||
}
|
||||
@@ -215,7 +215,7 @@ Core::FunctionReplyObject UasHandler::modifyUas(const CreateModifyUasRequest &re
|
||||
{
|
||||
QString error = QStringLiteral("Participant with id %1 is no Uas participant.").arg(request.participantId());
|
||||
|
||||
ERROR_LOG() << error;
|
||||
ERROR_LOG(m_logger) << error;
|
||||
|
||||
return Core::FunctionReplyObject(error.toStdString().c_str());
|
||||
}
|
||||
@@ -233,7 +233,7 @@ bool UasHandler::isUasParticipant(int participantId) const
|
||||
|
||||
if (PARTICIPANT == nullptr)
|
||||
{
|
||||
WARNING_LOG() << "Got invalid participantId " << participantId;
|
||||
WARNING_LOG(m_logger) << "Got invalid participantId " << participantId;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
@@ -42,6 +42,7 @@ private slots:
|
||||
void onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification mod);
|
||||
void onUASRadioLinkConnectionStatusChanged(const UASRadioLinkConnectionStatus &data, DataModification mod);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
Core::FunctionReplyObject removeUas(const RemoveUasRequest &request);
|
||||
Core::FunctionReplyObject removeUas(UasHandling::Uas *uasToDelete);
|
||||
Core::FunctionReplyObject createUas(const CreateModifyUasRequest &request);
|
||||
|
||||
+5
-5
@@ -36,7 +36,7 @@ bool WebSocketInterfaceHandler::init()
|
||||
{
|
||||
cleanup();
|
||||
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
m_dataManager = new DataManager(m_mainHandler->exerciseId(), m_mainHandler->db(), m_mainHandler->ddsHandler()->dtc());
|
||||
|
||||
@@ -44,15 +44,15 @@ bool WebSocketInterfaceHandler::init()
|
||||
|
||||
m_webSocketServer = new LtsWebSocket::LtsWebSocketServer(m_messageFactory, this);
|
||||
|
||||
DEBUG_LOG() << "Initialising LtsWebSocketServer";
|
||||
DEBUG_LOG(m_logger) << "Initialising LtsWebSocketServer";
|
||||
if (!m_webSocketServer->init(QStringLiteral("PPM"), Settings::getWebSocketServerPortRange(1)))
|
||||
{
|
||||
ERROR_LOG() << "Failed to initialise LtsWebSocketServer";
|
||||
ERROR_LOG(m_logger) << "Failed to initialise LtsWebSocketServer";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
DEBUG_LOG() << "Connection signals and slots";
|
||||
DEBUG_LOG(m_logger) << "Connection signals and slots";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,9 @@
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
|
||||
DdsHandler::DdsHandler(int domainId, int exerciseId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, exerciseId <= 0 ? IDL::PartitionType::Global : IDL::PartitionType::Exercise, exerciseId))
|
||||
{
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DdsHandler::DdsHandler(int domainId, int exerciseId) : m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, exerciseId <= 0 ? IDL::PartitionType::Global : IDL::PartitionType::Exercise, exerciseId)),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
DdsHandler::~DdsHandler()
|
||||
@@ -40,7 +39,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;
|
||||
}
|
||||
|
||||
@@ -56,7 +55,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
std::shared_ptr<DTS::PartitionTime> dtsPartitionTime;
|
||||
dtsPartitionTime.reset(m_ddsConnector->createDTS<DTS::PartitionTimeImpl>());
|
||||
m_exerciseTime = std::make_shared<ExerciseTime>(dtsPartitionTime);
|
||||
ERROR_LOG() << "OKKKKK THIS THE NEW MAIN HANDLER DDS " << this->thread();
|
||||
ERROR_LOG(m_logger) << "OKKKKK THIS THE NEW MAIN HANDLER DDS " << this->thread();
|
||||
m_ddsDts = ParticipantManagement::Interface::Dts::create(m_ddsConnector);
|
||||
m_ddsFts = ParticipantManagement::Interface::Fts::create(m_ddsConnector);
|
||||
m_ddsDtc = ParticipantManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
@@ -68,7 +67,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
m_exAnyConnector = std::make_shared<DDSConnector::DdsConnector>(m_ddsConnector->getDomainParticipant(), IDL::PartitionType::Any);
|
||||
if (!m_exAnyConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG() << "Could not init Dds Connector with IDL::PartitionType::Any";
|
||||
ERROR_LOG(m_logger) << "Could not init Dds Connector with IDL::PartitionType::Any";
|
||||
return false;
|
||||
}
|
||||
m_exAnyConnector->initPublisherSubscriber();
|
||||
@@ -77,7 +76,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
m_ddsAnyExDts->enableUASRadioLinkConnectionStatus(true);
|
||||
if (exerciseId <= 0)
|
||||
{
|
||||
DEBUG_LOG() << "Creating * FTS: " << m_exAnyConnector->getDefaultPartition();
|
||||
DEBUG_LOG(m_logger) << "Creating * FTS: " << m_exAnyConnector->getDefaultPartition();
|
||||
m_ddsAnyExFts = ParticipantManagement::Interface::Fts::create(m_exAnyConnector);
|
||||
// do not enable anything here - enable where it is used (inside type handling) to make sure
|
||||
// no other service get a subscription matched information without actually having data
|
||||
@@ -107,7 +106,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
!m_ddsDts->enableMissionPlan(bExe)
|
||||
)
|
||||
{
|
||||
ERROR_LOG() << "Error initializing DTS";
|
||||
ERROR_LOG(m_logger) << "Error initializing DTS";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -144,7 +143,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
|
||||
)
|
||||
{
|
||||
ERROR_LOG() << "Error initializing FTS";
|
||||
ERROR_LOG(m_logger) << "Error initializing FTS";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
void longActionBreak();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_exAnyConnector;
|
||||
|
||||
|
||||
+26
-26
@@ -45,16 +45,16 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(domainId, exerciseId);
|
||||
if (!m_ddsHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Could not init DdsHandler";
|
||||
ERROR_LOG(m_logger) << "Could not init DdsHandler";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init DdsHandler"));
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "DdsHandler initialized";
|
||||
DEBUG_LOG(m_logger) << "DdsHandler initialized";
|
||||
|
||||
m_dbHandler = std::make_shared<DbHandler>();
|
||||
if (!m_dbHandler->init(exerciseId, Settings::settings()))
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -63,7 +63,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;
|
||||
}
|
||||
@@ -72,55 +72,55 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
{
|
||||
m_dbHandlerEx0 = m_dbHandler;
|
||||
}
|
||||
DEBUG_LOG() << "DbHandler initialized";
|
||||
DEBUG_LOG(m_logger) << "DbHandler initialized";
|
||||
|
||||
m_typeHandler = TypeHandling::TypeHandler::createInstance(this, m_logger);
|
||||
if (!m_typeHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Could not init TypeHandler";
|
||||
ERROR_LOG(m_logger) << "Could not init TypeHandler";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init TypeHandler"));
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "TypeHandler initialized";
|
||||
DEBUG_LOG(m_logger) << "TypeHandler initialized";
|
||||
|
||||
m_partyHandler = std::make_shared<PartyHandling::PartyHandler>(this);
|
||||
if (!m_partyHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Could not init PartyHandler";
|
||||
ERROR_LOG(m_logger) << "Could not init PartyHandler";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init PartyHandler"));
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "PartyHandler initialized";
|
||||
DEBUG_LOG(m_logger) << "PartyHandler initialized";
|
||||
|
||||
m_tabFtc = TrainingAreaBase::Interface::Ftc::create(m_ddsHandler->dds());
|
||||
if (!m_tabFtc->enableAll())
|
||||
{
|
||||
ERROR_LOG() << "Could not init TrainingAreaBase FTC";
|
||||
ERROR_LOG(m_logger) << "Could not init TrainingAreaBase FTC";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "TrainingAreaBase FTC initialized";
|
||||
DEBUG_LOG(m_logger) << "TrainingAreaBase FTC initialized";
|
||||
|
||||
m_aesFtc = AreaEffectSimulation::Interface::Ftc::create(m_ddsHandler->dds());
|
||||
if (!m_aesFtc->enableChargeAdministrationModify())
|
||||
{
|
||||
ERROR_LOG() << "Could not init AreaEffectSimulation FTC";
|
||||
ERROR_LOG(m_logger) << "Could not init AreaEffectSimulation FTC";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_participantHandler = std::make_shared<ParticipantHandling::ParticipantHandlerForExercise>(this);
|
||||
if (!m_participantHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Could not init ParticipantHandler";
|
||||
ERROR_LOG(m_logger) << "Could not init ParticipantHandler";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init ParticipantHandler"));
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "ParticipantHandler initialized";
|
||||
DEBUG_LOG(m_logger) << "ParticipantHandler initialized";
|
||||
m_ddsHandler->pacemaker()->addPort(m_participantHandler->getWebSocketPort(), Core::PortType::WebSocketPositionServer);
|
||||
|
||||
m_targetInformationHandler = std::make_shared<ParticipantManagement::HandlerTargetInformation>(this);
|
||||
if (!m_targetInformationHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Could not init TargetInformationHandler";
|
||||
ERROR_LOG(m_logger) << "Could not init TargetInformationHandler";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init TargetInformationHandler"));
|
||||
return false;
|
||||
}
|
||||
@@ -129,11 +129,11 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
m_biteHandler = std::make_shared<BiteHandling::BiteHandler>(this);
|
||||
if (!m_biteHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Could not init BiteHandler";
|
||||
ERROR_LOG(m_logger) << "Could not init BiteHandler";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init BiteHandler"));
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "BiteHandler initialized";
|
||||
DEBUG_LOG(m_logger) << "BiteHandler initialized";
|
||||
|
||||
// template handler is not needed in exercise dependent PPM
|
||||
if (m_ddsHandler->dds()->getPartitionId() <= 0)
|
||||
@@ -141,11 +141,11 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
m_templateHandler = std::make_shared<TemplateHandling::TemplateHandler>(this);
|
||||
if (!m_templateHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Could not init TemplateHandler";
|
||||
ERROR_LOG(m_logger) << "Could not init TemplateHandler";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init TemplateHandler"));
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "TemplateHandler initialized";
|
||||
DEBUG_LOG(m_logger) << "TemplateHandler initialized";
|
||||
}
|
||||
|
||||
m_getParticipants = std::make_shared<GetParticipants>(this);
|
||||
@@ -154,20 +154,20 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
m_equipmentEventHandler = std::make_shared<EquipmentEventHandling::EquipmentEventHandler>(this);
|
||||
if (!m_equipmentEventHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Could not init EquipmentEventHandler";
|
||||
ERROR_LOG(m_logger) << "Could not init EquipmentEventHandler";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init EquipmentEventHandler"));
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "EquipmentEventHandler initialized";
|
||||
DEBUG_LOG(m_logger) << "EquipmentEventHandler initialized";
|
||||
|
||||
// WebSocketServer
|
||||
m_websocketHandler = std::make_shared<WebSocketInterface::WebSocketInterfaceHandler>(this);
|
||||
if (!m_websocketHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Could not init WebSocketInterfaceHandler";
|
||||
ERROR_LOG(m_logger) << "Could not init WebSocketInterfaceHandler";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "WebSocketInterfaceHandler initialized";
|
||||
DEBUG_LOG(m_logger) << "WebSocketInterfaceHandler initialized";
|
||||
m_ddsHandler->pacemaker()->addPort(m_websocketHandler->webSocketPort(), Core::PortType::WebSocketServer);
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
|
||||
|
||||
@@ -177,11 +177,11 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
m_uasHandler = std::make_shared<UasHandling::UasHandler>(this);
|
||||
if (!m_uasHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Could not init UasHandler";
|
||||
ERROR_LOG(m_logger) << "Could not init UasHandler";
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "UasHandler initialized";
|
||||
DEBUG_LOG(m_logger) << "UasHandler initialized";
|
||||
}
|
||||
|
||||
if (exerciseId != 0)
|
||||
@@ -190,7 +190,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
m_missionPlanHandler = std::make_shared<UasHandling::MissionPlanHandler>(this);
|
||||
if (!m_missionPlanHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Couldn't init MissionPlanHandler";
|
||||
ERROR_LOG(m_logger) << "Couldn't init MissionPlanHandler";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,8 @@ class MainHandler final : public ParticipantHandling::BaseDataProvider
|
||||
qint64 currentTimeMSec() const override;
|
||||
|
||||
private: // attributes
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<DbHandler> m_dbHandler;
|
||||
std::shared_ptr<DbHandler> m_dbHandlerEx0;
|
||||
|
||||
+4
-4
@@ -37,14 +37,14 @@ bool WebSocketHandler::init(quint16 listenPort)
|
||||
{
|
||||
if (!m_webSocketServer->listen(QHostAddress::Any, listenPort))
|
||||
{
|
||||
WARNING_LOG() << "Can not listen on port " << listenPort << " - aborting";
|
||||
WARNING_LOG(m_logger) << "Can not listen on port " << listenPort << " - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
connect(m_webSocketServer, &QWebSocketServer::newConnection,
|
||||
this, &WebSocketHandler::onNewConnection);
|
||||
|
||||
INFO_LOG() << "Listening on port " << m_webSocketServer->serverPort();
|
||||
INFO_LOG(m_logger) << "Listening on port " << m_webSocketServer->serverPort();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ void WebSocketHandler::onNewConnection()
|
||||
|
||||
m_webSockets += ws;
|
||||
|
||||
INFO_LOG() << "New websocket connected";
|
||||
INFO_LOG(m_logger) << "New websocket connected";
|
||||
}
|
||||
|
||||
void WebSocketHandler::onWebSocketDisconnected()
|
||||
@@ -102,7 +102,7 @@ void WebSocketHandler::onWebSocketDisconnected()
|
||||
m_webSockets.removeAll(ws);
|
||||
ws->deleteLater();
|
||||
|
||||
INFO_LOG() << "A websocket disconnected";
|
||||
INFO_LOG(m_logger) << "A websocket disconnected";
|
||||
}
|
||||
|
||||
bool WebSocketHandler::sendPosition(const ParticipantPosition &participantPosition, int equipmentNumber) const
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
bool sendPosition(const ParticipantPosition& participantPosition, int equipmentNumber) const;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool sendTelegramInternal(const ParticipantPosition& pos, int eqNo) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
@@ -38,6 +39,7 @@ private Q_SLOTS:
|
||||
void onWebSocketDisconnected();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QWebSocketServer* m_webSocketServer = nullptr;
|
||||
QVector<QWebSocket*> m_webSockets;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user