Adds immediate migration results in progress

This commit is contained in:
torsten committed 2026-08-19 11:18:24 +02:00
1 parent 8453e104c5
commit 3bb6e89496
2102 files changed
+17482 -15071

No files matched your search

@@ -11,9 +11,8 @@
namespace OcSituationServer
{
CentralAesDataQueue::CentralAesDataQueue(QObject *parent)
: QObject(parent)
{
CentralAesDataQueue::CentralAesDataQueue(QObject *parent) : QObject(parent),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
}
@@ -35,7 +34,7 @@ void CentralAesDataQueue::addRemoveMessage(int32_t aesItemId, AreaEffectSimulati
else
m_internalQueue.prepend({aesItemId, OcSituation::Remove, data});
DEBUG_LOG() << "New remove-message added: Id = " << aesItemId
DEBUG_LOG(m_logger) << "New remove-message added: Id = " << aesItemId
<< ", aesType = " << aesType << ". "
<< m_internalQueue.size() << " normal, "
<< m_internalPrioritizedQueue.size() << " prioritized and "
@@ -114,7 +113,7 @@ QByteArray CentralAesDataQueue::getSendingData(qint32 size)
++messageCounter;
WARNING_LOG() << "Could not build data with max size of " << size << " bytes. Delivering data with " << result.size() << " bytes.";
WARNING_LOG(m_logger) << "Could not build data with max size of " << size << " bytes. Delivering data with " << result.size() << " bytes.";
}
while (!m_internalQueue.isEmpty() && ((result.size() + m_internalQueue.head().data.size()) <= size))
@@ -131,11 +130,11 @@ QByteArray CentralAesDataQueue::getSendingData(qint32 size)
++messageCounter;
WARNING_LOG() << "Could not build data with max size of " << size << " bytes. Delivering data with " << result.size() << " bytes.";
WARNING_LOG(m_logger) << "Could not build data with max size of " << size << " bytes. Delivering data with " << result.size() << " bytes.";
}
DEBUG_LOG() << "Data with max size = " << size << "requestet. " << result.size() << " bytes delivered.";
DEBUG_LOG() << messageCounter << " messages are sent. "
DEBUG_LOG(m_logger) << "Data with max size = " << size << "requestet. " << result.size() << " bytes delivered.";
DEBUG_LOG(m_logger) << messageCounter << " messages are sent. "
<< m_internalQueue.size() << " normal, "
<< m_internalPrioritizedQueue.size() << " prioritized and "
<< m_internalQueue.size() + m_internalPrioritizedQueue.size() << " remaining messages in total.";
@@ -162,7 +161,7 @@ void CentralAesDataQueue::clearSpecificMessage(int32_t aesItemId, OcSituation::C
{
m_internalQueue.removeAt(counter);
DEBUG_LOG() << "Removed already existing message. aesItemId = " << aesItemId << ", changeType = " << changeType;
DEBUG_LOG(m_logger) << "Removed already existing message. aesItemId = " << aesItemId << ", changeType = " << changeType;
return;
}
@@ -174,7 +173,7 @@ void CentralAesDataQueue::clearSpecificMessage(int32_t aesItemId, OcSituation::C
{
m_internalPrioritizedQueue.removeAt(counter);
DEBUG_LOG() << "Removed already existing message. aesItemId = " << aesItemId << ", changeType = " << changeType;
DEBUG_LOG(m_logger) << "Removed already existing message. aesItemId = " << aesItemId << ", changeType = " << changeType;
return;
}
@@ -16,14 +16,14 @@ namespace OcSituationServer
DdsHandler::DdsHandler(int domainId, int exerciseId)
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Exercise, exerciseId))
{
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
}
bool DdsHandler::init(const QStringList &qosFileList)
{
if (!m_ddsConnector->init(qosFileList))
{
ERROR_LOG() << "Error initializing dds connections - aborting";
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
return false;
}
@@ -42,10 +42,10 @@ bool DdsHandler::init(const QStringList &qosFileList)
m_ddsFts = OcSituationServer::Interface::Fts::create(m_ddsConnector);
bRet &= m_ddsDts->enableAll();
INFO_LOG() << "Dts initialised";
INFO_LOG(m_logger) << "Dts initialised";
bRet &= m_ddsFts->enableAll();
INFO_LOG() << "Fts initialised";
INFO_LOG(m_logger) << "Fts initialised";
return bRet;
}
@@ -39,6 +39,7 @@ public:
Q_SIGNALS:
void partitionTimeChanged(qint64 partitionTime);
private:
NGL::INGLLogger &m_logger;
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<Core::Pacemaker> m_pacemaker;
std::shared_ptr<Core::Interface::Dtc> m_dtcCore;
@@ -57,7 +57,7 @@ bool HandlerOcAesData::init()
// read all Ieds from database
if (!m_dbHandler->select(dataVec))
{
ERROR_LOG() << "Error reading reset counter from database!";
ERROR_LOG(m_logger) << "Error reading reset counter from database!";
return false;
}
@@ -77,7 +77,7 @@ bool HandlerOcAesData::init()
}
default:
{
WARNING_LOG() << "Reset counter for aes type: " << data.aesTypeId << " read from db is not handled.";
WARNING_LOG(m_logger) << "Reset counter for aes type: " << data.aesTypeId << " read from db is not handled.";
break;
}
}
@@ -86,7 +86,7 @@ bool HandlerOcAesData::init()
// AES DTC enable
if (!m_aesDtc->enableDangerArea())
{
ERROR_LOG() << "Enabling AES Data-Topics failed.";
ERROR_LOG(m_logger) << "Enabling AES Data-Topics failed.";
return false;
}
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::dangerAreaChanged, this, &HandlerOcAesData::onDangerAreaChanged);
@@ -95,7 +95,7 @@ bool HandlerOcAesData::init()
if (!m_gimDtc->enableIed() ||
!m_gimDtc->enableIedPosition())
{
ERROR_LOG() << "Enabling GIM Data-Topics failed.";
ERROR_LOG(m_logger) << "Enabling GIM Data-Topics failed.";
return false;
}
connect(m_gimDtc.get(), &GuezIedManagement::Interface::Dtc::iedChanged, this, &HandlerOcAesData::onIedChanged);
@@ -103,7 +103,7 @@ bool HandlerOcAesData::init()
connect(m_iedPositionCycleTimer, &QTimer::timeout, this, &HandlerOcAesData::sendIedPositions);
m_iedPositionCycleTimer->setInterval(Settings::iedPositionCycleTime());
DEBUG_LOG() << "Starting ied position timer with interval: " << m_iedPositionCycleTimer->interval();
DEBUG_LOG(m_logger) << "Starting ied position timer with interval: " << m_iedPositionCycleTimer->interval();
m_iedPositionCycleTimer->start();
return true;
@@ -116,7 +116,7 @@ void HandlerOcAesData::demandAesItems(OcSituation::AesType aesType, int eqNumber
case OcSituation::AesType::DangerArea:
case OcSituation::AesType::Ied:
{
DEBUG_LOG() << "Got demand for aes type: " << aesType << " from equipment: " << eqNumber;
DEBUG_LOG(m_logger) << "Got demand for aes type: " << aesType << " from equipment: " << eqNumber;
if (!m_collectionTimer[aesType]->isActive())
m_collectionTimer[aesType]->start();
@@ -126,7 +126,7 @@ void HandlerOcAesData::demandAesItems(OcSituation::AesType aesType, int eqNumber
}
default:
{
WARNING_LOG() << "Aes type: " << aesType << " is currently not handled.";
WARNING_LOG(m_logger) << "Aes type: " << aesType << " is currently not handled.";
}
}
}
@@ -134,9 +134,9 @@ void HandlerOcAesData::demandAesItems(OcSituation::AesType aesType, int eqNumber
void HandlerOcAesData::onSendOcDataReply(const Core::FunctionReplyObject &reply)
{
if (reply.error())
ERROR_LOG() << "Oc data could not be send: " << reply.translated();
ERROR_LOG(m_logger) << "Oc data could not be send: " << reply.translated();
else
DEBUG_LOG() << "Oc data send successfully to TAB!";
DEBUG_LOG(m_logger) << "Oc data send successfully to TAB!";
}
void HandlerOcAesData::onDangerAreaChanged(const AreaEffectSimulation::DangerArea &data, DataModification mod)
@@ -165,7 +165,7 @@ void HandlerOcAesData::onIedPositionChanged(const GuezIedManagement::IedPosition
m_iedPositionsToBeSend.insert(data.id(), data);
}
else
ERROR_LOG() << "Got ied position for not existing ID: " << data.id();
ERROR_LOG(m_logger) << "Got ied position for not existing ID: " << data.id();
}
void HandlerOcAesData::onCollectionTimeOutDemandDangerAreas()
@@ -184,7 +184,7 @@ void HandlerOcAesData::sendIedPositions()
{
if (m_iedPositionsToBeSend.size() == 0)
{
DEBUG_LOG() << "No new ied positions to be send.";
DEBUG_LOG(m_logger) << "No new ied positions to be send.";
return;
}
@@ -209,14 +209,14 @@ void HandlerOcAesData::sendIedPositions()
data[1] = ++cnt;
QByteArray ba = qCompress(data);
DEBUG_LOG() << "Added ied position " << pos
DEBUG_LOG(m_logger) << "Added ied position " << pos
<< " data size: " << data.size()
<< " compressed size: " << ba.size();
if (ba.size() > Settings::maxNumOfBytePerAesTxCycle()) // one cycle is full -> send
{
DEBUG_LOG() << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG() << "Compressed Data: " << ba.toHex(' ');
DEBUG_LOG(m_logger) << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG(m_logger) << "Compressed Data: " << ba.toHex(' ');
payload.append(ba);
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
m_tabFtc->sendOcDataRequest(req, this);
@@ -234,8 +234,8 @@ void HandlerOcAesData::sendIedPositions()
if (cnt > 0) // is still data to be send?
{
DEBUG_LOG() << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG() << "Compressed Data: " << qCompress(data).toHex(' ');
DEBUG_LOG(m_logger) << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG(m_logger) << "Compressed Data: " << qCompress(data).toHex(' ');
payload.append(qCompress(data));
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
m_tabFtc->sendOcDataRequest(req, this);
@@ -246,7 +246,7 @@ void HandlerOcAesData::sendIedPositions()
void HandlerOcAesData::collectionTimeout(OcSituation::AesType type, const std::function<void (int)> &sendFunction)
{
DEBUG_LOG() << "There are " << m_demandingEquipments[type].size() << " requests for aes type: " << type
DEBUG_LOG(m_logger) << "There are " << m_demandingEquipments[type].size() << " requests for aes type: " << type
<< " sending Items as " << ((m_demandingEquipments[type].size() > 5) ? QStringLiteral("broadcast") : QStringLiteral("direct")) << " telegram(s)";
if (m_demandingEquipments[type].size() > 5)
@@ -296,13 +296,13 @@ void HandlerOcAesData::sendDangerAreasToTab(int eqNumber)
data[1] = ++cnt;
QByteArray ba = qCompress(data);
DEBUG_LOG() << "Added danger area " << dangerArea
DEBUG_LOG(m_logger) << "Added danger area " << dangerArea
<< " data size: " << data.size()
<< " compressed size: " << ba.size();
if (ba.size() > Settings::maxNumOfBytePerAesTxCycle()) // one cycle is full -> send
{
DEBUG_LOG() << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG() << "Compressed Data: " << ba.toHex(' ');
DEBUG_LOG(m_logger) << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG(m_logger) << "Compressed Data: " << ba.toHex(' ');
payload.append(ba);
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
m_tabFtc->sendOcDataRequest(req, this);
@@ -321,8 +321,8 @@ void HandlerOcAesData::sendDangerAreasToTab(int eqNumber)
if (cnt > 0) // is still data to be send?
{
DEBUG_LOG() << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG() << "Compressed Data: " << qCompress(data).toHex(' ');
DEBUG_LOG(m_logger) << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG(m_logger) << "Compressed Data: " << qCompress(data).toHex(' ');
payload.append(qCompress(data));
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
m_tabFtc->sendOcDataRequest(req, this);
@@ -365,14 +365,14 @@ void HandlerOcAesData::sendIedsToTab(int eqNumber)
data[1] = ++cnt;
QByteArray ba = qCompress(data);
DEBUG_LOG() << "Added ied " << ied
DEBUG_LOG(m_logger) << "Added ied " << ied
<< " data size: " << data.size()
<< " compressed size: " << ba.size();
if (ba.size() > Settings::maxNumOfBytePerAesTxCycle()) // one cycle is full -> send
{
DEBUG_LOG() << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG() << "Compressed Data: " << ba.toHex(' ');
DEBUG_LOG(m_logger) << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG(m_logger) << "Compressed Data: " << ba.toHex(' ');
payload.append(ba);
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
m_tabFtc->sendOcDataRequest(req, this);
@@ -390,8 +390,8 @@ void HandlerOcAesData::sendIedsToTab(int eqNumber)
if (cnt > 0) // is still data to be send?
{
DEBUG_LOG() << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG() << "Compressed Data: " << qCompress(data).toHex(' ');
DEBUG_LOG(m_logger) << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG(m_logger) << "Compressed Data: " << qCompress(data).toHex(' ');
payload.append(qCompress(data));
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
m_tabFtc->sendOcDataRequest(req, this);
@@ -414,7 +414,7 @@ void HandlerOcAesData::incrementResetCnt(OcSituation::AesType aesType)
}
default:
{
WARNING_LOG() << "Reset counter for aes type: " << aesType << " is not handled in incrementResetCnt.";
WARNING_LOG(m_logger) << "Reset counter for aes type: " << aesType << " is not handled in incrementResetCnt.";
break;
}
}
@@ -440,14 +440,14 @@ void HandlerOcAesData::setResetCnt(OcSituation::AesType aesType, int resetCnt)
}
default:
{
WARNING_LOG() << "Reset counter for aes type: " << aesType << " is not handled in setResetCnt.";
WARNING_LOG(m_logger) << "Reset counter for aes type: " << aesType << " is not handled in setResetCnt.";
break;
}
}
// update db
if (!m_dbHandler->update(data))
ERROR_LOG() << "Error updating reset counter in db.";
ERROR_LOG(m_logger) << "Error updating reset counter in db.";
}
} // namespace OcSituationServer
@@ -43,7 +43,7 @@ void ThreadOcCentralAesData::requestOcCentralAesData(OcSituation::SituationCente
int radius,
bool initial)
{
INFO_LOG() << "OC-Situation Request for centerEquipmentId: " << centerEquipmentId
INFO_LOG(m_logger) << "OC-Situation Request for centerEquipmentId: " << centerEquipmentId
<< " from O/C-laptop-Id: " << m_equipmentId
<< " with radius of " << radius
<< "m, initial: " << initial;
@@ -58,7 +58,7 @@ void ThreadOcCentralAesData::requestOcCentralAesData(OcSituation::SituationCente
if (m_handler)
m_handler->setRequestCentralAesData(centerType, centerEquipmentId, position, radius, initial);
else
DEBUG_LOG() << "Thread doesn't exist up to now! Do nothing.";
DEBUG_LOG(m_logger) << "Thread doesn't exist up to now! Do nothing.";
}
void ThreadOcCentralAesData::run()
@@ -67,7 +67,7 @@ void ThreadOcCentralAesData::run()
{
QMutexLocker l(&m_accessMutex);
QMutexLocker m(&s_ddsAccesMutex);
DEBUG_LOG() << "Instance new OC-Thread for O/C-Laptop-Id: " << m_equipmentId;
DEBUG_LOG(m_logger) << "Instance new OC-Thread for O/C-Laptop-Id: " << m_equipmentId;
m_handler = new HandlerOcCentralAesData(m_mainHandler->dds(),
m_baseCoordinate,
@@ -77,7 +77,7 @@ void ThreadOcCentralAesData::run()
m_handler->setRequestCentralAesData(m_centerType, m_centerEquipmentId, m_position, m_radius, true);
}
INFO_LOG() << "OC-Thread started for O/C-Laptop-Id: " << m_equipmentId;
INFO_LOG(m_logger) << "OC-Thread started for O/C-Laptop-Id: " << m_equipmentId;
exec();
{
@@ -104,7 +104,7 @@ HandlerOcCentralAesData::HandlerOcCentralAesData(const std::shared_ptr<DdsHandle
, m_dataQueue(new CentralAesDataQueue(this))
, m_logger(getLogger(QStringLiteral("HandlerOcCentralAesData.") + QString::number(equipmentId)))
{
INFO_LOG() << "Create O/C-CentralAesHandler for O/C-Laptop-Id: " << equipmentId
INFO_LOG(m_logger) << "Create O/C-CentralAesHandler for O/C-Laptop-Id: " << equipmentId
<< " aliveTimeout: " << Settings::aliveTimeout() << " sec"
<< " txCyleTime: " << Settings::txCycleTime() << " sec"
<< " maxTransferBytes: " << Settings::maxNumOfBytePerTxCycle();
@@ -153,70 +153,70 @@ HandlerOcCentralAesData::HandlerOcCentralAesData(const std::shared_ptr<DdsHandle
if (data.isCentral())
m_allCentralEffectClusters.insert(data.id(), data);
});
TRACE_LOG() << "Got " << m_allCentralEffectClusters.size() << " central EffectClusters on startup.";
TRACE_LOG(m_logger) << "Got " << m_allCentralEffectClusters.size() << " central EffectClusters on startup.";
m_aesDtc->nContaminations([this](const AreaEffectSimulation::NContamination & data)
{
if (data.isCentral())
m_allCentralNContaminations.insert(data.id(), data);
});
TRACE_LOG() << "Got " << m_allCentralNContaminations.size() << " central NContaminations on startup.";
TRACE_LOG(m_logger) << "Got " << m_allCentralNContaminations.size() << " central NContaminations on startup.";
m_aesDtc->bCContaminations([this](const AreaEffectSimulation::BCContamination & data)
{
if (data.isCentral())
m_allCentralBCContaminations.insert(data.id(), data);
});
TRACE_LOG() << "Got " << m_allCentralBCContaminations.size() << " central BCContaminations on startup.";
TRACE_LOG(m_logger) << "Got " << m_allCentralBCContaminations.size() << " central BCContaminations on startup.";
m_aesDtc->explosionAreas([this](const AreaEffectSimulation::ExplosionArea & data)
{
if (data.isCentral())
m_allCentralExplosionsArea.insert(data.id(), data);
});
TRACE_LOG() << "Got " << m_allCentralExplosionsArea.size() << " central ExplosionsAreas on startup.";
TRACE_LOG(m_logger) << "Got " << m_allCentralExplosionsArea.size() << " central ExplosionsAreas on startup.";
m_aesDtc->explosionSingles([this](const AreaEffectSimulation::ExplosionSingle & data)
{
if (data.isCentral())
m_allCentralExplosionsSingle.insert(data.id(), data);
});
TRACE_LOG() << "Got " << m_allCentralExplosionsSingle.size() << " central ExplosionsSingles on startup.";
TRACE_LOG(m_logger) << "Got " << m_allCentralExplosionsSingle.size() << " central ExplosionsSingles on startup.";
m_aesDtc->mineAreas([this](const AreaEffectSimulation::MineArea & data)
{
if (data.isCentral())
m_allCentralMineAreas.insert(data.id(), data);
});
TRACE_LOG() << "Got " << m_allCentralMineAreas.size() << " central MineAreas on startup.";
TRACE_LOG(m_logger) << "Got " << m_allCentralMineAreas.size() << " central MineAreas on startup.";
m_aesDtc->functionalAreas([this](const AreaEffectSimulation::FunctionalArea & data)
{
if (data.isCentral())
m_allCentralFunctionalAreas.insert(data.id(), data);
});
TRACE_LOG() << "Got " << m_allCentralFunctionalAreas.size() << " central FunctionalAreas on startup.";
TRACE_LOG(m_logger) << "Got " << m_allCentralFunctionalAreas.size() << " central FunctionalAreas on startup.";
m_aesDtc->boobyTraps([this](const AreaEffectSimulation::BoobyTrap & data)
{
if (data.isCentral())
m_allCentralBoobyTraps.insert(data.id(), data);
});
TRACE_LOG() << "Got " << m_allCentralBoobyTraps.size() << " central BoobyTraps on startup.";
TRACE_LOG(m_logger) << "Got " << m_allCentralBoobyTraps.size() << " central BoobyTraps on startup.";
m_aesDtc->offRouteMines([this](const AreaEffectSimulation::OffRouteMine & data)
{
if (data.isCentral())
m_allCentralOffRouteMines.insert(data.id(), data);
});
TRACE_LOG() << "Got " << m_allCentralOffRouteMines.size() << " central OffRouteMines on startup.";
TRACE_LOG(m_logger) << "Got " << m_allCentralOffRouteMines.size() << " central OffRouteMines on startup.";
m_aesDtc->explosionClusters([this](const AreaEffectSimulation::ExplosionCluster &data)
{
if (data.isCentral())
m_allCentralExplosionClusters.insert(data.id(), data);
});
TRACE_LOG() << "Got " << m_allCentralExplosionClusters.size() << " central ExplosionClusters on startup.";
TRACE_LOG(m_logger) << "Got " << m_allCentralExplosionClusters.size() << " central ExplosionClusters on startup.";
//fetch aes itemviews
QList<qint32> aesItemIds = allInternalAesItemIds();
@@ -225,7 +225,7 @@ HandlerOcCentralAesData::HandlerOcCentralAesData(const std::shared_ptr<DdsHandle
if (aesItemIds.contains(data.aesItemId()))
m_allCentralAesItemViews.insert(data.aesItemId(), data);
});
TRACE_LOG() << "Got " << allInternalAesItemIds().size() << " central AesItems in total on startup. And " << m_allCentralAesItemViews.size() << " AesItemViews.";
TRACE_LOG(m_logger) << "Got " << allInternalAesItemIds().size() << " central AesItems in total on startup. And " << m_allCentralAesItemViews.size() << " AesItemViews.";
m_aesDtc->enableEffectCluster();
m_aesDtc->enableNContamination();
@@ -248,10 +248,10 @@ void HandlerOcCentralAesData::setRequestCentralAesData(OcSituation::SituationCen
int radius,
bool initial)
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
QMutexLocker l(&m_accessMutex);
DEBUG_LOG() << "Requested CenterEquipmentId: " << centerEquipmentId << " radius: " << radius;
DEBUG_LOG(m_logger) << "Requested CenterEquipmentId: " << centerEquipmentId << " radius: " << radius;
bool endThread = false;
@@ -272,7 +272,7 @@ void HandlerOcCentralAesData::setRequestCentralAesData(OcSituation::SituationCen
if (centerParticipant.id() <= 0)
{
ERROR_LOG() << "Participant with EqId " << m_centerEquipmentId
ERROR_LOG(m_logger) << "Participant with EqId " << m_centerEquipmentId
<< " as center of the oc situation request does not exist!";
endThread = true;
}
@@ -282,7 +282,7 @@ void HandlerOcCentralAesData::setRequestCentralAesData(OcSituation::SituationCen
if (partPosition.participantId() == 0)
{
ERROR_LOG() << "Participant with EqId " << m_centerEquipmentId
ERROR_LOG(m_logger) << "Participant with EqId " << m_centerEquipmentId
<< " as center of the oc situation request has no position!";
endThread = true;
}
@@ -294,7 +294,7 @@ void HandlerOcCentralAesData::setRequestCentralAesData(OcSituation::SituationCen
}
if (endThread && ++m_retryCount < 5)
{
INFO_LOG() << "Retry setting data - maybe participant is not yet available... " << m_retryCount;
INFO_LOG(m_logger) << "Retry setting data - maybe participant is not yet available... " << m_retryCount;
QTimer::singleShot(1000 * m_retryCount, this, [this]()
{
// must be initial here
@@ -305,7 +305,7 @@ void HandlerOcCentralAesData::setRequestCentralAesData(OcSituation::SituationCen
}
else
{
INFO_LOG() << "Situation is not requested anymore -> end thread";
INFO_LOG(m_logger) << "Situation is not requested anymore -> end thread";
endThread = true;
}
}
@@ -316,13 +316,13 @@ void HandlerOcCentralAesData::setRequestCentralAesData(OcSituation::SituationCen
{
if (m_centerParticipantId == 0)
{
DEBUG_LOG() << "m_centerParticipantId == 0";
DEBUG_LOG(m_logger) << "m_centerParticipantId == 0";
endThread = true;
}
}
else if ((centerPosition.lon() == std::nan("")) || (centerPosition.lat() == std::nan("")))
{
DEBUG_LOG() << "m_centerParticipantId == 0";
DEBUG_LOG(m_logger) << "m_centerParticipantId == 0";
endThread = true;
}
}
@@ -337,7 +337,7 @@ void HandlerOcCentralAesData::setRequestCentralAesData(OcSituation::SituationCen
QTimer::singleShot(0, this, &HandlerOcCentralAesData::resetAliveTimer);
if (endThread && !initial)
{
DEBUG_LOG() << "Ending Thread --> stopping txTimer and resetting internal data.";
DEBUG_LOG(m_logger) << "Ending Thread --> stopping txTimer and resetting internal data.";
QTimer::singleShot(0, this, &HandlerOcCentralAesData::handleSituation);
@@ -448,13 +448,13 @@ void HandlerOcCentralAesData::onAesItemViewChanged(const AreaEffectSimulation::A
void HandlerOcCentralAesData::handleSituation()
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
QMutexLocker l(&m_accessMutex);
if (m_radius == 0)
{
INFO_LOG() << "Do not send Situation as radius is 0, centerEquipmentId " << m_centerEquipmentId
INFO_LOG(m_logger) << "Do not send Situation as radius is 0, centerEquipmentId " << m_centerEquipmentId
<< ", m_position " << m_centerPosition;
QTimer::singleShot(0, this, &HandlerOcCentralAesData::aliveTimeout); // ending thread
return;
@@ -469,7 +469,7 @@ void HandlerOcCentralAesData::handleSituation()
bool hasOverload = m_aesItemsInRange.size() > 50;
if (hasOverload)
{
DEBUG_LOG() << "Got more than 50 AesItems in range. " << m_aesItemsInRange.size() << " in total --> Sorting out.";
DEBUG_LOG(m_logger) << "Got more than 50 AesItems in range. " << m_aesItemsInRange.size() << " in total --> Sorting out.";
QMultiMap<qreal, qint32> distances;
@@ -481,7 +481,7 @@ void HandlerOcCentralAesData::handleSituation()
distances.insert(distance, currentAesItemId);
}
DEBUG_LOG() << "We have " << distances.size() << " valid distances.";
DEBUG_LOG(m_logger) << "We have " << distances.size() << " valid distances.";
m_aesItemsInRange.clear();
@@ -490,12 +490,12 @@ void HandlerOcCentralAesData::handleSituation()
for (auto it = distances.constBegin(); (it != distances.constEnd()) && (counter < 50); ++it, ++counter)
m_aesItemsInRange.insert(it.value());
DEBUG_LOG() << "We now have " << m_aesItemsInRange.size() << " AES Items to send.";
DEBUG_LOG(m_logger) << "We now have " << m_aesItemsInRange.size() << " AES Items to send.";
}
QSet<qint32> validIds = m_aesItemsInRange - oldAesItemsInRange;
DEBUG_LOG() << "After sorting out old items, we have " << validIds.size() << " items left.";
DEBUG_LOG(m_logger) << "After sorting out old items, we have " << validIds.size() << " items left.";
removeKickedOutAesItems(oldAesItemsInRange);
@@ -525,12 +525,12 @@ void HandlerOcCentralAesData::handleSituation()
req.equipmentNumber(m_equipmentId);
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
DEBUG_LOG() << "Sending " << req.payload().size() << " Bytes payload.";
DEBUG_LOG(m_logger) << "Sending " << req.payload().size() << " Bytes payload.";
emit sendOcData(req);
}
else
DEBUG_LOG() << "Sending timeout, but nothing to send.";
DEBUG_LOG(m_logger) << "Sending timeout, but nothing to send.";
}
void HandlerOcCentralAesData::resetAliveTimer()
@@ -540,7 +540,7 @@ void HandlerOcCentralAesData::resetAliveTimer()
void HandlerOcCentralAesData::aliveTimeout()
{
INFO_LOG() << "O/C-Thread keep alive timeout for O/C-Laptop-Id: " << m_equipmentId
INFO_LOG(m_logger) << "O/C-Thread keep alive timeout for O/C-Laptop-Id: " << m_equipmentId
<< " - Thread will be finished id: " << QThread::currentThreadId();
QThread::currentThread()->quit();
@@ -548,8 +548,8 @@ void HandlerOcCentralAesData::aliveTimeout()
void HandlerOcCentralAesData::onResetInternalData()
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
DEBUG_LOG() << "Resetting internal data!";
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
DEBUG_LOG(m_logger) << "Resetting internal data!";
m_aesItemsInRange.clear();
m_dataQueue->clear();
@@ -559,7 +559,7 @@ void HandlerOcCentralAesData::onResetInternalData()
void HandlerOcCentralAesData::fetchAesItemsInRange()
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
if (m_radius == 0)
return;
@@ -567,11 +567,11 @@ void HandlerOcCentralAesData::fetchAesItemsInRange()
const QPointF relCenterPos = PositionConverter::relativeFromGeographic(m_centerPosition, m_baseCoordinate);
if (m_centerType == OcSituation::SituationCenterType::Equipment)
INFO_LOG() << "Fetching AesItems in radius around equipment " << m_centerEquipmentId
INFO_LOG(m_logger) << "Fetching AesItems in radius around equipment " << m_centerEquipmentId
<< " with position " << relCenterPos.x() << "/" << relCenterPos.y() << " and radius: " << m_radius << ", " << m_baseCoordinate.mgrs()
<< ", " << m_centerPosition.lon() << ", " << m_centerPosition.lat();
else
INFO_LOG() << "Fetching AesItems in radius of position " << relCenterPos.x() << "/" << relCenterPos.y() << " radius: " << m_radius;
INFO_LOG(m_logger) << "Fetching AesItems in radius of position " << relCenterPos.x() << "/" << relCenterPos.y() << " radius: " << m_radius;
m_aesItemsInRange.clear();
@@ -586,16 +586,16 @@ void HandlerOcCentralAesData::fetchAesItemsInRange()
qint32 offRouteMinesInRange = fetchAesItemsInCircle(m_allCentralOffRouteMines);
qint32 explosionClustersInRage = fetchAesItemsInCircle(m_allCentralExplosionClusters);
TRACE_LOG() << "Got " << effectClustersInRange << " EffectClusters in range.";
TRACE_LOG() << "Got " << nContaminationsInRange << " NContaminations in range.";
TRACE_LOG() << "Got " << bCContaminationsInRange << " BCContaminations in range.";
TRACE_LOG() << "Got " << explosionsAreaInRange << " ExplosionsArea in range.";
TRACE_LOG() << "Got " << explosionsSingleInRange << " ExplosionsSingle in range.";
TRACE_LOG() << "Got " << mineAreasInRange << " MineAreas in range.";
TRACE_LOG() << "Got " << functionalAreasInRange << " FunctionalAreas in range.";
TRACE_LOG() << "Got " << boobyTrapsInRange << " BoobyTraps in range.";
TRACE_LOG() << "Got " << offRouteMinesInRange << " OffRouteMines in range.";
TRACE_LOG() << "Got " << explosionClustersInRage << " ExplosionClusters in range.";
TRACE_LOG(m_logger) << "Got " << effectClustersInRange << " EffectClusters in range.";
TRACE_LOG(m_logger) << "Got " << nContaminationsInRange << " NContaminations in range.";
TRACE_LOG(m_logger) << "Got " << bCContaminationsInRange << " BCContaminations in range.";
TRACE_LOG(m_logger) << "Got " << explosionsAreaInRange << " ExplosionsArea in range.";
TRACE_LOG(m_logger) << "Got " << explosionsSingleInRange << " ExplosionsSingle in range.";
TRACE_LOG(m_logger) << "Got " << mineAreasInRange << " MineAreas in range.";
TRACE_LOG(m_logger) << "Got " << functionalAreasInRange << " FunctionalAreas in range.";
TRACE_LOG(m_logger) << "Got " << boobyTrapsInRange << " BoobyTraps in range.";
TRACE_LOG(m_logger) << "Got " << offRouteMinesInRange << " OffRouteMines in range.";
TRACE_LOG(m_logger) << "Got " << explosionClustersInRage << " ExplosionClusters in range.";
}
template<typename T>
@@ -607,7 +607,7 @@ qint32 HandlerOcCentralAesData::fetchAesItemsInCircle(const QHash<qint32, T> &ae
{
if (!m_allCentralAesItemViews.contains(it.key()))
{
WARNING_LOG() << "Got AesItem::id " << it.key() << " but there is no corresponding AesItemView.";
WARNING_LOG(m_logger) << "Got AesItem::id " << it.key() << " but there is no corresponding AesItemView.";
continue;
}
@@ -616,7 +616,7 @@ qint32 HandlerOcCentralAesData::fetchAesItemsInCircle(const QHash<qint32, T> &ae
if (it.value().effectStateId() == AreaEffectSimulation::AesEffectState::inner_enum::EsExpired ||
it.value().effectStateId() == AreaEffectSimulation::AesEffectState::inner_enum::EsRemoved)
{
TRACE_LOG() << "AesItem of type " << aesItemView.aesTypeId() << ", with id " << it.key() << " is removed or expired --> skipping.";
TRACE_LOG(m_logger) << "AesItem of type " << aesItemView.aesTypeId() << ", with id " << it.key() << " is removed or expired --> skipping.";
continue;
}
@@ -697,7 +697,7 @@ void HandlerOcCentralAesData::removeKickedOutAesItems(const QSet<qint32> &aesIte
{
QSet<qint32> kickedOutAesItems = aesItemsSentBefore - m_aesItemsInRange;
DEBUG_LOG() << "Found " << kickedOutAesItems.size() << " AesItems to kick out.";
DEBUG_LOG(m_logger) << "Found " << kickedOutAesItems.size() << " AesItems to kick out.";
AreaEffectSimulation::AesType aesType = AreaEffectSimulation::AesType::inner_enum::AtUnknown;
@@ -727,7 +727,7 @@ void HandlerOcCentralAesData::removeKickedOutAesItems(const QSet<qint32> &aesIte
aesType = AreaEffectSimulation::AesType::inner_enum::AtExplosionCluster;
else
{
WARNING_LOG() << "Could not remove AesItem with id " << currentAesItemId << ". There is no way to find out its AesType";
WARNING_LOG(m_logger) << "Could not remove AesItem with id " << currentAesItemId << ". There is no way to find out its AesType";
continue;
}
@@ -737,7 +737,7 @@ void HandlerOcCentralAesData::removeKickedOutAesItems(const QSet<qint32> &aesIte
void HandlerOcCentralAesData::buildSituationCircle()
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
// building the situation "circle" --> we use a regular polygon with 8 edges
m_situationCircle.clear();
@@ -763,7 +763,7 @@ qreal HandlerOcCentralAesData::calculateDistanceToCircleCenter(qint32 aesItemId)
{
if (!m_allCentralAesItemViews.contains(aesItemId))
{
WARNING_LOG() << "Could not calculate distance to circle center, because there is no AesItemView for AesItem::id " << aesItemId;
WARNING_LOG(m_logger) << "Could not calculate distance to circle center, because there is no AesItemView for AesItem::id " << aesItemId;
return -1.0;
}
@@ -53,7 +53,7 @@ bool HandlerOcData::init()
// EVL DTC enable
if (!m_evlDtc->enableEvaluationSchema())
{
ERROR_LOG() << "Enabling EVL Data-Topics failed.";
ERROR_LOG(m_logger) << "Enabling EVL Data-Topics failed.";
return false;
}
connect(m_evlDtc.get(), &Evaluations::Interface::Dtc::evaluationSchemaChanged, this, &HandlerOcData::onEvaluationSchemaChanged);
@@ -66,40 +66,40 @@ bool HandlerOcData::init()
// EVL FTC enable
if (!m_evlFtc->enableEvlCommentModify())
{
ERROR_LOG() << "Enabling EVL Function-Topics failed.";
ERROR_LOG(m_logger) << "Enabling EVL Function-Topics failed.";
return false;
}
// Msg FTC enable
if (!m_msgFtc->enableCreateOperatorMessage())
{
ERROR_LOG() << "Enabling MSG Function-Topics failed.";
ERROR_LOG(m_logger) << "Enabling MSG Function-Topics failed.";
return false;
}
if (!m_ppmDtc->enableParticipant())
{
ERROR_LOG() << "Enabling PPM Data-Topics failed.";
ERROR_LOG(m_logger) << "Enabling PPM Data-Topics failed.";
return false;
}
if (!m_ppmFtc->enableRegisterParticipant())
{
ERROR_LOG() << "Enabling PPM FTC-Topics failed.";
ERROR_LOG(m_logger) << "Enabling PPM FTC-Topics failed.";
return false;
}
// TAB DTC enable
if (!m_tabDtc->enableOcData())
{
ERROR_LOG() << "Enabling TAB Data-Topics failed.";
ERROR_LOG(m_logger) << "Enabling TAB Data-Topics failed.";
return false;
}
// TAB DTC enable
if (!m_tabDtc->enableConnections())
{
ERROR_LOG() << "Enabling TAB Data-Topics failed.";
ERROR_LOG(m_logger) << "Enabling TAB Data-Topics failed.";
return false;
}
@@ -108,56 +108,56 @@ bool HandlerOcData::init()
// TAB FTC enable
if (!m_tabFtc->enableSendOcData())
{
ERROR_LOG() << "Enabling TAB Function-Topics failed.";
ERROR_LOG(m_logger) << "Enabling TAB Function-Topics failed.";
return false;
}
// Handler aes data
if (!m_handlerOcAesData->init())
{
ERROR_LOG() << "Could not initialise HandlerOcAesData.";
ERROR_LOG(m_logger) << "Could not initialise HandlerOcAesData.";
return false;
}
connect(m_stateInformationTimer, &QTimer::timeout, this, &HandlerOcData::sendStateInformation);
m_stateInformationTimer->setInterval(Settings::stateInformationCycleTime());
INFO_LOG() << "Starting StateInformation timer with interval: " << m_stateInformationTimer->interval();
INFO_LOG(m_logger) << "Starting StateInformation timer with interval: " << m_stateInformationTimer->interval();
m_stateInformationTimer->start();
INFO_LOG() << "Initialisation HandlerOcData succesful.";
INFO_LOG(m_logger) << "Initialisation HandlerOcData succesful.";
return true;
}
void HandlerOcData::onEvlCommentModifyReply(const Core::FunctionReplyObject &reply)
{
if (reply.error())
ERROR_LOG() << "Evaluation could not be transmitted to EVL: " << reply.translated();
ERROR_LOG(m_logger) << "Evaluation could not be transmitted to EVL: " << reply.translated();
else
DEBUG_LOG() << "Evaluation successfully transmitted to EVL!";
DEBUG_LOG(m_logger) << "Evaluation successfully transmitted to EVL!";
}
void HandlerOcData::onCreateOperatorMessageReply(const Core::FunctionReplyObject &reply)
{
if (reply.error())
ERROR_LOG() << "Message could not be created by MSG: " << reply.translated();
ERROR_LOG(m_logger) << "Message could not be created by MSG: " << reply.translated();
else
DEBUG_LOG() << "Message created successfully by MSG!";
DEBUG_LOG(m_logger) << "Message created successfully by MSG!";
}
void HandlerOcData::onSendOcDataReply(const Core::FunctionReplyObject &reply)
{
if (reply.error())
ERROR_LOG() << "Oc data could not be send: " << reply.translated();
ERROR_LOG(m_logger) << "Oc data could not be send: " << reply.translated();
else
DEBUG_LOG() << "Oc data send successfully to TAB!";
DEBUG_LOG(m_logger) << "Oc data send successfully to TAB!";
}
void HandlerOcData::onRegisterParticipantReply(const ParticipantManagement::RegisterReply &reply)
{
if (reply.errorString().size())
ERROR_LOG() << "Modify Participant data could not be send: " << reply.errorString();
ERROR_LOG(m_logger) << "Modify Participant data could not be send: " << reply.errorString();
else
DEBUG_LOG() << "Modify Participant data send successfully to ppm!";
DEBUG_LOG(m_logger) << "Modify Participant data send successfully to ppm!";
}
void HandlerOcData::onEvaluationSchemaChanged(const Evaluations::EvaluationSchema &data, DataModification modType)
@@ -183,7 +183,7 @@ void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataMo
LtsUtils::get1Byte(payload, telegramId);
DEBUG_LOG() << "New OcData telegramId: " << telegramId;
DEBUG_LOG(m_logger) << "New OcData telegramId: " << telegramId;
switch (telegramId)
{
@@ -227,7 +227,7 @@ void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataMo
}
default:
{
INFO_LOG() << "OC-data with telegram ID: " << telegramId << " is not by HandlerOcData OSS!";
INFO_LOG(m_logger) << "OC-data with telegram ID: " << telegramId << " is not by HandlerOcData OSS!";
break;
}
}
@@ -269,7 +269,7 @@ void HandlerOcData::onSituationThreadExit()
{
ThreadOcSituationData *t = qobject_cast<ThreadOcSituationData *>(sender());
INFO_LOG() << "Exit O/C-Thread for O/C-Laptop-Id: " << m_situationThreads.key(t);
INFO_LOG(m_logger) << "Exit O/C-Thread for O/C-Laptop-Id: " << m_situationThreads.key(t);
QMutexLocker l(&m_accessMutex);
m_situationThreads.remove(m_situationThreads.key(t));
@@ -281,7 +281,7 @@ void HandlerOcData::onCentralAesThreadExit()
{
ThreadOcCentralAesData *t = qobject_cast<ThreadOcCentralAesData *>(sender());
INFO_LOG() << "Exit CentralAesData-Thread for O/C-Laptop-Id: " << m_centralAesDataThreads.key(t);
INFO_LOG(m_logger) << "Exit CentralAesData-Thread for O/C-Laptop-Id: " << m_centralAesDataThreads.key(t);
QMutexLocker l(&m_accessMutex);
m_centralAesDataThreads.remove(m_centralAesDataThreads.key(t));
@@ -320,7 +320,7 @@ void HandlerOcData::onSendEquipmentMessageOcRequest(const rti::core::SampleIdent
void HandlerOcData::onEquipmentErrorRequest(const rti::core::SampleIdentity &cookie, const EquipmentErrorRequest &request)
{
ERROR_LOG() << "onEquipmentErrorRequest" << request.equipmentNumber();
ERROR_LOG(m_logger) << "onEquipmentErrorRequest" << request.equipmentNumber();
EquipmentErrorRegistration out;
// out.id(request.requestId());
out.sampleTime(QDateTime::currentMSecsSinceEpoch());
@@ -347,7 +347,7 @@ void HandlerOcData::handleDemandSituation(const QByteArray &data, int equipmentI
LtsUtils::get2Byte(data, pos, centerEquipmentId);
LtsUtils::get2Byte(data, pos, radius);
DEBUG_LOG() << "Request from O/C-Laptop-Id: " << equipmentId
DEBUG_LOG(m_logger) << "Request from O/C-Laptop-Id: " << equipmentId
<< " centerEquipmentId: " << centerEquipmentId << " radius: " << radius;
}
else
@@ -359,7 +359,7 @@ void HandlerOcData::handleDemandSituation(const QByteArray &data, int equipmentI
position.lat(tmp);
LtsUtils::get2Byte(data, pos, radius);
DEBUG_LOG() << "Request from O/C-Laptop-Id: " << equipmentId
DEBUG_LOG(m_logger) << "Request from O/C-Laptop-Id: " << equipmentId
<< " center: " << position << " radius: " << radius;
}
bool filterActive = false;
@@ -440,7 +440,7 @@ void HandlerOcData::handleDemandEvaluationSchema(const QByteArray &data, int equ
// ignoring requested schema ID, as we only have one active schema to be send to TA
Evaluations::EvaluationSchema schema = m_evlDtc->evaluationSchema(m_currentActiveEvaluationSchemaId);
DEBUG_LOG() << "Sending to equipmentnumber: " << equipmentNumber << " evaluation schmema: " << m_currentActiveEvaluationSchemaId;
DEBUG_LOG(m_logger) << "Sending to equipmentnumber: " << equipmentNumber << " evaluation schmema: " << m_currentActiveEvaluationSchemaId;
TrainingAreaBase::SendOcDataRequest out;
out.equipmentNumber(equipmentNumber);
@@ -485,7 +485,7 @@ void HandlerOcData::handleEvaluation(const QByteArray &data)
LtsUtils::get2Byte(data, pos, textLength);
out.text(QByteArray(data.mid(pos, textLength)).toStdString());
DEBUG_LOG() << "Got new evl comment: " << out;
DEBUG_LOG(m_logger) << "Got new evl comment: " << out;
m_evlFtc->evlCommentModifyRequest(out, this);
}
@@ -512,7 +512,7 @@ void HandlerOcData::handleMessage(const QByteArray &data)
recipientIds[0] = participantId;
else
{
ERROR_LOG() << "Recipient equipment number: " << tmp << " is unknown. Aborting creating message.";
ERROR_LOG(m_logger) << "Recipient equipment number: " << tmp << " is unknown. Aborting creating message.";
return;
}
}
@@ -530,7 +530,7 @@ void HandlerOcData::handleMessage(const QByteArray &data)
out.senderId(participantId);
else
{
WARNING_LOG() << "Sender equipment number: " << tmp << " is unknown. Setting senderId to 0.";
WARNING_LOG(m_logger) << "Sender equipment number: " << tmp << " is unknown. Setting senderId to 0.";
out.senderId(0);
out.senderType(Messaging::AddressType::ObserverController);
}
@@ -544,7 +544,7 @@ void HandlerOcData::handleMessage(const QByteArray &data)
// get exerciseId
LtsUtils::get2Byte(data, pos, tmp);
if (tmp == 0)
WARNING_LOG() << "Could'n set ExerciseId" << " " << tmp << " set to 0";
WARNING_LOG(m_logger) << "Could'n set ExerciseId" << " " << tmp << " set to 0";
out.exerciseId(tmp);
// get address type
const QByteArray msg(data.right(data.size() - pos));
@@ -560,7 +560,7 @@ void HandlerOcData::handleMessage(const QByteArray &data)
out.message(msg.mid(idx + 1).constData());
}
DEBUG_LOG() << "Got new message: " << out;
DEBUG_LOG(m_logger) << "Got new message: " << out;
m_msgFtc->createOperatorMessageRequest(out, this);
}
@@ -586,7 +586,7 @@ void HandlerOcData::handleEquipmentErrorRegistration(const QByteArray &data)
out.sampleTime(QDateTime::currentMSecsSinceEpoch());
DEBUG_LOG() << "Got new error registration: " << out;
DEBUG_LOG(m_logger) << "Got new error registration: " << out;
m_dts->publish(out);
}
@@ -625,7 +625,7 @@ void HandlerOcData::handleEquipmentRegistration(const QByteArray &data)
req.participantId(participantId);
req.info(part.info());
req.identification(part.identification());
DEBUG_LOG() << "Try to register part with id: " << req.participantId() << " and eqNumeber " << req.equipmentNumber();
DEBUG_LOG(m_logger) << "Try to register part with id: " << req.participantId() << " and eqNumeber " << req.equipmentNumber();
m_ppmFtc->registerParticipantRequest(req, this);
}
@@ -37,6 +37,7 @@ public:
bool init();
protected:
NGL::INGLLogger &m_logger;
void onEvlCommentModifyReply(const Core::FunctionReplyObject &reply) override final;
void onCreateOperatorMessageReply(const Core::FunctionReplyObject &reply) override final;
void onSendOcDataReply(const Core::FunctionReplyObject &reply) override final;
@@ -49,7 +49,7 @@ void ThreadOcSituationData::requestOcSituationData(OcSituation::SituationCenterT
QSet<ParticipantManagement::TypeClass::type> typeClassList,
bool initial)
{
INFO_LOG() << "OC-Situation Request for centerEquipmentId: " << centerEquipmentId
INFO_LOG(m_logger) << "OC-Situation Request for centerEquipmentId: " << centerEquipmentId
<< " from O/C-laptop-Id: " << m_equipmentId
<< " with radius of " << radius
<< "m, initial: " << initial;
@@ -67,7 +67,7 @@ void ThreadOcSituationData::requestOcSituationData(OcSituation::SituationCenterT
if (m_handler)
m_handler->setRequestOcSituationData(centerType, centerEquipmentId, position, radius, filterActive, partyList, typeClassList, initial);
else
DEBUG_LOG() << "Thread doesn't exist up to now! Do nothing.";
DEBUG_LOG(m_logger) << "Thread doesn't exist up to now! Do nothing.";
}
void ThreadOcSituationData::run()
@@ -76,7 +76,7 @@ void ThreadOcSituationData::run()
{
QMutexLocker l(&m_accessMutex);
QMutexLocker m(&s_ddsAccesMutex);
DEBUG_LOG() << "Instance new OC-Thread for O/C-Laptop-Id: " << m_equipmentId;
DEBUG_LOG(m_logger) << "Instance new OC-Thread for O/C-Laptop-Id: " << m_equipmentId;
m_handler = new HandlerOcSituationData(m_mainHandler->dds(),
m_baseCoordinate,
@@ -86,7 +86,7 @@ void ThreadOcSituationData::run()
m_handler->setRequestOcSituationData(m_centerType, m_centerEquipmentId, m_position, m_radius, m_filterActive, m_partyList, m_typeClassList, true);
}
INFO_LOG() << "OC-Thread started for O/C-Laptop-Id: " << m_equipmentId;
INFO_LOG(m_logger) << "OC-Thread started for O/C-Laptop-Id: " << m_equipmentId;
exec();
{
@@ -113,7 +113,7 @@ HandlerOcSituationData::HandlerOcSituationData(const std::shared_ptr<DdsHandler>
, m_txTimer(new QTimer(this))
, m_logger(getLogger(QStringLiteral("HandlerOcSituationData.") + QString::number(equipmentId)))
{
INFO_LOG() << "Create O/C-Handler for O/C-Laptop-Id: " << equipmentId
INFO_LOG(m_logger) << "Create O/C-Handler for O/C-Laptop-Id: " << equipmentId
<< " aliveTimeout: " << Settings::aliveTimeout() << " sec"
<< " txCyleTime: " << Settings::txCycleTime() << " sec"
<< " maxTransferBytes: " << Settings::maxNumOfBytePerTxCycle();
@@ -161,10 +161,10 @@ void HandlerOcSituationData::setRequestOcSituationData(OcSituation::SituationCen
QSet<ParticipantManagement::TypeClass::type> typeClasses,
bool initial)
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
QMutexLocker l(&m_accessMutex);
DEBUG_LOG() << "Requested CenterEquipmentId: " << centerEquipmentId << " radius: " << radius;
DEBUG_LOG(m_logger) << "Requested CenterEquipmentId: " << centerEquipmentId << " radius: " << radius;
bool endThread = false;
@@ -195,7 +195,7 @@ void HandlerOcSituationData::setRequestOcSituationData(OcSituation::SituationCen
if (centerParticipant.id() <= 0)
{
ERROR_LOG() << "Participant with EqId " << m_centerEquipmentId
ERROR_LOG(m_logger) << "Participant with EqId " << m_centerEquipmentId
<< " as center of the oc situation request does not exist!";
endThread = true;
}
@@ -204,7 +204,7 @@ void HandlerOcSituationData::setRequestOcSituationData(OcSituation::SituationCen
const ParticipantManagement::ParticipantPosition &partPosition = m_allParticipantPositions.value(centerParticipant.id());
if (partPosition.participantId() == 0)
{
ERROR_LOG() << "Participant with EqId " << m_centerEquipmentId
ERROR_LOG(m_logger) << "Participant with EqId " << m_centerEquipmentId
<< " as center of the oc situation request has no position!";
endThread = true;
}
@@ -216,7 +216,7 @@ void HandlerOcSituationData::setRequestOcSituationData(OcSituation::SituationCen
}
if (endThread && ++m_retryCount < 5)
{
INFO_LOG() << "Retry setting data - maybe participant is not yet available... " << m_retryCount;
INFO_LOG(m_logger) << "Retry setting data - maybe participant is not yet available... " << m_retryCount;
QTimer::singleShot(1000 * m_retryCount, this, [this]()
{
// must be initial here
@@ -227,7 +227,7 @@ void HandlerOcSituationData::setRequestOcSituationData(OcSituation::SituationCen
}
else
{
INFO_LOG() << "Situation is not requested anymore -> end thread";
INFO_LOG(m_logger) << "Situation is not requested anymore -> end thread";
endThread = true;
}
}
@@ -259,7 +259,7 @@ void HandlerOcSituationData::setRequestOcSituationData(OcSituation::SituationCen
void HandlerOcSituationData::onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType)
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
if (modType == DataModification::eRemoved)
return;
@@ -269,7 +269,7 @@ void HandlerOcSituationData::onParticipantChanged(const ParticipantManagement::P
if (!m_participants.contains(participantId))
{
DEBUG_LOG() << "m_participants does not contain participant id: " << participantId;
DEBUG_LOG(m_logger) << "m_participants does not contain participant id: " << participantId;
return; // participant is not of interest (now)
}
@@ -290,11 +290,11 @@ void HandlerOcSituationData::onParticipantChanged(const ParticipantManagement::P
setModified(participantId, OcSituation::ModificationFlag::eDesignator);
m_participants[participantId] = data;
DEBUG_LOG() << "updated data in m_participants" << data;
DEBUG_LOG(m_logger) << "updated data in m_participants" << data;
if (m_modifiedFlags.contains(participantId))
{
INFO_LOG() << "setModified for: " << m_participantId2EqId[participantId]
INFO_LOG(m_logger) << "setModified for: " << m_participantId2EqId[participantId]
<< " / " << participantId
<< " bits: 0x" << QString::number(m_modifiedFlags[participantId], 16);
}
@@ -313,7 +313,7 @@ static inline int getEquipmentStateBits(const ParticipantManagement::DynamicPart
void HandlerOcSituationData::onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType)
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
if (modType == DataModification::eRemoved)
return;
@@ -322,7 +322,7 @@ void HandlerOcSituationData::onDynamicParticipantDataChanged(const ParticipantMa
if (!m_participants.contains(participantId))
{
DEBUG_LOG() << "m_participants does not contain participant id: " << participantId;
DEBUG_LOG(m_logger) << "m_participants does not contain participant id: " << participantId;
return; // participant does not interest us yet;
}
@@ -343,11 +343,11 @@ void HandlerOcSituationData::onDynamicParticipantDataChanged(const ParticipantMa
setModified(participantId, OcSituation::ModificationFlag::eState);
m_dynamicParticpantData[participantId] = data;
DEBUG_LOG() << "updated data in m_dynamicParticpantData" << data;
DEBUG_LOG(m_logger) << "updated data in m_dynamicParticpantData" << data;
if (m_modifiedFlags.contains(participantId))
{
INFO_LOG() << "setModified for: " << m_participantId2EqId[participantId]
INFO_LOG(m_logger) << "setModified for: " << m_participantId2EqId[participantId]
<< " / " << participantId
<< " bits: 0x" << QString::number(m_modifiedFlags[participantId], 16);
}
@@ -355,7 +355,7 @@ void HandlerOcSituationData::onDynamicParticipantDataChanged(const ParticipantMa
void HandlerOcSituationData::onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType)
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
if (modType == DataModification::eRemoved)
return;
const int participantId = data.participantId();
@@ -368,7 +368,7 @@ void HandlerOcSituationData::onParticipantPositionChanged(const ParticipantManag
if (!m_participants.contains(participantId))
{
DEBUG_LOG() << "m_participants does not contain participant id: " << participantId;
DEBUG_LOG(m_logger) << "m_participants does not contain participant id: " << participantId;
return; // participant does not interest us yet;
}
@@ -404,11 +404,11 @@ void HandlerOcSituationData::onParticipantPositionChanged(const ParticipantManag
}
m_participantPositions[participantId] = data;
DEBUG_LOG() << "updated data in m_participantPositions" << data;
DEBUG_LOG(m_logger) << "updated data in m_participantPositions" << data;
if (m_modifiedFlags.contains(participantId))
{
INFO_LOG() << "setModified for: " << m_participantId2EqId[participantId]
INFO_LOG(m_logger) << "setModified for: " << m_participantId2EqId[participantId]
<< " / " << participantId
<< " bits: 0x" << QString::number(m_modifiedFlags[participantId], 16);
}
@@ -444,13 +444,13 @@ void HandlerOcSituationData::onDusMineStateChanged(const AreaEffectSimulation::D
void HandlerOcSituationData::handleSituation()
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
QMutexLocker l(&m_accessMutex);
if (m_radius == 0)
{
INFO_LOG() << "Do not send Situation as radius is 0, centerEquipmentId " << m_centerEquipmentId
INFO_LOG(m_logger) << "Do not send Situation as radius is 0, centerEquipmentId " << m_centerEquipmentId
<< ", m_position " << m_centerPosition;
QTimer::singleShot(0, this, &HandlerOcSituationData::aliveTimeout); // ending thread
return;
@@ -462,7 +462,7 @@ void HandlerOcSituationData::handleSituation()
const QByteArray data = createDataStream(Settings::maxNumOfBytePerTxCycle(), prioQueue);
if (data.isEmpty())
{
DEBUG_LOG() << "Don't send empty data to TAB.";
DEBUG_LOG(m_logger) << "Don't send empty data to TAB.";
return;
}
@@ -487,7 +487,7 @@ void HandlerOcSituationData::resetAliveTimer()
void HandlerOcSituationData::aliveTimeout()
{
INFO_LOG() << "O/C-Thread keep alive timeout for O/C-Laptop-Id: " << m_equipmentId
INFO_LOG(m_logger) << "O/C-Thread keep alive timeout for O/C-Laptop-Id: " << m_equipmentId
<< " - Thread will be finished id: " << QThread::currentThreadId();
QThread::currentThread()->quit();
@@ -495,9 +495,9 @@ void HandlerOcSituationData::aliveTimeout()
void HandlerOcSituationData::onResetInternalData()
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
INFO_LOG() << "Resetting internal data!";
INFO_LOG(m_logger) << "Resetting internal data!";
m_participants.clear();
m_dynamicParticpantData.clear();
m_participantPositions.clear();
@@ -514,15 +514,15 @@ void HandlerOcSituationData::onResetInternalData()
void HandlerOcSituationData::fetchParticipantsInRange()
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
const QPointF relCenterPos = PositionConverter::relativeFromGeographic(m_centerPosition, m_baseCoordinate);
if (m_centerType == OcSituation::SituationCenterType::Equipment)
INFO_LOG() << "Fetching participants in radius around equipment " << m_centerEquipmentId
INFO_LOG(m_logger) << "Fetching participants in radius around equipment " << m_centerEquipmentId
<< " with position " << relCenterPos.x() << "/" << relCenterPos.y() << " and radius: " << m_radius << ", " << m_baseCoordinate.mgrs()
<< ", " << m_centerPosition.lon() << ", " << m_centerPosition.lat();
else
INFO_LOG() << "Fetching participants in radius of position " << relCenterPos.x() << "/" << relCenterPos.y() << " radius: " << m_radius;
INFO_LOG(m_logger) << "Fetching participants in radius of position " << relCenterPos.x() << "/" << relCenterPos.y() << " radius: " << m_radius;
const double rangeSqr = m_radius * m_radius;
QMultiMap<double, int> curParticipantsInRange;
@@ -542,7 +542,7 @@ void HandlerOcSituationData::fetchParticipantsInRange()
if ((m_partyList.count() > 0 && m_partyList.contains(participant.partyId()) == false) ||
(m_typeClassList.count() > 0 && m_typeClassList.contains(typeClass.underlying()) == false))
{
DEBUG_LOG() << participant.id() << " filtered out";
DEBUG_LOG(m_logger) << participant.id() << " filtered out";
continue;
}
}
@@ -554,13 +554,13 @@ void HandlerOcSituationData::fetchParticipantsInRange()
if (distanceSqr > rangeSqr)
{
DEBUG_LOG() << "Participant NOT in range equipment number: " << participant.equipmentNumber().get()
DEBUG_LOG(m_logger) << "Participant NOT in range equipment number: " << participant.equipmentNumber().get()
<< " pos: " << relPartPos.x() << "/" << relPartPos.y()
<< " distance: " << std::sqrt(distanceSqr) << " distanceSqr: " << distanceSqr;
continue;
}
DEBUG_LOG() << "Participant in range equipment number: " << participant.equipmentNumber().get()
DEBUG_LOG(m_logger) << "Participant in range equipment number: " << participant.equipmentNumber().get()
<< " pos: " << relPartPos.x() << "/" << relPartPos.y()
<< " distance: " << std::sqrt(distanceSqr) << " distanceSqr: " << distanceSqr;
curParticipantsInRange.insertMulti(distanceSqr, participant.id());
@@ -574,7 +574,7 @@ void HandlerOcSituationData::fetchParticipantsInRange()
{
handleParticipant(m_allParticipants.value(id));
curParticipants.insert(id);
DEBUG_LOG() << "Added participant to hundred nearest: " << m_participantId2EqId[id]
DEBUG_LOG(m_logger) << "Added participant to hundred nearest: " << m_participantId2EqId[id]
<< " / " << id;
++cnt;
if (cnt >= Settings::maxParticipantsInSituation())
@@ -591,7 +591,7 @@ void HandlerOcSituationData::fetchParticipantsInRange()
{
m_newlyOutdatedParticipants.insert(id);
m_outdatedParticipants.insert(id);
DEBUG_LOG() << "Participant outdated: " << m_participantId2EqId[id]
DEBUG_LOG(m_logger) << "Participant outdated: " << m_participantId2EqId[id]
<< " / " << id;
}
}
@@ -600,7 +600,7 @@ void HandlerOcSituationData::fetchParticipantsInRange()
void HandlerOcSituationData::handleParticipant(const ParticipantManagement::Participant &participant)
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
int participantId = participant.id();
if (participant.equipmentNumber().is_set())
@@ -611,7 +611,7 @@ void HandlerOcSituationData::handleParticipant(const ParticipantManagement::Part
// now check if is a new participant
if (!m_participants.contains(participantId))
{
DEBUG_LOG() << "Adding previously unknown participant to m_participants: " << m_participantId2EqId.value(participantId)
DEBUG_LOG(m_logger) << "Adding previously unknown participant to m_participants: " << m_participantId2EqId.value(participantId)
<< " / " << participantId;
// new participant -> all modified
setModified(participantId, OcSituation::ModificationFlag::eAll);
@@ -625,7 +625,7 @@ void HandlerOcSituationData::handleParticipant(const ParticipantManagement::Part
// old participant, check if was outdated
if (m_outdatedParticipants.remove(participantId))
{
DEBUG_LOG() << "Adding old player that is inside the radius again: " << m_participantId2EqId.value(participantId)
DEBUG_LOG(m_logger) << "Adding old player that is inside the radius again: " << m_participantId2EqId.value(participantId)
<< " / " << participantId;
if (m_modifiedFlags[participantId] == OcSituation::ModificationFlag::eNone)
setModified(participantId, OcSituation::ModificationFlag::ePosition2D);
@@ -641,7 +641,7 @@ static inline bool sortParticipantsForRange(const QPair<int, float> &p1,
QVector<QPair<int, float>> HandlerOcSituationData::createPrioQueue() const
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
QVector<QPair<int, float>> participantsPrioQueue;
participantsPrioQueue.reserve(m_participantsToSend.size());
@@ -665,12 +665,12 @@ QVector<QPair<int, float>> HandlerOcSituationData::createPrioQueue() const
cntNotSendDbg = participantIt.value();
// Je nicht gesendeten -> 5 % abziehen, aber nie alles
const int cntNotSend = participantIt.value() > 20 ? 19 : participantIt.value();
DEBUG_LOG() << "prio: " << prio << ", prio / 20 * cntNotSend: " << prio / 20 * cntNotSend;
DEBUG_LOG(m_logger) << "prio: " << prio << ", prio / 20 * cntNotSend: " << prio / 20 * cntNotSend;
prio -= (prio / 20 * cntNotSend);
}
participantsPrioQueue.push_back(qMakePair(participantId, prio));
DEBUG_LOG() << "Radius from center for: " << m_participantId2EqId[participantId]
DEBUG_LOG(m_logger) << "Radius from center for: " << m_participantId2EqId[participantId]
<< " / " << participantId << " = " << sqrt(r2) << "m, prio: " << prio
<< ", not sent: " << cntNotSendDbg << " time(s)";
}
@@ -681,7 +681,7 @@ QVector<QPair<int, float>> HandlerOcSituationData::createPrioQueue() const
QByteArray HandlerOcSituationData::createDataStream(int maxSize,
const QVector<QPair<int, float>> &participantsPrioQueue)
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
QByteArray ret;
@@ -690,7 +690,7 @@ QByteArray HandlerOcSituationData::createDataStream(int maxSize,
maxSize -= 5;
// first: participants that are not in range any more
DEBUG_LOG() << "m_newlyOutdatedParticipants: " << m_newlyOutdatedParticipants.size();
DEBUG_LOG(m_logger) << "m_newlyOutdatedParticipants: " << m_newlyOutdatedParticipants.size();
QSet<int> copyOfOutdated = m_newlyOutdatedParticipants;
for (const auto participantId : std::as_const(m_newlyOutdatedParticipants))
{
@@ -701,21 +701,21 @@ QByteArray HandlerOcSituationData::createDataStream(int maxSize,
continue;
QByteArray ba = m_bWithCompression ? qCompress(ret) : ret;
DEBUG_LOG() << "Added info about oudated player " << m_participantId2EqId[participantId]
DEBUG_LOG(m_logger) << "Added info about oudated player " << m_participantId2EqId[participantId]
<< " / " << participantId
<< " data size: " << ret.size()
<< " compressed size: " << ba.size();
if (ba.size() > maxSize)
{
m_newlyOutdatedParticipants = copyOfOutdated;
TRACE_LOG() << "Uncompressed Data: " << ret.toHex(' ');
TRACE_LOG(m_logger) << "Uncompressed Data: " << ret.toHex(' ');
return ba;
}
}
m_newlyOutdatedParticipants = copyOfOutdated;
// Data updates
DEBUG_LOG() << "participantsPrioQueue: " << participantsPrioQueue.size();
DEBUG_LOG(m_logger) << "participantsPrioQueue: " << participantsPrioQueue.size();
for (auto prioPair : participantsPrioQueue)
{
int participantId = prioPair.first;
@@ -734,7 +734,7 @@ QByteArray HandlerOcSituationData::createDataStream(int maxSize,
// default DynamicParticipantData crashes the tablet software. we skip it ... for now
if (dynamicParticipantData == ParticipantManagement::DynamicParticipantData())
{
INFO_LOG() << "There is only default DynamicParticipantData for participant with id " << participantId << " --> skipping";
INFO_LOG(m_logger) << "There is only default DynamicParticipantData for participant with id " << participantId << " --> skipping";
continue;
}
@@ -753,21 +753,21 @@ QByteArray HandlerOcSituationData::createDataStream(int maxSize,
continue;
QByteArray ba = m_bWithCompression ? qCompress(ret) : ret;
DEBUG_LOG() << "Added info about changed player " << m_participantId2EqId[participantId]
DEBUG_LOG(m_logger) << "Added info about changed player " << m_participantId2EqId[participantId]
<< " / " << participantId
<< " bits: 0x" << QString::number(modifiedFlags, 16)
<< " data size: " << ret.size()
<< " compressed: " << ba.size();
if (ba.size() > maxSize)
{
DEBUG_LOG() << "Uncompressed Data: " << ret.toHex(' ');
DEBUG_LOG(m_logger) << "Uncompressed Data: " << ret.toHex(' ');
return ba;
}
}
if (!ret.isEmpty())
{
DEBUG_LOG() << "Uncompressed Data: " << ret.toHex(' ');
DEBUG_LOG(m_logger) << "Uncompressed Data: " << ret.toHex(' ');
return m_bWithCompression ? qCompress(ret) : ret;
}
else
@@ -776,7 +776,7 @@ QByteArray HandlerOcSituationData::createDataStream(int maxSize,
void HandlerOcSituationData::updatePrioOfNotSendParticipants()
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
// add a prio bonus to all participants not send this cycle
QMap<int, OcSituation::ModificationBits>::const_iterator it = m_modifiedFlags.constBegin();
for (; it != m_modifiedFlags.constEnd(); ++it)
@@ -794,15 +794,15 @@ void HandlerOcSituationData::updatePrioOfNotSendParticipants()
participantIt.value()++;
notSentSince = participantIt.value();
}
DEBUG_LOG() << "Player " << m_participantId2EqId[participantId]
DEBUG_LOG(m_logger) << "Player " << m_participantId2EqId[participantId]
<< " / " << participantId << " not sent for " << notSentSince << " time(s)";
}
}
void HandlerOcSituationData::setModified(int participantId, OcSituation::ModificationBits bits)
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
DEBUG_LOG() << "setModified " << bits << " for: " << m_participantId2EqId[participantId]
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
DEBUG_LOG(m_logger) << "setModified " << bits << " for: " << m_participantId2EqId[participantId]
<< " / " << participantId;
m_participantsToSend.insert(participantId);
@@ -817,8 +817,8 @@ void HandlerOcSituationData::setModified(int participantId, OcSituation::Modific
void HandlerOcSituationData::clearModified(int participantId)
{
TRACE_LOG() << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
DEBUG_LOG() << "clearModified for: " << m_participantId2EqId[participantId]
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << Q_FUNC_INFO;
DEBUG_LOG(m_logger) << "clearModified for: " << m_participantId2EqId[participantId]
<< " / " << participantId;
m_modifiedFlags.remove(participantId);
m_participantsNotSend.remove(participantId);
@@ -921,7 +921,7 @@ void HandlerOcSituationData::addVBG(QByteArray &buf, const ParticipantManagement
uint8_t vitRes = (youngestStateInformation.vitality() / 10);
if (vitRes > 10)
{
WARNING_LOG() << "Vitality of Participant " << data.participantId() << " is not between 0 and 100%. Putting to 100%";
WARNING_LOG(m_logger) << "Vitality of Participant " << data.participantId() << " is not between 0 and 100%. Putting to 100%";
vitRes = 10;
}
vitRes += ((int)youngestStateInformation.sanitationResult().underlying() << 4);
@@ -17,8 +17,7 @@
namespace OcSituationServer
{
MainHandler::MainHandler(QObject *parent)
: QObject(parent)
MainHandler::MainHandler(QObject *parent) : QObject(parent)
, m_exerciseId(0)
, m_ddsHandler(nullptr)
, m_dbHandler(nullptr)
@@ -32,8 +31,8 @@ MainHandler::MainHandler(QObject *parent)
, m_ppmDtc(nullptr)
, m_ppmFtc(nullptr)
, m_tabDtc(nullptr)
, m_tabFtc(nullptr)
{}
, m_tabFtc(nullptr),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
MainHandler::~MainHandler()
{
@@ -69,55 +68,55 @@ bool MainHandler::init(int domainId, int exerciseId)
if (!m_dbHandler->init(exerciseId, Settings::settings()))
{
ERROR_LOG() << "Initialisation dbHandler failed.";
ERROR_LOG(m_logger) << "Initialisation dbHandler failed.";
return false;
}
DEBUG_LOG() << "Initialisation dbHandler succesful.";
DEBUG_LOG(m_logger) << "Initialisation dbHandler succesful.";
// initialize DDS
m_ddsHandler = std::make_shared<DdsHandler>(domainId, exerciseId);
if (!m_ddsHandler->init())
{
ERROR_LOG() << "Initialisation ddsHandler failed.";
ERROR_LOG(m_logger) << "Initialisation ddsHandler failed.";
return false;
}
DEBUG_LOG() << "Initialisation ddsHandler succesful.";
DEBUG_LOG(m_logger) << "Initialisation ddsHandler succesful.";
// create AES Dtc
m_aesDtc = AreaEffectSimulation::Interface::Dtc::create(m_ddsHandler->dds());
DEBUG_LOG() << "Created AES Dtc";
DEBUG_LOG(m_logger) << "Created AES Dtc";
// create EVL Dtc
m_evlDtc = Evaluations::Interface::Dtc::create(m_ddsHandler->dds());
DEBUG_LOG() << "Created EVL Dtc";
DEBUG_LOG(m_logger) << "Created EVL Dtc";
// create EVL Ftc
m_evlFtc = Evaluations::Interface::Ftc::create(m_ddsHandler->dds());
DEBUG_LOG() << "Created EVL Ftc";
DEBUG_LOG(m_logger) << "Created EVL Ftc";
// create GIM Dtc
m_gimDtc = GuezIedManagement::Interface::Dtc::create(m_ddsHandler->dds());
DEBUG_LOG() << "Created GIM Dtc";
DEBUG_LOG(m_logger) << "Created GIM Dtc";
// create MSG Ftc
m_msgFtc = Messaging::Interface::Ftc::create(m_ddsHandler->dds());
DEBUG_LOG() << "Created Msg Ftc";
DEBUG_LOG(m_logger) << "Created Msg Ftc";
// create PPM Dtc
m_ppmDtc = ParticipantManagement::Interface::Dtc::create(m_ddsHandler->dds());
DEBUG_LOG() << "Created PPM Dtc";
DEBUG_LOG(m_logger) << "Created PPM Dtc";
// create PPM Ftc
m_ppmFtc = ParticipantManagement::Interface::Ftc::create(m_ddsHandler->dds());
DEBUG_LOG() << "Created PPM Dtc";
DEBUG_LOG(m_logger) << "Created PPM Dtc";
// create TAB Dtc
m_tabDtc = TrainingAreaBase::Interface::Dtc::create(m_ddsHandler->dds());
DEBUG_LOG() << "Created TAB Dtc";
DEBUG_LOG(m_logger) << "Created TAB Dtc";
// create TAB Ftc
m_tabFtc = TrainingAreaBase::Interface::Ftc::create(m_ddsHandler->dds());
DEBUG_LOG() << "Created TAB Ftc";
DEBUG_LOG(m_logger) << "Created TAB Ftc";
// create position converter
m_positionConverter = std::make_shared<PositionConverter>(this);
@@ -126,7 +125,7 @@ bool MainHandler::init(int domainId, int exerciseId)
m_handlerOcData = std::make_shared<HandlerOcData>(this, this);
if (!m_handlerOcData->init())
{
ERROR_LOG() << "Initialisation HandlerOcData failed.";
ERROR_LOG(m_logger) << "Initialisation HandlerOcData failed.";
return false;
}
@@ -63,6 +63,7 @@ public:
int exerciseId() const { return m_exerciseId; }
private:
NGL::INGLLogger &m_logger;
int m_exerciseId;
std::shared_ptr<DdsHandler> m_ddsHandler;
@@ -15,12 +15,11 @@
namespace OcSituationServer
{
PositionConverter::PositionConverter(MainHandler *m_mainHandler)
: m_mainHandler(m_mainHandler)
PositionConverter::PositionConverter(MainHandler *m_mainHandler) : m_mainHandler(m_mainHandler)
, m_baseCoord(LtsCoordTrans::UtmCoordinate())
, m_asmDtc(AssetManagement::Interface::Dtc::create(m_mainHandler->dds()->dds()))
, m_exmDtc(ExerciseManagement::Interface::Dtc::create(m_mainHandler->dds()->dds()))
{
, m_exmDtc(ExerciseManagement::Interface::Dtc::create(m_mainHandler->dds()->dds())),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
m_exmDtc->enableExercise();
m_asmDtc->enableTrainingArea();
}
@@ -41,24 +40,24 @@ bool PositionConverter::initCoordConversion()
if (!m_exmDtc->waitForHistoricalDataExercise(15000))
{
ERROR_LOG() << "Error initializing ExerciseManagement DTC";
ERROR_LOG(m_logger) << "Error initializing ExerciseManagement DTC";
return false;
}
const auto ex = m_exmDtc->exercise(m_mainHandler->exerciseId());
if (ex.id() <= 0)
{
ERROR_LOG() << "Can not retrieve exercise information for id " << m_mainHandler->exerciseId();
ERROR_LOG(m_logger) << "Can not retrieve exercise information for id " << m_mainHandler->exerciseId();
return false;
}
if (!m_asmDtc->waitForHistoricalDataTrainingArea(10000))
{
ERROR_LOG() << "Error initializing AssetManagement DTC";
ERROR_LOG(m_logger) << "Error initializing AssetManagement DTC";
return false;
}
const auto ta = m_asmDtc->trainingArea(ex.trainingAreaId());
if (ta.id() <= 0)
{
ERROR_LOG() << "Can not retrieve training are information for id " << ex.trainingAreaId();
ERROR_LOG(m_logger) << "Can not retrieve training are information for id " << ex.trainingAreaId();
return false;
}