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:
2785 files changed
+18754
-18316
No files matched your search
@@ -29,7 +29,7 @@ CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
|
||||
# generate gna_[d|f]tc.h
|
||||
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY(AAR SV WS svcGnaCommon SHARED ${SRCS_common})
|
||||
NGL_ADD_LIBRARY2(AAR SV WS svcGnaCommon SHARED ${SRCS_common})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcGnaCommon
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
@@ -57,7 +57,7 @@ SET(SRCS_client
|
||||
# generate gna_[d|f]tc_impl.[cpp|h]
|
||||
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY(AAR SV WS svcGnaClient SHARED ${SRCS_client})
|
||||
NGL_ADD_LIBRARY2(AAR SV WS svcGnaClient SHARED ${SRCS_client})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcGnaClient
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
@@ -113,7 +113,7 @@ CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
|
||||
# Generate gna.sql, gna.xml
|
||||
CODEGEN_SQL(SRCS_server ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY(AAR SV svcGnaServer SHARED ${SRCS_server})
|
||||
NGL_ADD_LIBRARY2(AAR SV svcGnaServer SHARED ${SRCS_server})
|
||||
NGL_TARGET_LINK_LIBRARIES(svcGnaServer
|
||||
PRIVATE
|
||||
ddsfts
|
||||
|
||||
@@ -41,16 +41,16 @@ void AbstractSocketHandler::textMessageReceived(const QByteArray &msg)
|
||||
{
|
||||
if (msg.isEmpty())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Empty message received";
|
||||
ERROR_LOG() << "Empty message received";
|
||||
return;
|
||||
}
|
||||
const QJsonObject obj = QJsonDocument::fromJson(msg).object();
|
||||
DEBUG_LOG(m_logger) << "incoming telegram: " << msg;
|
||||
DEBUG_LOG() << "incoming telegram: " << msg;
|
||||
|
||||
const QJsonValue type = obj.value(QStringLiteral("type"));
|
||||
if (!type.isString())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can not read type id: " << msg;
|
||||
ERROR_LOG() << "Can not read type id: " << msg;
|
||||
return;
|
||||
}
|
||||
const QString typeStr = type.toString();
|
||||
@@ -66,11 +66,11 @@ void AbstractSocketHandler::textMessageReceived(const QByteArray &msg)
|
||||
else if (typeStr.compare(Constraints<NasatSimulationStatus>::type(), Qt::CaseInsensitive) == 0)
|
||||
emit simulationStatusReceived(NasatSimulationStatus::fromJson(data));
|
||||
else
|
||||
ERROR_LOG(m_logger) << "Got unknown json telegram: " << msg;
|
||||
ERROR_LOG() << "Got unknown json telegram: " << msg;
|
||||
}
|
||||
catch (const JsonException &ex)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not parse json telegram: " << msg
|
||||
ERROR_LOG() << "Could not parse json telegram: " << msg
|
||||
<< ", error: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ protected:
|
||||
virtual bool sendTelegramInternal(const QByteArray &tele) = 0;
|
||||
|
||||
protected:
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -13,7 +13,6 @@ namespace GuezNasat
|
||||
|
||||
Participant2Dds::Participant2Dds(const dds::domain::DomainParticipant &domainParticipant, int exerciseId)
|
||||
: m_ddsConnector(new DDSConnector::DdsConnector(domainParticipant, IDL::PartitionType::Exercise, exerciseId))
|
||||
, m_logger(getLogger("Participant2Dds"))
|
||||
{
|
||||
m_ddsConnector->initPublisherSubscriber();
|
||||
m_ppmDtc = ParticipantManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
@@ -27,22 +26,22 @@ Participant2Dds::Participant2Dds(const dds::domain::DomainParticipant &domainPar
|
||||
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " create FTC..." << " exerciseId=" << exerciseId;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " create FTC..." << " exerciseId=" << exerciseId;
|
||||
|
||||
m_aesFtc = AreaEffectSimulation::Interface::Ftc::create(m_ddsConnector);
|
||||
if (!m_aesFtc->enableAirSupportImpactModify())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not enable AES AirSupportImpactModify FTC for"
|
||||
ERROR_LOG() << "Could not enable AES AirSupportImpactModify FTC for"
|
||||
<< " exerciseId=" << exerciseId;
|
||||
m_aesFtc = nullptr;
|
||||
}
|
||||
if (!m_aesFtc->enableExplosionClusterModify())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not enable AES enableExplosionClusterModify FTC for"
|
||||
ERROR_LOG() << "Could not enable AES enableExplosionClusterModify FTC for"
|
||||
<< " exerciseId=" << exerciseId;
|
||||
m_aesFtc = nullptr;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " create FTC..." << " exerciseId=" << exerciseId << " Done: " << m_aesFtc.get();
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " create FTC..." << " exerciseId=" << exerciseId << " Done: " << m_aesFtc.get();
|
||||
}
|
||||
|
||||
bool Participant2Dds::publish(const TrainingAreaBase::EquipmentPosition &pos)
|
||||
@@ -52,7 +51,7 @@ bool Participant2Dds::publish(const TrainingAreaBase::EquipmentPosition &pos)
|
||||
m_tabDts = TrainingAreaBase::Interface::Dts::create(m_ddsConnector);
|
||||
if (!m_tabDts->enableEquipmentPosition())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not enable TAB equipment position DTS for "
|
||||
ERROR_LOG() << "Could not enable TAB equipment position DTS for "
|
||||
<< m_ddsConnector->getDefaultPartition();
|
||||
m_tabDts = nullptr;
|
||||
return false;
|
||||
@@ -81,7 +80,7 @@ bool Participant2Dds::publish(const GuezNasat::Nasat9Liner &nl)
|
||||
m_gnaDts = GuezNasat::Interface::Dts::create(m_ddsConnector);
|
||||
if (!m_gnaDts->enableNasat9Liner())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not enable GNA Nasat9Liner DTS for "
|
||||
ERROR_LOG() << "Could not enable GNA Nasat9Liner DTS for "
|
||||
<< m_ddsConnector->getDefaultPartition();
|
||||
m_gnaDts = nullptr;
|
||||
return false;
|
||||
@@ -93,13 +92,13 @@ bool Participant2Dds::publish(const GuezNasat::Nasat9Liner &nl)
|
||||
|
||||
void Participant2Dds::addParticipantToWatch(int participantId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "addParticipantToWatch: " << participantId;
|
||||
DEBUG_LOG() << "addParticipantToWatch: " << participantId;
|
||||
m_participantsToWatch += participantId;
|
||||
}
|
||||
|
||||
void Participant2Dds::removeParticipantToWatch(int participantId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "removeParticipantToWatch: " << participantId;
|
||||
DEBUG_LOG() << "removeParticipantToWatch: " << participantId;
|
||||
m_participantsToWatch -= participantId;
|
||||
}
|
||||
|
||||
@@ -121,7 +120,7 @@ void Participant2Dds::onParticipantChanged(const ParticipantManagement::Particip
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
DEBUG_LOG(m_logger) << "onParticipantChanged: " << data.id()
|
||||
DEBUG_LOG() << "onParticipantChanged: " << data.id()
|
||||
<< ", " << m_participantsToWatch.contains(data.id())
|
||||
<< ", " << m_participantsToWatch.size()
|
||||
<< ", " << m_participantsToWatch.contains(data.id())
|
||||
@@ -138,18 +137,17 @@ void Participant2Dds::onParticipantChanged(const ParticipantManagement::Particip
|
||||
|
||||
DdsHandler::DdsHandler(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(ddsConnector->getDomainParticipant(), IDL::PartitionType::AllExercises))
|
||||
, m_logger(getLogger("DdsHandler"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << m_ddsConnector->getDomainId() << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG() << "DdsHandler(" << m_ddsConnector->getDomainId() << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
INFO_LOG(m_logger) << "--- Start GuezNasat DDSHandler.";
|
||||
INFO_LOG() << "--- Start GuezNasat DDSHandler.";
|
||||
|
||||
if (!m_ddsConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
||||
ERROR_LOG() << "Error initializing dds connections - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -160,22 +158,22 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
m_ddsDts = GuezNasat::Interface::Dts::create(m_ddsConnector);
|
||||
bool bRet = m_ddsDts->enableNasatAircraft() &&
|
||||
m_ddsDts->enableNasatAircraftParticipant();
|
||||
INFO_LOG(m_logger) << "Dts initialised: " << bRet;
|
||||
INFO_LOG() << "Dts initialised: " << bRet;
|
||||
|
||||
|
||||
m_ddsFts = GuezNasat::Interface::Fts::create(m_ddsConnector);
|
||||
bRet &= m_ddsFts->enableAll();
|
||||
INFO_LOG(m_logger) << "Fts initialised: " << bRet;
|
||||
INFO_LOG() << "Fts initialised: " << bRet;
|
||||
|
||||
|
||||
m_exmDtc = ExerciseManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
bRet &= m_exmDtc->enableExercise();
|
||||
INFO_LOG(m_logger) << "EXM Dtc initialised: " << bRet;
|
||||
INFO_LOG() << "EXM Dtc initialised: " << bRet;
|
||||
|
||||
|
||||
m_pdmDtc = ProjectDataManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
bRet &= m_pdmDtc->enableChargeType();
|
||||
INFO_LOG(m_logger) << "PDM Dtc initialised: " << bRet;
|
||||
INFO_LOG() << "PDM Dtc initialised: " << bRet;
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ private:
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<GuezNasat::Interface::Dts> m_gnaDts;
|
||||
QSet<int> m_participantsToWatch;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
class DdsHandler final
|
||||
@@ -70,8 +69,6 @@ private:
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> m_aesFtc;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
||||
QHash<int, std::weak_ptr<Participant2Dds>> m_nasatParticipant2Dds;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -37,7 +37,6 @@ HandlerNasatAircraft::HandlerNasatAircraft(Initialization *mainHandler)
|
||||
, m_dts(mainHandler->dds()->dts())
|
||||
, m_fts(mainHandler->dds()->fts())
|
||||
, m_db(mainHandler->db())
|
||||
, m_logger(getLogger("HandlerNasatAircraft"))
|
||||
{}
|
||||
|
||||
HandlerNasatAircraft::~HandlerNasatAircraft()
|
||||
@@ -85,16 +84,16 @@ void HandlerNasatAircraft::flaFluSimulationChanged(int nasatId, bool bSimulation
|
||||
m_dts->publish(na);
|
||||
return;
|
||||
}
|
||||
WARNING_LOG(m_logger) << "Got a flaFluSimulationChanged information but aircraft with id " << nasatId << " is not available";
|
||||
WARNING_LOG() << "Got a flaFluSimulationChanged information but aircraft with id " << nasatId << " is not available";
|
||||
}
|
||||
|
||||
void HandlerNasatAircraft::onModifyNasatAircraftRequest(const rti::core::SampleIdentity &cookie,
|
||||
const NasatAircraft &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onModifyNasatAircraftRequest: " << request;
|
||||
DEBUG_LOG() << "onModifyNasatAircraftRequest: " << request;
|
||||
auto ret = request.id() > 0 ? modifyNasatAircraftRequest(request) : createNasatAircraftRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
WARNING_LOG() << ret();
|
||||
m_fts->modifyNasatAircraftReply(cookie, ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,5 @@ private:
|
||||
std::shared_ptr<GuezNasat::Interface::Fts> m_fts;
|
||||
std::shared_ptr<DatabaseInterface> m_db;
|
||||
QHash<int, NasatAircraft> m_nasatAircrafts;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
+31
-32
@@ -39,28 +39,27 @@ HandlerNasatAircraftParticipant::HandlerNasatAircraftParticipant(Initialization
|
||||
, m_dts(mainHandler->dds()->dts())
|
||||
, m_fts(mainHandler->dds()->fts())
|
||||
, m_db(mainHandler->db())
|
||||
, m_logger(getLogger("HandlerNasatAircraftParticipant"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
HandlerNasatAircraftParticipant::~HandlerNasatAircraftParticipant()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START";
|
||||
for (const auto &data : std::as_const(m_nasatAircraftParticipants))
|
||||
m_dts->removeNasatAircraftByKey(data.id());
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
bool HandlerNasatAircraftParticipant::init()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START";
|
||||
|
||||
auto cb = [this](const Database::NasatAircraftParticipant & data)
|
||||
{
|
||||
const auto dds(fromDb(data));
|
||||
DEBUG_LOG(m_logger) << "m_nasatAircraftParticipants.insert(" << dds.id() << ")";
|
||||
DEBUG_LOG() << "m_nasatAircraftParticipants.insert(" << dds.id() << ")";
|
||||
m_nasatAircraftParticipants.insert(dds.id(), dds);
|
||||
m_dts->publish(dds);
|
||||
m_mainHandler->handlerParticipant()->onNasatAircraftParticipantCreated(dds);
|
||||
@@ -86,16 +85,16 @@ bool HandlerNasatAircraftParticipant::init()
|
||||
dumpExercises();
|
||||
});
|
||||
|
||||
DEBUG_LOG(m_logger) << "HandlerNasatAircraftParticipant init done";
|
||||
DEBUG_LOG() << "HandlerNasatAircraftParticipant init done";
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START";
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandlerNasatAircraftParticipant::dumpNasatAircraftParticipants()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START, size=" << m_nasatAircraftParticipants.size();
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " --------------------------------------";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START, size=" << m_nasatAircraftParticipants.size();
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " --------------------------------------";
|
||||
|
||||
auto it = m_nasatAircraftParticipants.begin();
|
||||
while (it != m_nasatAircraftParticipants.end())
|
||||
@@ -103,17 +102,17 @@ void HandlerNasatAircraftParticipant::dumpNasatAircraftParticipants()
|
||||
const auto &id = it.key();
|
||||
const auto &nap = it.value();
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " id=" << id << " - nap=" << nap;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " id=" << id << " - nap=" << nap;
|
||||
++it;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " --------------------------------------";
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " END, size=" << m_nasatAircraftParticipants.size();
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " --------------------------------------";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " END, size=" << m_nasatAircraftParticipants.size();
|
||||
}
|
||||
|
||||
void HandlerNasatAircraftParticipant::dumpExercises()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START, size=" << m_exercises.size();
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " --------------------------------------";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START, size=" << m_exercises.size();
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " --------------------------------------";
|
||||
|
||||
auto it = m_exercises.begin();
|
||||
while (it != m_exercises.end())
|
||||
@@ -121,11 +120,11 @@ void HandlerNasatAircraftParticipant::dumpExercises()
|
||||
const auto &id = it.key();
|
||||
const auto &nasatAircraftParticipant = it.value();
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " id=" << id << " - nasatAircraftParticipant=" << nasatAircraftParticipant;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " id=" << id << " - nasatAircraftParticipant=" << nasatAircraftParticipant;
|
||||
++it;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " --------------------------------------";
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " END, size=" << m_exercises.size();
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " --------------------------------------";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " END, size=" << m_exercises.size();
|
||||
}
|
||||
|
||||
void HandlerNasatAircraftParticipant::aircraftRemoved(int nasatAircraftId)
|
||||
@@ -146,7 +145,7 @@ void HandlerNasatAircraftParticipant::aircraftRemoved(int nasatAircraftId)
|
||||
|
||||
void HandlerNasatAircraftParticipant::participantRemoved(int exerciseId, int participantId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "participantRemoved: " << exerciseId << ", " << participantId;
|
||||
DEBUG_LOG() << "participantRemoved: " << exerciseId << ", " << participantId;
|
||||
auto it = m_nasatAircraftParticipants.begin();
|
||||
while (it != m_nasatAircraftParticipants.end())
|
||||
{
|
||||
@@ -180,7 +179,7 @@ bool isExerciseStateValid(ExerciseManagement::ExerciseState_def::type state)
|
||||
|
||||
void HandlerNasatAircraftParticipant::onExerciseChanged(const ExerciseManagement::Exercise &exercise, DataModification modType)
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " START" << " , exercise" << exercise << " , modType" << modType;
|
||||
INFO_LOG() << Q_FUNC_INFO << " START" << " , exercise" << exercise << " , modType" << modType;
|
||||
|
||||
const int exId = exercise.id();
|
||||
switch (modType)
|
||||
@@ -191,10 +190,10 @@ void HandlerNasatAircraftParticipant::onExerciseChanged(const ExerciseManagement
|
||||
const bool valid = isExerciseStateValid(exercise.state().underlying());
|
||||
if (!valid)
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " STATE of exId=" << exId
|
||||
INFO_LOG() << Q_FUNC_INFO << " STATE of exId=" << exId
|
||||
<< " , state=" << exercise.state();
|
||||
int cnt = removeNapsOfExercise(exId);
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " STATE of exId=" << exId << " not valid : counter of removed naps=" << cnt;
|
||||
INFO_LOG() << Q_FUNC_INFO << " STATE of exId=" << exId << " not valid : counter of removed naps=" << cnt;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -206,11 +205,11 @@ void HandlerNasatAircraftParticipant::onExerciseChanged(const ExerciseManagement
|
||||
const bool valid = isExerciseStateValid(exercise.state().underlying());
|
||||
if (!valid)
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " STATE change of exId=" << exId
|
||||
INFO_LOG() << Q_FUNC_INFO << " STATE change of exId=" << exId
|
||||
<< " , old state=" << exerciseRef.state()
|
||||
<< " , new state=" << exercise.state();
|
||||
int cnt = removeNapsOfExercise(exId);
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " STATE change of exId=" << exId << " : counter of removed naps=" << cnt;
|
||||
INFO_LOG() << Q_FUNC_INFO << " STATE change of exId=" << exId << " : counter of removed naps=" << cnt;
|
||||
}
|
||||
}
|
||||
m_exercises[exId] = exercise;
|
||||
@@ -219,13 +218,13 @@ void HandlerNasatAircraftParticipant::onExerciseChanged(const ExerciseManagement
|
||||
case DataModification::eRemoved:
|
||||
{
|
||||
int cnt = removeNapsOfExercise(exId);
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " STATE change of Exercise, counter of removed naps=" << cnt;
|
||||
INFO_LOG() << Q_FUNC_INFO << " STATE change of Exercise, counter of removed naps=" << cnt;
|
||||
|
||||
m_exercises.remove(exId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END" << " , exercise" << exercise << " , modType" << modType;
|
||||
INFO_LOG() << Q_FUNC_INFO << " END" << " , exercise" << exercise << " , modType" << modType;
|
||||
}
|
||||
|
||||
void HandlerNasatAircraftParticipant::removeNasatAircraftParticipant(const NasatAircraftParticipant &val)
|
||||
@@ -239,10 +238,10 @@ void HandlerNasatAircraftParticipant::removeNasatAircraftParticipant(const Nasat
|
||||
void HandlerNasatAircraftParticipant::onModifyNasatAircraftParticipantRequest(const rti::core::SampleIdentity &cookie,
|
||||
const NasatAircraftParticipant &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onModifyNasatAircraftParticipantRequest: " << request;
|
||||
DEBUG_LOG() << "onModifyNasatAircraftParticipantRequest: " << request;
|
||||
auto ret = request.id() <= 0 ? createNasatAircraftParticipantRequest(request) : modifyNasatAircraftParticipantRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
WARNING_LOG() << ret();
|
||||
m_fts->modifyNasatAircraftParticipantReply(cookie, ret);
|
||||
}
|
||||
|
||||
@@ -300,7 +299,7 @@ Core::FunctionReplyObject HandlerNasatAircraftParticipant::modifyNasatAircraftPa
|
||||
|
||||
int HandlerNasatAircraftParticipant::removeNapsOfExercise(int exerciseId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START, exerciseId=" << exerciseId
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START, exerciseId=" << exerciseId
|
||||
<< ", m_nasatAircraftParticipants.size()" << m_nasatAircraftParticipants.size();
|
||||
int count = 0;
|
||||
QHash<int, NasatAircraftParticipant> napsCopy = m_nasatAircraftParticipants;
|
||||
@@ -309,7 +308,7 @@ int HandlerNasatAircraftParticipant::removeNapsOfExercise(int exerciseId)
|
||||
{
|
||||
if (nap.exerciseId() == exerciseId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " nap has to be removed: nap=" << nap;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " nap has to be removed: nap=" << nap;
|
||||
|
||||
NasatAircraftParticipant napToTriggerRemoving;
|
||||
napToTriggerRemoving.id(nap.id());
|
||||
@@ -320,7 +319,7 @@ int HandlerNasatAircraftParticipant::removeNapsOfExercise(int exerciseId)
|
||||
++count;
|
||||
}
|
||||
}
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " END, exerciseId=" << exerciseId
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " END, exerciseId=" << exerciseId
|
||||
<< ", m_nasatAircraftParticipants.size()" << m_nasatAircraftParticipants.size()
|
||||
<< ", counter=" << count;
|
||||
return count;
|
||||
|
||||
-2
@@ -55,7 +55,5 @@ private:
|
||||
std::shared_ptr<DatabaseInterface> m_db;
|
||||
QHash<int, NasatAircraftParticipant> m_nasatAircraftParticipants;
|
||||
QHash<int, ExerciseManagement::Exercise> m_exercises;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
@@ -22,21 +22,20 @@ namespace GuezNasat
|
||||
HandlerNasatImpact::HandlerNasatImpact(Initialization *mainHandler)
|
||||
: AreaEffectSimulation::Interface::Ftc::AirSupportImpactModifyReplyHandler()
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_logger(getLogger("HandlerNasatImpact"))
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
auto pdmDtc = m_mainHandler->dds()->pdmDtc();
|
||||
connect(pdmDtc.get(), &ProjectDataManagement::Interface::Dtc::chargeTypeChanged,
|
||||
this, &HandlerNasatImpact::onChargeTypeChanged);
|
||||
pdmDtc->chargeTypes([this](const ProjectDataManagement::ChargeType &ct) { onChargeTypeChanged(ct);});
|
||||
|
||||
#ifdef TRIGGER_DUMMY_IMPACT
|
||||
FATAL_LOG(m_logger) << LOGFUNCTION << " prepare singleShot...";
|
||||
FATAL_LOG(m_logger) << Q_FUNC_INFO << " prepare singleShot...";
|
||||
|
||||
QTimer *timer = new QTimer;
|
||||
timer->setInterval(30000);
|
||||
connect(timer, &QTimer::timeout, [this] () {
|
||||
FATAL_LOG(m_logger) << LOGFUNCTION << " singleShot...";
|
||||
FATAL_LOG(m_logger) << Q_FUNC_INFO << " singleShot...";
|
||||
|
||||
NasatWeaponRelease wr;
|
||||
wr.aircraftId = 1;
|
||||
@@ -54,38 +53,38 @@ HandlerNasatImpact::HandlerNasatImpact(Initialization *mainHandler)
|
||||
|
||||
this->nasatWeaponRelease(wr);
|
||||
|
||||
FATAL_LOG(m_logger) << LOGFUNCTION << " singleShot...DONE";
|
||||
FATAL_LOG(m_logger) << Q_FUNC_INFO << " singleShot...DONE";
|
||||
});
|
||||
timer->start();
|
||||
|
||||
#endif
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
void HandlerNasatImpact::onAirSupportImpactModifyReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
WARNING_LOG(m_logger) << "Could not create single explosion for nasat impact: " << reply();
|
||||
WARNING_LOG() << "Could not create single explosion for nasat impact: " << reply();
|
||||
|
||||
#ifdef NLDEVCTRL_844
|
||||
testing.replyCounter++;
|
||||
INFO_LOG(m_logger) << "Got create reply: " << reply() << "(id=" << reply.id() << ")"
|
||||
INFO_LOG() << "Got create reply: " << reply() << "(id=" << reply.id() << ")"
|
||||
<< ", this=" << this
|
||||
<< " - replyCounter=" << testing.replyCounter;
|
||||
#else
|
||||
INFO_LOG(m_logger) << "Got create reply: " << reply() << "(id=" << reply.id() << ")"
|
||||
INFO_LOG() << "Got create reply: " << reply() << "(id=" << reply.id() << ")"
|
||||
<< ", this=" << this;
|
||||
#endif
|
||||
}
|
||||
|
||||
void HandlerNasatImpact::onExplosionClusterModifyReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Got create reply: " << reply() << "(id=" << reply.id() << ")"
|
||||
INFO_LOG() << "Got create reply: " << reply() << "(id=" << reply.id() << ")"
|
||||
<< ", this=" << this
|
||||
<< ", reply.error()=" << reply.error();
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "onExplosionClusterModifyReply: Got reply: " << reply() << "(id=" << reply.id() << ")"
|
||||
ERROR_LOG() << "onExplosionClusterModifyReply: Got reply: " << reply() << "(id=" << reply.id() << ")"
|
||||
<< " '" << reply.translated() << "'";
|
||||
}
|
||||
|
||||
@@ -114,7 +113,7 @@ void HandlerNasatImpact::nasatImpact(int nasatId, const Core::GeoPosition &pos,
|
||||
return;
|
||||
#endif
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START, nasatId=" << nasatId
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START, nasatId=" << nasatId
|
||||
<< ", pos=" << pos
|
||||
<< ", flightTimeMsec = " << flightTimeMsec
|
||||
<< ", impactTimeMsec = " << impactTimeMsec;
|
||||
@@ -122,7 +121,7 @@ void HandlerNasatImpact::nasatImpact(int nasatId, const Core::GeoPosition &pos,
|
||||
const auto participants = m_mainHandler->handlerParticipant()->participantsForNasatId(nasatId);
|
||||
if (participants.isEmpty())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Can not find a valid participant for nasat aircraft with id " << nasatId;
|
||||
WARNING_LOG() << "Can not find a valid participant for nasat aircraft with id " << nasatId;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -146,7 +145,7 @@ void HandlerNasatImpact::nasatImpact(int nasatId, const Core::GeoPosition &pos,
|
||||
if (m_logger.isDebugEnabled())
|
||||
{
|
||||
const Core::GeoPosition &nasatPos = m_mainHandler->handlerParticipant()->nasatPosition(nasatId);
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START, nasatId=" << nasatId
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START, nasatId=" << nasatId
|
||||
<< ", pos=" << nasatPos
|
||||
<< ", flightTimeMsec = " << flightTimeMsec
|
||||
<< ", impactTimeMsec=" << impactTimeMsec;
|
||||
@@ -192,7 +191,7 @@ void HandlerNasatImpact::nasatImpact(int nasatId, const Core::GeoPosition &pos,
|
||||
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << " Sending air support impact: number of participant= " << participants.size();
|
||||
DEBUG_LOG() << " Sending air support impact: number of participant= " << participants.size();
|
||||
for (const NasatAircraftParticipantEx *nap : participants)
|
||||
{
|
||||
|
||||
@@ -206,17 +205,17 @@ void HandlerNasatImpact::nasatImpact(int nasatId, const Core::GeoPosition &pos,
|
||||
|
||||
int success = nap->publisher()->publish(ecCommonModifyRequest, this);
|
||||
if (success)
|
||||
DEBUG_LOG(m_logger) << "Sending air support impact create request: " << ecReq << " to exercise " << nap->exerciseId()
|
||||
DEBUG_LOG() << "Sending air support impact create request: " << ecReq << " to exercise " << nap->exerciseId()
|
||||
<< ", nap=" << nap->participant()
|
||||
<< " -> success = " << success;
|
||||
else
|
||||
ERROR_LOG(m_logger) << "Error on Sending air support impact create request: " << ecReq << " to exercise " << nap->exerciseId()
|
||||
ERROR_LOG() << "Error on Sending air support impact create request: " << ecReq << " to exercise " << nap->exerciseId()
|
||||
<< ", nap=" << nap->participant()
|
||||
<< " -> success = " << success;
|
||||
|
||||
#ifdef NLDEVCTRL_844
|
||||
testing.requestCounter++;
|
||||
INFO_LOG(m_logger) << " requestCounter = " << testing.requestCounter;
|
||||
INFO_LOG() << " requestCounter = " << testing.requestCounter;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -255,7 +254,7 @@ void HandlerNasatImpact::onChargeTypeChanged(const ProjectDataManagement::Charge
|
||||
int nasatId = obj.value(QLatin1String("nasatId")).toInt();
|
||||
if (nasatId == 0)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Found charge with an invalid property 'nasatId', id: " << ct.id();
|
||||
WARNING_LOG() << "Found charge with an invalid property 'nasatId', id: " << ct.id();
|
||||
return;
|
||||
}
|
||||
m_chargeMapping.insert(nasatId, ct.id());
|
||||
@@ -267,7 +266,7 @@ int HandlerNasatImpact::chargeTypeFromMunitionCode(int nasatChargeCode) const
|
||||
auto it = m_chargeMapping.find(nasatChargeCode);
|
||||
if (it != m_chargeMapping.end())
|
||||
return it.value();
|
||||
WARNING_LOG(m_logger) << "Got unmapped nasat charge code " << nasatChargeCode;
|
||||
WARNING_LOG() << "Got unmapped nasat charge code " << nasatChargeCode;
|
||||
Q_ASSERT(false);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -34,10 +34,7 @@ private:
|
||||
int fuseTypeToPdmIgniterType(FuseType fusetype) const;
|
||||
private:
|
||||
Initialization *m_mainHandler;
|
||||
QHash<int, int> m_chargeMapping;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
|
||||
QHash<int, int> m_chargeMapping;
|
||||
#ifdef NLDEVCTRL_844
|
||||
struct ForTesting
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace GuezNasat
|
||||
{
|
||||
HandlerNasatNineLiner::HandlerNasatNineLiner(Initialization *mainHandler)
|
||||
: m_mainHandler(mainHandler)
|
||||
, m_logger(getLogger("HandlerNasatNineLiner"))
|
||||
{}
|
||||
|
||||
bool HandlerNasatNineLiner::init() const
|
||||
@@ -26,7 +25,7 @@ bool HandlerNasatNineLiner::init() const
|
||||
connect(m_mainHandler->handlerParticipant().get(), &HandlerParticipant::nasatAircraftParticipantRemoved,
|
||||
this, &HandlerNasatNineLiner::onNasatAircraftParticipantRemoved, Qt::DirectConnection);
|
||||
|
||||
DEBUG_LOG(m_logger) << "HandlerNasatNineLiner init done";
|
||||
DEBUG_LOG() << "HandlerNasatNineLiner init done";
|
||||
|
||||
|
||||
return true;
|
||||
@@ -109,18 +108,18 @@ static Nasat9Liner createDds9Liner(const NasatNineLiner &nasatNineLiner)
|
||||
void HandlerNasatNineLiner::nineLinerReceived(const NasatNineLiner &nasatNineLiner)
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "nineLinerReceived, aircraftId=" << nasatNineLiner.aircraftId
|
||||
DEBUG_LOG() << "nineLinerReceived, aircraftId=" << nasatNineLiner.aircraftId
|
||||
<< " - nasatNineLiner.aircraftId is aka nasatId";
|
||||
|
||||
const auto participants = m_mainHandler->handlerParticipant()->participantsForNasatId(nasatNineLiner.aircraftId);
|
||||
if (participants.isEmpty())
|
||||
{
|
||||
INFO_LOG(m_logger) << "No exercise participants found to publish 9-liner for nasat aircraft with id "
|
||||
INFO_LOG() << "No exercise participants found to publish 9-liner for nasat aircraft with id "
|
||||
<< nasatNineLiner.aircraftId;
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "nineLinerReceived, publishing to exercises";
|
||||
DEBUG_LOG() << "nineLinerReceived, publishing to exercises";
|
||||
|
||||
static int s_id = 1;
|
||||
Nasat9Liner nl = createDds9Liner(nasatNineLiner);
|
||||
@@ -130,7 +129,7 @@ void HandlerNasatNineLiner::nineLinerReceived(const NasatNineLiner &nasatNineLin
|
||||
const auto &exerciseParticipantId = it.key();
|
||||
auto nape = it.value();
|
||||
|
||||
DEBUG_LOG(m_logger) << "nineLinerReceived, publishing to exercises, s_id=" << s_id
|
||||
DEBUG_LOG() << "nineLinerReceived, publishing to exercises, s_id=" << s_id
|
||||
<< ", exerciseParticipantId.exerciseId=" << exerciseParticipantId.exerciseId
|
||||
<< ", exerciseParticipantId.participantId=" << exerciseParticipantId.participantId;
|
||||
|
||||
@@ -172,17 +171,17 @@ void HandlerNasatNineLiner::onNasatAircraftParticipantRemoved(const NasatAircraf
|
||||
|
||||
|
||||
const int nasatId = m_mainHandler->nasatAircraft()->nasatIdFromNasatAircraftId(nap.nasatAircraftId());
|
||||
INFO_LOG(m_logger) << " onNasatAircraftParticipantRemoved, nap = " << nap << ", nasatId = " << nasatId;
|
||||
INFO_LOG() << " onNasatAircraftParticipantRemoved, nap = " << nap << ", nasatId = " << nasatId;
|
||||
if (nasatId < 0)
|
||||
{
|
||||
WARNING_LOG(m_logger) << " nasatIdFromNasatAircraftId failed, nap=" << nap;
|
||||
WARNING_LOG() << " nasatIdFromNasatAircraftId failed, nap=" << nap;
|
||||
return;
|
||||
}
|
||||
|
||||
const auto participants = m_mainHandler->handlerParticipant()->participantsForNasatId(nasatId);
|
||||
if (participants.isEmpty())
|
||||
{
|
||||
INFO_LOG(m_logger) << "No exercise participants found to publish 9-liner for nasat aircraft with id "
|
||||
INFO_LOG() << "No exercise participants found to publish 9-liner for nasat aircraft with id "
|
||||
<< nap.nasatAircraftId();
|
||||
return;
|
||||
}
|
||||
@@ -193,7 +192,7 @@ void HandlerNasatNineLiner::onNasatAircraftParticipantRemoved(const NasatAircraf
|
||||
auto nape = it.value();
|
||||
auto &nineLinerParticipant = m_nineLiner[exerciseParticipantId];
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " updating for removing "
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " updating for removing "
|
||||
<< ", exerciseParticipantId.exerciseId=" << exerciseParticipantId.exerciseId
|
||||
<< ", exerciseParticipantId.participantId=" << exerciseParticipantId.participantId
|
||||
<< ", nineLinerParticipant.isEmpty()=" << nineLinerParticipant.isEmpty();
|
||||
@@ -203,7 +202,7 @@ void HandlerNasatNineLiner::onNasatAircraftParticipantRemoved(const NasatAircraf
|
||||
auto &oldLast = nineLinerParticipant.last();
|
||||
if (oldLast.isCurrent())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " updating for removing "
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " updating for removing "
|
||||
<< ", exerciseParticipantId.exerciseId=" << exerciseParticipantId.exerciseId
|
||||
<< ", exerciseParticipantId.participantId=" << exerciseParticipantId.participantId;
|
||||
oldLast.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
|
||||
@@ -28,6 +28,5 @@ public Q_SLOTS:
|
||||
private:
|
||||
QHash<ExerciseParticipantKey, QVector<Nasat9Liner>> m_nineLiner;
|
||||
Initialization *m_mainHandler;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
@@ -20,25 +20,24 @@ namespace GuezNasat
|
||||
NasatAircraftParticipantEx::NasatAircraftParticipantEx()
|
||||
: m_logger(getLogger("NasatAircraftParticipantEx"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
NasatAircraftParticipantEx::NasatAircraftParticipantEx(const NasatAircraftParticipant &nap, const std::shared_ptr<Participant2Dds> &publisher)
|
||||
: m_nap(nap)
|
||||
, m_publisher(publisher)
|
||||
, m_logger(getLogger("NasatAircraftParticipantEx"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START";
|
||||
m_publisher->addParticipantToWatch(m_nap.participantId());
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
NasatAircraftParticipantEx::~NasatAircraftParticipantEx()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START";
|
||||
m_publisher->removeParticipantToWatch(m_nap.participantId());
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
int NasatAircraftParticipantEx::partyId() const
|
||||
@@ -52,7 +51,6 @@ int NasatAircraftParticipantEx::partyId() const
|
||||
|
||||
HandlerParticipant::HandlerParticipant(Initialization *mainHandler)
|
||||
: m_mainHandler(mainHandler)
|
||||
, m_logger(getLogger("ParticipantPositionPublisher"))
|
||||
{}
|
||||
|
||||
HandlerParticipant::~HandlerParticipant()
|
||||
@@ -84,23 +82,23 @@ void HandlerParticipant::onNasatAircraftParticipantRemoved(const NasatAircraftPa
|
||||
auto it = m_activePublisher.find(nasatId);
|
||||
if (it == m_activePublisher.end())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "No publisher for NasatAircraftParticipant " << nasatId << "(" << nap.nasatAircraftId() << ") found !?";
|
||||
WARNING_LOG() << "No publisher for NasatAircraftParticipant " << nasatId << "(" << nap.nasatAircraftId() << ") found !?";
|
||||
return;
|
||||
}
|
||||
auto itParticipants = it.value().find(ExerciseParticipantKey(nap.exerciseId(), nap.participantId()));
|
||||
if (itParticipants == it.value().end())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "No participant entry for NasatAircraftParticipant " << nasatId << "("
|
||||
WARNING_LOG() << "No participant entry for NasatAircraftParticipant " << nasatId << "("
|
||||
<< nap.exerciseId() << "," << nap.participantId() << ") found !?";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << " emit nasatAircraftParticipantRemoved, nap = " << nap;
|
||||
DEBUG_LOG() << " emit nasatAircraftParticipantRemoved, nap = " << nap;
|
||||
emit nasatAircraftParticipantRemoved(nap);
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << "Remove position publisher for " << nap;
|
||||
DEBUG_LOG() << "Remove position publisher for " << nap;
|
||||
|
||||
|
||||
NasatAircraftParticipantEx* napeCopy= itParticipants.value();
|
||||
@@ -121,11 +119,11 @@ void HandlerParticipant::onNasatAircraftParticipantRemoved(const NasatAircraftPa
|
||||
|
||||
Core::GeoPosition HandlerParticipant::nasatPosition(int nasatId) const
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START, nasatId=" << nasatId;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START, nasatId=" << nasatId;
|
||||
auto it = m_lastNasatPositionsAsCoreGeoposition.find(nasatId);
|
||||
if (it == m_lastNasatPositionsAsCoreGeoposition.end())
|
||||
{
|
||||
INFO_LOG(m_logger) << "No NasatPosition for nasat id " << nasatId << " found";
|
||||
INFO_LOG() << "No NasatPosition for nasat id " << nasatId << " found";
|
||||
return {};
|
||||
}
|
||||
return *it;
|
||||
@@ -133,7 +131,7 @@ Core::GeoPosition HandlerParticipant::nasatPosition(int nasatId) const
|
||||
|
||||
void HandlerParticipant::onNasatPosition(const NasatPosition &position)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START, position.aircraftId=" << position.aircraftId;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START, position.aircraftId=" << position.aircraftId;
|
||||
const Core::GeoPosition geoPos(position.position.lon * LtsCoordTrans::deg2rad(),
|
||||
position.position.lat * LtsCoordTrans::deg2rad(),
|
||||
position.position.height);
|
||||
@@ -146,11 +144,11 @@ void HandlerParticipant::onNasatPosition(const NasatPosition &position)
|
||||
|
||||
void HandlerParticipant::onNasatAircraftPosition(int nasatId, const Core::GeoPosition &pos, qint64 ts)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START, nasatId=" << nasatId;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START, nasatId=" << nasatId;
|
||||
auto it = m_activePublisher.find(nasatId);
|
||||
if (it == m_activePublisher.end())
|
||||
{
|
||||
INFO_LOG(m_logger) << "No position publisher for nasat id " << nasatId << " found - ignoring " << m_activePublisher.size();
|
||||
INFO_LOG() << "No position publisher for nasat id " << nasatId << " found - ignoring " << m_activePublisher.size();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -163,11 +161,11 @@ void HandlerParticipant::onNasatAircraftPosition(int nasatId, const Core::GeoPos
|
||||
tabPos.equipmentNumber(-napEx->participantId());
|
||||
int success = napEx->publisher()->publish(tabPos);
|
||||
if (success)
|
||||
DEBUG_LOG(m_logger) << "Publishing positon: " << tabPos << " to exercise " << napEx->exerciseId()
|
||||
DEBUG_LOG() << "Publishing positon: " << tabPos << " to exercise " << napEx->exerciseId()
|
||||
<< ", napEx: " << napEx->participant()
|
||||
<< " -> success = " << success;
|
||||
else
|
||||
ERROR_LOG(m_logger) << "Error on Publishing positon: " << tabPos << " to exercise " << napEx->exerciseId()
|
||||
ERROR_LOG() << "Error on Publishing positon: " << tabPos << " to exercise " << napEx->exerciseId()
|
||||
<< ", napEx: " << napEx->participant()
|
||||
<< " -> success = " << success;
|
||||
|
||||
@@ -182,7 +180,7 @@ void HandlerParticipant::onNasatIdChanged(int oldNasatId, int newNasatId)
|
||||
|
||||
void HandlerParticipant::createNasatAircraftParticipant(const NasatAircraftParticipant &nap, int nasatId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Creating position publisher for " << nap
|
||||
DEBUG_LOG() << "Creating position publisher for " << nap
|
||||
<< ", nasatId=" << nasatId;
|
||||
auto *napEx = new NasatAircraftParticipantEx(nap,
|
||||
m_mainHandler->dds()->ddsParticipant(nap.exerciseId()));
|
||||
|
||||
@@ -33,7 +33,6 @@ struct NasatAircraftParticipantEx final
|
||||
private:
|
||||
NasatAircraftParticipant m_nap;
|
||||
std::shared_ptr<Participant2Dds> m_publisher;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
struct ExerciseParticipantKey
|
||||
@@ -87,6 +86,5 @@ private:
|
||||
|
||||
QHash<int, Core::GeoPosition> m_lastNasatPositionsAsCoreGeoposition;
|
||||
Initialization *m_mainHandler;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
@@ -43,13 +43,13 @@ Initialization::~Initialization()
|
||||
bool Initialization::initialize(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector,
|
||||
const QSqlDatabase &)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Start GuezNasat Initialization.";
|
||||
INFO_LOG() << "Start GuezNasat Initialization.";
|
||||
|
||||
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(ddsConnector);
|
||||
if (!m_ddsHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation DdsHandler failed.";
|
||||
ERROR_LOG() << "Initialisation DdsHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ bool Initialization::initialize(const std::shared_ptr<DDSConnector::DdsConnector
|
||||
if (!m_dbHandler->init(ddsConnector->getPartitionId(), Settings::settings()))
|
||||
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation DbHandler failed.";
|
||||
ERROR_LOG() << "Initialisation DbHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -80,16 +80,16 @@ bool Initialization::initialize(const std::shared_ptr<DDSConnector::DdsConnector
|
||||
|
||||
if (Settings::useWebSocket())
|
||||
{
|
||||
INFO_LOG(m_logger) << "Using WebSocket";
|
||||
INFO_LOG() << "Using WebSocket";
|
||||
m_jsonSocketHandler.reset(new WebSocketHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG(m_logger) << "Using TcpSocket";
|
||||
INFO_LOG() << "Using TcpSocket";
|
||||
m_jsonSocketHandler.reset(new TcpSocketHandler);
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "GuezNasat Initialization initialized";
|
||||
INFO_LOG() << "GuezNasat Initialization initialized";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ bool Initialization::initialize(const std::shared_ptr<DDSConnector::DdsConnector
|
||||
|
||||
bool Initialization::loadFromDatabase()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << "START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << "START";
|
||||
|
||||
if (!m_ddsHandler ||
|
||||
!m_dbHandler ||
|
||||
@@ -111,27 +111,27 @@ bool Initialization::loadFromDatabase()
|
||||
|
||||
if (!m_handlerNasatAircraft->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerNasatAircraft failed.";
|
||||
ERROR_LOG() << "Initialisation HandlerNasatAircraft failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_handlerNasatAircraftParticipant->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerNasatAircraftParticipant failed.";
|
||||
ERROR_LOG() << "Initialisation HandlerNasatAircraftParticipant failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_handlerNasatImpact->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerNasatImpact failed.";
|
||||
ERROR_LOG() << "Initialisation HandlerNasatImpact failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_handlerNasatNineLiner->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerNasatNineLiner failed.";
|
||||
ERROR_LOG() << "Initialisation HandlerNasatNineLiner failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_handlerParticipant->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation ParticipantPositionPublisher failed.";
|
||||
ERROR_LOG() << "Initialisation ParticipantPositionPublisher failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -147,13 +147,13 @@ bool Initialization::loadFromDatabase()
|
||||
NOTICE_LOG(m_logger) << "Initialisation SocketHandler ....";
|
||||
if (!m_jsonSocketHandler->init(Settings::socketListenPort()))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation WebSocketHandler failed.";
|
||||
ERROR_LOG() << "Initialisation WebSocketHandler failed.";
|
||||
}
|
||||
});
|
||||
#else
|
||||
if (!m_jsonSocketHandler->init(Settings::socketListenPort()))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation WebSocketHandler failed.";
|
||||
ERROR_LOG() << "Initialisation WebSocketHandler failed.";
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -171,7 +171,7 @@ bool Initialization::loadFromDatabase()
|
||||
QObject::connect(m_jsonSocketHandler.get(), &AbstractSocketHandler::nineLinerReceived,
|
||||
m_handlerNasatNineLiner.get(), &HandlerNasatNineLiner::nineLinerReceived);
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << "END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << "END";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <ngldb/db_service_handler.h>
|
||||
#include <GuezNasat/gna_export.h>
|
||||
#include "svcgnaserver_export.h"
|
||||
#include <GuezNasat/logger.h>
|
||||
|
||||
class QSqlDatabase;
|
||||
@@ -46,8 +46,5 @@ private:
|
||||
std::shared_ptr<HandlerNasatNineLiner> m_handlerNasatNineLiner;
|
||||
std::shared_ptr<HandlerParticipant> m_handlerParticipant;
|
||||
std::shared_ptr<AbstractSocketHandler> m_jsonSocketHandler;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include "gna_export.h"
|
||||
#include "svcgnacommon_export.h"
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
#include <QPointF>
|
||||
#include <QString>
|
||||
#include <GuezNasat/gna_export.h>
|
||||
#include "svcgnaserver_export.h"
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user