Qt6 Migration: DDS-Stubs, Logger-Fixes, Export-Header Korrekturen

- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung
- 44 Export-Header Include-Pfade korrigiert (_export.h)
- 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h)
- INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros
- Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits)
- FATAL_LOG Makro hinzugefügt
- InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h)
- FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h)
- AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp)
- SymbolAppearance Klasse vollständig definiert mit content() Methode
- BuildingComponentFilter Klasse definiert mit Copy-Konstruktor
- Ftc Factory: nullptr Return (abstract class)
- AesFilter Klasse in aes.hpp hinzugefügt
- Dtc Klasse in ppm.hpp mit participantChanged Signal
- AesType Enum: alle 15 At* Werte definiert
- AesEffectState_def: EsReceived hinzugefügt
- DataModification Enum: eAdded/eModified/eRemoved
- function_reply_object.h → core_types.h Include-Pfad (72 Dateien)
- Enum-Class-Streaming Template-Operator in INGLLogger.h
- ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen
- ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge
- QRegExp → QRegularExpression in tpm_js_parser.cpp
- .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert
- Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
torstenandCopilot committed 2026-08-19 06:06:24 +02:00
1 parent 010f91928a
commit b774f4035c
2785 files changed
+18754 -18316

No files matched your search

@@ -21,7 +21,6 @@ BiteHandler::BiteHandler(MainHandler *mainHandler)
: QObject()
, Interface::Fts::CallBiteRequestHandler(mainHandler->fts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("BiteHandler"))
{
}
@@ -33,7 +32,7 @@ bool BiteHandler::init()
void BiteHandler::onDemandBiteReply(const Core::FunctionReplyObject &replyObject)
{
if (replyObject.error())
WARNING_LOG(m_logger) << "Got an demandBiteError: " << replyObject();
WARNING_LOG() << "Got an demandBiteError: " << replyObject();
auto it = m_demandedBiteParticipantRequests.find(replyObject.id());
if (it != m_demandedBiteParticipantRequests.end())
@@ -46,17 +45,17 @@ void BiteHandler::onDemandBiteReply(const Core::FunctionReplyObject &replyObject
m_demandedBiteParticipantRequests.erase(it);
}
else
WARNING_LOG(m_logger) << "Bite request with request id " << replyObject.id() << " was not replied to by the proxy";
WARNING_LOG() << "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(m_logger) << "onCallBiteRequest: " << request;
DEBUG_LOG() << "onCallBiteRequest: " << request;
auto ret = callBiteRequest(cookie, request);
if (ret.error() || ret.id())
{
WARNING_LOG(m_logger) << ret();
WARNING_LOG() << ret();
m_mainHandler->fts()->callBiteReply(cookie, ret);
}
// delayed answer in non-error case
@@ -76,7 +75,7 @@ Core::FunctionReplyObject BiteHandler::callBiteRequest(const rti::core::SampleId
{
if (m_demandedBiteParticipants.contains(participantId))
{
DEBUG_LOG(m_logger) << "demandBiteRequest for participant Id "
DEBUG_LOG() << "demandBiteRequest for participant Id "
<< participantId
<< " already triggered - reply is still to be done";
bAlreadyDemandedFound = true;
@@ -86,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(m_logger) << "Got BITE request for non existing participant id " << participantId;
WARNING_LOG() << "Got BITE request for non existing participant id " << participantId;
continue;
}
if (participant->equipmentNumber() == 0)
{
WARNING_LOG(m_logger) << "Got BITE request participant id " << participantId << " but has no equipment number set";
WARNING_LOG() << "Got BITE request participant id " << participantId << " but has no equipment number set";
continue;
}
bOneFound = true;
@@ -135,7 +134,7 @@ Core::FunctionReplyObject BiteHandler::callBiteRequest(const rti::core::SampleId
void BiteHandler::onBiteRequestTimeout(int requestId)
{
INFO_LOG(m_logger) << "onBiteRequestTimeout for " << requestId;
INFO_LOG() << "onBiteRequestTimeout for " << requestId;
onDemandBiteReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
}
@@ -38,7 +38,7 @@ CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
# generate ppm_[d|f]tc.h
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
NGL_ADD_LIBRARY(AAR SV WS HLA svcPpmCommon SHARED ${SRCS_common})
NGL_ADD_LIBRARY2(AAR SV WS HLA svcPpmCommon SHARED ${SRCS_common})
NGL_TARGET_INCLUDE_DIRECTORIES(svcPpmCommon
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
@@ -73,7 +73,7 @@ SET(SRCS_client
# generate ppm_[d|f]tc_impl.[cpp|h]
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
NGL_ADD_LIBRARY(WS AAR SV HLA svcPpmClient SHARED ${SRCS_client})
NGL_ADD_LIBRARY2(WS AAR SV HLA svcPpmClient SHARED ${SRCS_client})
NGL_TARGET_INCLUDE_DIRECTORIES(svcPpmClient
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
@@ -104,7 +104,7 @@ SET(SRCS_server
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
# WS for RecordReplayPlugin
NGL_ADD_LIBRARY(AAR SV WS svcPpmServer SHARED ${SRCS_server})
NGL_ADD_LIBRARY2(AAR SV WS svcPpmServer SHARED ${SRCS_server})
NGL_TARGET_INCLUDE_DIRECTORIES(svcPpmServer
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
@@ -19,7 +19,6 @@ ParticipantManagement::EquipmentEventHandling::EquipmentEventHandler::EquipmentE
, Interface::Fts::EquipmentSystemEventDataRequestHandler(mainHandler->fts())
, m_mainHandler (mainHandler)
, m_filterId(0)
, m_logger(getLogger("EquipmentEventHandler"))
{
}
@@ -27,13 +26,13 @@ bool ParticipantManagement::EquipmentEventHandling::EquipmentEventHandler::init(
{
if (!m_mainHandler->tabDtc()->enableEquipmentEvent())
{
ERROR_LOG (m_logger) << " TAB Dtc enableEquipmentEvent() failed !";
ERROR_LOG() << " TAB Dtc enableEquipmentEvent() failed !";
return false;
}
if (!m_mainHandler->dts()->enableEquipmentSystemEventFtcReply())
{
ERROR_LOG (m_logger) << " Dts enableEquipmentSystemEventDataFtcReply() failed !";
ERROR_LOG() << " Dts enableEquipmentSystemEventDataFtcReply() failed !";
return false;
}
connect(m_mainHandler->tabDtc().get(), &TrainingAreaBase::Interface::Dtc::equipmentEventChanged, this, &EquipmentEventHandler::onEquipmentEventChanged);
@@ -44,7 +43,7 @@ bool ParticipantManagement::EquipmentEventHandling::EquipmentEventHandler::init(
void ParticipantManagement::EquipmentEventHandling::EquipmentEventHandler::onEquipmentSystemEventDataRequest(const rti::core::SampleIdentity &cookie,
const ParticipantManagement::EquipmentSystemEventDataRequest &request)
{
INFO_LOG(m_logger) << "IN onEquipmentSystemEventDataRequest";
INFO_LOG() << "IN onEquipmentSystemEventDataRequest";
Core::FunctionReplyObject ret;
@@ -59,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(m_logger) << "stmt: " << stmt;
INFO_LOG() << "stmt: " << stmt;
NSqlQuery q(m_mainHandler->db()->database());
if (!q.exec(stmt))
{
ERROR_LOG(m_logger) << "Error while selecting event-data ";
ERROR_LOG(m_logger) << "stmt : " << stmt;
ERROR_LOG() << "Error while selecting event-data ";
ERROR_LOG() << "stmt : " << stmt;
ret.setStr("Error while selecting data");
m_mainHandler->fts()->equipmentSystemEventDataReply(cookie, ret);
return;
@@ -133,7 +132,7 @@ void ParticipantManagement::EquipmentEventHandling::EquipmentEventHandler::onEqu
if (!m_mainHandler->dts()->publish(event))
{
ERROR_LOG(m_logger) << "Error publishing equipment event to dds from eqnr: " << event.equipmentNumber() ;
ERROR_LOG() << "Error publishing equipment event to dds from eqnr: " << event.equipmentNumber() ;
}
}
@@ -26,7 +26,6 @@ ParticipantManagement::PpmTests::PpmTests(QObject *parent)
, m_equipmentId(-1)
, m_participantId(1)
, m_bTestsSuccessful(true)
, m_logger(getLogger("Test"))
{
}
@@ -38,7 +37,7 @@ ParticipantManagement::PpmTests::~PpmTests()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::startTest()
{
INFO_LOG(m_logger) << "********* startTest **************";
INFO_LOG() << "********* startTest **************";
switch (m_testId)
{
case 1:
@@ -84,14 +83,14 @@ void ParticipantManagement::PpmTests::startTest()
failExit();
break;
}
INFO_LOG(m_logger) << "********* endTest **************";
INFO_LOG() << "********* 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(m_logger) << "init begin";
INFO_LOG() << "init begin";
m_testId = testId;
m_partyId = partyId;
@@ -108,22 +107,22 @@ bool ParticipantManagement::PpmTests::init(int domainId, int exerciseId, int tes
return false;
m_ddsConnector->initPublisherSubscriber();
DEBUG_LOG(m_logger) << "create DTC PPM";
DEBUG_LOG() << "create DTC PPM";
m_dtc = ParticipantManagement::Interface::Dtc::create(m_ddsConnector);
DEBUG_LOG(m_logger) << "init DTC PPM";
DEBUG_LOG() << "init DTC PPM";
bool bRet = m_dtc->enableAll();
DEBUG_LOG(m_logger) << "create FTC PPM";
DEBUG_LOG() << "create FTC PPM";
m_ftc = ParticipantManagement::Interface::Ftc::create(m_ddsConnector);
DEBUG_LOG(m_logger) << "init FTC PPM";
DEBUG_LOG() << "init FTC PPM";
bRet &= m_ftc->enableAll();
DEBUG_LOG(m_logger) << "init end PPM - bRet = " << bRet;
DEBUG_LOG() << "init end PPM - bRet = " << bRet;
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;
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;
return bRet;
}
@@ -131,7 +130,7 @@ bool ParticipantManagement::PpmTests::init(int domainId, int exerciseId, int tes
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::tryCreateTemplate()
{
INFO_LOG(m_logger) << "Trying to send Create Template";
INFO_LOG() << "Trying to send Create Template";
std::vector<ParticipantManagement::TemplateData> data;
@@ -149,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(m_logger) << "SuperiorModId: " << tdSup.modId();
DEBUG_LOG() << "SuperiorModId: " << tdSup.modId();
data.push_back(tdSup);
if (!m_ftc->modifyTemplateDataRequest(ModifyTemplateDataRequest(data),this))
{
ERROR_LOG(m_logger) << "Error creating template data";
ERROR_LOG() << "Error creating template data";
failExit();
}
QTest::qWait(1000);
@@ -165,7 +164,7 @@ void ParticipantManagement::PpmTests::tryCreateTemplate()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::tryCreateParticipant()
{
INFO_LOG(m_logger) << "Trying to send Create ParticipantData per ModifyParticipantData";
INFO_LOG() << "Trying to send Create ParticipantData per ModifyParticipantData";
ParticipantManagement::ParticipantData ptd;
ptd.modId(1);
@@ -183,7 +182,7 @@ void ParticipantManagement::PpmTests::tryCreateParticipant()
if (!m_ftc->modifyParticipantDataRequest(req,this))
{
ERROR_LOG(m_logger) << "Error creating participant data";
ERROR_LOG() << "Error creating participant data";
failExit();
}
QTest::qWait(1000);
@@ -193,7 +192,7 @@ void ParticipantManagement::PpmTests::tryCreateParticipant()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::tryUpdateInfoParticipant()
{
INFO_LOG(m_logger) << "Trying to send update info per registerForParticantRequest";
INFO_LOG() << "Trying to send update info per registerForParticantRequest";
ParticipantManagement::RegisterParticipantRequest rpr;
rpr.participantId(m_participantId);
@@ -204,7 +203,7 @@ void ParticipantManagement::PpmTests::tryUpdateInfoParticipant()
if (!m_ftc->registerParticipantRequest(rpr,this))
{
ERROR_LOG(m_logger) << "Error updating info/identification for participant";
ERROR_LOG() << "Error updating info/identification for participant";
failExit();
}
QTest::qWait(1000);
@@ -213,7 +212,7 @@ void ParticipantManagement::PpmTests::tryUpdateInfoParticipant()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::tryRegisterParticipant()
{
INFO_LOG(m_logger) << "Trying to send registerForParticantRequest";
INFO_LOG() << "Trying to send registerForParticantRequest";
ParticipantManagement::RegisterParticipantRequest rpr;
rpr.participantId(m_participantId);
@@ -224,7 +223,7 @@ void ParticipantManagement::PpmTests::tryRegisterParticipant()
if (!m_ftc->registerParticipantRequest(rpr,this))
{
ERROR_LOG(m_logger) << "Error updating info/identification for participant";
ERROR_LOG() << "Error updating info/identification for participant";
failExit();
}
QTest::qWait(1000);
@@ -233,7 +232,7 @@ void ParticipantManagement::PpmTests::tryRegisterParticipant()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::tryCreateParty()
{
INFO_LOG(m_logger) << "Trying to Create Party per ModifyPartyData";
INFO_LOG() << "Trying to Create Party per ModifyPartyData";
ParticipantManagement::Party party;
@@ -252,7 +251,7 @@ void ParticipantManagement::PpmTests::tryCreateParty()
if (!m_ftc->modifyPartyDataRequest(req, this))
{
ERROR_LOG(m_logger) << "Error creating party data";
ERROR_LOG() << "Error creating party data";
failExit();
}
@@ -270,7 +269,7 @@ void ParticipantManagement::PpmTests::tryCreateParty()
if (!m_ftc->modifyPartyDataRequest(req, this))
{
ERROR_LOG(m_logger) << "Error creating party data";
ERROR_LOG() << "Error creating party data";
failExit();
}
@@ -288,7 +287,7 @@ void ParticipantManagement::PpmTests::tryCreateParty()
if (!m_ftc->modifyPartyDataRequest(req, this))
{
ERROR_LOG(m_logger) << "Error creating party data";
ERROR_LOG() << "Error creating party data";
failExit();
}
@@ -306,7 +305,7 @@ void ParticipantManagement::PpmTests::tryCreateParty()
if (!m_ftc->modifyPartyDataRequest(req, this))
{
ERROR_LOG(m_logger) << "Error creating party data";
ERROR_LOG() << "Error creating party data";
failExit();
}
@@ -317,7 +316,7 @@ void ParticipantManagement::PpmTests::tryCreateParty()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::tryModifyParty()
{
INFO_LOG(m_logger) << "Trying to send Modify PartyData per ModifyPartyData";
INFO_LOG() << "Trying to send Modify PartyData per ModifyPartyData";
ParticipantManagement::Party party;
@@ -325,7 +324,7 @@ void ParticipantManagement::PpmTests::tryModifyParty()
party = m_dtc->party(m_partyId);
if (party.id() < 0)
{
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
ERROR_LOG() << "Party not found: id = " << m_partyId;
failExit();
}
@@ -339,7 +338,7 @@ void ParticipantManagement::PpmTests::tryModifyParty()
if (!m_ftc->modifyPartyDataRequest(req, this))
{
ERROR_LOG(m_logger) << "Error modifying party data";
ERROR_LOG() << "Error modifying party data";
failExit();
}
@@ -349,7 +348,7 @@ void ParticipantManagement::PpmTests::tryModifyParty()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::tryRemoveParty()
{
INFO_LOG(m_logger) << "Trying to send RemoveParty";
INFO_LOG() << "Trying to send RemoveParty";
ParticipantManagement::Party party;
@@ -357,7 +356,7 @@ void ParticipantManagement::PpmTests::tryRemoveParty()
party = m_dtc->party(m_partyId);
if (party.id() < 0)
{
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
ERROR_LOG() << "Party not found: id = " << m_partyId;
failExit();
}
@@ -368,12 +367,12 @@ void ParticipantManagement::PpmTests::tryRemoveParty()
{
if (party.isUsedBy())
{
INFO_LOG(m_logger) << "Not possible to delete used party!" ;
INFO_LOG() << "Not possible to delete used party!" ;
successExit();
}
else
{
ERROR_LOG(m_logger) << "Failed to delete not used party with id " << m_partyId;
ERROR_LOG() << "Failed to delete not used party with id " << m_partyId;
failExit();
}
}
@@ -384,14 +383,14 @@ void ParticipantManagement::PpmTests::tryRemoveParty()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::trySyncParties()
{
INFO_LOG(m_logger) << "Trying to sync parties with Ex 0";
INFO_LOG() << "Trying to sync parties with Ex 0";
SyncPartiesRequest req;
req.exerciseId(42);
if (!m_ftc->syncPartiesRequest(req, this))
{
ERROR_LOG(m_logger) << "Error sync parties";
ERROR_LOG() << "Error sync parties";
failExit();
}
@@ -401,7 +400,7 @@ void ParticipantManagement::PpmTests::trySyncParties()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::tryChangeUsed()
{
INFO_LOG(m_logger) << "Trying to send change used";
INFO_LOG() << "Trying to send change used";
ParticipantManagement::Party party;
@@ -409,7 +408,7 @@ void ParticipantManagement::PpmTests::tryChangeUsed()
party = m_dtc->party(m_partyId);
if (party.id() < 0)
{
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
ERROR_LOG() << "Party not found: id = " << m_partyId;
failExit();
}
@@ -419,7 +418,7 @@ void ParticipantManagement::PpmTests::tryChangeUsed()
if (!m_ftc->changePartyUsedStateRequest(req, this))
{
ERROR_LOG(m_logger) << "Error modifying used party";
ERROR_LOG() << "Error modifying used party";
failExit();
}
@@ -430,7 +429,7 @@ void ParticipantManagement::PpmTests::tryChangeUsed()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::tryCreateEquipmentType()
{
INFO_LOG(m_logger) << "Trying to send Create EquipmentType per ModifyEquipmentTypeDataRequest";
INFO_LOG() << "Trying to send Create EquipmentType per ModifyEquipmentTypeDataRequest";
ParticipantManagement::EquipmentType etd;
etd.id(1);
@@ -447,7 +446,7 @@ void ParticipantManagement::PpmTests::tryCreateEquipmentType()
if (!m_ftc->modifyEquipmentTypeDataRequest(ModifyEquipmentTypeDataRequest(data, false),this))
{
ERROR_LOG(m_logger) << "Error creating equipment type data";
ERROR_LOG() << "Error creating equipment type data";
failExit();
}
QTest::qWait(1000);
@@ -457,7 +456,7 @@ void ParticipantManagement::PpmTests::tryCreateEquipmentType()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::tryCreateType()
{
INFO_LOG(m_logger) << "Trying to send CreateTypeRequest";
INFO_LOG() << "Trying to send CreateTypeRequest";
if (!m_ftc->modifyTypeRequest(Type(0,
ParticipantManagement::TypeClass::SupportEntity,
@@ -470,7 +469,7 @@ void ParticipantManagement::PpmTests::tryCreateType()
{}, std::string()),
this))
{
ERROR_LOG(m_logger) << "Error creating type data";
ERROR_LOG() << "Error creating type data";
failExit();
}
@@ -480,7 +479,7 @@ void ParticipantManagement::PpmTests::tryCreateType()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::tryModifyType()
{
INFO_LOG(m_logger) << "Trying to send ModifyTypeRequest";
INFO_LOG() << "Trying to send ModifyTypeRequest";
if (!m_ftc->modifyTypeRequest(Type(m_typeId,
ParticipantManagement::TypeClass::SupportEntity,
@@ -493,7 +492,7 @@ void ParticipantManagement::PpmTests::tryModifyType()
{}, std::string()),
this))
{
ERROR_LOG(m_logger) << "Error modifying type data";
ERROR_LOG() << "Error modifying type data";
failExit();
}
QTest::qWait(1000);
@@ -502,11 +501,11 @@ void ParticipantManagement::PpmTests::tryModifyType()
//--------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::tryRemoveType()
{
INFO_LOG(m_logger) << "Trying to send RemoveTypeRequest";
INFO_LOG() << "Trying to send RemoveTypeRequest";
if (!m_ftc->removeTypeRequest(RemoveTypeRequest(m_typeId), this))
{
ERROR_LOG(m_logger) << "Error modifying type data";
ERROR_LOG() << "Error modifying type data";
failExit();
}
QTest::qWait(1000);
@@ -516,7 +515,7 @@ void ParticipantManagement::PpmTests::tryRemoveType()
// ------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::onError(const QString &reason)
{
ERROR_LOG(m_logger) << "Got Reply error: " << reason;
ERROR_LOG() << "Got Reply error: " << reason;
failExit();
}
@@ -528,7 +527,7 @@ void ParticipantManagement::PpmTests::onCreateReply(const Core::FunctionReplyObj
onError(replyObject.translated());
return;
}
INFO_LOG(m_logger) << "Got createReply with id " << replyObject.id()
INFO_LOG() << "Got createReply with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
@@ -541,7 +540,7 @@ void ParticipantManagement::PpmTests::onModifyReply(const Core::FunctionReplyObj
onError(replyObject.translated());
return;
}
INFO_LOG(m_logger) << "Got modifyRequest with id " << replyObject.id()
INFO_LOG() << "Got modifyRequest with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
@@ -554,7 +553,7 @@ void ParticipantManagement::PpmTests::onRemoveReply(const Core::FunctionReplyObj
onError(replyObject.translated());
return;
}
INFO_LOG(m_logger) << "Got removeReply with id " << replyObject.id()
INFO_LOG() << "Got removeReply with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
@@ -567,7 +566,7 @@ void ParticipantManagement::PpmTests::onSyncPartiesReply(const Core::FunctionRep
onError(replyObject.translated());
return;
}
INFO_LOG(m_logger) << "Got syncParties with id " << replyObject.id()
INFO_LOG() << "Got syncParties with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
@@ -586,22 +585,22 @@ void ParticipantManagement::PpmTests::onRemovePartyReply(const Core::FunctionRep
onError(replyObject.translated());
return;
}
INFO_LOG(m_logger) << "Got removeReply with id " << replyObject.id()
INFO_LOG() << "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(m_logger) << "onRegisterParticipantReply " << reply.errorString() << "exerciseId: " << reply.exerciseId();
ERROR_LOG() << "onRegisterParticipantReply " << reply.errorString() << "exerciseId: " << reply.exerciseId();
for ( std::string str : reply.errorParams())
ERROR_LOG(m_logger) << "error params: " << str;
ERROR_LOG() << "error params: " << str;
}
// ------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::failExit()
{
ERROR_LOG(m_logger) << "FAIL EXIT !";
ERROR_LOG() << "FAIL EXIT !";
m_bTestsSuccessful = false;
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
@@ -609,7 +608,7 @@ void ParticipantManagement::PpmTests::failExit()
// ------------------------------------------------------------------------------
void ParticipantManagement::PpmTests::successExit()
{
INFO_LOG(m_logger) << "SUCCESS EXIT !";
INFO_LOG() << "SUCCESS EXIT !";
m_bTestsSuccessful = true;
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
@@ -11,7 +11,7 @@
#include <QObject>
#include <memory>
#include <DDS/Core/function_reply_object.h>
#include <DDS/Core/core_types.h>
namespace ParticipantManagement
{
@@ -19,7 +19,6 @@ namespace ParticipantManagement
GetParticipants::GetParticipants(MainHandler *mainHandler)
: Interface::Fts::GetParticipantsRequestHandler(mainHandler->fts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("GetParticipants"))
{}
GetParticipants::~GetParticipants()
@@ -30,7 +29,7 @@ GetParticipants::~GetParticipants()
void GetParticipants::onGetParticipantsRequest(const rti::core::SampleIdentity &cookie,
const GetParticipantsRequest &request)
{
DEBUG_LOG(m_logger) << "onGetParticipantsRequest" << request;
DEBUG_LOG() << "onGetParticipantsRequest" << request;
// Initialize RecordReplay to get initial participants
@@ -55,7 +54,7 @@ void GetParticipants::onGetParticipantsRequest(const rti::core::SampleIdentity &
participants[p.id()] = std::move(p);
}
DEBUG_LOG(m_logger) << "Starting to read participant from record replay. Size: "
DEBUG_LOG() << "Starting to read participant from record replay. Size: "
<< participants.size();
GetParticipantsReply reply;
@@ -26,7 +26,5 @@ private:
private:
MainHandler *m_mainHandler;
NGL::INGLLogger &m_logger;
};
}
@@ -124,7 +124,7 @@ bool Participant::setPosition(const TrainingAreaBase::EquipmentPosition &newPosi
if (!mountedParticipant)
{
WARNING_LOG(m_logger) << "Mounted Participant with equipNo " << mountedEqId << " not found - ignoring";
WARNING_LOG() << "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(m_logger) << "Mounting Participant with id: " << mountedParticipant->id() << " to id: " << id();
INFO_LOG() << "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(m_logger) << "position for participant " << m_participantData.id()
WARNING_LOG() << "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(m_logger) << "Trying to mount to ourself: " << id();
WARNING_LOG() << "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(m_logger) << "Unmounting Participant with ID: " << unmountedParticipant->id() << "from ID: " << this->id();
INFO_LOG() << "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(m_logger) << "mainVulState was manipulated into: " << i;
//WARNING_LOG() << "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(m_logger) << "Sending a BC (VBG12) if the last vuln is CR (VBG0) is not allowed! Something went wrong on the sender side (TNE?)";
WARNING_LOG() << "Sending a BC (VBG12) if the last vuln is CR (VBG0) is not allowed! Something went wrong on the sender side (TNE?)";
DEBUG_LOG(m_logger) << "setState for eqid: " << newState.equipmentNumber()
DEBUG_LOG() << "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(m_logger) << "Missing vulnerabilityBits! bailing by supplementing by adding this vuln state to the bits";
WARNING_LOG() << "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(m_logger) << "Participant with EqNo "
WARNING_LOG() << "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(m_logger) << "Cannot cast upper 2 Bits to SanEvaluation! Defaulting to Okay";
WARNING_LOG() << "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(m_logger) << "Cannot cast lower 6 Bits to SanResult! Defaulting to Unhandled";
WARNING_LOG() << "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(m_logger) << "Gear Assignment";
DEBUG_LOG() << "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(m_logger) << "Got a gear assignment but gear id is 0 - old Saab AGDUS? - ignoring";
WARNING_LOG() << "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(m_logger) << "Gear Assignment: Removing Designation with gearId: " << it->gearId();
DEBUG_LOG() << "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(m_logger) << "Adjust Turret - substracting index wanne " << substr;
INFO_LOG() << "Adjust Turret - substracting index wanne " << substr;
if (gi.remain() >= substr)
gi.remain() = gi.remain() - m_dynamicData.gear()[index_wanne].remain();
INFO_LOG(m_logger) << "Turret remain " << gi.remain();
INFO_LOG() << "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(m_logger) << "Not assigned, but equipmentnumber is set";
WARNING_LOG() << "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(m_logger) << "Now assigned from WMS, but no equipmentnumber or old assign state != NotAssigned: "
WARNING_LOG() << "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(m_logger) << "Now assigned from WMS (handout), but no equipmentnumber or old assign state != NotAssigned/AssignedWms: "
WARNING_LOG() << "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(m_logger) << "Now assigned from EXCON, but no equipmentnumber or old assign state != NotAssigned: "
WARNING_LOG() << "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(m_logger) << "Now assigned from ExconWmsOverruled, old assign state != AssignedWms or != HandoutWms or equipment number is set: "
WARNING_LOG() << "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(m_logger) << "hasToBeChanged: " << data;
DEBUG_LOG() << "hasToBeChanged: " << data;
ParticipantManagement::ParticipantBase &curData = m_participantData;
bool hasChanges = (curData != data);
@@ -62,7 +62,7 @@ bool ParticipantHandler::init()
if (!m_webSocketHandler->init(Settings::getWebSocketServerPortRange(2)))
{
ERROR_LOG(m_logger) << "could not init websockethandler";
ERROR_LOG() << "could not init websockethandler";
return false;
}
@@ -71,14 +71,14 @@ bool ParticipantHandler::init()
void ParticipantHandler::setEquipmentNumberForParticipant(int oldEqNo, int newEqNo, int participantId)
{
DEBUG_LOG(m_logger) << "setEquipmentNumberForParticipant, old: " << oldEqNo << ", new: " << newEqNo << ", participant: " << participantId;
DEBUG_LOG() << "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(m_logger) << "Another participant (" << val << ") already has the equipment number " << newEqNo << " - overriding it with participant "
WARNING_LOG() << "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(m_logger) << " >>>>>> [ParticipantHandler] participantByEquipmentNumber participantId: " << participantId << " | equipNumb: " << equipmentNumber;
DEBUG_LOG() << " >>>>>> [ParticipantHandler] participantByEquipmentNumber participantId: " << participantId << " | equipNumb: " << equipmentNumber;
return participantById(participantId);
}
@@ -97,7 +97,7 @@ void ParticipantHandler::onNewGearEvent(const TrainingAreaBase::EquipmentGearEve
{
if (isTelegramInFuture(gearEvent))
{
WARNING_LOG(m_logger) << "Got an EquipmentGearEvent which has a timestamp in the future: " << gearEvent.sampleTime();
WARNING_LOG() << "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(m_logger) << "Got gear charge state for unknown equipment number " << gearEvent.equipmentNumber();
WARNING_LOG() << "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(m_logger) << "Got an EquipmentGearChargeState which has a timestamp in the future: " << chargeState.sampleTime();
WARNING_LOG() << "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(m_logger) << "Got gear charge state for unknown equipment number " << chargeState.equipmentNumber();
WARNING_LOG() << "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(m_logger) << "Got an EquipmentGearAssignment which has a timestamp in the future: " << gearAssignment.sampleTime();
WARNING_LOG() << "Got an EquipmentGearAssignment which has a timestamp in the future: " << gearAssignment.sampleTime();
return;
}
Participant *participantToBeChanged = participantByEquipmentNumber(gearAssignment.equipmentNumber());
if (!participantToBeChanged)
{
WARNING_LOG(m_logger) << "Got gear assignment for unknown equipment number " << gearAssignment.equipmentNumber();
WARNING_LOG() << "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(m_logger) << "Got an EquipmentState which has a timestamp in the future: " << data.sampleTime();
WARNING_LOG() << "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(m_logger) << "Got equipment state for unknown equipment number " << data.equipmentNumber();
WARNING_LOG() << "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(m_logger) << "Got an EquipmentPosition which has a timestamp in the future: " << position.sampleTime();
WARNING_LOG() << "Got an EquipmentPosition which has a timestamp in the future: " << position.sampleTime();
return;
}
if (isTelegramOutdated(position) && position.position().reportingSource() != Core::PositionReportingSource::SetByOperator)
{
INFO_LOG(m_logger) << "position is outdated: " << position;
INFO_LOG() << "position is outdated: " << position;
return;
}
DEBUG_LOG(m_logger) << "Got new position from proxy: " << position;
DEBUG_LOG() << "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(m_logger) << "Got EquipmentPosition " << position << " for unknown equipment number: " << equipNo;
WARNING_LOG() << "Got EquipmentPosition " << position << " for unknown equipment number: " << equipNo;
return;
}
@@ -270,14 +270,14 @@ void ParticipantHandler::onNewEquipmentOperationalStateFromProxy(const TrainingA
{
if (isTelegramInFuture(operationalState))
{
WARNING_LOG(m_logger) << "Got an EquipmentOperationalState which has a timestamp in the future: " << operationalState.sampleTime();
WARNING_LOG() << "Got an EquipmentOperationalState which has a timestamp in the future: " << operationalState.sampleTime();
return;
}
Participant *participantToUpdate = participantByEquipmentNumber(operationalState.equipmentNumber());
if (!participantToUpdate)
{
WARNING_LOG(m_logger) << "Got EquipmentOperationalState for unknown equipment number: " << operationalState;
WARNING_LOG() << "Got EquipmentOperationalState for unknown equipment number: " << operationalState;
return;
}
@@ -289,12 +289,12 @@ void ParticipantHandler::onNewBiteFromProxy(const TrainingAreaBase::EquipmentBit
{
if (isTelegramInFuture(bite))
{
WARNING_LOG(m_logger) << "Got an EquipmentBite which has a timestamp in the future: " << bite.sampleTime();
WARNING_LOG() << "Got an EquipmentBite which has a timestamp in the future: " << bite.sampleTime();
return;
}
if (isTelegramOutdated(bite))
{
WARNING_LOG(m_logger) << "Got an EquipmentBite which has a timestamp in the past: " << bite.sampleTime();
WARNING_LOG() << "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(m_logger) << "Got a ParticipantModeReport which has a timestamp in the future: " << report.sampleTime();
WARNING_LOG() << "Got a ParticipantModeReport which has a timestamp in the future: " << report.sampleTime();
return;
}
if (isTelegramOutdated(report))
{
WARNING_LOG(m_logger) << "Got a ParticipantModeReport which has a timestamp in the past: " << report.sampleTime();
WARNING_LOG() << "Got a ParticipantModeReport which has a timestamp in the past: " << report.sampleTime();
return;
}
Participant *participant = participantByEquipmentNumber(report.equipmentNumber());
if (!participant)
{
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << report.equipmentNumber();
ERROR_LOG() << 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(m_logger) << "Got a SpecialSensorData which has a timestamp in the future: " << data.sampleTime();
WARNING_LOG() << "Got a SpecialSensorData which has a timestamp in the future: " << data.sampleTime();
return;
}
if (isTelegramOutdated(data))
{
WARNING_LOG(m_logger) << "Got a SpecialSensorData which has a timestamp in the past: " << data.sampleTime();
WARNING_LOG() << "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(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG() << 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(m_logger) << "New Laser Designation: "
DEBUG_LOG() << "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(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
return;
}
DynamicParticipantData dpd = participant->dynamicParticipantData();
DEBUG_LOG(m_logger) << "Begin Update Laser Designation: ";
DEBUG_LOG() << "Begin Update Laser Designation: ";
updateLaserDesignation(dpd, data);
DEBUG_LOG(m_logger) << "End Update Laser Designation: ";
DEBUG_LOG() << "End Update Laser Designation: ";
DEBUG_LOG(m_logger) << "Set DPD and publish ";
DEBUG_LOG() << "Set DPD and publish ";
participant->setDynamicData(dpd);
participant->publishDynamicData();
}
void ParticipantHandler::onLaserDesignationRemoved(int equipmentNumber, int gearId)
{
DEBUG_LOG(m_logger) << "On Remove Laser Designation: ";
DEBUG_LOG() << "On Remove Laser Designation: ";
Participant *participant = participantByEquipmentNumber(equipmentNumber);
if (!participant)
{
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << equipmentNumber;
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with equipment number " << equipmentNumber;
return;
}
DynamicParticipantData dpd = participant->dynamicParticipantData();
DEBUG_LOG(m_logger) << "Begin Remove Laser Designation: ";
DEBUG_LOG() << "Begin Remove Laser Designation: ";
removeLaserDesignation(dpd, gearId);
DEBUG_LOG(m_logger) << "End Remove Laser Designation: ";
DEBUG_LOG() << "End Remove Laser Designation: ";
DEBUG_LOG(m_logger) << "Set DPD and publish ";
DEBUG_LOG() << "Set DPD and publish ";
participant->setDynamicData(dpd);
participant->publishDynamicData();
}
void ParticipantHandler::onBuildingHitLineInfo(const Buildings::BuildingHitLineInfo &data)
{
DEBUG_LOG(m_logger) << "onBuildingHitLineInfo "
DEBUG_LOG() << "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(m_logger) << LOGFUNCTION << "Could not find participant with participantId: " << data.originatorParticipantId();
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with participantId: " << data.originatorParticipantId();
return;
}
DynamicParticipantData dpd = participant->dynamicParticipantData();
DEBUG_LOG(m_logger) << "Begin Update Laser Designation: ";
DEBUG_LOG() << "Begin Update Laser Designation: ";
updateLaserDesignation(dpd, data);
DEBUG_LOG(m_logger) << "End Update Laser Designation: ";
DEBUG_LOG() << "End Update Laser Designation: ";
DEBUG_LOG(m_logger) << "setDynamicData";
DEBUG_LOG() << "setDynamicData";
participant->setDynamicData(dpd);
DEBUG_LOG(m_logger) << "publishDynamicData"
DEBUG_LOG() << "publishDynamicData"
<< " dpd.designations().size()=" << dpd.designations().size();
participant->publishDynamicData();
}
void ParticipantHandler::onSanitaryMaterialStockReport(const TrainingAreaBase::ParticipantSanitaryMaterialStockReport &data)
{
DEBUG_LOG(m_logger) << "onSanitaryMaterialStockReport";
DEBUG_LOG() << "onSanitaryMaterialStockReport";
Participant *participant = participantByEquipmentNumber(data.equipmentNumber());
if (!participant)
{
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG() << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
return;
}
if (data.qualification() == TrainingAreaBase::Qualification::NotDefined)
{
DEBUG_LOG(m_logger) << "!!! Clear Materials : equipment number " << data.equipmentNumber();
DEBUG_LOG(m_logger) << "!!! Clear Materials : sample time " << data.sampleTime();
DEBUG_LOG() << "!!! Clear Materials : equipment number " << data.equipmentNumber();
DEBUG_LOG() << "!!! 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(m_logger) << "!!! Set Materials : equipment number " << data.equipmentNumber();
DEBUG_LOG(m_logger) << "!!! Set Materials : sample time " << data.sampleTime();
DEBUG_LOG() << "!!! Set Materials : equipment number " << data.equipmentNumber();
DEBUG_LOG() << "!!! 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(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG() << 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(m_logger) << "!!! Clear Sanitation = " << data.sampleTime();
DEBUG_LOG(m_logger) << "!!! Clear Sanitation: equipNo = " << data.equipmentNumber();
DEBUG_LOG() << "!!! Clear Sanitation = " << data.sampleTime();
DEBUG_LOG() << "!!! 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(m_logger) << "!!! SetSanitation: sample time = " << data.sampleTime();
DEBUG_LOG(m_logger) << "!!! SetSanitation: equipNo = " << data.equipmentNumber();
DEBUG_LOG() << "!!! SetSanitation: sample time = " << data.sampleTime();
DEBUG_LOG() << "!!! 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(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG() << 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(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG() << 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(m_logger) << LOGFUNCTION << "Could not find participant with id " << data.participantId();
ERROR_LOG() << 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(m_logger) << "-Update Laser Designation - Start ";
DEBUG_LOG() << "-Update Laser Designation - Start ";
for (LaserDesignation &laserDesignation : data.designations())
{
if (laserDesignation.gearId() != newLaserDesignation.gearId())
continue;
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << laserDesignation.gearId() << " found in designations";
DEBUG_LOG() << "-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(m_logger) << "-Update Laser Designation - Data updated, returning";
DEBUG_LOG() << "-Update Laser Designation - Data updated, returning";
return;
}
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " NOT found in designations";
DEBUG_LOG() << "-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(m_logger) << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " NOT found in Gears";
DEBUG_LOG() << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " NOT found in Gears";
return;
}
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";
DEBUG_LOG() << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " found in Gears";
DEBUG_LOG() << "-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(m_logger) << "-Update Laser Designation by Building Hitline Info";
DEBUG_LOG() << "-Update Laser Designation by Building Hitline Info";
for (LaserDesignation &laserDesignation : dataInOut.designations())
{
DEBUG_LOG(m_logger) << "-Update Laser Designation by Building Hitline Info - Updating (first) Designation with GearId " << laserDesignation.gearId();
DEBUG_LOG() << "-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(m_logger) << "-Update Laser Designation by Building Hitline Info - Added Designation";
ERROR_LOG() << "-Update Laser Designation by Building Hitline Info - Added Designation";
}
ERROR_LOG(m_logger) << "-Update Laser Designation by Building Hitline Info - No laserDesignation available participantId="
ERROR_LOG() << "-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(m_logger) << "-Remove Laser Designation: Start";
DEBUG_LOG() << "-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(m_logger) << "-Remove Laser Designation: GearId NOT found";
DEBUG_LOG() << "-Remove Laser Designation: GearId NOT found";
return;
}
DEBUG_LOG(m_logger) << "-Remove Laser Designation: Removing Designation";
DEBUG_LOG() << "-Remove Laser Designation: Removing Designation";
data.designations().erase(eraseIterator);
}
@@ -166,8 +166,6 @@ class ParticipantHandler
QMap<int, HitLineInfo> m_hitLineInfoMap;
BaseDataProvider *m_bdp;
LOGGER_T m_logger;
std::shared_ptr<WebSocketHandler> m_webSocketHandler;
friend class Participant;
@@ -18,7 +18,6 @@ namespace ParticipantHandling
ProxyListener::ProxyListener(MainHandler *mainHandler)
: QObject()
, m_mainHandler(mainHandler)
, m_logger(getLogger("ProxyListener"))
{}
bool ProxyListener::init()
@@ -30,7 +29,7 @@ bool ProxyListener::init()
this, &ProxyListener::onProxyEquipmentBiteChanged);
if (!m_tabDtc->enableEquipmentBite())
{
ERROR_LOG(m_logger) << "Could not initialize TraininAreaBase data topic client";
ERROR_LOG() << "Could not initialize TraininAreaBase data topic client";
return false;
}
@@ -92,7 +91,7 @@ bool ProxyListener::init()
!m_tabDtc->enableUASMissionStatus() ||
!m_bldDtc->enableBuildingHitLineInfo())
{
ERROR_LOG(m_logger) << "Could not initialize TraininAreaBase data topic client";
ERROR_LOG() << "Could not initialize TraininAreaBase data topic client";
return false;
}
}
@@ -105,7 +104,7 @@ void ProxyListener::onProxyEquipmentPositionChanged(const TrainingAreaBase::Equi
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new position data from proxy " << data;
DEBUG_LOG() << "Got new position data from proxy " << data;
emit newPosition(data);
}
@@ -115,7 +114,7 @@ void ProxyListener::onProxyEquipmentGearAssignmentChanged(const TrainingAreaBase
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new gear assignment from proxy " << data;
DEBUG_LOG() << "Got new gear assignment from proxy " << data;
emit newGearAssignment(data);
}
@@ -125,7 +124,7 @@ void ProxyListener::onProxyEquipmentGearEventChanged(const TrainingAreaBase::Equ
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new gear event " << data;
DEBUG_LOG() << "Got new gear event " << data;
emit newGearEvent(data);
}
@@ -135,19 +134,19 @@ void ProxyListener::onProxyEquipmentGearChargeStateChanged(const TrainingAreaBas
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new gear charge state " << data;
DEBUG_LOG() << "Got new gear charge state " << data;
emit newGearChargeState(data);
}
void ProxyListener::onProxyParticipantSanitaryMaterialStockReportChanged(const TrainingAreaBase::ParticipantSanitaryMaterialStockReport &data, DataModification modType)
{
DEBUG_LOG(m_logger) << "FUCKING FUCK FUCK" << data;
DEBUG_LOG() << "FUCKING FUCK FUCK" << data;
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new material stock report" << data;
DEBUG_LOG() << "Got new material stock report" << data;
emit newSanitaryMaterialStockReport(data);
}
@@ -157,7 +156,7 @@ void ProxyListener::onProxyEquipmentStateChanged(const TrainingAreaBase::Equipme
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new equipment state " << data;
DEBUG_LOG() << "Got new equipment state " << data;
emit newState(data);
}
@@ -167,7 +166,7 @@ void ProxyListener::onProxyEquipmentOperationalStateChanged(const TrainingAreaBa
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new equipment operational state " << data;
DEBUG_LOG() << "Got new equipment operational state " << data;
emit newEquipmentOperationalState(data);
}
@@ -177,7 +176,7 @@ void ProxyListener::onProxyEquipmentBiteChanged(const TrainingAreaBase::Equipmen
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new equipment bite " << data;
DEBUG_LOG() << "Got new equipment bite " << data;
emit newEquipmentBite(data);
}
@@ -187,7 +186,7 @@ void ProxyListener::onProxyCtaDataErrorChanged(const TrainingAreaBase::CtaDataEr
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new Combat Training Area Data error: " << data;
DEBUG_LOG() << "Got new Combat Training Area Data error: " << data;
emit newCtaDataError(data);
}
@@ -197,7 +196,7 @@ void ProxyListener::onSpecialSensorDataChanged(const TrainingAreaBase::SpecialSe
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new Special Sensor data: " << data;
DEBUG_LOG() << "Got new Special Sensor data: " << data;
emit newSpecialSensorData(data);
}
@@ -207,7 +206,7 @@ void ProxyListener::onFunctionalAreaEntryChanged(const TrainingAreaBase::Functio
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got functional area entry: " << data;
DEBUG_LOG() << "Got functional area entry: " << data;
emit newFunctionalAreaEntryChanged(data);
}
@@ -216,12 +215,12 @@ void ProxyListener::onLaserDesignationChanged(const TrainingAreaBase::LaserDesig
{
if (modType == DataModification::eRemoved)
{
DEBUG_LOG(m_logger) << "Got no laser designation data: " << data;
DEBUG_LOG() << "Got no laser designation data: " << data;
emit laserDesignationRemoved(data.equipmentNumber(), data.gearId());
return;
}
DEBUG_LOG(m_logger) << "Got laser designation data: " << data;
DEBUG_LOG() << "Got laser designation data: " << data;
emit newLaserDesignationData(data);
}
@@ -231,7 +230,7 @@ void ProxyListener::onProxyParticipantSanitationChanged(const TrainingAreaBase::
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new Participant Sanitation" << data;
DEBUG_LOG() << "Got new Participant Sanitation" << data;
emit newParticipantSanitation(data);
}
@@ -241,7 +240,7 @@ void ProxyListener::onOperatorActionChanged(const TrainingAreaBase::OperatorActi
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new Operator Action" << data;
DEBUG_LOG() << "Got new Operator Action" << data;
emit newOperatorAction(data);
}
@@ -251,7 +250,7 @@ void ProxyListener::onEquipmentEventChanged(const TrainingAreaBase::EquipmentEve
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new Operator Action" << data;
DEBUG_LOG() << "Got new Operator Action" << data;
emit newEquipmentEvent(data);
@@ -276,13 +275,13 @@ void ProxyListener::onUASStatusChanged(const TrainingAreaBase::UASStatus &data,
UASRadioLinkConnectionStatus newState;
newState.id(uas.id());
newState.uasState(data.uasState());
DEBUG_LOG(m_logger) << "Publish new UAS State " << newState;
DEBUG_LOG() << "Publish new UAS State " << newState;
m_mainHandler->ddsHandler()->exAnyDts()->publish(newState);
}
void ProxyListener::onUASMissionStatusChanged(const TrainingAreaBase::UASMissionStatus &data, DataModification modType)
{
DEBUG_LOG(m_logger) << "currentTask = " << (int)data.currentTask().underlying() << ", currentMissionName = " << data.currentMissionName() << ", name of ended mission: " << data.missionEnded();
DEBUG_LOG() << "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
@@ -291,14 +290,14 @@ void ProxyListener::onUASMissionStatusChanged(const TrainingAreaBase::UASMission
*/
if (modType == DataModification::eRemoved)
{
DEBUG_LOG(m_logger) << "removed - stop";
DEBUG_LOG() << "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(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 ]")<<")";
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 ]")<<")";
return;
}
@@ -306,7 +305,7 @@ void ProxyListener::onUASMissionStatusChanged(const TrainingAreaBase::UASMission
const int participantId = m_mainHandler->ddsHandler()->dtc()->participantIdByEquipmentNumber(data.equipmentNumber());
if (participantId <= 0)
{
ERROR_LOG(m_logger) << "participant for eqid " << data.equipmentNumber() << " not found - unable to fulfill current mission action";
ERROR_LOG() << "participant for eqid " << data.equipmentNumber() << " not found - unable to fulfill current mission action";
return;
}
@@ -315,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(m_logger) << "setCurrentMissionActionFulfilled didn't work out";
ERROR_LOG() << "setCurrentMissionActionFulfilled didn't work out";
return;
}
DEBUG_LOG(m_logger) << "setCurrentMissionActionFulfilled done !";
DEBUG_LOG() << "setCurrentMissionActionFulfilled done !";
});
}
@@ -328,7 +327,7 @@ void ProxyListener::onBuildingHitLineInfoChanged(const Buildings::BuildingHitLin
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new Building Hitline Info" << data;
DEBUG_LOG() << "Got new Building Hitline Info" << data;
emit newBuildingHitLineInfo(data);
@@ -339,7 +338,7 @@ void ProxyListener::onProxyParticipantModeReportChanged(const TrainingAreaBase::
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "Got new Participant Mode Report Training Area Data error " << data;
DEBUG_LOG() << "Got new Participant Mode Report Training Area Data error " << data;
emit newParticipantModeReport(data);
}
@@ -354,7 +353,7 @@ Core::FunctionReplyObject ProxyListener::demandVulnerabilityStateChange(const rt
const int requestId = req.requestId();
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "VulnerabilityStateChange timeout for " << requestId;
INFO_LOG() << "VulnerabilityStateChange timeout for " << requestId;
onDemandVulnerabilityStateChangeReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
@@ -374,14 +373,14 @@ void ProxyListener::onDemandVulnerabilityStateChangeReply(const Core::FunctionRe
Core::FunctionReplyObject ProxyListener::sendModifyUasStateRequest(const rti::core::SampleIdentity &cookie,
const TrainingAreaBase::SendModifyUasStateRequest &req)
{
DEBUG_LOG(m_logger) << " -- [ProxyListener] sendModifyUasStateRequest uasId: " << req.uasId();
DEBUG_LOG() << " -- [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(m_logger) << "ModifyUasState timeout for " << requestId;
INFO_LOG() << "ModifyUasState timeout for " << requestId;
onSendModifyUasStateReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
@@ -407,7 +406,7 @@ Core::FunctionReplyObject ProxyListener::demandInitRequest(const rti::core::Samp
const int requestId = req.requestId();
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "DemandInit timeout for " << requestId;
INFO_LOG() << "DemandInit timeout for " << requestId;
onDemandInitReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
@@ -434,7 +433,7 @@ Core::FunctionReplyObject ProxyListener::sendEquipmentMessage(const rti::core::S
const int requestId = req.requestId();
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "SendMessage timeout for " << requestId;
INFO_LOG() << "SendMessage timeout for " << requestId;
onSendEquipmentMessageReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
@@ -461,7 +460,7 @@ Core::FunctionReplyObject ProxyListener::sendParticipantModeRequest(const rti::c
const int requestId = req.requestId();
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "SendParticipantMode timeout for " << requestId;
INFO_LOG() << "SendParticipantMode timeout for " << requestId;
onSendParticipantModeReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
@@ -485,7 +484,7 @@ Core::FunctionReplyObject ProxyListener::sendSetSanitationRequest(const rti::cor
const int requestId = req.requestId();
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "sendSetSanitationRequest timeout for " << requestId;
INFO_LOG() << "sendSetSanitationRequest timeout for " << requestId;
onSendSetSanitationReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
@@ -508,7 +507,7 @@ Core::FunctionReplyObject ProxyListener::selectiveReammunitionRequest(const rti:
const int requestId = req.requestId();
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "selectiveReammunitionRequest timeout for " << requestId;
INFO_LOG() << "selectiveReammunitionRequest timeout for " << requestId;
onSendSelectiveReammunitionReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
@@ -534,7 +533,7 @@ Core::FunctionReplyObject ProxyListener::sendOcCommandRequest(const rti::core::S
const int requestId = req.requestId();
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "SendOcCommand timeout for " << requestId;
INFO_LOG() << "SendOcCommand timeout for " << requestId;
onSendOcCommandReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
@@ -568,7 +567,7 @@ void ProxyListener::handleReply(const std::function<void(const rti::core::Sample
const char *requestType)
{
if (replyObject.error())
WARNING_LOG(m_logger) << requestType << ": " << replyObject();
WARNING_LOG() << requestType << ": " << replyObject();
auto it = m_trainingAreaRequests.find(replyObject.id());
if (it != m_trainingAreaRequests.end())
@@ -581,7 +580,7 @@ void ProxyListener::handleReply(const std::function<void(const rti::core::Sample
m_trainingAreaRequests.erase(it);
}
else
WARNING_LOG(m_logger) << requestType << " with request id " << replyObject.id() << " was not replied to by the proxy";
WARNING_LOG() << requestType << " with request id " << replyObject.id() << " was not replied to by the proxy";
}
@@ -27,7 +27,6 @@ UnitPositionCalculator::UnitPositionCalculator(ParticipantHandler *participantHa
, m_bSomethingChangedSinceLastCalculation(false)
, m_timer(new QTimer(this))
, m_bRunning(true)
, m_logger(getLogger("UnitPositionCalculator"))
{
connect(m_timer, &QTimer::timeout, this, &UnitPositionCalculator::calculate);
m_timer->setSingleShot(true);
@@ -46,7 +45,7 @@ UnitPositionCalculator::~UnitPositionCalculator()
void UnitPositionCalculator::startCalculation()
{
DEBUG_LOG(m_logger) << "Starting calculation timer";
DEBUG_LOG() << "Starting calculation timer";
m_timer->start();
m_bRunning = true;
}
@@ -68,7 +67,7 @@ void UnitPositionCalculator::waitForCalculationFinished()
void UnitPositionCalculator::onParticipantDeleted(int participantId)
{
DEBUG_LOG(m_logger) << "Participant " << participantId << " deleted";
DEBUG_LOG() << "Participant " << participantId << " deleted";
auto it = m_participantData.find(participantId);
if (it == m_participantData.end())
return;
@@ -77,7 +76,7 @@ void UnitPositionCalculator::onParticipantDeleted(int participantId)
void UnitPositionCalculator::onPositionChanged(int participantId, int64_t positionTime, const Core::GeoPosition &pos)
{
DEBUG_LOG(m_logger) << "Position for participant " << participantId << " changed to "
DEBUG_LOG() << "Position for participant " << participantId << " changed to "
<< pos << " (" << positionTime / 1000 << "s)";
CalculatedUnitPosition &data = getParticipant(participantId);
if (data.sampleTimeLeader() >= positionTime)
@@ -92,7 +91,7 @@ void UnitPositionCalculator::onPositionChanged(int participantId, int64_t positi
void UnitPositionCalculator::onSuperiorChanged(int participantId, int superiorId)
{
DEBUG_LOG(m_logger) << "Superior for participant " << participantId << " changed to " << superiorId;
DEBUG_LOG() << "Superior for participant " << participantId << " changed to " << superiorId;
CalculatedUnitPosition &data = getParticipant(participantId);
data.superiorId = superiorId;
m_bSomethingChangedSinceLastCalculation = true;
@@ -106,7 +105,7 @@ void UnitPositionCalculator::onInferiorChanged(int participantId, const std::vec
slIds.reserve(inferiorIds.size());
for (int id : inferiorIds)
slIds += QString::number(id);
DEBUG_LOG(m_logger) << "Inferior for participant " << participantId << " changed, size: " << slIds.join(QLatin1Char(' '));
DEBUG_LOG() << "Inferior for participant " << participantId << " changed, size: " << slIds.join(QLatin1Char(' '));
}
CalculatedUnitPosition &data = getParticipant(participantId);
@@ -119,7 +118,7 @@ UnitPositionCalculator::CalculatedUnitPosition &UnitPositionCalculator::getParti
auto it = m_participantData.find(participantId);
if (it == m_participantData.end())
{
DEBUG_LOG(m_logger) << "No information for participant " << participantId << " - creating dummy data";
DEBUG_LOG() << "No information for participant " << participantId << " - creating dummy data";
CalculatedUnitPosition data;
data.participantId(participantId);
@@ -139,7 +138,7 @@ void UnitPositionCalculator::calculate()
if (!m_bSomethingChangedSinceLastCalculation)
{
if (!s_bDebugOnce)
DEBUG_LOG(m_logger) << "Nothing changed - no calculation needed -> waiting for new data";
DEBUG_LOG() << "Nothing changed - no calculation needed -> waiting for new data";
s_bDebugOnce = true;
m_timer->start(1000);
return;
@@ -311,7 +310,7 @@ void UnitPositionCalculator::onCalculationDone()
if (it != m_publishedPositionData.end())
{
ParticipantManagement::UnitPosition &up = it->second;
DEBUG_LOG(m_logger) << "old: " << up << ", new: " << pos << ", equal: " << (up == pos);
DEBUG_LOG() << "old: " << up << ", new: " << pos << ", equal: " << (up == pos);
if (up == pos)
continue;
// nan == nan is always false, have to check it on our own
@@ -70,7 +70,6 @@ private:
bool m_bSomethingChangedSinceLastCalculation;
QTimer *m_timer;
bool m_bRunning;
NGL::INGLLogger &m_logger;
};
} // namespace ParticipantHandling
@@ -23,7 +23,6 @@ PartyHandling::PartyHandler::PartyHandler(MainHandler *mainHandler)
, SyncPartiesRequestHandler(mainHandler->exerciseId() <= 0 ? nullptr : mainHandler->fts())
, ChangePartyUsedStateRequestHandler(mainHandler->fts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("PartyHandler"))
{
}
@@ -49,7 +48,7 @@ bool PartyHandling::PartyHandler::init()
// read parties from db
if (!m_mainHandler->db()->select(partyVec))
{
ERROR_LOG(m_logger) << "Error while reading party data from database";
ERROR_LOG() << "Error while reading party data from database";
return false;
}
@@ -60,7 +59,7 @@ bool PartyHandling::PartyHandler::init()
if (partyVec.isEmpty())
{
ERROR_LOG(m_logger) << "Error while reading party data from database";
ERROR_LOG() << "Error while reading party data from database";
return false;
}
@@ -78,7 +77,7 @@ bool PartyHandling::PartyHandler::init()
//------------------------------------------------------------------------------------------
void PartyHandling::PartyHandler::resetAdlerProperties( QString &properties, const int partyId)
{
DEBUG_LOG(m_logger) << "properties: " << properties;
DEBUG_LOG() << "properties: " << properties;
QJsonObject obj = QJsonDocument::fromJson(properties.toUtf8()).object();
if (!obj.contains(QStringLiteral("Adler")))
@@ -88,7 +87,7 @@ void PartyHandling::PartyHandler::resetAdlerProperties( QString &properties, con
if (connectState == ParticipantManagement::ConnectState::Undefined)
return;
DEBUG_LOG(m_logger) << "connectState: " << connectState;
DEBUG_LOG() << "connectState: " << connectState;
if (connectState != ParticipantManagement::ConnectState::Disconnected)
{
@@ -98,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(m_logger) << "isSaaConnected set to false";
INFO_LOG() << "isSaaConnected set to false";
}
}
@@ -111,7 +110,7 @@ QVector<Database::PpmParty> PartyHandling::PartyHandler::loadDefaultParties(bool
QVector<Database::PpmParty> partyVec;
if (!m_mainHandler->dbEx0()->select(partyVec))
ERROR_LOG(m_logger) << "Error while reading party data from database (ex_0)";
ERROR_LOG() << "Error while reading party data from database (ex_0)";
auto cb = [](const Database::PpmParty &p1,const Database::PpmParty &p2) -> bool
{
@@ -140,7 +139,7 @@ void PartyHandling::PartyHandler::onModifyPartyDataRequest(const rti::core::Samp
{
auto ret = modifyPartyDataRequest(request);
if (ret.error())
WARNING_LOG(m_logger) << ret();
WARNING_LOG() << ret();
m_mainHandler->fts()->modifyPartyDataReply(cookie, ret);
}
@@ -148,7 +147,7 @@ void PartyHandling::PartyHandler::onModifyPartyDataRequest(const rti::core::Samp
//------------------------------------------------------------------------------------------
Core::FunctionReplyObject PartyHandling::PartyHandler::modifyPartyDataRequest(const ParticipantManagement::Party &request)
{
DEBUG_LOG(m_logger) << "onModifyPartyDataRequest: " << request;
DEBUG_LOG() << "onModifyPartyDataRequest: " << request;
Party *partyToPublish = m_parties.value(request.id());
if (!partyToPublish && request.id() >= 0)
@@ -157,7 +156,7 @@ Core::FunctionReplyObject PartyHandling::PartyHandler::modifyPartyDataRequest(co
if (!partyToPublish) // create new party
{
DEBUG_LOG(m_logger) << "Creating new party";
DEBUG_LOG() << "Creating new party";
// insert into database
Database::PpmParty newDbParty;
@@ -173,7 +172,7 @@ Core::FunctionReplyObject PartyHandling::PartyHandler::modifyPartyDataRequest(co
if (!m_mainHandler->db()->insert(newDbParty))
{
QString errText = m_mainHandler->db()->getLastError().databaseText();
ERROR_LOG(m_logger) << "Error inserting Party into database: " << errText;
ERROR_LOG() << "Error inserting Party into database: " << errText;
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Error inserting new party to database: %1")).arg(errText);
}
@@ -182,7 +181,7 @@ Core::FunctionReplyObject PartyHandling::PartyHandler::modifyPartyDataRequest(co
}
else // modify existing party
{
DEBUG_LOG(m_logger) << "Modifying party with id " << partyToPublish->id();
DEBUG_LOG() << "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 ...
@@ -204,10 +203,10 @@ Core::FunctionReplyObject PartyHandling::PartyHandler::modifyPartyDataRequest(co
void PartyHandling::PartyHandler::onRemovePartyRequest(const rti::core::SampleIdentity &cookie,
const ParticipantManagement::RemovePartyRequest &request)
{
DEBUG_LOG(m_logger) << "onRemovePartyRequest: " << request;
DEBUG_LOG() << "onRemovePartyRequest: " << request;
auto ret = removePartyRequest(request);
if (ret.error())
WARNING_LOG(m_logger) << ret();
WARNING_LOG() << ret();
m_mainHandler->fts()->removePartyReply(cookie, ret);
}
@@ -215,7 +214,7 @@ void PartyHandling::PartyHandler::onRemovePartyRequest(const rti::core::SampleId
//------------------------------------------------------------------------------------------
Core::FunctionReplyObject PartyHandling::PartyHandler::removePartyRequest(const ParticipantManagement::RemovePartyRequest &request)
{
DEBUG_LOG(m_logger) << "onRemovePartyRequest " << request;
DEBUG_LOG() << "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"));
@@ -228,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(m_logger) << "Removing party with ID " << request.partyId();
DEBUG_LOG() << "Removing party with ID " << request.partyId();
return removeParty(partyToDelete);
}
@@ -254,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(m_logger) << "onSyncPartiesRequest: " << request;
DEBUG_LOG() << "onSyncPartiesRequest: " << request;
Core::FunctionReplyObject rep;
QVector<Database::PpmParty> partyVec = loadDefaultParties(false);
@@ -262,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(m_logger) << "Checking Party Id: " << partyId;
DEBUG_LOG() << "Checking Party Id: " << partyId;
Database::PpmParty partyEx0 = (*it);
@@ -273,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(m_logger) << "Error inserting new party with id " << partyId << " to database: " << errText;
WARNING_LOG() << "Error inserting new party with id " << partyId << " to database: " << errText;
continue;
}
else
{
DEBUG_LOG(m_logger) << "Inserting Party Id: " << partyId;
DEBUG_LOG() << "Inserting Party Id: " << partyId;
PartyHandling::Party *newParty = new PartyHandling::Party(partyEx0);
m_parties.insert(partyEx0.id, newParty);
m_mainHandler->dts()->publish(newParty->toDdsParty());
@@ -294,7 +293,7 @@ void PartyHandling::PartyHandler::onSyncPartiesRequest(const rti::core::SampleId
|| partyEx0.hlaForceIdentifier != partyEx->toDbParty().hlaForceIdentifier
|| partyEx0.roleId != partyEx->toDbParty().roleId;
DEBUG_LOG(m_logger) << "Has changes = " << hasChanges;
DEBUG_LOG() << "Has changes = " << hasChanges;
if (hasChanges)
{
@@ -313,7 +312,7 @@ void PartyHandling::PartyHandler::onSyncPartiesRequest(const rti::core::SampleId
auto ret = modifyPartyDataRequest(req);
if (ret.error())
WARNING_LOG(m_logger) << ret();
WARNING_LOG() << ret();
}
}
}
@@ -333,14 +332,14 @@ void PartyHandling::PartyHandler::onSyncPartiesRequest(const rti::core::SampleId
}
if (!found)
{
DEBUG_LOG(m_logger) << "Party id to be deleted = " << curParty->id();
DEBUG_LOG() << "Party id to be deleted = " << curParty->id();
if (curParty->isUsedBy())
INFO_LOG(m_logger) << "Party with id " << curParty->id() << " cannot be deleted, is in use";
INFO_LOG() << "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(m_logger) << ret();
WARNING_LOG() << ret();
}
}
}
@@ -353,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(m_logger) << "onChangePartyUsedStateRequest: " << request;
DEBUG_LOG() << "onChangePartyUsedStateRequest: " << request;
auto ret = changePartyUsedStateRequest(request);
if (ret.error())
WARNING_LOG(m_logger) << ret();
WARNING_LOG() << ret();
m_mainHandler->fts()->changePartyUsedStateReply(cookie, ret);
}
@@ -375,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(m_logger) << "Change used state for party " << party->id() << " to " << party->isUsedBy();
DEBUG_LOG() << "Change used state for party " << party->id() << " to " << party->isUsedBy();
m_mainHandler->dts()->publish(party->toDdsParty());
}
return Core::FunctionReplyObject(request.partyId());
@@ -17,35 +17,34 @@ HandlerTargetInformation::HandlerTargetInformation(MainHandler *mainHandler)
: ModifyTargetInformationRequestHandler(mainHandler->fts())
, RemoveTargetInformationRequestHandler(mainHandler->fts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("HandlerTargetInformation"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG() << Q_FUNC_INFO << " END";
}
//--------------------------------------------------------------------------
HandlerTargetInformation::~HandlerTargetInformation()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG() << Q_FUNC_INFO << " END";
}
//--------------------------------------------------------------------------
bool HandlerTargetInformation::init()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG() << Q_FUNC_INFO << " START";
bool bRet = true;
// create objects
auto cb = [this, &bRet](const Database::PpmTargetInformation & data)
{
DEBUG_LOG(m_logger) << "Reading from DB PpmTargetInformation with id = " << data.id;
DEBUG_LOG() << "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(m_logger) << ret();
ERROR_LOG() << ret();
bRet = false;
return;
}
@@ -53,11 +52,11 @@ bool HandlerTargetInformation::init()
};
if (!m_mainHandler->db()->select(cb) || !bRet)
{
ERROR_LOG(m_logger) << "Error reading data from database!";
ERROR_LOG() << "Error reading data from database!";
return false;
}
DEBUG_LOG(m_logger) << "m_objectMap.size() = " << m_objectMap.size();
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
DEBUG_LOG() << "m_objectMap.size() = " << m_objectMap.size();
TRACE_LOG() << Q_FUNC_INFO << " END";
return true;
}
@@ -67,19 +66,19 @@ bool HandlerTargetInformation::init()
void HandlerTargetInformation::onModifyTargetInformationRequest(const rti::core::SampleIdentity &cookie,
const ModifyTargetInformationRequest &request)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG() << Q_FUNC_INFO << " START";
const auto ret = targetInformationModifyRequest(request);
if (ret.error())
WARNING_LOG(m_logger) << ret();
WARNING_LOG() << ret();
m_mainHandler->fts()->modifyTargetInformationReply(cookie, ret);
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
TRACE_LOG() << Q_FUNC_INFO << " END";
}
//--------------------------------------------------------------------------
Core::FunctionReplyObject HandlerTargetInformation::targetInformationModifyRequest(const ModifyTargetInformationRequest &request)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG() << Q_FUNC_INFO << " START";
const int requestId = request.targetInfo().id();
// modify
if (requestId > 0)
@@ -101,7 +100,7 @@ Core::FunctionReplyObject HandlerTargetInformation::targetInformationModifyReque
}
else
m_objectMap.insert(ifs->getId(), ifs);
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
TRACE_LOG() << Q_FUNC_INFO << " END";
return ret;
}
@@ -109,7 +108,7 @@ Core::FunctionReplyObject HandlerTargetInformation::targetInformationModifyReque
void HandlerTargetInformation::onRemoveTargetInformationRequest(const rti::core::SampleIdentity &cookie,
const RemoveTargetInformationRequest &request)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " request=" << request;
TRACE_LOG() << Q_FUNC_INFO << " request=" << request;
Core::FunctionReplyObject ret;
ObjectTargetInformation *ifs = m_objectMap.value(request.id());
@@ -123,7 +122,7 @@ void HandlerTargetInformation::onRemoveTargetInformationRequest(const rti::core:
ret = ifs->removeObject();
if (ret.error())
ERROR_LOG(m_logger) << ret();
ERROR_LOG() << ret();
else
{
// delete Object
@@ -54,7 +54,7 @@ private: // attributes
QHash<int, ObjectTargetInformation *> m_objectMap;
MainHandler *m_mainHandler;
NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility
};
} // namespace ParticipantManagement
@@ -110,19 +110,18 @@ std::vector<ShootbackArea> vecfromJson(const QJsonValue &val)
ObjectTargetInformation::ObjectTargetInformation(MainHandler *mainHandler)
: m_mainHandler(mainHandler)
, m_logger(getLogger("ObjectTargetInformation"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG() << Q_FUNC_INFO << " END";
}
//------------------------------------------------------------------------------
ObjectTargetInformation::~ObjectTargetInformation()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG() << Q_FUNC_INFO << " START";
if (isValid())
m_mainHandler->dts()->removeTargetInformationByKey(m_data.id());
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
TRACE_LOG() << Q_FUNC_INFO << " END";
}
//------------------------------------------------------------------------------
@@ -134,7 +133,7 @@ bool ObjectTargetInformation::isValid() const
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectTargetInformation::createObject(const TargetInformation &data)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG() << Q_FUNC_INFO << " START";
m_data = data;
if (m_data.id() <= 0)
@@ -145,20 +144,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(m_logger) << "New PpmTargetInformation: " /*<< m_data.id()*/;
DEBUG_LOG() << "New PpmTargetInformation: " /*<< m_data.id()*/;
}
// Publish Data via DTS
onPublishData();
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
TRACE_LOG() << Q_FUNC_INFO << " END";
return Core::FunctionReplyObject(m_data.id());
}
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectTargetInformation::updateObject(const TargetInformation &data)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START, participantId=" << data.participantId()
TRACE_LOG() << Q_FUNC_INFO << " START, participantId=" << data.participantId()
<< " size =" << data.shootbackAreas().size();
Database::PpmTargetInformation dbData;
dbData = toDbData(data);
@@ -167,12 +166,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(m_logger) << "Data changed for TargetInformation: " << m_data.participantId();
DEBUG_LOG() << "Data changed for TargetInformation: " << m_data.participantId();
// Publish Data via DTS
onPublishData();
TRACE_LOG(m_logger) << LOGFUNCTION << " END, id=" << data.id()
TRACE_LOG() << Q_FUNC_INFO << " END, id=" << data.id()
<< " size =" << data.shootbackAreas().size();
return Core::FunctionReplyObject(m_data.id());
}
@@ -180,7 +179,7 @@ Core::FunctionReplyObject ObjectTargetInformation::updateObject(const TargetInfo
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectTargetInformation::removeObject()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG() << 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());
@@ -188,7 +187,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(m_logger) << LOGFUNCTION << " END";
TRACE_LOG() << Q_FUNC_INFO << " END";
return Core::FunctionReplyObject(m_data.id());
}
@@ -196,10 +195,10 @@ Core::FunctionReplyObject ObjectTargetInformation::removeObject()
//------------------------------------------------------------------------------
void ObjectTargetInformation::onPublishData()
{
TRACE_LOG(m_logger) << "Publish TargetInformation-data to dds (" << m_data.id() << ") ...";
TRACE_LOG() << "Publish TargetInformation-data to dds (" << m_data.id() << ") ...";
if (!m_mainHandler->dts()->publish(m_data))
ERROR_LOG(m_logger) << "Error publishing TargetInformation-data to dds";
ERROR_LOG() << "Error publishing TargetInformation-data to dds";
}
// -------------------------------------------------------------------------------------------------------
@@ -10,7 +10,7 @@
#include "dds_handler.h"
#include <ParticipantManagement/logger.h>
#include <DDS/Core/function_reply_object.h>
#include <DDS/Core/core_types.h>
// Generated
#include <ParticipantManagement/ppm.hpp>
@@ -51,7 +51,5 @@ protected:
private:
MainHandler *m_mainHandler;
TargetInformation m_data;
NGL::INGLLogger &m_logger;
};
}
@@ -24,7 +24,6 @@ namespace TemplateHandling
TemplateHandler::TemplateHandler(MainHandler *mainHandler)
: Interface::Fts::ModifyTemplateDataRequestHandler(mainHandler->exerciseId() <= 0 ? mainHandler->fts() : nullptr)
, m_mainHandler(mainHandler)
, m_logger(getLogger("TemplateHandler"))
{}
TemplateHandler::~TemplateHandler()
@@ -41,7 +40,7 @@ bool TemplateHandler::init()
};
if (!m_mainHandler->db()->select(cb))
{
ERROR_LOG(m_logger) << "Error while reading template data from database";
ERROR_LOG() << "Error while reading template data from database";
return false;
}
@@ -59,10 +58,10 @@ bool TemplateHandler::init()
void TemplateHandler::onModifyTemplateDataRequest(const rti::core::SampleIdentity &cookie,
const ParticipantManagement::ModifyTemplateDataRequest &request)
{
DEBUG_LOG(m_logger) << "onModifyTemplateDataRequest: " << request;
DEBUG_LOG() << "onModifyTemplateDataRequest: " << request;
const auto ret = modifyTemplateDataRequest(request);
if (ret.error())
WARNING_LOG(m_logger) << ret();
WARNING_LOG() << ret();
m_mainHandler->fts()->modifyTemplateDataReply(cookie, ret);
}
@@ -93,7 +92,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
}
removeTransaction.commit();
DEBUG_LOG(m_logger) << "Starting validating ModifyTemplateDataRequest";
DEBUG_LOG() << "Starting validating ModifyTemplateDataRequest";
if (templatesToBeCreatedOrModified.size() >= 1000) // concurrent validation for big requests
{
QVector<QFuture<Core::FunctionReplyObject>> futureVec;
@@ -126,7 +125,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
{
for (const ParticipantManagement::TemplateData &currentTemplate : std::as_const(templatesToBeCreatedOrModified))
{
DEBUG_LOG(m_logger) << "Validating template: " << currentTemplate;
DEBUG_LOG() << "Validating template: " << currentTemplate;
auto ret = validateTemplateData(templatesToBeCreatedOrModified, modIdToTemplateId, currentTemplate);
if (ret.error())
return ret;
@@ -135,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(m_logger) << "ModifyTemplateDataRequest has valid data";
DEBUG_LOG() << "ModifyTemplateDataRequest has valid data";
// create new and update existing templates
DEBUG_LOG(m_logger) << "Creating new and updating existing templates ...";
DEBUG_LOG() << "Creating new and updating existing templates ...";
for (const TemplateData &currentData : std::as_const(templatesToBeCreatedOrModified))
{
Template *templateToUpdate = m_templates.value(modIdToTemplateId.value(currentData.modId()));
if (!templateToUpdate)
{
DEBUG_LOG(m_logger) << "Creating new template: " << currentData;
DEBUG_LOG() << "Creating new template: " << currentData;
const auto ret = createNewTemplate(currentData, modIdToTemplateId, templatesWithChanges);
if (ret.error())
return ret;
@@ -156,13 +155,13 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
if (templateToUpdate->hasToBeChanged(currentData) &&
!templatesWithChanges.contains(templateToUpdate))
{
DEBUG_LOG(m_logger) << "Template changed: " << templateToUpdate->toDdsTemplateParticipant();
DEBUG_LOG() << "Template changed: " << templateToUpdate->toDdsTemplateParticipant();
templatesWithChanges.append(templateToUpdate);
}
}
}
DEBUG_LOG(m_logger) << "New templates created and existing templates updated";
DEBUG_LOG() << "New templates created and existing templates updated";
// build hierarchy
for (const TemplateData &currentData : std::as_const(templatesToBeCreatedOrModified)) // first set superiorIds
@@ -180,7 +179,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
if (!currentTemplate->hasNewInferiorStructure(inferiorIdsForTemplate(currentTemplate->id())) ||
templatesWithChanges.contains(currentTemplate))
continue;
DEBUG_LOG(m_logger) << "Template got new inferiors: " << currentTemplate->toDdsTemplateParticipant();
DEBUG_LOG() << "Template got new inferiors: " << currentTemplate->toDdsTemplateParticipant();
templatesWithChanges.append(currentTemplate);
}
@@ -208,7 +207,7 @@ std::vector<int32_t> TemplateHandler::inferiorIdsForTemplate(int32_t superiorTem
{
if (currentTemplate->superiorId() == superiorTemplateId)
{
DEBUG_LOG(m_logger) << "Building hierarchy, parentId: " << superiorTemplateId << " has child " << currentTemplate->id();
DEBUG_LOG() << "Building hierarchy, parentId: " << superiorTemplateId << " has child " << currentTemplate->id();
result.push_back(currentTemplate->id());
}
}
@@ -255,14 +254,14 @@ Core::FunctionReplyObject TemplateHandler::validateTemplateData(const QVector<Te
{
if (templateToValidate.templateId() != 0)
{
DEBUG_LOG(m_logger) << "Checking template id";
DEBUG_LOG() << "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(m_logger) << "... ok";
DEBUG_LOG() << "... ok";
{
QMutexLocker l(&m_mutex);
modIdToTemplateId.insert(templateToValidate.modId(), existingTemplate->id()); /* register template to indicate that this template
@@ -273,7 +272,7 @@ Core::FunctionReplyObject TemplateHandler::validateTemplateData(const QVector<Te
// superior ids valid?
if (templateToValidate.superiorModId() > 0)
{
DEBUG_LOG(m_logger) << "checking superiorIds";
DEBUG_LOG() << "checking superiorIds";
// superior exists?
bool isExistingSuperiorId = false;
for (const TemplateData &dat : dataVec)
@@ -290,14 +289,14 @@ Core::FunctionReplyObject TemplateHandler::validateTemplateData(const QVector<Te
.arg(templateToValidate.modId())
.arg(templateToValidate.superiorModId());
DEBUG_LOG(m_logger) << "... ok";
DEBUG_LOG() << "... 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(m_logger) << "Checking hierarchyNumbers";
DEBUG_LOG() << "Checking hierarchyNumbers";
for (const TemplateData &dat : dataVec)
{
// operator==() on optionals returns false if not set ...
@@ -309,18 +308,18 @@ Core::FunctionReplyObject TemplateHandler::validateTemplateData(const QVector<Te
.arg(dat.superiorModId())
.arg(dat.hierarchyNumber());
}
DEBUG_LOG(m_logger) << "... ok";
DEBUG_LOG() << "... ok";
}
// typeId valid?
DEBUG_LOG(m_logger) << "Checking typeId";
DEBUG_LOG() << "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(m_logger) << "... ok";
DEBUG_LOG() << "... ok";
return Core::FunctionReplyObject();
}
@@ -45,9 +45,6 @@ protected:
MainHandler *m_mainHandler;
QHash<int32_t, Type *> m_types;
QHash<int32_t, EquipmentType *> m_equipmentTypes;
LOGGER_T m_logger;
}; // class TypeHandler
} // namespace TypeHandling
} // namespace ParticipantManagement
@@ -24,7 +24,6 @@ MissionPlanHandler::MissionPlanHandler(MainHandler *mainHandler)
, Interface::Fts::RemoveMissionPlanRequestHandler(mainHandler->fts())
, Interface::Fts::SetMissionActionFulfilledRequestHandler(mainHandler->fts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("MissionPlanHandler"))
{
}
@@ -36,7 +35,7 @@ ParticipantManagement::UasHandling::MissionPlanHandler::~MissionPlanHandler()
bool MissionPlanHandler::init()
{
DEBUG_LOG(m_logger)<<" -- MissionPlanHandler init...";
DEBUG_LOG()<<" -- MissionPlanHandler init...";
qDeleteAll(m_objMissionPlans);
m_objMissionPlans.clear();
if (!loadMissionPlansFromDb())
@@ -60,7 +59,7 @@ void MissionPlanHandler::onRemoveMissionPlanRequest(const rti::core::SampleIdent
void MissionPlanHandler::onSetMissionActionFulfilledRequest(const rti::core::SampleIdentity &cookie, const SetMissionActionFulfilledRequest &request)
{
//DEBUG_LOG(m_logger)<<">> -- onSetMissionActionFulfilledRequest -- ";
//DEBUG_LOG()<<">> -- onSetMissionActionFulfilledRequest -- ";
Core::FunctionReplyObject reply = setMissionActionFulfilledRequest(request);
m_mainHandler->ddsHandler()->fts()->setMissionActionFulfilledReply(cookie, reply);
}
@@ -72,22 +71,22 @@ bool MissionPlanHandler::loadMissionPlansFromDb()
QVector<ParticipantManagement::Database::PpmMissionAction> missionActionVec;
if (!m_mainHandler->db()->select(missionActionVec))
{
ERROR_LOG(m_logger)<<"Error reading data from database >> PpmMissionAction: "<<missionActionVec.size();
ERROR_LOG()<<"Error reading data from database >> PpmMissionAction: "<<missionActionVec.size();
return false;
}
if (!m_mainHandler->db()->select(missionItemVec))
{
ERROR_LOG(m_logger)<<"Error reading data from database >> missionItemVec"<<missionItemVec.size();
ERROR_LOG()<<"Error reading data from database >> missionItemVec"<<missionItemVec.size();
return false;
}
if (!m_mainHandler->db()->select(missionPlanVec))
{
ERROR_LOG(m_logger)<<"Error reading data from database >> missionPlanVec"<<missionPlanVec.size();
ERROR_LOG()<<"Error reading data from database >> missionPlanVec"<<missionPlanVec.size();
return false;
}
DEBUG_LOG(m_logger) << "load MissionPlans From Db Plans size = " << missionPlanVec.size()
DEBUG_LOG() << "load MissionPlans From Db Plans size = " << missionPlanVec.size()
<<" Items size = "<<missionItemVec.size()
<<" Actions size = "<<missionActionVec.size();
// add to internal buffer
@@ -170,7 +169,7 @@ bool MissionPlanHandler::loadMissionPlansFromDb()
m_mainHandler->ddsHandler()->dts()->publish(missionPlan);
}
DEBUG_LOG(m_logger)<<" -- END load mission plan From Db -- ";
DEBUG_LOG()<<" -- END load mission plan From Db -- ";
return true;
}
@@ -181,11 +180,11 @@ bool MissionPlanHandler::isUasInAutoMode(int participantId)
if (uas.id() < 1)
{
ERROR_LOG(m_logger) << "no uas for pid " << participantId;
ERROR_LOG() << "no uas for pid " << participantId;
return false;
}
DEBUG_LOG(m_logger) << "uas with pid " << participantId << " is in mode: " << (int)uas.uasState().underlying();
DEBUG_LOG() << "uas with pid " << participantId << " is in mode: " << (int)uas.uasState().underlying();
return (uas.uasState() == ProjectDataManagement::UasState::Auto);
}
@@ -216,7 +215,7 @@ bool MissionPlanHandler::isUasCombatReady(int participantId)
youngestState.stateTime(0);
for (const auto &si : history)
{
DEBUG_LOG(m_logger) << "StateInformation "
DEBUG_LOG() << "StateInformation "
<< " time=" << si.stateTime()
<< " vulnerabilityBits=" << si.vulnerabilityBits()
<< " vulnerabilityKindId=" << si.vulnerabilityKindId();
@@ -229,7 +228,7 @@ bool MissionPlanHandler::isUasCombatReady(int participantId)
Core::FunctionReplyObject MissionPlanHandler::createMissionPlanRequest(const ModifyMissionPlanRequest &request)
{
DEBUG_LOG(m_logger) <<" >> -- createMissionPlanRequest -- ";
DEBUG_LOG() <<" >> -- 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());
@@ -268,7 +267,7 @@ Core::FunctionReplyObject MissionPlanHandler::createMissionPlanRequest(const Mod
Core::FunctionReplyObject MissionPlanHandler::modifyMissionPlanRequest(const ModifyMissionPlanRequest &request)
{
DEBUG_LOG(m_logger)<<" >> -- modifyMissionPlanRequest -- ";
DEBUG_LOG()<<" >> -- modifyMissionPlanRequest -- ";
/// 1- update Mission plan Table
/// 2- remove first all mission items and their actions
/// 3- add New mission items
@@ -286,7 +285,7 @@ Core::FunctionReplyObject MissionPlanHandler::modifyMissionPlanRequest(const Mod
Core::FunctionReplyObject MissionPlanHandler::removeMissionPlanRequest(int id)
{
DEBUG_LOG(m_logger)<<" >> -- removeMissionPlanRequest -- ";
DEBUG_LOG()<<" >> -- removeMissionPlanRequest -- ";
Core::FunctionReplyObject ret;
ObjectMissionPlan *obj = m_objMissionPlans.value(id, nullptr);
if (!obj)
@@ -318,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(m_logger) << ">> mission item: this mission name: " << thisMissionName << ", fulfilled: " << msa.fulfilled();
INFO_LOG() << ">> mission item: this mission name: " << thisMissionName << ", fulfilled: " << msa.fulfilled();
if (msa.fulfilled() > 0)
{
@@ -330,7 +329,7 @@ bool MissionPlanHandler::setCurrentMissionActionFulfilled(int participantId, con
continue;
}
DEBUG_LOG(m_logger) << ">> ######### setMissionActionFulfilledRequest !!! item = " << item.itemNumber() << ", name = " << item.name() << ", missionPlan = " << missionPlan->missionPlan().id();
DEBUG_LOG() << ">> ######### setMissionActionFulfilledRequest !!! item = " << item.itemNumber() << ", name = " << item.name() << ", missionPlan = " << missionPlan->missionPlan().id();
SetMissionActionFulfilledRequest req;
req.actionNumber(msa.actionNumber());
req.fulfilled(true);
@@ -339,7 +338,7 @@ bool MissionPlanHandler::setCurrentMissionActionFulfilled(int participantId, con
const auto res = setMissionActionFulfilledRequest(req);
if (res.error())
{
ERROR_LOG(m_logger) << "failed to set current mission action as fulfilled: " << res.str();
ERROR_LOG() << "failed to set current mission action as fulfilled: " << res.str();
}
found = true;
@@ -365,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(m_logger) << "failed to set current mission action as fulfilled: no action found for pId " << participantId;
DEBUG_LOG() << "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(m_logger)<<" -- [setMissionActionFulfilledRequest] req.missionId: "<<request.missionId();
DEBUG_LOG()<<" -- [setMissionActionFulfilledRequest] req.missionId: "<<request.missionId();
Core::FunctionReplyObject ret;
ObjectMissionPlan *obj = m_objMissionPlans.value(request.missionId(), nullptr);
if (!obj)
@@ -392,7 +391,7 @@ bool MissionPlanHandler::isUasParticipant(int participantId) const
if (PARTICIPANT == nullptr)
{
WARNING_LOG(m_logger) << "Got invalid participantId " << participantId;
WARNING_LOG() << "Got invalid participantId " << participantId;
return false;
}
@@ -56,7 +56,6 @@ private:
MainHandler *m_mainHandler;
QHash<int32_t, ObjectMissionPlan *> m_objMissionPlans;
LOGGER_T m_logger;
};
}
@@ -23,9 +23,8 @@ ObjectMissionPlan::ObjectMissionPlan(const std::shared_ptr<DdsHandler> &ddsHandl
, m_ddsHandler(ddsHandler)
, m_db(db)
, m_missionplan(missionPlan)
, m_logger(getLogger("ObjectMissionPlan"))
{
DEBUG_LOG(m_logger)<<" - ctor ObjectMissionPlan: planId: "<<m_missionplan.id();
DEBUG_LOG()<<" - ctor ObjectMissionPlan: planId: "<<m_missionplan.id();
}
@@ -126,7 +125,7 @@ Core::FunctionReplyObject ObjectMissionPlan::createMissionPlan(Database::PpmMiss
if (!m_db->insert(newMissionPlan))
{
QString error = QStringLiteral("Could not insert mission plan into database");
ERROR_LOG(m_logger)<< error;
ERROR_LOG()<< error;
return Core::FunctionReplyObject(error.toStdString().c_str());
}
@@ -182,11 +181,11 @@ Core::FunctionReplyObject ObjectMissionPlan::createMissionPlan(Database::PpmMiss
for (auto &item : m_missionplan.items())
{
for (auto &action : item.actions())
DEBUG_LOG(m_logger)<<"[CREATE] itemIdx: "<<item.itemNumber()
DEBUG_LOG()<<"[CREATE] itemIdx: "<<item.itemNumber()
<<" act.Num: "<<action.actionNumber()<<" act.ItemNum: "<<action.itemNumber()<<" itemFul:"<<action.fulfilled();
}
trans.commit();
DEBUG_LOG(m_logger)<< ">> [NEW] mission plan with id( "<<newMissionPlan.id<<" ) inserted !!";
DEBUG_LOG()<< ">> [NEW] mission plan with id( "<<newMissionPlan.id<<" ) inserted !!";
return Core::FunctionReplyObject(newMissionPlan.id);
}
@@ -206,7 +205,7 @@ Core::FunctionReplyObject ObjectMissionPlan::updateMissionPlan(Database::PpmMiss
if (!m_db->update(newMissionPlan))
{
QString error = QStringLiteral("Could not update mission plan! ");
ERROR_LOG(m_logger)<< error;
ERROR_LOG()<< error;
return Core::FunctionReplyObject(error.toStdString().c_str());
}
@@ -216,7 +215,7 @@ Core::FunctionReplyObject ObjectMissionPlan::updateMissionPlan(Database::PpmMiss
if (!m_db->removePpmMissionItem(itemId))
{
QString error = QStringLiteral("Could not remove mission plan from database");
ERROR_LOG(m_logger)<< error;
ERROR_LOG()<< error;
return Core::FunctionReplyObject(0, tr_lts("dds", "Could not update mission plan into!"));
}
}
@@ -270,7 +269,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(m_logger)<< ">> [UPDATE] mission plan with id( "<<m_missionplan.id()<<" ) Updated !!";
DEBUG_LOG()<< ">> [UPDATE] mission plan with id( "<<m_missionplan.id()<<" ) Updated !!";
return Core::FunctionReplyObject(m_missionplan.id());
}
@@ -281,13 +280,13 @@ Core::FunctionReplyObject ObjectMissionPlan::removeMissionPlan(int id)
if (!m_db->removePpmMissionPlan(id))
{
QString error = QStringLiteral("Could not remove mission plan ! ");
ERROR_LOG(m_logger)<< error;
ERROR_LOG()<< error;
return Core::FunctionReplyObject(error.toStdString().c_str());
}
trans.commit();
m_dbMissionActions.clear();
m_mapMissionItems.clear();
DEBUG_LOG(m_logger)<< ">> [REMOVE] mission Action with id( "<<id<<" ) deleted !!";
DEBUG_LOG()<< ">> [REMOVE] mission Action with id( "<<id<<" ) deleted !!";
return Core::FunctionReplyObject();
}
@@ -301,14 +300,14 @@ Core::FunctionReplyObject ObjectMissionPlan::setMissionActionFulfilled(SetMissio
if (!m_db)
{
ERROR_LOG(m_logger) << "no init yet....";
ERROR_LOG() << "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(m_logger)<< error;
ERROR_LOG()<< error;
return Core::FunctionReplyObject(error.toStdString().c_str());
}
@@ -327,7 +326,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(m_logger)<< error;
ERROR_LOG()<< error;
return Core::FunctionReplyObject(error.toStdString().c_str());
}
@@ -337,7 +336,7 @@ Core::FunctionReplyObject ObjectMissionPlan::setMissionActionFulfilled(SetMissio
if (!m_db->update(dbAction))
{
QString error = QStringLiteral("Could not update mission action! ");
ERROR_LOG(m_logger)<< error;
ERROR_LOG()<< error;
return Core::FunctionReplyObject(error.toStdString().c_str());
}
@@ -372,7 +371,7 @@ Core::FunctionReplyObject ObjectMissionPlan::setMissionActionFulfilled(SetMissio
Core::FunctionReplyObject ObjectMissionPlan::setMissionPlanAborted(bool state)
{
DEBUG_LOG(m_logger)<<" -- [setMissionPlanAborted] abort mission plan: "<<m_missionplan.id();
DEBUG_LOG()<<" -- [setMissionPlanAborted] abort mission plan: "<<m_missionplan.id();
Database::PpmMissionPlan dbMissionPlan;
// m_db->selectPpmMissionPlan(m_missionplan.id(),dbMissionPlan);
dbMissionPlan.missionStart = QDateTime::fromMSecsSinceEpoch(m_missionplan.missionStart());
@@ -388,7 +387,7 @@ Core::FunctionReplyObject ObjectMissionPlan::setMissionPlanAborted(bool state)
if (!m_db->update(dbMissionPlan))
{
QString error = QStringLiteral("Could not update mission plan! ");
ERROR_LOG(m_logger)<< error;
ERROR_LOG()<< error;
return Core::FunctionReplyObject(error.toStdString().c_str());
}
@@ -51,8 +51,6 @@ private:
QHash<int /*dbItemId*/, ParticipantManagement::MissionItem > m_mapMissionItems; /// key:dbItemId | Value MissionItem
std::vector<std::vector<ParticipantManagement::Database::PpmMissionAction> > m_dbMissionActions; /// [ItemNumber][ActionNumber]
LOGGER_T m_logger;
};
} // namespace UasHandling
@@ -26,7 +26,6 @@ UasHandler::UasHandler(MainHandler *mainHandler)
, CreateModifyUasRequestHandler(mainHandler->exAnyFts())
, RemoveUasRequestHandler(mainHandler->exAnyFts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("UasHandler"))
{
m_mainHandler->exAnyFts()->enableCreateModifyUas();
m_mainHandler->exAnyFts()->enableRemoveUas();
@@ -50,7 +49,7 @@ bool UasHandler::init()
// read parties from db
if (!m_mainHandler->db()->select(uasVec))
{
ERROR_LOG(m_logger) << "Error while reading Uas data from database";
ERROR_LOG() << "Error while reading Uas data from database";
return false;
}
@@ -70,7 +69,7 @@ bool UasHandler::init()
this, &UasHandler::onExerciseChanged);
if (!m_exmDtc->enableExercise())
{
ERROR_LOG(m_logger) << "Could not enable Topic 'Exercise' of EXM DTC";
ERROR_LOG() << "Could not enable Topic 'Exercise' of EXM DTC";
return false;
}
@@ -90,16 +89,16 @@ void UasHandler::onCreateModifyUasRequest(const rti::core::SampleIdentity &cooki
void UasHandler::onRemoveUasRequest(const rti::core::SampleIdentity &cookie, const RemoveUasRequest &request)
{
DEBUG_LOG(m_logger) << "onRemoveUasRequest: " << request;
DEBUG_LOG() << "onRemoveUasRequest: " << request;
auto ret = removeUas(request);
if (ret.error())
WARNING_LOG(m_logger) << ret();
WARNING_LOG() << ret();
m_mainHandler->exAnyFts()->removeUasReply(cookie, ret);
}
Core::FunctionReplyObject UasHandler::removeUas(const RemoveUasRequest &request)
{
DEBUG_LOG(m_logger) << "onRemoveUasRequest " << request;
DEBUG_LOG() << "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"));
@@ -112,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(m_logger) << "Removing UAS with ID " << request.id();
DEBUG_LOG() << "Removing UAS with ID " << request.id();
return removeUas(uasToDelete);
}
@@ -138,7 +137,7 @@ Core::FunctionReplyObject UasHandler::removeUas(UasHandling::Uas *uasToDelete)
//------------------------------------------------------------------------------------------
Core::FunctionReplyObject UasHandler::createUas(const CreateModifyUasRequest &request)
{
DEBUG_LOG(m_logger) << LOGFUNCTION;
DEBUG_LOG() << Q_FUNC_INFO;
// cant check here as we dont have access to all party participants
/*
@@ -146,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(m_logger) << error;
ERROR_LOG() << error;
return Core::FunctionReplyObject(error.toStdString().c_str());
}*/
@@ -169,7 +168,7 @@ Core::FunctionReplyObject UasHandler::createUas(const CreateModifyUasRequest &re
{
QString error = QStringLiteral("Could not insert Uas into database");
ERROR_LOG(m_logger) << error;
ERROR_LOG() << error;
return Core::FunctionReplyObject(error.toStdString().c_str());
}
@@ -189,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(m_logger) << error;
ERROR_LOG() << error;
return Core::FunctionReplyObject(error.toStdString().c_str());
}
@@ -205,7 +204,7 @@ Core::FunctionReplyObject UasHandler::modifyUas(const CreateModifyUasRequest &re
{
QString error = QStringLiteral("There are no changes in modify request.");
ERROR_LOG(m_logger) << error;
ERROR_LOG() << error;
return Core::FunctionReplyObject(error.toStdString().c_str());
}
@@ -216,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(m_logger) << error;
ERROR_LOG() << error;
return Core::FunctionReplyObject(error.toStdString().c_str());
}
@@ -234,7 +233,7 @@ bool UasHandler::isUasParticipant(int participantId) const
if (PARTICIPANT == nullptr)
{
WARNING_LOG(m_logger) << "Got invalid participantId " << participantId;
WARNING_LOG() << "Got invalid participantId " << participantId;
return false;
}
@@ -53,9 +53,6 @@ private:
MainHandler *m_mainHandler;
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
QHash<int32_t, Uas *> m_uass;
LOGGER_T m_logger;
};
} // namespace UasHandling
} // namespace ParticipantManagement
@@ -24,7 +24,6 @@ WebSocketInterfaceHandler::WebSocketInterfaceHandler(MainHandler *mainHandler, Q
, m_messageFactory(nullptr)
, m_dataManager(nullptr)
, m_mainHandler(mainHandler)
, m_logger(getLogger("WebSocketInterfaceHandler"))
{
}
@@ -37,7 +36,7 @@ bool WebSocketInterfaceHandler::init()
{
cleanup();
DEBUG_LOG(m_logger) << "... ok";
DEBUG_LOG() << "... ok";
m_dataManager = new DataManager(m_mainHandler->exerciseId(), m_mainHandler->db(), m_mainHandler->ddsHandler()->dtc());
@@ -45,15 +44,15 @@ bool WebSocketInterfaceHandler::init()
m_webSocketServer = new LtsWebSocket::LtsWebSocketServer(m_messageFactory, this);
DEBUG_LOG(m_logger) << "Initialising LtsWebSocketServer";
DEBUG_LOG() << "Initialising LtsWebSocketServer";
if (!m_webSocketServer->init(QStringLiteral("PPM"), Settings::getWebSocketServerPortRange(1)))
{
ERROR_LOG(m_logger) << "Failed to initialise LtsWebSocketServer";
ERROR_LOG() << "Failed to initialise LtsWebSocketServer";
return false;
}
DEBUG_LOG(m_logger) << "... ok";
DEBUG_LOG() << "... ok";
DEBUG_LOG(m_logger) << "Connection signals and slots";
DEBUG_LOG() << "Connection signals and slots";
return true;
}
@@ -19,9 +19,8 @@ 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))
, m_logger(getLogger("DdsHandler"))
{
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
}
DdsHandler::~DdsHandler()
@@ -41,7 +40,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
{
if (!m_ddsConnector->init(qosFileList))
{
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
ERROR_LOG() << "Error initializing dds connections - aborting";
return false;
}
@@ -57,7 +56,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(m_logger) << "OKKKKK THIS THE NEW MAIN HANDLER DDS " << this->thread();
ERROR_LOG() << "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);
@@ -69,7 +68,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(m_logger) << "Could not init Dds Connector with IDL::PartitionType::Any";
ERROR_LOG() << "Could not init Dds Connector with IDL::PartitionType::Any";
return false;
}
m_exAnyConnector->initPublisherSubscriber();
@@ -78,7 +77,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
m_ddsAnyExDts->enableUASRadioLinkConnectionStatus(true);
if (exerciseId <= 0)
{
DEBUG_LOG(m_logger) << "Creating * FTS: " << m_exAnyConnector->getDefaultPartition();
DEBUG_LOG() << "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
@@ -108,7 +107,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
!m_ddsDts->enableMissionPlan(bExe)
)
{
ERROR_LOG(m_logger) << "Error initializing DTS";
ERROR_LOG() << "Error initializing DTS";
return false;
}
@@ -145,7 +144,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
)
{
ERROR_LOG(m_logger) << "Error initializing FTS";
ERROR_LOG() << "Error initializing FTS";
return false;
}
@@ -63,8 +63,6 @@ private:
std::shared_ptr<Core::Pacemaker> m_pacemaker;
std::shared_ptr<Core::TopicLockMaster> m_topicLockMaster;
std::shared_ptr<ExerciseTime> m_exerciseTime;
NGL::INGLLogger &m_logger;
};
}
@@ -9,7 +9,7 @@
#pragma once
#include <NGLLogger/INGLLogger.h>
#include "ppm_export.h"
#include "svcppmcommon_export.h"
namespace ParticipantManagement
{
@@ -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(m_logger) << "Could not init DdsHandler";
ERROR_LOG() << "Could not init DdsHandler";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init DdsHandler"));
return false;
}
DEBUG_LOG(m_logger) << "DdsHandler initialized";
DEBUG_LOG() << "DdsHandler initialized";
m_dbHandler = std::make_shared<DbHandler>();
if (!m_dbHandler->init(exerciseId, Settings::settings()))
{
ERROR_LOG(m_logger) << "Could not init DbHandler";
ERROR_LOG() << "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(m_logger) << "Could not init DbHandler";
ERROR_LOG() << "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(m_logger) << "DbHandler initialized";
DEBUG_LOG() << "DbHandler initialized";
m_typeHandler = TypeHandling::TypeHandler::createInstance(this, m_logger);
if (!m_typeHandler->init())
{
ERROR_LOG(m_logger) << "Could not init TypeHandler";
ERROR_LOG() << "Could not init TypeHandler";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init TypeHandler"));
return false;
}
DEBUG_LOG(m_logger) << "TypeHandler initialized";
DEBUG_LOG() << "TypeHandler initialized";
m_partyHandler = std::make_shared<PartyHandling::PartyHandler>(this);
if (!m_partyHandler->init())
{
ERROR_LOG(m_logger) << "Could not init PartyHandler";
ERROR_LOG() << "Could not init PartyHandler";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init PartyHandler"));
return false;
}
DEBUG_LOG(m_logger) << "PartyHandler initialized";
DEBUG_LOG() << "PartyHandler initialized";
m_tabFtc = TrainingAreaBase::Interface::Ftc::create(m_ddsHandler->dds());
if (!m_tabFtc->enableAll())
{
ERROR_LOG(m_logger) << "Could not init TrainingAreaBase FTC";
ERROR_LOG() << "Could not init TrainingAreaBase FTC";
return false;
}
DEBUG_LOG(m_logger) << "TrainingAreaBase FTC initialized";
DEBUG_LOG() << "TrainingAreaBase FTC initialized";
m_aesFtc = AreaEffectSimulation::Interface::Ftc::create(m_ddsHandler->dds());
if (!m_aesFtc->enableChargeAdministrationModify())
{
ERROR_LOG(m_logger) << "Could not init AreaEffectSimulation FTC";
ERROR_LOG() << "Could not init AreaEffectSimulation FTC";
return false;
}
m_participantHandler = std::make_shared<ParticipantHandling::ParticipantHandlerForExercise>(this);
if (!m_participantHandler->init())
{
ERROR_LOG(m_logger) << "Could not init ParticipantHandler";
ERROR_LOG() << "Could not init ParticipantHandler";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init ParticipantHandler"));
return false;
}
DEBUG_LOG(m_logger) << "ParticipantHandler initialized";
DEBUG_LOG() << "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(m_logger) << "Could not init TargetInformationHandler";
ERROR_LOG() << "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(m_logger) << "Could not init BiteHandler";
ERROR_LOG() << "Could not init BiteHandler";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init BiteHandler"));
return false;
}
DEBUG_LOG(m_logger) << "BiteHandler initialized";
DEBUG_LOG() << "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(m_logger) << "Could not init TemplateHandler";
ERROR_LOG() << "Could not init TemplateHandler";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init TemplateHandler"));
return false;
}
DEBUG_LOG(m_logger) << "TemplateHandler initialized";
DEBUG_LOG() << "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(m_logger) << "Could not init EquipmentEventHandler";
ERROR_LOG() << "Could not init EquipmentEventHandler";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, QStringLiteral("Could not init EquipmentEventHandler"));
return false;
}
DEBUG_LOG(m_logger) << "EquipmentEventHandler initialized";
DEBUG_LOG() << "EquipmentEventHandler initialized";
// WebSocketServer
m_websocketHandler = std::make_shared<WebSocketInterface::WebSocketInterfaceHandler>(this);
if (!m_websocketHandler->init())
{
ERROR_LOG(m_logger) << "Could not init WebSocketInterfaceHandler";
ERROR_LOG() << "Could not init WebSocketInterfaceHandler";
return false;
}
DEBUG_LOG(m_logger) << "WebSocketInterfaceHandler initialized";
DEBUG_LOG() << "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(m_logger) << "Could not init UasHandler";
ERROR_LOG() << "Could not init UasHandler";
return false;
}
DEBUG_LOG(m_logger) << "UasHandler initialized";
DEBUG_LOG() << "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(m_logger) << "Couldn't init MissionPlanHandler";
ERROR_LOG() << "Couldn't init MissionPlanHandler";
return false;
}
}
@@ -101,7 +101,5 @@ class MainHandler final : public ParticipantHandling::BaseDataProvider
std::shared_ptr<WebSocketInterface::WebSocketInterfaceHandler> m_websocketHandler;
std::shared_ptr<UasHandling::UasHandler> m_uasHandler;
std::shared_ptr<UasHandling::MissionPlanHandler> m_missionPlanHandler;
LOGGER_T m_logger;
};
} // namespace ParticipantManagement
@@ -7,7 +7,7 @@
*/
#pragma once
#include <ParticipantManagement/ppm.hpp>
#include "ppm_export.h"
#include "svcppmcommon_export.h"
namespace ParticipantManagement
{
@@ -37,14 +37,14 @@ bool WebSocketHandler::init(quint16 listenPort)
{
if (!m_webSocketServer->listen(QHostAddress::Any, listenPort))
{
WARNING_LOG(m_logger) << "Can not listen on port " << listenPort << " - aborting";
WARNING_LOG() << "Can not listen on port " << listenPort << " - aborting";
return false;
}
connect(m_webSocketServer, &QWebSocketServer::newConnection,
this, &WebSocketHandler::onNewConnection);
INFO_LOG(m_logger) << "Listening on port " << m_webSocketServer->serverPort();
INFO_LOG() << "Listening on port " << m_webSocketServer->serverPort();
return true;
}
@@ -90,7 +90,7 @@ void WebSocketHandler::onNewConnection()
m_webSockets += ws;
INFO_LOG(m_logger) << "New websocket connected";
INFO_LOG() << "New websocket connected";
}
void WebSocketHandler::onWebSocketDisconnected()
@@ -102,7 +102,7 @@ void WebSocketHandler::onWebSocketDisconnected()
m_webSockets.removeAll(ws);
ws->deleteLater();
INFO_LOG(m_logger) << "A websocket disconnected";
INFO_LOG() << "A websocket disconnected";
}
bool WebSocketHandler::sendPosition(const ParticipantPosition &participantPosition, int equipmentNumber) const
@@ -40,8 +40,6 @@ private Q_SLOTS:
private:
QWebSocketServer* m_webSocketServer = nullptr;
QVector<QWebSocket*> m_webSockets;
LOGGER_T m_logger;
};
}