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
+3
-3
@@ -33,7 +33,7 @@ bool Api::init(const BuildingBsmConfig &bsmConfig)
|
||||
|
||||
bool Api::triggerFlashlight(int bsmId, const QString &hostname, int numberOfFlashes, int pauseBetweenFlashesSec)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "triggerFlashlight bsmId=" << bsmId
|
||||
DEBUG_LOG() << "triggerFlashlight bsmId=" << bsmId
|
||||
<< " hostname=" << hostname
|
||||
<< " numberOfFlashes=" << numberOfFlashes
|
||||
<< " pauseBetweenFlashesSec=" << pauseBetweenFlashesSec;
|
||||
@@ -46,7 +46,7 @@ bool Api::triggerFlashlightPulse(int bsmId, const QString &hostname,
|
||||
int choppedConfiguration,
|
||||
int flashDuration)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "triggerFlashlightPulse bsmId=" << bsmId
|
||||
DEBUG_LOG() << "triggerFlashlightPulse bsmId=" << bsmId
|
||||
<< " hostname=" << hostname
|
||||
<< " numberOfFlashes=" << numberOfFlashes
|
||||
<< " pauseDuration=" << pauseDuration
|
||||
@@ -60,7 +60,7 @@ bool Api::triggerFlashlights( int numberOfFlashes,
|
||||
int choppedConfiguration,
|
||||
int flashDuration)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "triggerFlashlights numberOfFlashes=" << numberOfFlashes
|
||||
DEBUG_LOG() << "triggerFlashlights numberOfFlashes=" << numberOfFlashes
|
||||
<< " pauseDuration=" << pauseDuration
|
||||
<< " choppedConfiguration" << choppedConfiguration
|
||||
<< " flashDuration=" << flashDuration;
|
||||
|
||||
+1
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <BSM/buildingcontrolbsm_export.h>
|
||||
#include "buildingcontrolbsm_export.h"
|
||||
#include <QObject>
|
||||
#include <logger.h>
|
||||
#include "bsm_types.h"
|
||||
@@ -51,7 +51,6 @@ Q_SIGNALS:
|
||||
void bsmStateChanged(const QVector<BsmState> &bsmStates);
|
||||
private:
|
||||
SocketHandler *m_socketHandler;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -45,10 +45,10 @@ bool Socket::sendData(const QByteArray &data)
|
||||
{
|
||||
if (!isConnected())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "BSM " << m_config.id << ": Trying to send data but not connected!";
|
||||
WARNING_LOG() << "BSM " << m_config.id << ": Trying to send data but not connected!";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "BSM " << m_config.id << ": sending data: 0x" << data.toHex();
|
||||
DEBUG_LOG() << "BSM " << m_config.id << ": sending data: 0x" << data.toHex();
|
||||
m_tcpSocket->write(data);
|
||||
m_tcpSocket->flush();
|
||||
return true;
|
||||
@@ -57,7 +57,7 @@ bool Socket::sendData(const QByteArray &data)
|
||||
void Socket::setVersionInformation(int verMajor, int verMinor, int verRev, const QString &manufacturer)
|
||||
{
|
||||
m_versionInfo = QStringLiteral("%1.%2-%3 (%4)").arg(verMajor).arg(verMinor).arg(verRev).arg(manufacturer);
|
||||
INFO_LOG(m_logger) << "BSM " << m_config.id
|
||||
INFO_LOG() << "BSM " << m_config.id
|
||||
<< ": version = " << m_versionInfo;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ void Socket::gotAlive()
|
||||
|
||||
void Socket::onConnected()
|
||||
{
|
||||
INFO_LOG(m_logger) << "BSM " << m_config.id << " is connected to "
|
||||
INFO_LOG() << "BSM " << m_config.id << " is connected to "
|
||||
<< m_tcpSocket->peerAddress().toString() << ":" << m_tcpSocket->peerPort();
|
||||
Telegrams::PanConfigurationSetup tele;
|
||||
tele.m_aliveMessage = s_aliveTimeout;
|
||||
@@ -83,7 +83,7 @@ void Socket::onConnected()
|
||||
|
||||
void Socket::onDisconnected()
|
||||
{
|
||||
INFO_LOG(m_logger) << "BSM " << m_config.id << " is disconnected";
|
||||
INFO_LOG() << "BSM " << m_config.id << " is disconnected";
|
||||
m_versionInfo.clear();
|
||||
startReconnectTimer();
|
||||
emit disconnected(m_config.id);
|
||||
@@ -91,7 +91,7 @@ void Socket::onDisconnected()
|
||||
|
||||
void Socket::onError(QAbstractSocket::SocketError error)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BSM " << m_config.id
|
||||
DEBUG_LOG() << "BSM " << m_config.id
|
||||
<< " can not connect to " << m_config.hostname << ":" << m_config.port
|
||||
<< ": " << m_tcpSocket->errorString()
|
||||
<< " (" << error << ");";
|
||||
@@ -100,7 +100,7 @@ void Socket::onError(QAbstractSocket::SocketError error)
|
||||
|
||||
void Socket::onConnect()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BSM " << m_config.id
|
||||
DEBUG_LOG() << "BSM " << m_config.id
|
||||
<< " trying to connect to " << m_config.hostname << ":" << m_config.port;
|
||||
m_tcpSocket->connectToHost(m_config.hostname, m_config.port);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ void Socket::onReadyRead()
|
||||
|
||||
void Socket::onAliveTimeout()
|
||||
{
|
||||
WARNING_LOG(m_logger) << "BSM " << m_config.id
|
||||
WARNING_LOG() << "BSM " << m_config.id
|
||||
<< " alive timeout! Reconnecting";
|
||||
|
||||
}
|
||||
|
||||
-1
@@ -46,7 +46,6 @@ private:
|
||||
QTimer *m_reconnectTimer;
|
||||
QTimer *m_aliveTimer;
|
||||
QString m_versionInfo;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+15
-15
@@ -66,7 +66,7 @@ bool SocketHandler::triggerFlashlight(int bsmId, const QString &hostname, int nu
|
||||
Socket *s = hostname.isEmpty() ? getSocketForBsm(bsmId) : getSocketForBsm(hostname);
|
||||
if (!s)
|
||||
return false;
|
||||
DEBUG_LOG(m_logger) << "triggerFlashlight BSM Socket with socketId " << bsmId;
|
||||
DEBUG_LOG() << "triggerFlashlight BSM Socket with socketId " << bsmId;
|
||||
Telegrams::PanChoppedSignalFlashlight flash;
|
||||
flash.m_noOfFlashes = qBound(0, numberOfFlashes, 255);
|
||||
flash.m_pauseDuration = qBound(1, pauseBetweenFlashesSec, 10);
|
||||
@@ -83,7 +83,7 @@ bool SocketHandler::triggerFlashlightPulse(int bsmId, const QString &hostname,
|
||||
Socket *s = hostname.isEmpty() ? getSocketForBsm(bsmId) : getSocketForBsm(hostname);
|
||||
if (!s)
|
||||
return false;
|
||||
DEBUG_LOG(m_logger) << "triggerFlashlightPulse BSM Socket with socketId " << bsmId
|
||||
DEBUG_LOG() << "triggerFlashlightPulse BSM Socket with socketId " << bsmId
|
||||
<< " hostname=" << hostname
|
||||
<< " numberOfFlashes=" << numberOfFlashes
|
||||
<< " pauseDuration=" << pauseDuration
|
||||
@@ -118,12 +118,12 @@ bool SocketHandler::triggerFlashlights(int numberOfFlashes,
|
||||
++cntSocketsActive;
|
||||
}
|
||||
else
|
||||
WARNING_LOG(m_logger) << "BSM " << s->bsmConfig().id
|
||||
WARNING_LOG() << "BSM " << s->bsmConfig().id
|
||||
<< " is not connected - can not activate flash light";
|
||||
}
|
||||
if (cntSocketsActive == 0)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "No active bsm - can not trigger flash light for all bsm";
|
||||
WARNING_LOG() << "No active bsm - can not trigger flash light for all bsm";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -184,13 +184,13 @@ void SocketHandler::onDataAvailable(int id, const QByteArray &data)
|
||||
void SocketHandler::onSocketConnected(int id)
|
||||
{
|
||||
requestVersion(id);
|
||||
DEBUG_LOG(m_logger) << "BSM Socket with id " << id << " connected";
|
||||
DEBUG_LOG() << "BSM Socket with id " << id << " connected";
|
||||
m_bsmStateTimer.start();
|
||||
}
|
||||
|
||||
void SocketHandler::onSocketDisconnected(int id)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BSM Socket with id " << id << " disconnected";
|
||||
DEBUG_LOG() << "BSM Socket with id " << id << " disconnected";
|
||||
m_socketData[id].clear();
|
||||
m_bsmStateTimer.start();
|
||||
}
|
||||
@@ -216,12 +216,12 @@ Socket *SocketHandler::getSocketForBsm(int bsmId)
|
||||
Socket *s = m_sockets.value(bsmId);
|
||||
if (!s)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Got invalid bsm id (" << bsmId << ") to trigger flashlight";
|
||||
WARNING_LOG() << "Got invalid bsm id (" << bsmId << ") to trigger flashlight";
|
||||
return nullptr;
|
||||
}
|
||||
if (!s->isConnected())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Bsm with id " << bsmId
|
||||
WARNING_LOG() << "Bsm with id " << bsmId
|
||||
<< " is not connected - can not activate flash light";
|
||||
return nullptr;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ void SocketHandler::parseBsmTelegram(int id, const QByteArray &baTele)
|
||||
if (!tele)
|
||||
return;
|
||||
if (tele->telId() != Telegrams::PanTelegramId::ALIVE)
|
||||
DEBUG_LOG(m_logger) << "Got tele from bsm with id " << id << ": " << tele->print();
|
||||
DEBUG_LOG() << "Got tele from bsm with id " << id << ": " << tele->print();
|
||||
switch (tele->telId())
|
||||
{
|
||||
case Telegrams::PanTelegramId::ALIVE:
|
||||
@@ -317,7 +317,7 @@ void SocketHandler::parseBsmTelegram(int id, const QByteArray &baTele)
|
||||
|
||||
bool SocketHandler::requestVersion(int id)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Requesting version for BSM " << id;
|
||||
DEBUG_LOG() << "Requesting version for BSM " << id;
|
||||
Socket *s = m_sockets.value(id);
|
||||
if (!s || !s->isConnected())
|
||||
return false;
|
||||
@@ -333,7 +333,7 @@ void SocketHandler::handleDirectFire(int id, const Telegrams::PanDirectFire *tel
|
||||
|
||||
if (tele->m_ammunitionId == 0)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Got direct fire without valid ammunition - ignoring: " << tele->print();
|
||||
WARNING_LOG() << "Got direct fire without valid ammunition - ignoring: " << tele->print();
|
||||
return;
|
||||
}
|
||||
OpticalShot osNew;
|
||||
@@ -351,21 +351,21 @@ void SocketHandler::handleDirectFire(int id, const Telegrams::PanDirectFire *tel
|
||||
|
||||
void SocketHandler::handleDirectFireSummray()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "handleDirectFireSummray m_lastShots.size=" << m_lastShots.size();
|
||||
DEBUG_LOG() << "handleDirectFireSummray m_lastShots.size=" << m_lastShots.size();
|
||||
OpticalShot osNew;
|
||||
if ( m_lastShots.size() == 0)
|
||||
return;
|
||||
int distance = 3000;
|
||||
DEBUG_LOG(m_logger) << "distance=" << distance;
|
||||
DEBUG_LOG() << "distance=" << distance;
|
||||
for (const OpticalShot &os : std::as_const(m_lastShots))
|
||||
{
|
||||
int act_distance = os.deposition1 * os.deposition1 + os.deposition2 * os.deposition2;
|
||||
DEBUG_LOG(m_logger) << "act_distance=" << act_distance << " BSM-ID=" << os.id
|
||||
DEBUG_LOG() << "act_distance=" << act_distance << " BSM-ID=" << os.id
|
||||
<< " ammunitionId=" << os.ammunitionId;
|
||||
if ( act_distance < distance)
|
||||
{
|
||||
distance = act_distance;
|
||||
DEBUG_LOG(m_logger) << "distance=" << distance << " BSM-ID=" << os.id;
|
||||
DEBUG_LOG() << "distance=" << distance << " BSM-ID=" << os.id;
|
||||
osNew = os;
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -89,7 +89,6 @@ private:
|
||||
QElapsedTimer m_timerOC;
|
||||
QTimer m_cleanupQueueTimer;
|
||||
QTimer m_bsmStateTimer;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -61,22 +61,22 @@ void HandelEffect::handleEffect()
|
||||
switch (m_currentAction->aclass)
|
||||
{
|
||||
case AC_Unset:
|
||||
DEBUG_LOG(m_logger) << "---- This is unset ----";
|
||||
DEBUG_LOG() << "---- This is unset ----";
|
||||
break;
|
||||
case AC_Standard:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "---- This is a standard Action ----";
|
||||
DEBUG_LOG() << "---- This is a standard Action ----";
|
||||
if (!m_currentAction->url.isEmpty())
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "---- emit newHttpRequest(a->url):" << m_currentAction->url.toString();
|
||||
DEBUG_LOG() << "---- emit newHttpRequest(a->url):" << m_currentAction->url.toString();
|
||||
emit newHttpRequest(m_currentAction->url);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AC_Repeat:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "---- This is a Repeat Action";
|
||||
DEBUG_LOG() << "---- This is a Repeat Action";
|
||||
const RepeatAction *ra = static_cast<const RepeatAction *>(m_currentAction);
|
||||
|
||||
HandelEffect *he = new HandelEffect(this);
|
||||
@@ -92,7 +92,7 @@ void HandelEffect::handleEffect()
|
||||
case AC_Pause:
|
||||
{
|
||||
const PauseAction *pa = static_cast<const PauseAction *>(m_currentAction);
|
||||
DEBUG_LOG(m_logger) << "---- This is a Pause Action Pause=" << pa->pause
|
||||
DEBUG_LOG() << "---- This is a Pause Action Pause=" << pa->pause
|
||||
<< " comment=" << pa->comment;
|
||||
|
||||
QTimer::singleShot(pa->pause, this, &HandelEffect::handleEffect);
|
||||
@@ -102,11 +102,11 @@ void HandelEffect::handleEffect()
|
||||
}
|
||||
case AC_Bsm:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "---- This is a Bsm Action ";
|
||||
DEBUG_LOG() << "---- This is a Bsm Action ";
|
||||
const BsmAction *ba = static_cast<const BsmAction*>(m_currentAction);
|
||||
if (!ba->isNull())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "emit triggerAllFlashlights ------ atype=" << m_currentAction->atype
|
||||
DEBUG_LOG() << "emit triggerAllFlashlights ------ atype=" << m_currentAction->atype
|
||||
<< " pause=" << ba->pause
|
||||
<< " choplength=" << ba->choplength
|
||||
<< " pulses=" << ba->pulses
|
||||
@@ -120,7 +120,7 @@ void HandelEffect::handleEffect()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "--- End Action ";
|
||||
DEBUG_LOG() << "--- End Action ";
|
||||
|
||||
|
||||
QTimer::singleShot(0, this, &HandelEffect::handleEffect);
|
||||
|
||||
+33
-33
@@ -22,7 +22,7 @@ HandelEffects::HandelEffects(QObject *parent, const QString &loggerchannel)
|
||||
, m_getRelayStateTimer(new QTimer(this))
|
||||
, m_logger(getLogger(QStringLiteral("HandelEffects.") + loggerchannel))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "HandelEffects::init loggerchannel=" << loggerchannel;
|
||||
DEBUG_LOG() << "HandelEffects::init loggerchannel=" << loggerchannel;
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ void HandelEffects::init(const QString &controlEffectsCfg, const QString &hostna
|
||||
{
|
||||
m_xmlReader.init(controlEffectsCfg);
|
||||
|
||||
DEBUG_LOG(m_logger) << "HandelEffects::init";
|
||||
DEBUG_LOG() << "HandelEffects::init";
|
||||
m_hostname = hostname;
|
||||
m_lastDamage = -1;
|
||||
m_effectType = et;
|
||||
@@ -53,7 +53,7 @@ void HandelEffects::startEffects(int damagePercent)
|
||||
{
|
||||
if (m_lastDamage == damagePercent)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "damagePercent=" << damagePercent
|
||||
DEBUG_LOG() << "damagePercent=" << damagePercent
|
||||
<< " m_lastDamage=" << m_lastDamage
|
||||
<< " return";
|
||||
return;
|
||||
@@ -73,7 +73,7 @@ void HandelEffects::startEffects(int damagePercent)
|
||||
if (e->effectType == ET_Relay && m_effectType == ET_BsmFlash)
|
||||
continue;
|
||||
|
||||
DEBUG_LOG(m_logger) << "- HandelEffects::Starting Effect " << e << " of Type " << e->effectType << ". ----"
|
||||
DEBUG_LOG() << "- HandelEffects::Starting Effect " << e << " of Type " << e->effectType << ". ----"
|
||||
<< " name=" << e->name;
|
||||
for (const Range *range : e->constRanges())
|
||||
{
|
||||
@@ -87,7 +87,7 @@ void HandelEffects::startEffects(int damagePercent)
|
||||
|
||||
createEffectHandler(e, range);
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "- End Effect ";
|
||||
DEBUG_LOG() << "- End Effect ";
|
||||
}
|
||||
m_lastDamage = damagePercent;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ void HandelEffects::createEffectHandler(Effect *e, const Range *range)
|
||||
{
|
||||
if (m_effectType == ET_BsmFlash)
|
||||
{
|
||||
INFO_LOG(m_logger) << "setOverrides connect Flashes" ;
|
||||
INFO_LOG() << "setOverrides connect Flashes" ;
|
||||
connect(handelEffect, &HandelEffect::triggerAllFlashlights, this, &HandelEffects::triggerAllFlashlights, Qt::UniqueConnection);
|
||||
}
|
||||
else
|
||||
@@ -112,15 +112,15 @@ void HandelEffects::createEffectHandler(Effect *e, const Range *range)
|
||||
|
||||
connect(handelEffect, &HandelEffect::effectReady, this, &HandelEffects::onEffectReady);
|
||||
|
||||
DEBUG_LOG(m_logger) << "-- HandelEffects::Starting Range " << range->min << " - " << range->max
|
||||
DEBUG_LOG() << "-- HandelEffects::Starting Range " << range->min << " - " << range->max
|
||||
<< ". ----";
|
||||
|
||||
DEBUG_LOG(m_logger) << "-- Range has " << range->actions.count() << " actions";
|
||||
DEBUG_LOG() << "-- Range has " << range->actions.count() << " actions";
|
||||
|
||||
handelEffect->init(range->actions, 1);
|
||||
|
||||
QTimer::singleShot(0, handelEffect, &HandelEffect::handleEffect);
|
||||
DEBUG_LOG(m_logger) << "-- End Range ";
|
||||
DEBUG_LOG() << "-- End Range ";
|
||||
}
|
||||
|
||||
void HandelEffects::playHitSound(const int hitSoundId)
|
||||
@@ -162,18 +162,18 @@ void HandelEffects::switchRelay(const SwitchRelayValues &switchRelayValues)
|
||||
void HandelEffects::setOverrides(const QVector<BcuEffectState> &effectStates)
|
||||
{
|
||||
m_effectStates = effectStates;
|
||||
DEBUG_LOG(m_logger) << "In set overrides for " << m_hostname << ", effectStates.size: " << effectStates.size();
|
||||
DEBUG_LOG() << "In set overrides for " << m_hostname << ", effectStates.size: " << effectStates.size();
|
||||
for(const auto &es : std::as_const(m_effectStates))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "m_effectStates: es.id=" << es.id
|
||||
DEBUG_LOG() << "m_effectStates: es.id=" << es.id
|
||||
<< ", es.type=" << es.type
|
||||
<< ", es.override=" << es.effectOverride;
|
||||
}
|
||||
m_sounds = EffectOverride::EO_Auto;
|
||||
DEBUG_LOG(m_logger) << "Nun die Schleife:";
|
||||
DEBUG_LOG() << "Nun die Schleife:";
|
||||
for(const auto &es : std::as_const(effectStates))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "es.id=" << es.id
|
||||
DEBUG_LOG() << "es.id=" << es.id
|
||||
<< ", es.type=" << es.type
|
||||
<< ", es.override=" << es.effectOverride;
|
||||
switch (es.type) {
|
||||
@@ -194,14 +194,14 @@ void HandelEffects::setOverrides(const QVector<BcuEffectState> &effectStates)
|
||||
if (e->effectHandler)
|
||||
{
|
||||
disconnect(e->effectHandler, &HandelEffect::newHttpRequest, this, &HandelEffects::sendHttpRequest);
|
||||
INFO_LOG(m_logger) << "setOverrides emit triggerAllFlashlights(0,0,0,0)" ;
|
||||
INFO_LOG() << "setOverrides emit triggerAllFlashlights(0,0,0,0)" ;
|
||||
emit triggerAllFlashlights(0,0,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (es.effectOverride == BEO_Off )
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BEO_Off";
|
||||
DEBUG_LOG() << "BEO_Off";
|
||||
|
||||
QUrl url = XmlReader::createPreparedUrl(contents(), m_hostname);
|
||||
QUrlQuery query;
|
||||
@@ -260,7 +260,7 @@ void HandelEffects::setOverrides(const QVector<BcuEffectState> &effectStates)
|
||||
{
|
||||
if (e->effectHandler)
|
||||
{
|
||||
INFO_LOG(m_logger) << "setOverrides disconnect Flashes" ;
|
||||
INFO_LOG() << "setOverrides disconnect Flashes" ;
|
||||
disconnect (e->effectHandler, &HandelEffect::triggerAllFlashlights, this, &HandelEffects::triggerAllFlashlights);
|
||||
}
|
||||
}
|
||||
@@ -309,7 +309,7 @@ QVector<BcuEffectState> HandelEffects::getOverrides()
|
||||
break;
|
||||
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "getOverrides "
|
||||
DEBUG_LOG() << "getOverrides "
|
||||
<< " id=" << override.id
|
||||
<< " type=" << override.type
|
||||
<< " override" << override.effectOverride;
|
||||
@@ -335,7 +335,7 @@ void HandelEffects::sendHttpRequest(const QUrl &url)
|
||||
{
|
||||
QUrl copy = url;
|
||||
copy.setHost(m_hostname);
|
||||
DEBUG_LOG(m_logger) << "sendHttpRequest" << copy.toString();
|
||||
DEBUG_LOG() << "sendHttpRequest" << copy.toString();
|
||||
emit newHttpRequest(copy, HandleHttpQueueMessageStatus::MS_Single);
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ void HandelEffects::onRelayStateTimerTimeout()
|
||||
emit sendRelayState(m_relayState);
|
||||
m_overridesSend = false;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "send get relay-State contents()=" << contents().toString()
|
||||
DEBUG_LOG() << "send get relay-State contents()=" << contents().toString()
|
||||
<< " m_offlineCounter=" << m_offlineCounter;
|
||||
QUrl url = XmlReader::createPreparedUrl(contents(), m_hostname);
|
||||
url.setPath(QStringLiteral("/relay.php"));
|
||||
@@ -364,12 +364,12 @@ void HandelEffects::onRelayStateTimerTimeout()
|
||||
void HandelEffects::handleEgcuReplyObject(const QString &host, const QByteArray &data)
|
||||
{
|
||||
bool relayStateChanged = false;
|
||||
TRACE_LOG(m_logger) << "handleEgcuReply Object:" << data
|
||||
TRACE_LOG() << "handleEgcuReply Object:" << data
|
||||
<< " m_offlineState=" << m_offlineState;
|
||||
|
||||
if (m_offlineState)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "State wiederherstellen !!!!!!!!!!! m_offlineState=" << m_offlineState;
|
||||
DEBUG_LOG() << "State wiederherstellen !!!!!!!!!!! m_offlineState=" << m_offlineState;
|
||||
m_offlineState = false;
|
||||
setOverrides(m_effectStates);
|
||||
}
|
||||
@@ -384,7 +384,7 @@ void HandelEffects::handleEgcuReplyObject(const QString &host, const QByteArray
|
||||
rsi.id = it.key().toInt();
|
||||
rsi.state = it.value().isString() ? (it.value().toString().compare(QLatin1String("on"), Qt::CaseInsensitive) == 0) : it.value().toBool(false);
|
||||
m_relayState.relayStates.append(rsi);
|
||||
TRACE_LOG(m_logger) << "id=" << rsi.id
|
||||
TRACE_LOG() << "id=" << rsi.id
|
||||
<< " state=" << rsi.state;
|
||||
}
|
||||
if ( m_relayState.relayStates.size() == lastRelayState.relayStates.size())
|
||||
@@ -393,19 +393,19 @@ void HandelEffects::handleEgcuReplyObject(const QString &host, const QByteArray
|
||||
{
|
||||
if (m_relayState.relayStates[i].state != lastRelayState.relayStates[i].state)
|
||||
{
|
||||
TRACE_LOG(m_logger) << "Values relayStateChanged = true";
|
||||
TRACE_LOG() << "Values relayStateChanged = true";
|
||||
relayStateChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_LOG(m_logger) << "Size relayStateChanged = true";
|
||||
TRACE_LOG() << "Size relayStateChanged = true";
|
||||
relayStateChanged = true;
|
||||
}
|
||||
if ( m_offlineCounter > 1)
|
||||
{
|
||||
TRACE_LOG(m_logger) << "m_offlineCounter=" << m_offlineCounter;
|
||||
TRACE_LOG() << "m_offlineCounter=" << m_offlineCounter;
|
||||
relayStateChanged = true;
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ void HandelEffects::handleEgcuReplyObject(const QString &host, const QByteArray
|
||||
m_relayState.stateTime = QDateTime::currentMSecsSinceEpoch();
|
||||
m_relayState.offlineTime = 0;
|
||||
m_offlineCounter=0;
|
||||
DEBUG_LOG(m_logger) << "host=" << host.toLower()
|
||||
DEBUG_LOG() << "host=" << host.toLower()
|
||||
<< " relayStateChanged=" << relayStateChanged
|
||||
<< " m_overridesSend=" << m_overridesSend
|
||||
<< " m_offlineState=" << m_offlineState;
|
||||
@@ -427,7 +427,7 @@ void HandelEffects::handleEgcuReplyObject(const QString &host, const QByteArray
|
||||
|
||||
if ( m_relayState.hostname.toLower() == host.toLower() && relayStateChanged)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "emit sendRelayState(m_relayState) relayStateChanged";
|
||||
DEBUG_LOG() << "emit sendRelayState(m_relayState) relayStateChanged";
|
||||
emit sendRelayState(m_relayState);
|
||||
}
|
||||
}
|
||||
@@ -435,7 +435,7 @@ void HandelEffects::handleEgcuReplyObject(const QString &host, const QByteArray
|
||||
void HandelEffects::handleEgcuReplyArray(const QString &host, const QByteArray &data)
|
||||
{
|
||||
Q_UNUSED (host);
|
||||
TRACE_LOG(m_logger) << "handleEgcuReply Array:" << data;
|
||||
TRACE_LOG() << "handleEgcuReply Array:" << data;
|
||||
m_relayState.relayStates.clear();
|
||||
|
||||
const QJsonObject jsonObject = QJsonDocument::fromJson(data).object();
|
||||
@@ -449,7 +449,7 @@ void HandelEffects::handleEgcuReplyArray(const QString &host, const QByteArray &
|
||||
rsi.id = i;
|
||||
rsi.state = stateArray[i].isString() ? (stateArray[i].toString().compare(QLatin1String("on"), Qt::CaseInsensitive)== 0 ): stateArray[i].toBool(false);
|
||||
m_relayState.relayStates.append(rsi);
|
||||
TRACE_LOG(m_logger) << "id=" << rsi.id
|
||||
TRACE_LOG() << "id=" << rsi.id
|
||||
<< " state=" << rsi.state;
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ void HandelEffects::handleEgcuReplyArray(const QString &host, const QByteArray &
|
||||
void HandelEffects::handleEgcuReply(const QString &host, const QByteArray &data)
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "HandelEffects::handleEgcuReply host=" << host
|
||||
DEBUG_LOG() << "HandelEffects::handleEgcuReply host=" << host
|
||||
<< " m_hostname=" << m_hostname
|
||||
<< " m_overridesSend=" << m_overridesSend;
|
||||
|
||||
@@ -477,18 +477,18 @@ void HandelEffects::handleEgcuReply(const QString &host, const QByteArray &data)
|
||||
if (!jsonObject.contains(QStringLiteral("State")) )
|
||||
{
|
||||
m_overridesSend = true;
|
||||
TRACE_LOG(m_logger) << "No State return";
|
||||
TRACE_LOG() << "No State return";
|
||||
return;
|
||||
}
|
||||
const QJsonValue jsonValue = jsonObject[QStringLiteral("State")];
|
||||
if (jsonValue.isArray())
|
||||
{
|
||||
TRACE_LOG(m_logger) << "data isArray\n";
|
||||
TRACE_LOG() << "data isArray\n";
|
||||
handleEgcuReplyArray(host, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_LOG(m_logger) << "data isObject\n";
|
||||
TRACE_LOG() << "data isObject\n";
|
||||
handleEgcuReplyObject(host, data);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "xmlreader.h"
|
||||
|
||||
#include <ControlEffects/controleffects_export.h>
|
||||
#include "controleffects_export.h"
|
||||
#include <BSM/bsm_types.h>
|
||||
#include <logger.h>
|
||||
#include "handle_http_request.h"
|
||||
|
||||
+25
-25
@@ -21,11 +21,11 @@ bool XmlReader::init(const QString &effectConfigFile)
|
||||
m_contents.effects.clear();
|
||||
|
||||
QFile file(effectConfigFile);
|
||||
DEBUG_LOG(m_logger) << "open effectConfigFile: " << effectConfigFile;
|
||||
DEBUG_LOG() << "open effectConfigFile: " << effectConfigFile;
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Couldn't open EffectConfigFile: " << effectConfigFile;
|
||||
WARNING_LOG() << "Couldn't open EffectConfigFile: " << effectConfigFile;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -63,18 +63,18 @@ bool XmlReader::init(const QString &effectConfigFile)
|
||||
|
||||
if (xml.hasError())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Effect Config File had XML Errors:\n" << xml.errorString();
|
||||
ERROR_LOG() << "Effect Config File had XML Errors:\n" << xml.errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "Effect Config File Contents: " << m_contents.toString();
|
||||
DEBUG_LOG() << "Effect Config File Contents: " << m_contents.toString();
|
||||
createHttpRequests();
|
||||
return true;
|
||||
}
|
||||
|
||||
Effect *XmlReader::parseEffect(QXmlStreamReader &xml)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "- parseEffect Start";
|
||||
DEBUG_LOG() << "- parseEffect Start";
|
||||
|
||||
if (xml.tokenType() != QXmlStreamReader::StartElement ||
|
||||
xml.name() != QStringLiteral("effect"))
|
||||
@@ -125,12 +125,12 @@ Effect *XmlReader::parseEffect(QXmlStreamReader &xml)
|
||||
}
|
||||
xml.readNext();
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "- parseEffect: Name: " << e->id
|
||||
DEBUG_LOG() << "- parseEffect: Name: " << e->id
|
||||
<< ", Type: " << e->effectType
|
||||
<< ", Category: " << e->category
|
||||
<< ", Name: " << e->name
|
||||
<< ", override: " << e->override;
|
||||
DEBUG_LOG(m_logger) << "- parseEffect End. It has " << e->ranges.size() << " ranges";
|
||||
DEBUG_LOG() << "- parseEffect End. It has " << e->ranges.size() << " ranges";
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ Range *XmlReader::parseRange(QXmlStreamReader &xml)
|
||||
xml.name() != QStringLiteral("range"))
|
||||
return {};
|
||||
|
||||
DEBUG_LOG(m_logger) << "-- parseRange Start";
|
||||
DEBUG_LOG() << "-- parseRange Start";
|
||||
Range *r = new Range();
|
||||
|
||||
QXmlStreamAttributes attributes = xml.attributes();
|
||||
@@ -164,10 +164,10 @@ Range *XmlReader::parseRange(QXmlStreamReader &xml)
|
||||
|
||||
xml.readNext();
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "-- parseRange: [" << r->min << "-" << r->max << "]"
|
||||
DEBUG_LOG() << "-- parseRange: [" << r->min << "-" << r->max << "]"
|
||||
<< ", restartOnChange: " <<r->restartOnChange
|
||||
<< ", ActionCount: " << r->actions.count();
|
||||
DEBUG_LOG(m_logger) << "-- parseRange End";
|
||||
DEBUG_LOG() << "-- parseRange End";
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ Action *XmlReader::parseAction(QXmlStreamReader &xml)
|
||||
if (xml.name() == QStringLiteral("bsm"))
|
||||
return parseBsmAction(xml);
|
||||
|
||||
WARNING_LOG(m_logger) << "--- parseUnknownAction with name '" << xml.name().string() << "'cannot be handled.";
|
||||
WARNING_LOG() << "--- parseUnknownAction with name '" << xml.name().string() << "'cannot be handled.";
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -198,18 +198,18 @@ PauseAction *XmlReader::parsePauseAction(QXmlStreamReader &xml)
|
||||
xml.name() != QLatin1String("pause"))
|
||||
return {};
|
||||
|
||||
DEBUG_LOG(m_logger) << "--- parsePauseAction Start";
|
||||
DEBUG_LOG() << "--- parsePauseAction Start";
|
||||
QXmlStreamAttributes attributes = xml.attributes();
|
||||
PauseAction *p = new PauseAction();
|
||||
p->atype = static_cast<ActionType>(attributes.value(QStringLiteral("type")).toInt());
|
||||
if (attributes.hasAttribute(QStringLiteral("comment")))
|
||||
p->comment = attributes.value(QStringLiteral("comment")).toString();
|
||||
p->pause = xml.readElementText().toInt();
|
||||
DEBUG_LOG(m_logger) << "--- parsePauseAction: "
|
||||
DEBUG_LOG() << "--- parsePauseAction: "
|
||||
<< " Pause: " << p->pause
|
||||
<< ", Comment: " << p->comment;
|
||||
|
||||
DEBUG_LOG(m_logger) << "--- parsePauseAction End";
|
||||
DEBUG_LOG() << "--- parsePauseAction End";
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ RepeatAction *XmlReader::parseRepeatAction(QXmlStreamReader &xml)
|
||||
if (xml.tokenType() != QXmlStreamReader::StartElement ||
|
||||
xml.name() != QStringLiteral("repeat"))
|
||||
return {};
|
||||
DEBUG_LOG(m_logger) << "--- parseRepeatAction Start";
|
||||
DEBUG_LOG() << "--- parseRepeatAction Start";
|
||||
RepeatAction *ra = new RepeatAction();
|
||||
QXmlStreamAttributes attributes = xml.attributes();
|
||||
|
||||
@@ -244,8 +244,8 @@ RepeatAction *XmlReader::parseRepeatAction(QXmlStreamReader &xml)
|
||||
QString repetitions = QString::number(ra->count);
|
||||
if (ra->count < 0)
|
||||
repetitions = QLatin1String("Infinite");
|
||||
DEBUG_LOG(m_logger) << "--- parseRepeatAction: Repetitions: " << repetitions << ", Comment: " << ra->comment;
|
||||
DEBUG_LOG(m_logger) << "--- parseRepeatAction End";
|
||||
DEBUG_LOG() << "--- parseRepeatAction: Repetitions: " << repetitions << ", Comment: " << ra->comment;
|
||||
DEBUG_LOG() << "--- parseRepeatAction End";
|
||||
return ra;
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ Action *XmlReader::parseStandardAction(QXmlStreamReader &xml)
|
||||
xml.name() != QStringLiteral("action"))
|
||||
return {};
|
||||
|
||||
DEBUG_LOG(m_logger) << "--- parseStandardAction Start";
|
||||
DEBUG_LOG() << "--- parseStandardAction Start";
|
||||
|
||||
QXmlStreamAttributes attributes = xml.attributes();
|
||||
|
||||
@@ -269,9 +269,9 @@ Action *XmlReader::parseStandardAction(QXmlStreamReader &xml)
|
||||
a->atype = static_cast<ActionType>(attributes.value(QStringLiteral("type")).toInt());
|
||||
if (attributes.hasAttribute(QStringLiteral("comment")))
|
||||
a->comment = attributes.value(QStringLiteral("comment")).toString();
|
||||
DEBUG_LOG(m_logger) << "--- parseStandardAction: Type: " << a->atype
|
||||
DEBUG_LOG() << "--- parseStandardAction: Type: " << a->atype
|
||||
<< ", Comment: " << a->comment;
|
||||
DEBUG_LOG(m_logger) << "--- parseStandardAction End";
|
||||
DEBUG_LOG() << "--- parseStandardAction End";
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ BsmAction *XmlReader::parseBsmAction(QXmlStreamReader &xml)
|
||||
QXmlStreamAttributes attributes = xml.attributes();
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << "--- parseBsmAction Start";
|
||||
DEBUG_LOG() << "--- parseBsmAction Start";
|
||||
BsmAction *a = new BsmAction();
|
||||
a->atype = static_cast<ActionType>(attributes.value(QStringLiteral("type")).toInt());
|
||||
if (attributes.hasAttribute(QStringLiteral("comment")))
|
||||
@@ -302,14 +302,14 @@ BsmAction *XmlReader::parseBsmAction(QXmlStreamReader &xml)
|
||||
xml.readNext();
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "--- parseBsmAction: Type: " << a->atype
|
||||
DEBUG_LOG() << "--- parseBsmAction: Type: " << a->atype
|
||||
<< ", Pause: " << a->pause
|
||||
<< ", Choplength: " << a->choplength
|
||||
<< ", Count: " << a->count
|
||||
<< ", Pulses: " << a->pulses
|
||||
<< ", Pulseduration: " << a->pulseduration
|
||||
<< ", Comment: " << a->comment;
|
||||
DEBUG_LOG(m_logger) << "--- parseBsmAction End";
|
||||
DEBUG_LOG() << "--- parseBsmAction End";
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ void XmlReader::generateUrl(const Effect *e, Action *a)
|
||||
}
|
||||
url.setQuery(query);
|
||||
a->url = url;
|
||||
DEBUG_LOG(m_logger) << "Effect " << e->name << ", Action '" << a->comment << "' now has URL: " << url.toString();
|
||||
DEBUG_LOG() << "Effect " << e->name << ", Action '" << a->comment << "' now has URL: " << url.toString();
|
||||
break;
|
||||
}
|
||||
case AC_Repeat:
|
||||
@@ -397,7 +397,7 @@ void XmlReader::generateUrl(const Effect *e, Action *a)
|
||||
case AC_Pause:
|
||||
case AC_Bsm:
|
||||
default:
|
||||
DEBUG_LOG(m_logger) << "Effect " << e->name << ", Action '" << a->comment << "' of Type " << a->aclass << " needs no URL";
|
||||
DEBUG_LOG() << "Effect " << e->name << ", Action '" << a->comment << "' of Type " << a->aclass << " needs no URL";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
-3
@@ -193,9 +193,6 @@ private:
|
||||
void generateUrl(const Effect *e, Action *a);
|
||||
|
||||
XmlContents m_contents;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
+3
-4
@@ -15,7 +15,6 @@ namespace Json
|
||||
Api::Api(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_webSocketHandler(new WebSocketHandler(this))
|
||||
, m_logger(getLogger("Json.Api"))
|
||||
{
|
||||
connect(m_webSocketHandler, &WebSocketHandler::telegramReceived,
|
||||
this, &Api::onTelegramReceived);
|
||||
@@ -66,7 +65,7 @@ void Api::sendHitResult(const HitResult &hitResult, const QMap <int, Contaminati
|
||||
tele.hitResult.contaminations += csi;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << ", tele = " << tele.toJson();
|
||||
DEBUG_LOG() << Q_FUNC_INFO << ", tele = " << tele.toJson();
|
||||
|
||||
m_webSocketHandler->sendTelegram(&tele, ws);
|
||||
}
|
||||
@@ -142,7 +141,7 @@ void Api::sendEffectOverrides(const QString &segment,
|
||||
|
||||
void Api::onTelegramReceived(const std::shared_ptr<Telegrams::BaseTelegram> &tele)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "tele->telegramId(): " << tele->telegramId();
|
||||
DEBUG_LOG() << "tele->telegramId(): " << tele->telegramId();
|
||||
|
||||
if (tele->telegramId() == Telegrams::SetDamageState::telegramId())
|
||||
{
|
||||
@@ -272,7 +271,7 @@ void Api::onTelegramReceived(const std::shared_ptr<Telegrams::BaseTelegram> &tel
|
||||
emit getBsmTechnicalStatus(tel->sensorId);
|
||||
return;
|
||||
}
|
||||
WARNING_LOG(m_logger) << "Received unhandled telegram " << tele->telegramId();
|
||||
WARNING_LOG() << "Received unhandled telegram " << tele->telegramId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-2
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <Json/buildingcontroljson_export.h>
|
||||
#include "buildingcontroljson_export.h"
|
||||
#include <VWM/vwm_types.h>
|
||||
#include <BSM/bsm_types.h>
|
||||
#include <logger.h>
|
||||
@@ -77,7 +77,6 @@ private Q_SLOTS:
|
||||
void onTelegramReceived(const std::shared_ptr<Telegrams::BaseTelegram> &tele);
|
||||
private:
|
||||
WebSocketHandler *m_webSocketHandler;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
+5
-6
@@ -14,7 +14,6 @@ namespace Json
|
||||
WebSocketHandler::WebSocketHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_webSocketServer(new QWebSocketServer(QStringLiteral("BCU"), QWebSocketServer::NonSecureMode, this))
|
||||
, m_logger(getLogger("Json.WebSocketHandler"))
|
||||
{}
|
||||
|
||||
WebSocketHandler::~WebSocketHandler()
|
||||
@@ -31,7 +30,7 @@ bool WebSocketHandler::init(quint16 listenPort)
|
||||
{
|
||||
if (!m_webSocketServer->listen(QHostAddress::Any, listenPort))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Can not listen on port " << listenPort << " - aborting";
|
||||
WARNING_LOG() << "Can not listen on port " << listenPort << " - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -49,7 +48,7 @@ bool WebSocketHandler::sendTelegram(const Telegrams::BaseTelegram *tele, QWebSoc
|
||||
return false;
|
||||
|
||||
const QString jsonStr = QString::fromUtf8(tele->toJson());
|
||||
DEBUG_LOG(m_logger) << "jsonStr" << jsonStr;
|
||||
DEBUG_LOG() << "jsonStr" << jsonStr;
|
||||
|
||||
bool bOk = false;
|
||||
for (QWebSocket *ws : std::as_const(m_webSockets))
|
||||
@@ -69,7 +68,7 @@ void WebSocketHandler::onNewConnection()
|
||||
QWebSocket *ws = m_webSocketServer->nextPendingConnection();
|
||||
if (!ws)
|
||||
return;
|
||||
DEBUG_LOG(m_logger) << "New websocket connection from " << ws->peerAddress().toString() << ":" << ws->peerPort();
|
||||
DEBUG_LOG() << "New websocket connection from " << ws->peerAddress().toString() << ":" << ws->peerPort();
|
||||
|
||||
connect(ws, &QWebSocket::textMessageReceived,
|
||||
this, &WebSocketHandler::onTextMessageReceived);
|
||||
@@ -83,11 +82,11 @@ void WebSocketHandler::onNewConnection()
|
||||
|
||||
void WebSocketHandler::onTextMessageReceived(const QString &msg)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "new text message: " << msg;
|
||||
DEBUG_LOG() << "new text message: " << msg;
|
||||
auto tele = std::shared_ptr<Telegrams::BaseTelegram>(Telegrams::BaseTelegram::telegramFromJson(msg.toUtf8()));
|
||||
if (!tele)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Error parsing incoming json data: '" << msg << "'";
|
||||
WARNING_LOG() << "Error parsing incoming json data: '" << msg << "'";
|
||||
return;
|
||||
}
|
||||
emit telegramReceived(tele);
|
||||
|
||||
-1
@@ -43,7 +43,6 @@ private Q_SLOTS:
|
||||
private:
|
||||
QWebSocketServer *m_webSocketServer;
|
||||
QSet<QWebSocket *> m_webSockets;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -29,7 +29,7 @@ Test::~Test()
|
||||
|
||||
void Test::hitResult(const BuildingControlUnit::HitResult &result)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Hit Result: sensorId = " << result.sensorId
|
||||
INFO_LOG() << "Hit Result: sensorId = " << result.sensorId
|
||||
<< ", originatorId = " << result.originatorId
|
||||
<< ", chargeTypeId = " << result.chargeTypeId
|
||||
<< ", dmgPercentOld = " << result.damagePercentOld
|
||||
@@ -54,18 +54,18 @@ void Test::test1()
|
||||
const auto hitPos = BuildingControlUnit::VWM::Math::checkBsmPosition(bsm.position, bsm.direction, rooms);
|
||||
if (hitPos.state != BuildingControlUnit::VWM::HitPosition::State::OuterWall)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Effect on bsm " << bsm.id << " does not hit building ! - position: "
|
||||
WARNING_LOG() << "Effect on bsm " << bsm.id << " does not hit building ! - position: "
|
||||
<< bsm.position << ", direction: " << bsm.direction;
|
||||
}
|
||||
else if (hitPos.distance < 0)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Effect on bsm " << bsm.id << " results in hit pos behind a wall ("
|
||||
WARNING_LOG() << "Effect on bsm " << bsm.id << " results in hit pos behind a wall ("
|
||||
<< hitPos.distance << "m) instead in front - BSM is not modelled in the correct place: "
|
||||
<< bsm.position << ", direction: " << bsm.direction << ", roomId which was hit: " << hitPos.roomId;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BSM with id " << bsm.id << " looks fine - room which will be hit: " << hitPos.roomId;
|
||||
DEBUG_LOG() << "BSM with id " << bsm.id << " looks fine - room which will be hit: " << hitPos.roomId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -24,5 +24,4 @@ private Q_SLOTS:
|
||||
void test5();
|
||||
void test6();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
+49
-49
@@ -38,7 +38,7 @@ bool Api::init(const QString &chargesConfig,
|
||||
const BuildingBsmConfig &bsmConfig,
|
||||
const bool initBuilding)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "chargesConfig=" << chargesConfig;
|
||||
DEBUG_LOG() << "chargesConfig=" << chargesConfig;
|
||||
if (!XmlReader::readCharges(chargesConfig, m_chargeMap))
|
||||
return false;
|
||||
if (!XmlReader::readBuilding(vulBuildingConfig, m_building))
|
||||
@@ -48,21 +48,21 @@ bool Api::init(const QString &chargesConfig,
|
||||
QString fltXml = QString(QStringLiteral("/opt/BuildingModels/StaticMeshes/%1.flt.xml")).arg(m_building.name());
|
||||
if (!XmlReader::readBuildingGeometry(fltXml, m_buildingRoomGeometry ))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error reading buildingRoomGeometry from file: " << fltXml << "'";
|
||||
ERROR_LOG() << "Error reading buildingRoomGeometry from file: " << fltXml << "'";
|
||||
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "Building buildingRoomGeometry read successfully from file: " << fltXml << "'";
|
||||
DEBUG_LOG() << "Building buildingRoomGeometry read successfully from file: " << fltXml << "'";
|
||||
|
||||
|
||||
|
||||
int numberOfRemoved = m_building.cleanupPolygons();
|
||||
int numberOfDuplicates = m_building.checkPolygons();
|
||||
DEBUG_LOG(m_logger) << "Building cleanupPolygons: " << m_building.name() << "' -> " << numberOfRemoved << " points removed";
|
||||
DEBUG_LOG() << "Building cleanupPolygons: " << m_building.name() << "' -> " << numberOfRemoved << " points removed";
|
||||
if (numberOfDuplicates > 0)
|
||||
ERROR_LOG(m_logger) << "Building checkPolygons: " << m_building.name() << "' -> " << numberOfDuplicates << " duplicates";
|
||||
ERROR_LOG() << "Building checkPolygons: " << m_building.name() << "' -> " << numberOfDuplicates << " duplicates";
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Building checkPolygons: " << m_building.name() << "' -> " << numberOfDuplicates << " duplicates";
|
||||
DEBUG_LOG() << "Building checkPolygons: " << m_building.name() << "' -> " << numberOfDuplicates << " duplicates";
|
||||
|
||||
|
||||
m_bsmMap = bsmConfig.bsmMap;
|
||||
@@ -85,7 +85,7 @@ void Api::onHitOptical(qint64 timeMSec, int sensorId, int originatorId, int char
|
||||
|
||||
if (!bsm.isValid())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Given bsm id " << sensorId << " is not in our internal bsm list!";
|
||||
WARNING_LOG() << "Given bsm id " << sensorId << " is not in our internal bsm list!";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ void Api::onHitOptical(qint64 timeMSec, int sensorId, int originatorId, int char
|
||||
|
||||
void Api::onSetEffectStatesRequest(const QString &hostname, const QVector<BcuEffectState> &effectStates)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSetEffectStatesRequest:"
|
||||
DEBUG_LOG() << "onSetEffectStatesRequest:"
|
||||
<< " hostname= " << hostname
|
||||
<< " effectStes.zize=" << effectStates.size();
|
||||
|
||||
@@ -120,7 +120,7 @@ void Api::onSetEffectStatesRequest(const QString &hostname, const QVector<BcuEff
|
||||
if (es.effectOverride == BcuEffectOverride::BEO_Off)
|
||||
{
|
||||
overridesObj.insert(QStringLiteral("flash"), 0);
|
||||
DEBUG_LOG(m_logger) << "flash = 0";
|
||||
DEBUG_LOG() << "flash = 0";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,14 +137,14 @@ void Api::onSetEffectStatesRequest(const QString &hostname, const QVector<BcuEff
|
||||
{
|
||||
QJsonObject relayStateObj;
|
||||
relayStateObj[QString::number(es.id)]=es.effectOverride;
|
||||
DEBUG_LOG(m_logger) << "relay = " << QString::number(es.id)
|
||||
DEBUG_LOG() << "relay = " << QString::number(es.id)
|
||||
<< " " << es.effectOverride;
|
||||
relayStateArray.append(relayStateObj);
|
||||
}
|
||||
else if (es.type == BcuEffectType::BET_BackgroundSound)
|
||||
{
|
||||
overridesObj.insert(QStringLiteral("sound"), es.effectOverride);
|
||||
DEBUG_LOG(m_logger) << "sound=" << es.effectOverride;
|
||||
DEBUG_LOG() << "sound=" << es.effectOverride;
|
||||
}
|
||||
}
|
||||
overridesObj.insert(QStringLiteral("relays"), relayStateArray);
|
||||
@@ -154,7 +154,7 @@ void Api::onSetEffectStatesRequest(const QString &hostname, const QVector<BcuEff
|
||||
propertiesObj[QStringLiteral("Overrides")] = overridesObj;
|
||||
|
||||
QString totalString = QString::fromLatin1(QJsonDocument(propertiesObj).toJson(QJsonDocument::Compact));
|
||||
DEBUG_LOG(m_logger) << "totalString=" << totalString;
|
||||
DEBUG_LOG() << "totalString=" << totalString;
|
||||
m_building.setSegmentProperties(hostname,totalString);
|
||||
StateStore::saveState(m_building, m_lastHitResult, m_contaminationStates);
|
||||
}
|
||||
@@ -264,15 +264,15 @@ void Api::onHitEcc(int originatorId, DamageState damageState, const QVector<int>
|
||||
|
||||
void Api::onSetContaminationState(const std::vector<ContaminationState> &contaminationStates)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "contaminationStates.size=" << contaminationStates.size();
|
||||
DEBUG_LOG() << "contaminationStates.size=" << contaminationStates.size();
|
||||
|
||||
for (const auto &newcs : contaminationStates)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "newcs.damagePercentNew=" << newcs.damagePercentNew
|
||||
DEBUG_LOG() << "newcs.damagePercentNew=" << newcs.damagePercentNew
|
||||
<< " m_lastHitResult.damagePercentNew=" << m_lastHitResult.damagePercentNew;
|
||||
if ( newcs.damagePercentNew > m_lastHitResult.damagePercentNew)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "newcs.damagePercentNew=" << newcs.damagePercentNew;
|
||||
DEBUG_LOG() << "newcs.damagePercentNew=" << newcs.damagePercentNew;
|
||||
m_lastHitResult.damagePercentNew = newcs.damagePercentNew;
|
||||
}
|
||||
if (m_contaminationStates.contains(newcs.aesId))
|
||||
@@ -302,7 +302,7 @@ void Api::onSetContaminationState(const std::vector<ContaminationState> &contami
|
||||
else
|
||||
m_contaminationStates.insert(newcs.aesId, newcs);
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "onSetContaminationState emit hitResult "
|
||||
DEBUG_LOG() << "onSetContaminationState emit hitResult "
|
||||
<< " m_lastHitResult.damagePercentNew=" << m_lastHitResult.damagePercentNew;
|
||||
emit hitResult(m_lastHitResult, m_contaminationStates, false);
|
||||
StateStore::saveState(m_building, m_lastHitResult, m_contaminationStates);
|
||||
@@ -311,7 +311,7 @@ void Api::onSetContaminationState(const std::vector<ContaminationState> &contami
|
||||
void Api::onResetContaminations()
|
||||
{
|
||||
m_contaminationStates.clear();
|
||||
DEBUG_LOG(m_logger) << "onResetContaminations emit hitResult";
|
||||
DEBUG_LOG() << "onResetContaminations emit hitResult";
|
||||
m_lastHitResult.chargeTypeId = 0;
|
||||
m_lastHitResult.originatorId = 0;
|
||||
m_lastHitResult.originatorType = BuildingControlUnit::OriginatorType::ECC;
|
||||
@@ -338,7 +338,7 @@ void Api::onHitCes(const qint64 effectTimeMSec, const int chargeTypeId,
|
||||
|
||||
hit.position.setZ(1);
|
||||
|
||||
INFO_LOG(m_logger) << "XXXXX CES Hit = " << hit;
|
||||
INFO_LOG() << "XXXXX CES Hit = " << hit;
|
||||
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ void Api::onHitCes(const qint64 effectTimeMSec, const int chargeTypeId,
|
||||
posTmp.setZ(10000);
|
||||
const LtsUtils::QPoint3D direction(0,0,1);
|
||||
const auto hitPosTmp = BuildingControlUnit::VWM::Math::checkBsmPosition(posTmp, direction, m_building.rooms());
|
||||
INFO_LOG(m_logger) << "XXXXX hitPosTmp after checkBsmPosition = " << hitPosTmp;
|
||||
INFO_LOG() << "XXXXX hitPosTmp after checkBsmPosition = " << hitPosTmp;
|
||||
if (hitPosTmp.state != BuildingControlUnit::VWM::HitPosition::State::NoHit)
|
||||
{
|
||||
auto room = m_building.rooms().value(hitPosTmp.roomId);
|
||||
@@ -382,7 +382,7 @@ void Api::onHitCes(const qint64 effectTimeMSec, const int chargeTypeId,
|
||||
NearestWall nearestWall;
|
||||
if (hitPos.state == BuildingControlUnit::VWM::HitPosition::State::NoHit)
|
||||
{
|
||||
INFO_LOG(m_logger) << "XXXXX CES Hit outside building - searching nearest wall ...";
|
||||
INFO_LOG() << "XXXXX CES Hit outside building - searching nearest wall ...";
|
||||
|
||||
double distanceOut = 0;
|
||||
LtsUtils::QPoint3D directionWallElementPointToDetonationOut;
|
||||
@@ -399,14 +399,14 @@ void Api::onHitCes(const qint64 effectTimeMSec, const int chargeTypeId,
|
||||
|
||||
if (hitPos.state == BuildingControlUnit::VWM::HitPosition::State::NoHit)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Internal error - could not find impact position on building "
|
||||
WARNING_LOG() << "Internal error - could not find impact position on building "
|
||||
<< m_building.name() << " with impact pos " << posImpactOnGround;
|
||||
}
|
||||
INFO_LOG(m_logger) << "XXXXX Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
|
||||
INFO_LOG() << "XXXXX Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
|
||||
<< " (p=" << hit.direction+posImpactOnGround << ")"
|
||||
<< " ; nearestWall.roomId=" << nearestWall.roomId;
|
||||
for (auto item : std::as_const(nearestWall.wallElement))
|
||||
DEBUG_LOG(m_logger) << "Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
|
||||
DEBUG_LOG() << "Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
|
||||
<< " (p=" << hit.direction+posImpactOnGround
|
||||
<< " - " << item;
|
||||
|
||||
@@ -417,7 +417,7 @@ void Api::onHitCes(const qint64 effectTimeMSec, const int chargeTypeId,
|
||||
|
||||
const LtsUtils::QPoint3D ¢er = centerOfWallElement3D(nearestWall.wallElement);
|
||||
|
||||
INFO_LOG(m_logger) << "XXXXX Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
|
||||
INFO_LOG() << "XXXXX Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
|
||||
<< ", m_building.name=" << m_building.name()
|
||||
<< ", m_building.modelId=" << m_building.modelId()
|
||||
<< ", nearestWall.roomId=" << nearestWall.roomId
|
||||
@@ -436,7 +436,7 @@ NearestWall Api::findNearestWall(const LtsUtils::QPoint3D &detonationLocation, d
|
||||
NearestWall nearestWall;
|
||||
distanceOut = std::numeric_limits<double>::max();
|
||||
|
||||
INFO_LOG(m_logger) << "XXXXX searching nearest wall ...";
|
||||
INFO_LOG() << "XXXXX searching nearest wall ...";
|
||||
for (const Room &room : std::as_const(m_building.rooms()))
|
||||
{
|
||||
for (const OuterWall &wall : std::as_const(room.outerWalls()))
|
||||
@@ -446,13 +446,13 @@ NearestWall Api::findNearestWall(const LtsUtils::QPoint3D &detonationLocation, d
|
||||
for (const LtsUtils::QPoint3D &p : std::as_const(we))
|
||||
{
|
||||
const double dist = (detonationLocation - p).length();
|
||||
DEBUG_LOG(m_logger) << "Room[" << room.id() << "]: " << p << ", dist = " << dist;
|
||||
DEBUG_LOG() << "Room[" << room.id() << "]: " << p << ", dist = " << dist;
|
||||
if (dist >= distanceOut)
|
||||
continue;
|
||||
|
||||
|
||||
distanceOut = dist;
|
||||
INFO_LOG(m_logger) << "New min distance " << dist << " Room[" << room.id() << "]: " << p;
|
||||
INFO_LOG() << "New min distance " << dist << " Room[" << room.id() << "]: " << p;
|
||||
directionWallElementPointToDetonationOut = p - detonationLocation;
|
||||
|
||||
nearestWall.roomId = room.id();
|
||||
@@ -486,7 +486,7 @@ void Api::onHitCes3D_Evaluation(const qint64 effectTimeMSec,
|
||||
|
||||
|
||||
|
||||
INFO_LOG(m_logger) << "XXXXXXXXXX CES Hit 3D = " << hit
|
||||
INFO_LOG() << "XXXXXXXXXX CES Hit 3D = " << hit
|
||||
<< ", detonationLocation = " << detonationLocation
|
||||
<< ", detonationDistance = " << detonationDistance
|
||||
<< ", chargeTypeId = " << chargeTypeId
|
||||
@@ -514,16 +514,16 @@ void Api::onHitCes3D_Evaluation(const qint64 effectTimeMSec,
|
||||
roomsWithDetonation = m_buildingRoomGeometry.pointIsInWhichRooms(detonationLocation);
|
||||
if (roomsWithDetonation.isEmpty())
|
||||
{
|
||||
INFO_LOG(m_logger) << "XXXX Building '" << m_building.name() << "'"
|
||||
INFO_LOG() << "XXXX Building '" << m_building.name() << "'"
|
||||
<< ", detonationLocation = " << detonationLocation
|
||||
<< " -> found no room";
|
||||
} else {
|
||||
if (roomsWithDetonation.size() == 1)
|
||||
INFO_LOG(m_logger) << "XXXX Building '" << m_building.name() << "'"
|
||||
INFO_LOG() << "XXXX Building '" << m_building.name() << "'"
|
||||
<< ", detonationLocation = " << detonationLocation
|
||||
<< " -> found just one room: " << roomsWithDetonation.first();
|
||||
else
|
||||
INFO_LOG(m_logger) << "XXXX Building '" << m_building.name() << "'"
|
||||
INFO_LOG() << "XXXX Building '" << m_building.name() << "'"
|
||||
<< ", detonationLocation = " << detonationLocation
|
||||
<< " -> found several rooms, choose first: " << roomsWithDetonation.first();
|
||||
|
||||
@@ -541,7 +541,7 @@ void Api::onHitCes3D_Evaluation(const qint64 effectTimeMSec,
|
||||
LtsUtils::QPoint3D directionWallElementPointToDetonationOut;
|
||||
NearestWall nearestWall = findNearestWall(detonationLocation, distanceOut, directionWallElementPointToDetonationOut);
|
||||
|
||||
INFO_LOG(m_logger) << "XXXXX CES Hit outside building - searching nearest wall ..."
|
||||
INFO_LOG() << "XXXXX CES Hit outside building - searching nearest wall ..."
|
||||
<< ", detonationDistance = " << detonationDistance
|
||||
<< ", nearestWall.roomId = " << nearestWall.roomId;
|
||||
|
||||
@@ -588,7 +588,7 @@ void Api::onHitCes3D_Evaluation(const qint64 effectTimeMSec,
|
||||
bool hitSuccess = m_building.hit(LtsUtils::QPoint3D(), LtsUtils::QPoint3D(),
|
||||
charge, &hitPosPreCalculated);
|
||||
|
||||
INFO_LOG(m_logger) << "onHitCes3D_Evaluation hitSuccess=" << hitSuccess;
|
||||
INFO_LOG() << "onHitCes3D_Evaluation hitSuccess=" << hitSuccess;
|
||||
|
||||
result.rooms = m_building.roomStates();
|
||||
result.damageState = m_building.damageState();
|
||||
@@ -627,7 +627,7 @@ void Api::onFortifyFactorRequest(int originatorId, const QVector<FortifyInfo> &f
|
||||
|
||||
void Api::onRelayStatesRequest(const QString &hostname, const QVector<RelayStateInfo> &relayStateInfos)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onRelayStateRequest hostname=" << hostname
|
||||
DEBUG_LOG() << "onRelayStateRequest hostname=" << hostname
|
||||
<< " only hanlde in svcBuildings"
|
||||
<< " relayStateInfos.size()=" << relayStateInfos.size();
|
||||
}
|
||||
@@ -649,14 +649,14 @@ void Api::sendOverrides()
|
||||
|
||||
QJsonObject docObj = QJsonObject(doc.object());
|
||||
|
||||
DEBUG_LOG(m_logger) << "sendOverrides hostname=" << hostname
|
||||
DEBUG_LOG() << "sendOverrides hostname=" << hostname
|
||||
<< " properties=" << properties;
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "sendOverrides hostname=" << hostname
|
||||
DEBUG_LOG() << "sendOverrides hostname=" << hostname
|
||||
<< " properties=" << properties << "BCU-Flash";
|
||||
BcuEffectState bcuEffectState;
|
||||
bcuEffectState.id = 1;
|
||||
@@ -677,7 +677,7 @@ void Api::sendOverrides()
|
||||
}
|
||||
if (eo != BcuEffectOverride::BEO_Auto)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "bcuEffectState.effectOverride = eo" << eo;
|
||||
DEBUG_LOG() << "bcuEffectState.effectOverride = eo" << eo;
|
||||
bcuEffectState.effectOverride = eo;
|
||||
emit newOverrides({}, {bcuEffectState});
|
||||
}
|
||||
@@ -726,7 +726,7 @@ void Api::sendHitToVwm(const Hit &hit)
|
||||
{
|
||||
m_hitsSinceLastInit += hit;
|
||||
|
||||
INFO_LOG(m_logger) << " XXXXX sendHitToVwm, Incoming hit=" << hit
|
||||
INFO_LOG() << " XXXXX sendHitToVwm, Incoming hit=" << hit
|
||||
<< " hit.chargeTypeId=" << hit.chargeTypeId
|
||||
<< " originatorId=" << hit.originatorId
|
||||
<< " typeOfHit=" << hit.typeOfHit;
|
||||
@@ -753,7 +753,7 @@ void Api::sendHitToVwm(const Hit &hit)
|
||||
charge.penetrationEffect = hit.penetrationFactor;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "charge=" << charge.chargeTypeId
|
||||
DEBUG_LOG() << "charge=" << charge.chargeTypeId
|
||||
<< " destructiveFactor" << charge.destructiveFactor
|
||||
<< " penetrationEffect" << charge.penetrationEffect;
|
||||
chargeOrg = charge;
|
||||
@@ -770,23 +770,23 @@ void Api::sendHitToVwm(const Hit &hit)
|
||||
|
||||
LtsUtils::QPoint3D dummyDist = hit.position - hit.direction;
|
||||
|
||||
INFO_LOG(m_logger) << " XXXX CES outside bulding, reduce charge: " << charge
|
||||
INFO_LOG() << " XXXX CES outside bulding, reduce charge: " << charge
|
||||
<< ", hit.position " << hit.position
|
||||
<< ", hit.direction " << hit.direction
|
||||
<< ", dummyDist " << dummyDist.length();
|
||||
charge.destructiveFactor *= 0.5;
|
||||
charge.penetrationEffect *= 0.5;
|
||||
INFO_LOG(m_logger) << " XXXX CES outside bulding, reduce charge: " << charge;
|
||||
INFO_LOG() << " XXXX CES outside bulding, reduce charge: " << charge;
|
||||
}
|
||||
|
||||
if (!charge.isValid())
|
||||
{
|
||||
if (hit.originatorType == OriginatorType::CesHit)
|
||||
WARNING_LOG(m_logger) << "Charge with id " << hit.chargeTypeId
|
||||
WARNING_LOG() << "Charge with id " << hit.chargeTypeId
|
||||
<< " not configured - can not caluclate impact effect for this charge";
|
||||
else
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Direct charge with id " << hit.chargeTypeId
|
||||
WARNING_LOG() << "Direct charge with id " << hit.chargeTypeId
|
||||
<< " not configured - can not caluclate impact effect for this charge";
|
||||
emit unknownDirectHit(hit.sensorId);
|
||||
}
|
||||
@@ -794,7 +794,7 @@ void Api::sendHitToVwm(const Hit &hit)
|
||||
}
|
||||
if (!m_building.hit(hit.position, hit.direction, charge))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Detected hit was outside of the building - ignored";
|
||||
WARNING_LOG() << "Detected hit was outside of the building - ignored";
|
||||
break;
|
||||
}
|
||||
result.rooms = m_building.roomStates();
|
||||
@@ -832,7 +832,7 @@ void Api::sendHitToVwm(const Hit &hit)
|
||||
{
|
||||
case DamageState::NoDamage:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Hit OC/ECC with NoDamage";
|
||||
DEBUG_LOG() << "Hit OC/ECC with NoDamage";
|
||||
m_building.init();
|
||||
|
||||
result.effectSoundId = Settings::effectSoundIdEccActivate();
|
||||
@@ -855,7 +855,7 @@ void Api::sendHitToVwm(const Hit &hit)
|
||||
}
|
||||
case DamageState::Destroyed:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Hit OC/ECC with Destroyed";
|
||||
DEBUG_LOG() << "Hit OC/ECC with Destroyed";
|
||||
const DamageState dsOld = m_building.damageState();
|
||||
|
||||
m_building.destroyAllRooms();
|
||||
@@ -879,14 +879,14 @@ void Api::sendHitToVwm(const Hit &hit)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
WARNING_LOG(m_logger) << "Invalid damage state override given: " << hit.damageStateOverride;
|
||||
WARNING_LOG() << "Invalid damage state override given: " << hit.damageStateOverride;
|
||||
result = HitResult();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OriginatorType::Unknown:
|
||||
WARNING_LOG(m_logger) << "Unknown originator type given: " << hit.originatorType;
|
||||
WARNING_LOG() << "Unknown originator type given: " << hit.originatorType;
|
||||
result = HitResult();
|
||||
break;
|
||||
}
|
||||
@@ -905,7 +905,7 @@ const Charge Api::chargeFromChargeTypeId(int chargeTypeId) const
|
||||
|
||||
for (auto i = m_chargeMap.cbegin(), end = m_chargeMap.cend(); i != end; ++i)
|
||||
{
|
||||
TRACE_LOG(m_logger) << "key=" << i.key() << " value=" << i.value();
|
||||
TRACE_LOG() << "key=" << i.key() << " value=" << i.value();
|
||||
if ( chargeTypeId == i.value().id)
|
||||
return m_chargeMap.value(i.key());
|
||||
}
|
||||
|
||||
+1
-2
@@ -8,7 +8,7 @@
|
||||
#include <logger.h>
|
||||
#include "vwm_building.h"
|
||||
#include "vwm_types.h"
|
||||
#include <VWM/buildingcontrolvwm_export.h>
|
||||
#include "buildingcontrolvwm_export.h"
|
||||
|
||||
namespace BuildingControlUnit
|
||||
{
|
||||
@@ -86,7 +86,6 @@ private:
|
||||
QMap <int, ContaminationState> m_contaminationStates;
|
||||
Building m_building;
|
||||
BuildingRoomGeometry m_buildingRoomGeometry;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
+12
-12
@@ -354,7 +354,7 @@ int Building::cleanupDublicatePointsInPolygon(int roomId, int idx, int subIdx, c
|
||||
auto p2 = points.at(j);
|
||||
if (qFuzzyCompare(p1, p2))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Building '" << m_name << "' -> "
|
||||
DEBUG_LOG() << "Building '" << m_name << "' -> "
|
||||
<< "Polygon point " << i << " (" << p1 << ") and " << j << " (" << p2
|
||||
<< ") in room " << roomId << ", " << type << "[" << idx
|
||||
<< "], element[" << subIdx << "] are the same! -> REMOVE";
|
||||
@@ -410,7 +410,7 @@ QVector<HitRoom> Building::roomStates() const
|
||||
hr.fortifyFactor = room.fortifyFactor();
|
||||
hr.directHit = room.isDirectHit();
|
||||
ret += hr;
|
||||
DEBUG_LOG(m_logger) << "HitRoom " << hr.roomId
|
||||
DEBUG_LOG() << "HitRoom " << hr.roomId
|
||||
<< " damage: " << hr.damagePercent
|
||||
<< "%, remainEffect: " << hr.remainingEffectPercent << "%"
|
||||
<< ", remainingEffectChargeTypeId: " << hr.remainingEffectChargeTypeId << "%"
|
||||
@@ -448,7 +448,7 @@ void Building::setRoomState(DamageState damageState, const QVector<int> &afffect
|
||||
auto it = m_rooms.find(roomId);
|
||||
if (it == m_rooms.end())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Could not find room with id " << roomId;
|
||||
WARNING_LOG() << "Could not find room with id " << roomId;
|
||||
continue;
|
||||
}
|
||||
if (damageState == DamageState::Destroyed)
|
||||
@@ -465,7 +465,7 @@ void Building::setFortifyInfo(const QVector<FortifyInfo> &foritfyInfos)
|
||||
auto it = m_rooms.find(info.roomId);
|
||||
if (it == m_rooms.end())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Could not find room with id " << info.roomId;
|
||||
WARNING_LOG() << "Could not find room with id " << info.roomId;
|
||||
continue;
|
||||
}
|
||||
Room &room = it.value();
|
||||
@@ -538,14 +538,14 @@ bool Building::hit(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &dir,
|
||||
const bool bBelowGround = isLastHitPositionBelowGroundHack();
|
||||
if (bBelowGround)
|
||||
{
|
||||
INFO_LOG(m_logger) << " XXXX CES belowGround, reduce charge: " << charge;
|
||||
INFO_LOG() << " XXXX CES belowGround, reduce charge: " << charge;
|
||||
charge.destructiveFactor *= 0.25;
|
||||
charge.penetrationEffect *= 0.25;
|
||||
INFO_LOG(m_logger) << " XXXX CES belowGround, reduce charge: " << charge;
|
||||
INFO_LOG() << " XXXX CES belowGround, reduce charge: " << charge;
|
||||
}
|
||||
|
||||
|
||||
INFO_LOG(m_logger) << "XXXXX HitPosition: state=" << m_lastHitPosition.state
|
||||
INFO_LOG() << "XXXXX HitPosition: state=" << m_lastHitPosition.state
|
||||
<< ", m_name=" << m_name
|
||||
<< ", m_modelId=" << m_modelId
|
||||
<< ", roomId=" << m_lastHitPosition.roomId
|
||||
@@ -560,7 +560,7 @@ bool Building::hit(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &dir,
|
||||
Room &hitRoom = m_rooms[m_lastHitPosition.roomId];
|
||||
if (!hitRoom.isValid())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Internal error in hit calculation - could not find room with id " << m_lastHitPosition.roomId;
|
||||
ERROR_LOG() << "Internal error in hit calculation - could not find room with id " << m_lastHitPosition.roomId;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -651,7 +651,7 @@ QMap<int, Building::NeighboursToCheck> Building::checkHitNeighbours(const QMap<i
|
||||
auto itRoom = m_rooms.find(neighbourRoomId);
|
||||
if (itRoom == m_rooms.end())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Could not find room with id " << neighbourRoomId;
|
||||
WARNING_LOG() << "Could not find room with id " << neighbourRoomId;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -670,7 +670,7 @@ QMap<int, Building::NeighboursToCheck> Building::checkHitNeighbours(const QMap<i
|
||||
|
||||
const double oldRe = neighbour.remainingEffect();
|
||||
neighbour.setRemainingEffect(neighbourRoom.remainEffect * TF);
|
||||
DEBUG_LOG(m_logger) << "room " << neighbourRoomId << " remaining effect old: "
|
||||
DEBUG_LOG() << "room " << neighbourRoomId << " remaining effect old: "
|
||||
<< oldRe << " -> new: " << neighbour.remainingEffect();
|
||||
|
||||
|
||||
@@ -740,7 +740,7 @@ int Building::checkDublicatePointsInPolygon(int roomId, int idx, int subIdx, con
|
||||
if (qFuzzyCompare(p1, p2))
|
||||
{
|
||||
++numberOfDuplicates;
|
||||
WARNING_LOG(m_logger) << "Building '" << m_name << "' -> "
|
||||
WARNING_LOG() << "Building '" << m_name << "' -> "
|
||||
<< "Polygon point " << i << " (" << p1 << ") and " << j << " (" << p2
|
||||
<< ") in room " << roomId << ", " << type << "[" << idx
|
||||
<< "], element[" << subIdx << "] are the same! (size=" << points.size() << ")";
|
||||
@@ -750,7 +750,7 @@ int Building::checkDublicatePointsInPolygon(int roomId, int idx, int subIdx, con
|
||||
|
||||
if (numberOfDuplicates > 0)
|
||||
for (auto point : points)
|
||||
WARNING_LOG(m_logger) << "Building '" << m_name << "' -> " << "point =" << point << " (same points)";
|
||||
WARNING_LOG() << "Building '" << m_name << "' -> " << "point =" << point << " (same points)";
|
||||
return numberOfDuplicates;
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -9,7 +9,7 @@
|
||||
#include <LtsUtilsCore/qpoint3d.h>
|
||||
#include <logger.h>
|
||||
#include "vwm_types.h"
|
||||
#include <VWM/buildingcontrolvwm_export.h>
|
||||
#include "buildingcontrolvwm_export.h"
|
||||
|
||||
namespace BuildingControlUnit
|
||||
{
|
||||
@@ -250,9 +250,7 @@ private:
|
||||
QString m_buildingProperties;
|
||||
QMap<QString, QString> m_segmentProperties;
|
||||
|
||||
HitPosition m_lastHitPosition;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
HitPosition m_lastHitPosition;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+11
-11
@@ -17,30 +17,30 @@ namespace VWM
|
||||
BuildingRoomGeometry::BuildingRoomGeometry()
|
||||
: m_logger(BuildingControlUnit::getLogger("VWM.BuildingRoomGeometry"))
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
BuildingRoomGeometry::~BuildingRoomGeometry()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
bool BuildingRoomGeometry::init(const QDomElement &domRoot)
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
|
||||
parse(domRoot);
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVector<int> BuildingRoomGeometry::pointIsInWhichRooms(const LtsUtils::QPoint3D &pointToFind)
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START, pointToFind" << pointToFind
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START, pointToFind" << pointToFind
|
||||
<< ", m_roomOutlines.size() " << m_roomOutlines.size();
|
||||
|
||||
QVector<int> roomtIds;
|
||||
@@ -52,26 +52,26 @@ QVector<int> BuildingRoomGeometry::pointIsInWhichRooms(const LtsUtils::QPoint3D
|
||||
const int roomId = it.key();
|
||||
const RoomOutlineData &rod = it.value();
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " check room " << roomId << " (check maxZ " << rod.maxZ << " ; minZ " << rod.minZ;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " check room " << roomId << " (check maxZ " << rod.maxZ << " ; minZ " << rod.minZ;
|
||||
if (m_logger.isDebugEnabled())
|
||||
qCritical() << " check room " << roomId << ", outline: " << rod.outline;
|
||||
|
||||
|
||||
if (rod.outline.containsPoint( {pointToFind.x(), pointToFind.y()}, Qt::OddEvenFill))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " within room " << roomId;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " within room " << roomId;
|
||||
|
||||
if ((rod.maxZ > pointToFind.z()) &&
|
||||
(pointToFind.z() > rod.minZ))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " found roomId: " << roomId
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " found roomId: " << roomId
|
||||
<< " pointToFind: " << pointToFind.x() << " , " << pointToFind.y();
|
||||
roomtIds.append(roomId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END, roomtIds.size() " << roomtIds.size();
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END, roomtIds.size() " << roomtIds.size();
|
||||
return roomtIds;
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -8,7 +8,7 @@
|
||||
#include <QPolygonF>
|
||||
#include <QDomElement>
|
||||
#include <LtsUtilsCore/qpoint3d.h>
|
||||
#include <VWM/buildingcontrolvwm_export.h>
|
||||
#include "buildingcontrolvwm_export.h"
|
||||
#include <logger.h>
|
||||
|
||||
|
||||
@@ -40,8 +40,6 @@ private:
|
||||
|
||||
|
||||
QMap<int, RoomOutlineData> m_roomOutlines;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
#include <QVector>
|
||||
#include "vwm_building.h"
|
||||
#include "vwm_types.h"
|
||||
#include <VWM/buildingcontrolvwm_export.h>
|
||||
#include "buildingcontrolvwm_export.h"
|
||||
|
||||
namespace BuildingControlUnit
|
||||
{
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
#include "vwm_building.h"
|
||||
#include "vwm_types.h"
|
||||
#include <VWM/buildingcontrolvwm_export.h>
|
||||
#include "buildingcontrolvwm_export.h"
|
||||
#include <QMap>
|
||||
|
||||
namespace BuildingControlUnit
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
#include "vwm_building.h"
|
||||
#include "vwm_building_room_geometry.h"
|
||||
#include "vwm_types.h"
|
||||
#include <VWM/buildingcontrolvwm_export.h>
|
||||
#include "buildingcontrolvwm_export.h"
|
||||
#include <QMap>
|
||||
|
||||
namespace BuildingControlUnit
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "bcu_types.h"
|
||||
#include <BuildingControlUnit/buildingcontrolcommon_export.h>
|
||||
#include "buildingcontrolcommon_export.h"
|
||||
|
||||
class QDomElement;
|
||||
|
||||
|
||||
+17
-18
@@ -13,9 +13,8 @@ HandleHttpRequest::HandleHttpRequest(bool useQueue, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_nam(new QNetworkAccessManager(this))
|
||||
, m_bUseQueue(useQueue)
|
||||
, m_logger(getLogger("HandleHttpRequest"))
|
||||
{
|
||||
INFO_LOG(m_logger) << "Using Queue: " << m_bUseQueue;
|
||||
INFO_LOG() << "Using Queue: " << m_bUseQueue;
|
||||
connect(m_nam, &QNetworkAccessManager::finished,
|
||||
this, &HandleHttpRequest::onReplyFinished);
|
||||
connect(m_nam, &QNetworkAccessManager::authenticationRequired,
|
||||
@@ -42,7 +41,7 @@ void HandleHttpRequest::enqueue(const QUrl &url, HandleHttpQueueMessageStatus st
|
||||
if ((HandleHttpQueueMessageStatus::MS_Cyclic == status) &&
|
||||
m_queueMap[host].uniquenessChecker.contains(url.toString()))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Discarding duplicate url \"" << url.toString() << "\" due to slow message handling.";
|
||||
WARNING_LOG() << "Discarding duplicate url \"" << url.toString() << "\" due to slow message handling.";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -50,7 +49,7 @@ void HandleHttpRequest::enqueue(const QUrl &url, HandleHttpQueueMessageStatus st
|
||||
networkRequest.request = QNetworkRequest(url);
|
||||
m_queueMap[host].uniquenessChecker.insert(url.toString());
|
||||
m_queueMap[host].requests.enqueue(networkRequest);
|
||||
DEBUG_LOG(m_logger) << "Added '" << url.toString() << " to queue for host: " << host
|
||||
DEBUG_LOG() << "Added '" << url.toString() << " to queue for host: " << host
|
||||
<< " Queue has " << m_queueMap[host].requests.count() << " elements";
|
||||
trySendNextRequest();
|
||||
}
|
||||
@@ -60,21 +59,21 @@ void HandleHttpRequest::onAuthenticationRequired(QNetworkReply *reply, QAuthenti
|
||||
{
|
||||
if (!reply || !authenticator)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Internal error - Nullptr exception!";
|
||||
ERROR_LOG() << "Internal error - Nullptr exception!";
|
||||
}
|
||||
else if (!m_queueMap.contains(reply->url().host()))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Internal error - got auth reply from unknown host!";
|
||||
WARNING_LOG() << "Internal error - got auth reply from unknown host!";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_bUseQueue && reply != m_queueMap[reply->url().host()].activeReply)
|
||||
WARNING_LOG(m_logger) << "Internal error - got auth reply from unknown request!";
|
||||
WARNING_LOG() << "Internal error - got auth reply from unknown request!";
|
||||
|
||||
|
||||
if (m_queueMap[reply->url().host()].bAuthAlreadyRequested)
|
||||
return;
|
||||
DEBUG_LOG(m_logger) << "Authentication request";
|
||||
DEBUG_LOG() << "Authentication request";
|
||||
authenticator->setUser(m_username);
|
||||
authenticator->setPassword(m_passwd);
|
||||
m_queueMap[reply->url().host()].bAuthAlreadyRequested = true;
|
||||
@@ -90,17 +89,17 @@ void HandleHttpRequest::onReplyFinished(QNetworkReply *reply)
|
||||
}
|
||||
if (!reply)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Internal error - Nullptr exception!";
|
||||
ERROR_LOG() << "Internal error - Nullptr exception!";
|
||||
}
|
||||
else if (!m_queueMap.contains(reply->url().host()))
|
||||
{
|
||||
reply->deleteLater();
|
||||
WARNING_LOG(m_logger) << "Internal error - got reply from unknown host!";
|
||||
WARNING_LOG() << "Internal error - got reply from unknown host!";
|
||||
}
|
||||
else if (m_bUseQueue && reply != m_queueMap[reply->url().host()].activeReply)
|
||||
{
|
||||
reply->deleteLater();
|
||||
WARNING_LOG(m_logger) << "Internal error - got reply from unknown request!";
|
||||
WARNING_LOG() << "Internal error - got reply from unknown request!";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -110,16 +109,16 @@ void HandleHttpRequest::onReplyFinished(QNetworkReply *reply)
|
||||
if ( m_newConnection)
|
||||
{
|
||||
m_newConnection = false;
|
||||
DEBUG_LOG(m_logger) << "emit newEgcuConnection host=" << reply->url().host();
|
||||
DEBUG_LOG() << "emit newEgcuConnection host=" << reply->url().host();
|
||||
emit newEgcuConnection(reply->url().host());
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "Request successfull";
|
||||
DEBUG_LOG() << "Request successfull";
|
||||
}
|
||||
else
|
||||
WARNING_LOG(m_logger) << "Invalid request for host " << reply->url().host() << ", response code: " << responseCode << ", query: " << reply->url().toString();
|
||||
WARNING_LOG() << "Invalid request for host " << reply->url().host() << ", response code: " << responseCode << ", query: " << reply->url().toString();
|
||||
|
||||
QByteArray replyData = reply->readAll();
|
||||
DEBUG_LOG(m_logger) << "Got reply (" << reply->url().toString() << "): " << replyData
|
||||
DEBUG_LOG() << "Got reply (" << reply->url().toString() << "): " << replyData
|
||||
<< " host=" << reply->url().host();
|
||||
emit egcuReply(reply->url().host(), replyData);
|
||||
|
||||
@@ -134,7 +133,7 @@ void HandleHttpRequest::sendNextRequest(HandleHttpQueue& queue)
|
||||
{
|
||||
if (m_bUseQueue && queue.activeReply != nullptr)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Internal error - active reply not yet finished!";
|
||||
WARNING_LOG() << "Internal error - active reply not yet finished!";
|
||||
}
|
||||
else if (!queue.requests.isEmpty())
|
||||
{
|
||||
@@ -145,11 +144,11 @@ void HandleHttpRequest::sendNextRequest(HandleHttpQueue& queue)
|
||||
if ( networkRequest.time.secsTo(QTime::currentTime()) < 5)
|
||||
{
|
||||
queue.activeReply = m_nam->get(request);
|
||||
DEBUG_LOG(m_logger) << "Send request " << request.url().toString() << " and waiting for reply (" << queue.activeReply << ")";
|
||||
DEBUG_LOG() << "Send request " << request.url().toString() << " and waiting for reply (" << queue.activeReply << ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "remove request " << request.url().toString()
|
||||
DEBUG_LOG() << "remove request " << request.url().toString()
|
||||
<< " because it's too old" << networkRequest.time.secsTo(QTime::currentTime());
|
||||
sendNextRequest(queue);
|
||||
m_newConnection = true;
|
||||
|
||||
-1
@@ -70,7 +70,6 @@ private Q_SLOTS:
|
||||
private:
|
||||
QNetworkAccessManager *m_nam;
|
||||
bool m_bUseQueue;
|
||||
LOGGER_T m_logger;
|
||||
QString m_username;
|
||||
QString m_passwd;
|
||||
QMap<QString, HandleHttpQueue> m_queueMap;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include <BuildingControlUnit/buildingcontrolcommon_export.h>
|
||||
#include "buildingcontrolcommon_export.h"
|
||||
|
||||
namespace BuildingControlUnit
|
||||
{
|
||||
|
||||
+21
-22
@@ -19,7 +19,6 @@ MainHandler::MainHandler()
|
||||
, m_handelEffectsBsm(nullptr)
|
||||
, m_handleHttpRequest(nullptr)
|
||||
, m_bsmFlash(BEO_Auto)
|
||||
, m_logger(getLogger("MainHandler"))
|
||||
{}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
@@ -60,17 +59,17 @@ bool MainHandler::init(const QString &ammuXml,
|
||||
}
|
||||
if (!m_vwmApi->init(ammuXml, vwmXml, bsmConfig, initBuilding))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can not initialize VWM API - aborting";
|
||||
ERROR_LOG() << "Can not initialize VWM API - aborting";
|
||||
return false;
|
||||
}
|
||||
if (!m_jsonApi->init(listenPort))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can not initialize Json API - aborting";
|
||||
ERROR_LOG() << "Can not initialize Json API - aborting";
|
||||
return false;
|
||||
}
|
||||
if (!m_bsmApi->init(bsmConfig))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can not initialize BSM API - aborting";
|
||||
ERROR_LOG() << "Can not initialize BSM API - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -136,16 +135,16 @@ bool MainHandler::init(const QString &ammuXml,
|
||||
|
||||
void MainHandler::setInitialOverrides(const QString &hostname)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "setInitialOverrides m_handelEffectsVec.size()=" << m_handelEffectsVec.size();
|
||||
DEBUG_LOG() << "setInitialOverrides m_handelEffectsVec.size()=" << m_handelEffectsVec.size();
|
||||
|
||||
for ( int i = 0; i < m_handelEffectsVec.size(); i++)
|
||||
{
|
||||
QString hostnameLocal = m_handelEffectsVec.at(i)->hostname();
|
||||
const QVector<BcuEffectState> effectStates = m_handelEffectsVec.at(i)->getOverrides();
|
||||
DEBUG_LOG(m_logger) << "setInitialOverrides host=" << hostnameLocal
|
||||
DEBUG_LOG() << "setInitialOverrides host=" << hostnameLocal
|
||||
<< " effectStates.size=" << effectStates.size();
|
||||
for (int j = 0; j < effectStates.size(); j++)
|
||||
DEBUG_LOG(m_logger) << "setInitialOverrides j=" << j
|
||||
DEBUG_LOG() << "setInitialOverrides j=" << j
|
||||
<< " id=" << effectStates[j].id
|
||||
<< " type=" << effectStates[j].type
|
||||
<< " override=" << effectStates[j].effectOverride;
|
||||
@@ -172,7 +171,7 @@ void MainHandler::onHitResult(const HitResult &result, const QMap<int, Contamina
|
||||
{
|
||||
Q_UNUSED(contaminationStates)
|
||||
const VWM::Charge charge = m_vwmApi->chargeFromChargeTypeId(result.chargeTypeId);
|
||||
DEBUG_LOG(m_logger) << "onHitResult chargeTypeId=" << result.chargeTypeId
|
||||
DEBUG_LOG() << "onHitResult chargeTypeId=" << result.chargeTypeId
|
||||
<< " result.effectSoundId=" << result.effectSoundId
|
||||
<< " damagePercentNew=" << result.damagePercentNew
|
||||
<< " destructiveFactor=" << charge.destructiveFactor;
|
||||
@@ -183,15 +182,15 @@ void MainHandler::onHitResult(const HitResult &result, const QMap<int, Contamina
|
||||
{
|
||||
for (HandelEffects *he : std::as_const(m_handelEffectsVec))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "playHitSound @EGCU " << he->hostname() << ", SoundId: " << result.effectSoundId;
|
||||
DEBUG_LOG() << "playHitSound @EGCU " << he->hostname() << ", SoundId: " << result.effectSoundId;
|
||||
he->playHitSound(result.effectSoundId);
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "HitResult: " << result;
|
||||
DEBUG_LOG() << "HitResult: " << result;
|
||||
if (result.sensorId != 0 && result.originatorId != 0 && m_bsmFlash != BEO_Off && charge.destructiveFactor > 1 )
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BSM Flash";
|
||||
DEBUG_LOG() << "BSM Flash";
|
||||
m_bsmApi->triggerFlashlight(result.sensorId);
|
||||
m_bsmApi->triggerFlashlightPulse(result.sensorId,
|
||||
QString(),
|
||||
@@ -201,7 +200,7 @@ void MainHandler::onHitResult(const HitResult &result, const QMap<int, Contamina
|
||||
Settings::flashDuration());
|
||||
}
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Kein BSM Flash";
|
||||
DEBUG_LOG() << "Kein BSM Flash";
|
||||
|
||||
|
||||
|
||||
@@ -211,14 +210,14 @@ void MainHandler::onHitResult(const HitResult &result, const QMap<int, Contamina
|
||||
|
||||
for (int i = 0; i < m_egcuConfig.egcus.size(); i++)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "segmentDamage.size=" << segmentDamage.size();
|
||||
DEBUG_LOG() << "segmentDamage.size=" << segmentDamage.size();
|
||||
if ( i < segmentDamage.size() )
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "segmentDamage[" << i <<"]=" << segmentDamage[i];
|
||||
DEBUG_LOG() << "segmentDamage[" << i <<"]=" << segmentDamage[i];
|
||||
m_handelEffectsVec[i]->startEffects(segmentDamage[i]);
|
||||
}
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "No segment Damage for egcu:" << m_egcuConfig.egcus[i].hostname;
|
||||
DEBUG_LOG() << "No segment Damage for egcu:" << m_egcuConfig.egcus[i].hostname;
|
||||
}
|
||||
m_handelEffectsBsm->startEffects(result.damagePercentNew);
|
||||
}
|
||||
@@ -232,22 +231,22 @@ void MainHandler::onUnknownDirectHit(int sensorId)
|
||||
|
||||
void MainHandler::onSetEffectStatesRequest(const QString &hostname, const QVector<BcuEffectState> &effectStates)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "1 BSM flash hostname='" << hostname
|
||||
DEBUG_LOG() << "1 BSM flash hostname='" << hostname
|
||||
<< "' isEmpty:"<< hostname.isEmpty()
|
||||
<<" isNull:" << hostname.isNull();
|
||||
m_effectStates.insert(hostname, effectStates);
|
||||
if (hostname.isEmpty())
|
||||
{
|
||||
m_bsmFlash = BEO_Auto;
|
||||
DEBUG_LOG(m_logger) << "2 BSM flash =" << m_bsmFlash;
|
||||
DEBUG_LOG() << "2 BSM flash =" << m_bsmFlash;
|
||||
m_handelEffectsBsm->setOverrides(effectStates);
|
||||
for ( int i = 0; i < effectStates.size(); i++)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "3 BSM flash =" << m_bsmFlash;
|
||||
DEBUG_LOG() << "3 BSM flash =" << m_bsmFlash;
|
||||
if ( effectStates.at(i).type == BET_BsmFlash)
|
||||
{
|
||||
m_bsmFlash = effectStates.at(i).effectOverride;
|
||||
DEBUG_LOG(m_logger) << "4 BSM flash =" << m_bsmFlash;
|
||||
DEBUG_LOG() << "4 BSM flash =" << m_bsmFlash;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -267,7 +266,7 @@ void MainHandler::onSwitchRelayRequest(const QString &hostname, const SwitchRela
|
||||
{
|
||||
if (m_handelEffectsVec[i]->hostname() == hostname )
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "switchRelay "
|
||||
DEBUG_LOG() << "switchRelay "
|
||||
<< " id=" << switchRelayValues.id
|
||||
<< " bcuRelayState=" << switchRelayValues.bcuRelayState;
|
||||
m_handelEffectsVec[i]->switchRelay(switchRelayValues);
|
||||
@@ -329,7 +328,7 @@ QVector<int> MainHandler::getSegmentDamage(const QVector<HitRoom> &allHitRooms,
|
||||
if (egcu.roomIds.size() > 0 )
|
||||
averageDamage = damagePercentSegment / egcu.roomIds.size();
|
||||
result.append(averageDamage);
|
||||
INFO_LOG(m_logger) << "getSegmentDamage[" << egcu.hostname << "]=" << averageDamage;
|
||||
INFO_LOG() << "getSegmentDamage[" << egcu.hostname << "]=" << averageDamage;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -338,7 +337,7 @@ QVector<int> MainHandler::getSegmentDamage(const QVector<HitRoom> &allHitRooms,
|
||||
void MainHandler::flashBuildingDestructionIndicator(int egcu)
|
||||
{
|
||||
|
||||
ERROR_LOG(m_logger) << "TODO flashBuildingDestructionIndicator egcu=" << egcu;
|
||||
ERROR_LOG() << "TODO flashBuildingDestructionIndicator egcu=" << egcu;
|
||||
|
||||
|
||||
|
||||
|
||||
-2
@@ -53,8 +53,6 @@ private:
|
||||
QVector<HandelEffects*> m_handelEffectsVec;
|
||||
QMap< QString, QVector<BcuEffectState>> m_effectStates;
|
||||
BcuEffectOverride m_bsmFlash;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <QString>
|
||||
#include <BuildingControlUnit/buildingcontrolcommon_export.h>
|
||||
#include "buildingcontrolcommon_export.h"
|
||||
|
||||
namespace BuildingControlUnit
|
||||
{
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <BuildingControlUnit/buildingcontrolcommon_export.h>
|
||||
#include "buildingcontrolcommon_export.h"
|
||||
#include <bcu_types.h>
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
@@ -34,7 +34,7 @@ CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
|
||||
# generate bld_[d|f]tc.h
|
||||
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY(AAR SV WS HLA svcBldCommon SHARED ${SRCS_common})
|
||||
NGL_ADD_LIBRARY2(AAR SV WS HLA svcBldCommon SHARED ${SRCS_common})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcBldCommon
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
@@ -63,7 +63,7 @@ SET(SRCS_client
|
||||
# generate bld_[d|f]tc_impl.[cpp|h]
|
||||
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY(AAR SV WS svcBldClient SHARED ${SRCS_client})
|
||||
NGL_ADD_LIBRARY2(AAR SV WS svcBldClient SHARED ${SRCS_client})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcBldClient
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
@@ -91,7 +91,7 @@ SET(SRCS_server
|
||||
# generate bld_[d|f]ts.h, bld_[d|f]ts_impl.[cpp|h]
|
||||
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY(AAR SV svcBldServer SHARED ${SRCS_server})
|
||||
NGL_ADD_LIBRARY2(AAR SV svcBldServer SHARED ${SRCS_server})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcBldServer
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
|
||||
@@ -26,7 +26,6 @@ BuildingControlHandler::BuildingControlHandler(MainHandler *mainHandler)
|
||||
, Interface::Fts::TriggerBsmFlashRequestHandler(mainHandler->ddsHandler()->fts())
|
||||
, Interface::Fts::SwitchRelayRequestHandler(mainHandler->ddsHandler()->fts())
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_logger(getLogger("BuildingControlHandler"))
|
||||
{}
|
||||
|
||||
BuildingControlHandler::~BuildingControlHandler()
|
||||
@@ -41,13 +40,13 @@ BuildingControlHandler::~BuildingControlHandler()
|
||||
|
||||
bool BuildingControlHandler::init()
|
||||
{
|
||||
DEBUG_LOG(m_logger)<<"BuildingControlHandler::init exerciseId="<<m_mainHandler->exerciseId();
|
||||
DEBUG_LOG()<<"BuildingControlHandler::init exerciseId="<<m_mainHandler->exerciseId();
|
||||
|
||||
const QString bcuName = QStringLiteral("BuildingControlUnit");
|
||||
m_bcuExecutableName = QStandardPaths::findExecutable(bcuName, { QCoreApplication::applicationDirPath()});
|
||||
if (m_bcuExecutableName.isEmpty())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Executable " << bcuName << " not found - can not start building control unit processes!";
|
||||
WARNING_LOG() << "Executable " << bcuName << " not found - can not start building control unit processes!";
|
||||
return false;
|
||||
}
|
||||
if (m_mainHandler->exerciseId() > 0)
|
||||
@@ -62,18 +61,18 @@ bool BuildingControlHandler::init()
|
||||
|
||||
const QMultiMap<qint64, Buildings::HistoryState> latestStates = recordReplay.getHistoryStateMap();
|
||||
|
||||
DEBUG_LOG(m_logger) << "Starting to read HistoryStatedata from record replay. Size: "
|
||||
DEBUG_LOG() << "Starting to read HistoryStatedata from record replay. Size: "
|
||||
<< latestStates.size();
|
||||
for (auto it = latestStates.begin(); it != latestStates.end(); ++it)
|
||||
{
|
||||
const Buildings::HistoryState &historyState = it.value();
|
||||
if (!m_mainHandler->ismHandler()->isElementAssignedToExercise(historyState.mseId(),m_mainHandler->exerciseId() ))
|
||||
{
|
||||
DEBUG_LOG(m_logger)<<"[INIT] [recordReplay]>>>>>>> mseId=" << historyState.mseId() << " not in execise";
|
||||
DEBUG_LOG()<<"[INIT] [recordReplay]>>>>>>> mseId=" << historyState.mseId() << " not in execise";
|
||||
continue;
|
||||
}
|
||||
m_historyStates.insert(historyState.mseId(), historyState);
|
||||
DEBUG_LOG(m_logger)<<"[INIT] [recordReplay]>>>>>>> "<<historyState;
|
||||
DEBUG_LOG()<<"[INIT] [recordReplay]>>>>>>> "<<historyState;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -93,7 +92,7 @@ void BuildingControlHandler::onBuildingRemoved(int buildingId)
|
||||
|
||||
void BuildingControlHandler::onBuildingChanged(const BuildingInfo &buildingInfo, bool damageInit = false)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged damageInit=" << damageInit
|
||||
DEBUG_LOG() << "onBuildingChanged damageInit=" << damageInit
|
||||
<< " mseId=" << buildingInfo.mseId;
|
||||
auto it = m_buildings.find(buildingInfo.mseId);
|
||||
BuildingProcess *bldg = nullptr;
|
||||
@@ -104,7 +103,7 @@ void BuildingControlHandler::onBuildingChanged(const BuildingInfo &buildingInfo,
|
||||
buildingInfo,
|
||||
damageInit,
|
||||
this);
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged m_buildings.insert mseId=" << buildingInfo.mseId;
|
||||
DEBUG_LOG() << "onBuildingChanged m_buildings.insert mseId=" << buildingInfo.mseId;
|
||||
m_buildings.insert(buildingInfo.mseId, bldg);
|
||||
bldg->newRelayInfos(m_relayInfos);
|
||||
bldg->start();
|
||||
@@ -119,17 +118,17 @@ void BuildingControlHandler::onBuildingChanged(const BuildingInfo &buildingInfo,
|
||||
if ( m_historyStates.contains(buildingInfo.mseId))
|
||||
{
|
||||
historyState = m_historyStates.value(buildingInfo.mseId);
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState contains historyState.mseId=" << historyState.mseId()
|
||||
DEBUG_LOG() << "onBuildingChanged setHistoryState contains historyState.mseId=" << historyState.mseId()
|
||||
<< " buildingInfo.mseId=" << buildingInfo.mseId;
|
||||
}
|
||||
else
|
||||
{
|
||||
historyState.mseId (buildingInfo.mseId);
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState insert historyState.mseId=" << historyState.mseId()
|
||||
DEBUG_LOG() << "onBuildingChanged setHistoryState insert historyState.mseId=" << historyState.mseId()
|
||||
<< " buildingInfo.mseId=" << buildingInfo.mseId;
|
||||
m_historyStates.insert(historyState.mseId(), historyState);
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState historyState.mseId=" << historyState.mseId()
|
||||
DEBUG_LOG() << "onBuildingChanged setHistoryState historyState.mseId=" << historyState.mseId()
|
||||
<< " buildingInfo.mseId=" << buildingInfo.mseId;
|
||||
bldg->setHistoryState(m_historyStates.value(buildingInfo.mseId));
|
||||
}
|
||||
@@ -137,59 +136,59 @@ void BuildingControlHandler::onBuildingChanged(const BuildingInfo &buildingInfo,
|
||||
void BuildingControlHandler::onSetBuildingContaminationStateRequest(const rti::core::SampleIdentity &cookie,
|
||||
const SetBuildingContaminationStateRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSetBuildingContaminationStateRequest " << request;
|
||||
DEBUG_LOG() << "onSetBuildingContaminationStateRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onSetBuildingContaminationStateRequestInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
WARNING_LOG() << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->setBuildingContaminationStateReply(cookie, fro);
|
||||
}
|
||||
|
||||
void BuildingControlHandler::onSetBuildingStatesRequest(const rti::core::SampleIdentity &cookie,
|
||||
const SetBuildingStatesRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSetBuildingStatesRequest " << request;
|
||||
DEBUG_LOG() << "onSetBuildingStatesRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onSetBuildingStatesRequestInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
WARNING_LOG() << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->setBuildingStatesReply(cookie, fro);
|
||||
}
|
||||
|
||||
void BuildingControlHandler::onSetFortifyFactorRequest(const rti::core::SampleIdentity &cookie,
|
||||
const SetFortifyFactorRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSetFortifyFactorRequest " << request;
|
||||
DEBUG_LOG() << "onSetFortifyFactorRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onSetFortifyFactorRequestInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
WARNING_LOG() << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->setFortifyFactorReply(cookie, fro);
|
||||
}
|
||||
|
||||
void BuildingControlHandler::onSendCesHitOnBuildingRequest(const rti::core::SampleIdentity &cookie,
|
||||
const SendCesHitOnBuildingRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequest " << request;
|
||||
DEBUG_LOG() << "onSendCesHitOnBuildingRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onSendCesHitOnBuildingRequestInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
WARNING_LOG() << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->sendCesHitOnBuildingReply(cookie, fro);
|
||||
}
|
||||
|
||||
void BuildingControlHandler::onSendCesHit3DonBuildingRequest(const rti::core::SampleIdentity &cookie, const SendCesHit3DonBuildingRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequest " << request;
|
||||
DEBUG_LOG() << "onSendCesHit3DonBuildingRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onSendCesHit3DonBuildingRequestInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
WARNING_LOG() << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->sendCesHit3DonBuildingReply(cookie, fro);
|
||||
}
|
||||
|
||||
void BuildingControlHandler::onTriggerBsmFlashRequest(const rti::core::SampleIdentity &cookie,
|
||||
const TriggerBsmFlashRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onTriggerBsmFlashRequest " << request;
|
||||
DEBUG_LOG() << "onTriggerBsmFlashRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onTriggerBsmFlashInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
WARNING_LOG() << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->triggerBsmFlashReply(cookie, fro);
|
||||
}
|
||||
|
||||
@@ -256,7 +255,7 @@ Core::FunctionReplyObject BuildingControlHandler::onSetFortifyFactorRequestInter
|
||||
|
||||
void BuildingControlHandler::setEffectStates(const int buildingId, const int assetId, const QByteArray &properties)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BuildingControlHandler::setEffectStates"
|
||||
DEBUG_LOG() << "BuildingControlHandler::setEffectStates"
|
||||
<< " buildingId=" << buildingId
|
||||
<< " assetId=" << assetId
|
||||
<< " properties=" << properties;
|
||||
@@ -283,11 +282,11 @@ void BuildingControlHandler::onRelayInfoChanged(const AssetManagement::RelayInfo
|
||||
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSendCesHitOnBuildingRequestInternal(const SendCesHitOnBuildingRequest &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequestInternal";
|
||||
DEBUG_LOG() << "onSendCesHitOnBuildingRequestInternal";
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
if (it == m_buildings.end())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequestInternal return";
|
||||
DEBUG_LOG() << "onSendCesHitOnBuildingRequestInternal return";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
}
|
||||
|
||||
@@ -296,21 +295,21 @@ Core::FunctionReplyObject BuildingControlHandler::onSendCesHitOnBuildingRequestI
|
||||
data.aesId(), data.impactPosition(),
|
||||
QString::fromStdString(data.properties())))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequestInternal return Can not send ces hit to building control process";
|
||||
DEBUG_LOG() << "onSendCesHitOnBuildingRequestInternal return Can not send ces hit to building control process";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send ces hit to building control process."));
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "FunctionReplyObject";
|
||||
DEBUG_LOG() << "FunctionReplyObject";
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSendCesHit3DonBuildingRequestInternal(const SendCesHit3DonBuildingRequest &data)
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequestInternal";
|
||||
DEBUG_LOG() << "onSendCesHit3DonBuildingRequestInternal";
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
if (it == m_buildings.end())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequestInternal return";
|
||||
DEBUG_LOG() << "onSendCesHit3DonBuildingRequestInternal return";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
}
|
||||
|
||||
@@ -319,16 +318,16 @@ Core::FunctionReplyObject BuildingControlHandler::onSendCesHit3DonBuildingReques
|
||||
data.aesId(), data.impactPosition(), data.detonationLocation(), data.detonationDistance(),
|
||||
QString::fromStdString(data.properties())))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequestInternal return Can not send ces hit to building control process";
|
||||
DEBUG_LOG() << "onSendCesHit3DonBuildingRequestInternal return Can not send ces hit to building control process";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send ces hit to building control process."));
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "FunctionReplyObject";
|
||||
DEBUG_LOG() << "FunctionReplyObject";
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject BuildingControlHandler::onTriggerBsmFlashInternal(const TriggerBsmFlashRequest &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onTriggerBsmFlashInternal";
|
||||
DEBUG_LOG() << "onTriggerBsmFlashInternal";
|
||||
|
||||
|
||||
{
|
||||
@@ -341,34 +340,34 @@ Core::FunctionReplyObject BuildingControlHandler::onTriggerBsmFlashInternal(cons
|
||||
BuildingInfo buildingInfo= bldg->buildingInfo();
|
||||
BsmInfo bsmInfo = buildingInfo.bsms.value(data.assetId());
|
||||
|
||||
DEBUG_LOG(m_logger) << " BuildingId=" << data.buildingId()
|
||||
DEBUG_LOG() << " BuildingId=" << data.buildingId()
|
||||
<< " assetId=" << bsmInfo.assetId
|
||||
<< " hostname=" << bsmInfo.hostname;
|
||||
|
||||
if (!bldg->triggerFlashlight(data))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onTriggerBsmFlashInternal return Can not send trigger flashlight to building control process";
|
||||
DEBUG_LOG() << "onTriggerBsmFlashInternal return Can not send trigger flashlight to building control process";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send trigger flashlight to building control process"));
|
||||
}
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "FunctionReplyObject";
|
||||
DEBUG_LOG() << "FunctionReplyObject";
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
void BuildingControlHandler::onSwitchRelayRequest(const rti::core::SampleIdentity &cookie,
|
||||
const SwitchRelayRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "SwitchRelayRequest " << request;
|
||||
DEBUG_LOG() << "SwitchRelayRequest " << request;
|
||||
|
||||
const Core::FunctionReplyObject fro = onSwitchRelayInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
WARNING_LOG() << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->switchRelayReply(cookie, fro);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSwitchRelayInternal(const SwitchRelayRequest &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSwitchRelayInternal " << data;
|
||||
DEBUG_LOG() << "onSwitchRelayInternal " << data;
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
if (it == m_buildings.end())
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
|
||||
@@ -68,6 +68,5 @@ private:
|
||||
QMap<int, AssetManagement::RelayInfo> m_relayInfos;
|
||||
QString m_bcuExecutableName;
|
||||
MainHandler *m_mainHandler;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
@@ -53,7 +53,6 @@ BuildingProcess::BuildingProcess(MainHandler *mainHandler,
|
||||
, m_hitLineInfoTimer(new QTimer(this))
|
||||
, m_hitLineId(info.mseId << 16)
|
||||
, m_initBuilding(initBuilding)
|
||||
, m_logger(getLogger("BuildingProcess"))
|
||||
{
|
||||
m_proc.setProgram(procName);
|
||||
m_proc.setReadChannel(QProcess::StandardOutput);
|
||||
@@ -81,22 +80,22 @@ void BuildingProcess::setBuildingInfo(const BuildingInfo &info)
|
||||
|
||||
void BuildingProcess::onStructureElementUpdateEffectOverrideReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitReply for id " << replyObject.id() << " success= " << replyObject.error();
|
||||
DEBUG_LOG() << "onSendCesHitReply for id " << replyObject.id() << " success= " << replyObject.error();
|
||||
}
|
||||
|
||||
bool BuildingProcess::start()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::start mseId = " << m_buildingInfo.mseId
|
||||
DEBUG_LOG() << "BuildingProcess::start mseId = " << m_buildingInfo.mseId
|
||||
<< " m_historyState.size() = " << m_historyState.stateHistory().size()
|
||||
<< " m_initBuilding=" << m_initBuilding;
|
||||
if (m_buildingInfo.mseId <= 0)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "No valid building information set - can not start building process";
|
||||
WARNING_LOG() << "No valid building information set - can not start building process";
|
||||
return false;
|
||||
}
|
||||
if (m_proc.state() != QProcess::NotRunning)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Process for building " << m_buildingInfo.mseId << " is already running!";
|
||||
WARNING_LOG() << "Process for building " << m_buildingInfo.mseId << " is already running!";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -121,13 +120,13 @@ bool BuildingProcess::start()
|
||||
const QByteArray bldCfgData = generateBuildingConfigData();
|
||||
|
||||
const QString effectConfigFilename = NGL::findFile(NGL::FileType::ConfigFile, QStringLiteral("effect_config.xml"));
|
||||
WARNING_LOG(m_logger) << "(effectConfigFilename) = " << effectConfigFilename;
|
||||
WARNING_LOG() << "(effectConfigFilename) = " << effectConfigFilename;
|
||||
|
||||
|
||||
const QString bldDataFilename = tmpPath + QStringLiteral("bldg_%1_building_config.xml").arg(m_buildingInfo.mseId);
|
||||
if (!writeFile(bldDataFilename, bldCfgData))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "(!writeFile(bldDataFilename, bldCfgData)";
|
||||
WARNING_LOG() << "(!writeFile(bldDataFilename, bldCfgData)";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -135,7 +134,7 @@ bool BuildingProcess::start()
|
||||
const QString chargesDataFilename = tmpPath + QStringLiteral("bldg_%1_charges.xml").arg(m_buildingInfo.mseId);
|
||||
if (!writeFile(chargesDataFilename, chargesData))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "(!writeFile(chargesDataFilename, chargesData)";
|
||||
WARNING_LOG() << "(!writeFile(chargesDataFilename, chargesData)";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -149,7 +148,7 @@ bool BuildingProcess::start()
|
||||
if (!effectPtr)
|
||||
continue;
|
||||
|
||||
DEBUG_LOG(m_logger) << "effect->id=" << effectPtr->id
|
||||
DEBUG_LOG() << "effect->id=" << effectPtr->id
|
||||
<< " effect->category=" << effectPtr->category
|
||||
<< " effect->effectType=" << effectPtr->effectType
|
||||
<< " effect->override=" << static_cast<int>(effectPtr->override);
|
||||
@@ -202,9 +201,9 @@ void BuildingProcess::shutdown()
|
||||
|
||||
void BuildingProcess::setHistoryState(const Buildings::HistoryState &historyState)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::setHistoryState size =" << historyState.stateHistory().size();
|
||||
DEBUG_LOG() << "BuildingProcess::setHistoryState size =" << historyState.stateHistory().size();
|
||||
|
||||
ERROR_LOG(m_logger) << "[BuildingProcess::setHistoryState]>>> history =" << historyState;
|
||||
ERROR_LOG() << "[BuildingProcess::setHistoryState]>>> history =" << historyState;
|
||||
m_historyState = historyState;
|
||||
m_historyState.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
m_mainHandler->ddsHandler()->dts()->publish(m_historyState);
|
||||
@@ -212,7 +211,7 @@ void BuildingProcess::setHistoryState(const Buildings::HistoryState &historyStat
|
||||
|
||||
bool BuildingProcess::setVulnerabilityState(ProjectDataManagement::VulnerabilityState state, const std::vector<int> &roomIds)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::setVulnerabilityState:" << state;
|
||||
DEBUG_LOG() << "BuildingProcess::setVulnerabilityState:" << state;
|
||||
if (!m_wsSocket || !m_wsSocket->isValid())
|
||||
return false;
|
||||
BuildingControlUnit::Json::Telegrams::SetDamageState tele;
|
||||
@@ -224,7 +223,7 @@ bool BuildingProcess::setVulnerabilityState(ProjectDataManagement::Vulnerability
|
||||
tele.roomIds += m_buildingInfo.roomId2SubId.value(id);
|
||||
|
||||
tele.originatorId = 0;
|
||||
DEBUG_LOG(m_logger) << "setVulnerabilityState websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
DEBUG_LOG() << "setVulnerabilityState websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
|
||||
|
||||
return true;
|
||||
@@ -232,7 +231,7 @@ bool BuildingProcess::setVulnerabilityState(ProjectDataManagement::Vulnerability
|
||||
|
||||
bool BuildingProcess::setContaminationState(const int &bldId, const ContaminationState &contaminationState)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::setContaminationState bldId: "<<bldId;
|
||||
DEBUG_LOG() << "BuildingProcess::setContaminationState bldId: "<<bldId;
|
||||
if (!m_wsSocket || !m_wsSocket->isValid())
|
||||
return false;
|
||||
BuildingControlUnit::Json::Telegrams::SetContaminationState tele;
|
||||
@@ -245,18 +244,18 @@ bool BuildingProcess::setContaminationState(const int &bldId, const Contaminatio
|
||||
contState.rooms = contaminationState.rooms();
|
||||
tele.contaminationStates.push_back(contState);
|
||||
|
||||
DEBUG_LOG(m_logger) << "SetContaminationState websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
DEBUG_LOG() << "SetContaminationState websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BuildingProcess::resetContaminationState()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::resetContaminationState" ;
|
||||
DEBUG_LOG() << "BuildingProcess::resetContaminationState" ;
|
||||
if (!m_wsSocket || !m_wsSocket->isValid())
|
||||
return false;
|
||||
BuildingControlUnit::Json::Telegrams::ResetContaminationState tele;
|
||||
DEBUG_LOG(m_logger) << "ResetContaminationState websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
DEBUG_LOG() << "ResetContaminationState websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
|
||||
|
||||
return true;
|
||||
@@ -277,7 +276,7 @@ bool BuildingProcess::setFortifyFactors(const std::vector<Buildings::FortifyFact
|
||||
|
||||
tele.fortifyFactors.push_back(info);
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "setFortifyFactors websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
DEBUG_LOG() << "setFortifyFactors websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
|
||||
return true;
|
||||
}
|
||||
@@ -294,7 +293,7 @@ bool BuildingProcess::setEffectStates( const int assetId, const QByteArray &prop
|
||||
|
||||
if (!m_wsSocket || !m_wsSocket->isValid())
|
||||
return false;
|
||||
DEBUG_LOG(m_logger) << "setEffectStates"
|
||||
DEBUG_LOG() << "setEffectStates"
|
||||
<< " assetId=" << assetId
|
||||
<< " properties=" << properties;
|
||||
|
||||
@@ -302,24 +301,24 @@ bool BuildingProcess::setEffectStates( const int assetId, const QByteArray &prop
|
||||
{
|
||||
for (const EgcuInfo &egcu : std::as_const(m_buildingInfo.egcus))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "EGCU: " << egcu.assetName
|
||||
DEBUG_LOG() << "EGCU: " << egcu.assetName
|
||||
<< " assetId=" << egcu.assetId
|
||||
<< " egcu.assetId=" << egcu.assetId
|
||||
<< " hostname=" << egcu.hostname;
|
||||
if ( assetId == egcu.assetId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "segment=" << egcu.hostname;
|
||||
DEBUG_LOG() << "segment=" << egcu.hostname;
|
||||
tele.segment = egcu.hostname;
|
||||
}
|
||||
}
|
||||
if (tele.segment.isEmpty())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Asset with id " << assetId << " not found in this building";
|
||||
WARNING_LOG() << "Asset with id " << assetId << " not found in this building";
|
||||
return false;
|
||||
}
|
||||
if (tele.segment == QString())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Asset with id=" << assetId << " has no Hostname!!!!";
|
||||
ERROR_LOG() << "Asset with id=" << assetId << " has no Hostname!!!!";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -386,9 +385,9 @@ bool BuildingProcess::setEffectStates( const int assetId, const QByteArray &prop
|
||||
}
|
||||
|
||||
QString valueStr = QString::fromUtf8(tele.toJson());
|
||||
DEBUG_LOG(m_logger) << "setEffectStates websocket send: " << valueStr;
|
||||
DEBUG_LOG() << "setEffectStates websocket send: " << valueStr;
|
||||
qint64 sendBytesCount = m_wsSocket->sendTextMessage(valueStr);
|
||||
DEBUG_LOG(m_logger) << "sendBytesCount= " << sendBytesCount;
|
||||
DEBUG_LOG() << "sendBytesCount= " << sendBytesCount;
|
||||
m_effectStates.insert(assetId, valueStr);
|
||||
|
||||
return true;
|
||||
@@ -409,7 +408,7 @@ bool BuildingProcess::relayState(const std::vector<Buildings::RelayStateItem> &r
|
||||
tele.relayStates.push_back(info);
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "relayState websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
DEBUG_LOG() << "relayState websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
|
||||
|
||||
return true;
|
||||
@@ -456,7 +455,7 @@ bool BuildingProcess::sendCesHitOnBuilding(const qint64 effectTimeMSec,
|
||||
tele.relPosition.z = relPos.offsetZ();
|
||||
tele.properties = properties;
|
||||
|
||||
DEBUG_LOG(m_logger) << "sendCesHitOnBuilding websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
DEBUG_LOG() << "sendCesHitOnBuilding websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
|
||||
return true;
|
||||
}
|
||||
@@ -526,7 +525,7 @@ bool BuildingProcess::sendCesHit3DonBuilding(const qint64 effectTimeMSec, const
|
||||
tele.detonationDistance = detonationDistance;
|
||||
tele.properties = properties;
|
||||
|
||||
DEBUG_LOG(m_logger) << "sendCesHit3DonBuilding websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
DEBUG_LOG() << "sendCesHit3DonBuilding websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
|
||||
return true;
|
||||
}
|
||||
@@ -537,7 +536,7 @@ bool BuildingProcess::switchRelay(const SwitchRelayRequest &data)
|
||||
|
||||
if (!m_wsSocket || !m_wsSocket->isValid())
|
||||
return false;
|
||||
DEBUG_LOG(m_logger) << "switchRelay"
|
||||
DEBUG_LOG() << "switchRelay"
|
||||
<< " buildingId=" << data.buildingId()
|
||||
<< " assetId=" << data.assetId()
|
||||
<< data.state();
|
||||
@@ -545,10 +544,10 @@ bool BuildingProcess::switchRelay(const SwitchRelayRequest &data)
|
||||
|
||||
for (const EgcuInfo &egcu : std::as_const(m_buildingInfo.egcus))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "EGCU: " << egcu.assetName
|
||||
DEBUG_LOG() << "EGCU: " << egcu.assetName
|
||||
<< " assetId=" << egcu.assetId
|
||||
<< " hostname=" << egcu.hostname;
|
||||
DEBUG_LOG(m_logger) << "data.assetId()=" << data.assetId()
|
||||
DEBUG_LOG() << "data.assetId()=" << data.assetId()
|
||||
<< "egcu.assetId=" << egcu.assetId;
|
||||
if ( data.assetId() != egcu.assetId)
|
||||
continue;
|
||||
@@ -562,7 +561,7 @@ bool BuildingProcess::switchRelay(const SwitchRelayRequest &data)
|
||||
tele.switchRelayValues.delay = data.pulseAttributes().get().delay();
|
||||
tele.switchRelayValues.pulse = data.pulseAttributes().get().pulse();
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "switchRelay websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
DEBUG_LOG() << "switchRelay websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
|
||||
return true;
|
||||
}
|
||||
@@ -575,7 +574,7 @@ bool BuildingProcess::triggerFlashlight(const TriggerBsmFlashRequest data)
|
||||
|
||||
if (!m_wsSocket || !m_wsSocket->isValid())
|
||||
return false;
|
||||
DEBUG_LOG(m_logger) << "triggerFlashlight"
|
||||
DEBUG_LOG() << "triggerFlashlight"
|
||||
<< " BuildingId=" << data.buildingId()
|
||||
<< " assetId=" << data.assetId()
|
||||
<< " m_buildingInfo.bsms.size()" << m_buildingInfo.bsms.size();
|
||||
@@ -583,7 +582,7 @@ bool BuildingProcess::triggerFlashlight(const TriggerBsmFlashRequest data)
|
||||
QMapIterator<int, BsmInfo> i(m_buildingInfo.bsms);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
DEBUG_LOG(m_logger) << "key=" << i.key()
|
||||
DEBUG_LOG() << "key=" << i.key()
|
||||
<< " assetId=" << i.value().assetId
|
||||
<< " bsmId=" << i.value().bsmId
|
||||
<< " hostname=" << i.value().hostname
|
||||
@@ -593,7 +592,7 @@ bool BuildingProcess::triggerFlashlight(const TriggerBsmFlashRequest data)
|
||||
if ( m_buildingInfo.bsms.contains(data.assetId()))
|
||||
{
|
||||
BsmInfo bsmInfo = m_buildingInfo.bsms.value(data.assetId());
|
||||
DEBUG_LOG(m_logger) << " BuildingId=" << data.buildingId()
|
||||
DEBUG_LOG() << " BuildingId=" << data.buildingId()
|
||||
<< " assetId=" << bsmInfo.assetId
|
||||
<< " hostname=" << bsmInfo.hostname;
|
||||
|
||||
@@ -602,7 +601,7 @@ bool BuildingProcess::triggerFlashlight(const TriggerBsmFlashRequest data)
|
||||
tele.pauseBetweenFlashesSec = 0;
|
||||
tele.sensorId = 0;
|
||||
|
||||
DEBUG_LOG(m_logger) << "triggerFlashlight websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
DEBUG_LOG() << "triggerFlashlight websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
|
||||
return true;
|
||||
}
|
||||
@@ -616,7 +615,7 @@ void BuildingProcess::onReadyRead()
|
||||
if (data.contains(strToSearch))
|
||||
{
|
||||
m_wsUrl = data.split(strToSearch).at(1).split(QLatin1Char('\n')).at(0).trimmed();
|
||||
INFO_LOG(m_logger) << "Using web socket url '" << m_wsUrl << "' for building " << m_buildingInfo.mseId;
|
||||
INFO_LOG() << "Using web socket url '" << m_wsUrl << "' for building " << m_buildingInfo.mseId;
|
||||
openWebSocket();
|
||||
}
|
||||
}
|
||||
@@ -627,12 +626,12 @@ void BuildingProcess::onProcessFinished(int exitCode, QProcess::ExitStatus exitS
|
||||
if (exitCode == 0 && exitStatus == QProcess::NormalExit)
|
||||
return;
|
||||
const char *what = exitStatus == QProcess::NormalExit ? "stopped" : "crashed";
|
||||
WARNING_LOG(m_logger) << "building control process for building " << m_buildingInfo.mseId
|
||||
WARNING_LOG() << "building control process for building " << m_buildingInfo.mseId
|
||||
<< " " << what << " with exit code " << exitCode << " - restarting in 1 second";
|
||||
if (exitCode != 0)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "stdout: " << m_proc.readAllStandardOutput();
|
||||
WARNING_LOG(m_logger) << "stderr: " << m_proc.readAllStandardError();
|
||||
WARNING_LOG() << "stdout: " << m_proc.readAllStandardOutput();
|
||||
WARNING_LOG() << "stderr: " << m_proc.readAllStandardError();
|
||||
}
|
||||
closeWebSocket();
|
||||
QTimer::singleShot(1000, this, &BuildingProcess::start);
|
||||
@@ -640,12 +639,12 @@ void BuildingProcess::onProcessFinished(int exitCode, QProcess::ExitStatus exitS
|
||||
|
||||
void BuildingProcess::onTextMessageReceived(const QString &message)
|
||||
{
|
||||
TRACE_LOG(m_logger) << "Got message from building control process: " << message;
|
||||
TRACE_LOG() << "Got message from building control process: " << message;
|
||||
BuildingControlUnit::Json::Telegrams::BaseTelegram *tel =
|
||||
BuildingControlUnit::Json::Telegrams::BaseTelegram::telegramFromJson(message.toUtf8());
|
||||
if (!tel)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Can not convert '" << message << "' to a valid telegram!";
|
||||
WARNING_LOG() << "Can not convert '" << message << "' to a valid telegram!";
|
||||
return;
|
||||
}
|
||||
if (tel->telegramId() == BuildingControlUnit::Json::Telegrams::BsmState::telegramId())
|
||||
@@ -657,7 +656,7 @@ void BuildingProcess::onTextMessageReceived(const QString &message)
|
||||
else if (tel->telegramId() == BuildingControlUnit::Json::Telegrams::EffectOverride::telegramId())
|
||||
handleEffectOverride(static_cast<BuildingControlUnit::Json::Telegrams::EffectOverride *>(tel));
|
||||
else
|
||||
WARNING_LOG(m_logger) << "Unhandled incoming telegram with id '" << tel->telegramId() << "'";
|
||||
WARNING_LOG() << "Unhandled incoming telegram with id '" << tel->telegramId() << "'";
|
||||
|
||||
delete tel;
|
||||
}
|
||||
@@ -693,7 +692,7 @@ void BuildingProcess::historyState(const BuildingState &state)
|
||||
&& state.originatorParticipantId() == 0
|
||||
&& state.contaminationStates().size() == 0)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "setVulnerabilityState->removeHistoryStateByKey:" << state.id();
|
||||
DEBUG_LOG() << "setVulnerabilityState->removeHistoryStateByKey:" << state.id();
|
||||
m_historyState.stateHistory().resize(0);
|
||||
}
|
||||
|
||||
@@ -709,10 +708,10 @@ void BuildingProcess::historyState(const BuildingState &state)
|
||||
historyStateItem.contaminationStates() = state.contaminationStates();
|
||||
|
||||
m_historyState.stateHistory().push_back(std::move(historyStateItem));
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::historyState contaminationStates:" << state;
|
||||
DEBUG_LOG() << "BuildingProcess::historyState contaminationStates:" << state;
|
||||
|
||||
m_historyState.mseId(state.id());
|
||||
DEBUG_LOG(m_logger) << "setVulnerabilityState->removeHistoryStateByKey:" << m_historyState.mseId();
|
||||
DEBUG_LOG() << "setVulnerabilityState->removeHistoryStateByKey:" << m_historyState.mseId();
|
||||
m_historyState.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
m_mainHandler->ddsHandler()->dts()->publish(m_historyState);
|
||||
}
|
||||
@@ -722,16 +721,16 @@ void BuildingProcess::handleHitResult(BuildingControlUnit::Json::Telegrams::HitR
|
||||
const BuildingControlUnit::Json::Telegrams::HitResult::HitResultInfo &data = tel->hitResult;
|
||||
BuildingState state;
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " data.hitOnRoomId=" << data.hitOnRoomId;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " data.hitOnRoomId=" << data.hitOnRoomId;
|
||||
state.id(m_buildingInfo.mseId);
|
||||
|
||||
int assetId = m_mainHandler->ddsHandler()->dtcIsm()->getAssetIdFromMountingPointId(m_buildingInfo.mseId, data.sensorId);
|
||||
DEBUG_LOG(m_logger) << "handleHitResult assetId=" << assetId;
|
||||
DEBUG_LOG() << "handleHitResult assetId=" << assetId;
|
||||
state.assetId(assetId);
|
||||
|
||||
InfrastructureManagement::StructureElement se;
|
||||
m_mainHandler->ddsHandler()->dtcIsm()->getStructureElementInMntPointAssetByAssetId(assetId, se);
|
||||
DEBUG_LOG(m_logger) << "handleHitResult structureElementId=" << se.id();
|
||||
DEBUG_LOG() << "handleHitResult structureElementId=" << se.id();
|
||||
state.structureElementId(se.id());
|
||||
state.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
if (data.originatorType == BuildingControlUnit::OriginatorType::DirectHit)
|
||||
@@ -809,7 +808,7 @@ void BuildingProcess::handleReconnectEgcu(const QString &segment)
|
||||
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << "handleReconnectEgcu segment =" << segment;
|
||||
DEBUG_LOG() << "handleReconnectEgcu segment =" << segment;
|
||||
|
||||
for (const EgcuInfo &egcu : std::as_const(m_buildingInfo.egcus))
|
||||
{
|
||||
@@ -818,7 +817,7 @@ void BuildingProcess::handleReconnectEgcu(const QString &segment)
|
||||
const auto keys = m_effectOverridesReconnect.keys();
|
||||
for (const int &relayId : keys)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "RelayId=" << relayId
|
||||
DEBUG_LOG() << "RelayId=" << relayId
|
||||
<< " Override=" << m_effectOverridesReconnect.value(relayId);
|
||||
|
||||
if (m_effectOverridesReconnect.value(relayId) >= 0)
|
||||
@@ -828,7 +827,7 @@ void BuildingProcess::handleReconnectEgcu(const QString &segment)
|
||||
|
||||
int structureElementIdMp = m_mainHandler->ddsHandler()->dtcIsm()->getStructueElementIdFromAssetId(egcu.assetId);
|
||||
|
||||
DEBUG_LOG(m_logger) << "EGCU: " << egcu.assetName
|
||||
DEBUG_LOG() << "EGCU: " << egcu.assetName
|
||||
<< " assetId=" << egcu.assetId
|
||||
<< " hostname='" << egcu.hostname
|
||||
<< "' buildingName=" << egcu.buildingName
|
||||
@@ -841,9 +840,9 @@ void BuildingProcess::handleReconnectEgcu(const QString &segment)
|
||||
request.structureElementId(structureElementIdMp);
|
||||
request.effectId(relayId);
|
||||
request.effectOverride(override);
|
||||
DEBUG_LOG(m_logger) << "Vor structureElementUpdateEffectOverrideRequest";
|
||||
DEBUG_LOG() << "Vor structureElementUpdateEffectOverrideRequest";
|
||||
int result = m_mainHandler->ismHandler()->ftcIsm()->structureElementUpdateEffectOverrideRequest(request, this);
|
||||
DEBUG_LOG(m_logger) << "Nach structureElementUpdateEffectOverrideRequest result=" << result;
|
||||
DEBUG_LOG() << "Nach structureElementUpdateEffectOverrideRequest result=" << result;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -856,7 +855,7 @@ void BuildingProcess::handleRelayState(BuildingControlUnit::Json::Telegrams::Rel
|
||||
{
|
||||
RelayState state;
|
||||
|
||||
DEBUG_LOG(m_logger) << "handleRelayState EGCU:" << tel->segment
|
||||
DEBUG_LOG() << "handleRelayState EGCU:" << tel->segment
|
||||
<< " m_buildingInfo.egcus.size()=" << m_buildingInfo.egcus.size()
|
||||
<< " stateTime=" << tel->stateTime
|
||||
<< " offlineTime=" << tel->offlineTime;
|
||||
@@ -872,7 +871,7 @@ void BuildingProcess::handleRelayState(BuildingControlUnit::Json::Telegrams::Rel
|
||||
{
|
||||
if (QString::compare(egcu.hostname,tel->segment, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "EGCU: " << egcu.assetName
|
||||
DEBUG_LOG() << "EGCU: " << egcu.assetName
|
||||
<< " assetId=" << egcu.assetId
|
||||
<< " hostname='" << egcu.hostname
|
||||
<< "' buildingName=" << egcu.buildingName;
|
||||
@@ -898,18 +897,18 @@ void BuildingProcess::handleRelayState(BuildingControlUnit::Json::Telegrams::Rel
|
||||
|
||||
void BuildingProcess::handleEffectOverride(BuildingControlUnit::Json::Telegrams::EffectOverride *tel)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::handleEffectOverride"
|
||||
DEBUG_LOG() << "BuildingProcess::handleEffectOverride"
|
||||
<< " tel->overrides.size=" << tel->overrides.size();
|
||||
|
||||
InfrastructureManagement::StructureElementUpdateEffectOverrideRequest request;
|
||||
for ( int i = 0; i < m_buildingInfo.egcus.size(); i++)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::handleEffectOverride i=" << i;
|
||||
DEBUG_LOG() << "BuildingProcess::handleEffectOverride i=" << i;
|
||||
if ( m_buildingInfo.egcus[i].hostname.toLower() == tel->segment)
|
||||
{
|
||||
int structureElementIdMp = m_mainHandler->ddsHandler()->dtcIsm()->getStructueElementIdFromAssetId( m_buildingInfo.egcus.at(i).assetId);
|
||||
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::handleEffectOverride i=" << i
|
||||
DEBUG_LOG() << "BuildingProcess::handleEffectOverride i=" << i
|
||||
<< " mountPointId=" << m_buildingInfo.egcus.at(i).mountPointId
|
||||
<< " assetId=" << m_buildingInfo.egcus.at(i).assetId
|
||||
<< " structureElementId=" << m_buildingInfo.structureElementId
|
||||
@@ -939,14 +938,14 @@ void BuildingProcess::handleEffectOverride(BuildingControlUnit::Json::Telegrams:
|
||||
break;
|
||||
}
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "Send Override Request"
|
||||
DEBUG_LOG() << "Send Override Request"
|
||||
<< " structureElementId=" << request.structureElementId()
|
||||
<< " effectId=" << request.effectId()
|
||||
<< " effectOverride=" << request.effectOverride();
|
||||
if ( request.structureElementId() > 0)
|
||||
m_mainHandler->ddsHandler()->ftcIsm()->structureElementUpdateEffectOverrideRequest(request, this);
|
||||
else
|
||||
ERROR_LOG(m_logger) << "request.structureElementId() =" << request.structureElementId() << " NOT VALID!!!";
|
||||
ERROR_LOG() << "request.structureElementId() =" << request.structureElementId() << " NOT VALID!!!";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1017,12 +1016,12 @@ bool BuildingProcess::writeFile(const QString &fn, const QByteArray &data)
|
||||
QFile f(fn);
|
||||
if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Can not open file '" << fn << "' - error: " << f.errorString();
|
||||
WARNING_LOG() << "Can not open file '" << fn << "' - error: " << f.errorString();
|
||||
return false;
|
||||
}
|
||||
if (f.write(data) != data.size())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Can not write data to file '" << fn << "' - error: " << f.errorString();
|
||||
WARNING_LOG() << "Can not write data to file '" << fn << "' - error: " << f.errorString();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -1113,7 +1112,7 @@ QByteArray BuildingProcess::generateChargesData() const
|
||||
auto it = chargeTypes.find(charge.chargeTypeId());
|
||||
if (it == chargeTypes.end())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Could not find charge type with id " << charge.chargeTypeId() << " - skipping";
|
||||
WARNING_LOG() << "Could not find charge type with id " << charge.chargeTypeId() << " - skipping";
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1155,7 +1154,7 @@ void BuildingProcess::openWebSocket()
|
||||
this, &BuildingProcess::onWebSocketDisconnected);
|
||||
connect(m_wsSocket, &QWebSocket::textMessageReceived,
|
||||
this, &BuildingProcess::onTextMessageReceived);
|
||||
WARNING_LOG(m_logger) << "openWebSocket:" << m_wsUrl.toLocal8Bit()
|
||||
WARNING_LOG() << "openWebSocket:" << m_wsUrl.toLocal8Bit()
|
||||
<< " (buildingId: " << m_buildingInfo.mseId << ") - socket: " << m_wsSocket;
|
||||
m_wsSocket->open(QUrl::fromEncoded(m_wsUrl.toLocal8Bit()));
|
||||
}
|
||||
@@ -1164,7 +1163,7 @@ void BuildingProcess::closeWebSocket()
|
||||
{
|
||||
if (m_wsSocket)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "closeWebSocket (buildingId : " << m_buildingInfo.mseId << ") - socket: " << m_wsSocket
|
||||
WARNING_LOG() << "closeWebSocket (buildingId : " << m_buildingInfo.mseId << ") - socket: " << m_wsSocket
|
||||
<< " localPort=" << m_wsSocket->localPort() << ", error: " << ", " << m_wsSocket->errorString();
|
||||
m_wsSocket->disconnect(this);
|
||||
m_wsSocket->close();
|
||||
@@ -1178,7 +1177,7 @@ void BuildingProcess::onWebSocketError(QAbstractSocket::SocketError error)
|
||||
{
|
||||
if (!m_wsSocket)
|
||||
return;
|
||||
WARNING_LOG(m_logger) << "Error connecting to " << m_wsSocket->peerAddress().toString() << ": " << error
|
||||
WARNING_LOG() << "Error connecting to " << m_wsSocket->peerAddress().toString() << ": " << error
|
||||
<< " (buildingId: " << m_buildingInfo.mseId << ") - socket: " << m_wsSocket;
|
||||
closeWebSocket();
|
||||
m_wsReconnectTimer->start(1000);
|
||||
@@ -1186,22 +1185,22 @@ void BuildingProcess::onWebSocketError(QAbstractSocket::SocketError error)
|
||||
|
||||
void BuildingProcess::onWebSocketConnected()
|
||||
{
|
||||
INFO_LOG(m_logger) << "connected to building control process " << m_buildingInfo.mseId << " via websockets localPort="<<m_wsSocket->localPort();
|
||||
INFO_LOG() << "connected to building control process " << m_buildingInfo.mseId << " via websockets localPort="<<m_wsSocket->localPort();
|
||||
|
||||
QMapIterator<int, QString> i(m_effectStates);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
|
||||
DEBUG_LOG(m_logger) << "setEffectStates websocket send: " << i.value();
|
||||
DEBUG_LOG() << "setEffectStates websocket send: " << i.value();
|
||||
qint64 sendBytesCount = m_wsSocket->sendTextMessage(i.value());
|
||||
DEBUG_LOG(m_logger) << "sendBytesCount= " << sendBytesCount;
|
||||
DEBUG_LOG() << "sendBytesCount= " << sendBytesCount;
|
||||
}
|
||||
m_wsReconnectTimer->stop();
|
||||
}
|
||||
|
||||
void BuildingProcess::onWebSocketDisconnected()
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Websocket to " << m_wsUrl << " closed - trying to reconnect in 1 sec"
|
||||
WARNING_LOG() << "Websocket to " << m_wsUrl << " closed - trying to reconnect in 1 sec"
|
||||
<< " (buildingId : " << m_buildingInfo.mseId << ") - socket: " << m_wsSocket
|
||||
<< " localPort=" << m_wsSocket->localPort();
|
||||
closeWebSocket();
|
||||
|
||||
@@ -96,6 +96,5 @@ private:
|
||||
QMap<int, BsmState> m_bsmStates;
|
||||
QHash<int,int> m_effectOverridesReconnect;
|
||||
bool m_initBuilding;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
@@ -10,9 +10,8 @@ namespace Buildings
|
||||
|
||||
DdsHandler::DdsHandler(int domainId, int exerciseId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Exercise, exerciseId))
|
||||
, m_logger(getLogger("DdsHandler"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
DdsHandler::~DdsHandler()
|
||||
@@ -28,7 +27,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
if (!m_ddsConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
||||
ERROR_LOG() << "Error initializing dds connections - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -48,16 +47,16 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
|
||||
bool bRet = m_ddsDts->enableAll();
|
||||
|
||||
DEBUG_LOG(m_logger) << "Dts initialised";
|
||||
DEBUG_LOG() << "Dts initialised";
|
||||
|
||||
bRet &= m_ddsFts->enableAll();
|
||||
INFO_LOG(m_logger) << "Fts initialised";
|
||||
INFO_LOG() << "Fts initialised";
|
||||
|
||||
bRet &= m_ftcIsm->enableStructureElementUpdateEffectOverride();
|
||||
INFO_LOG(m_logger) << "ISM Ftc initialised";
|
||||
INFO_LOG() << "ISM Ftc initialised";
|
||||
|
||||
bRet &= m_dtcPdm->enableChargeType();
|
||||
INFO_LOG(m_logger) << "ISM Ftc initialised";
|
||||
INFO_LOG() << "ISM Ftc initialised";
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -46,8 +46,6 @@ private:
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Ftc> m_ftcIsm;
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_dtcIsm;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtcPdm;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -22,7 +22,6 @@ IsmHandler::IsmHandler(MainHandler *mainHandler)
|
||||
, m_ftcIsm(nullptr)
|
||||
, m_changeTimeoutTimer(new QTimer(this))
|
||||
, m_changeTimeoutTimerInit(new QTimer(this))
|
||||
, m_logger(getLogger("IsmHandler"))
|
||||
{
|
||||
connect(m_changeTimeoutTimer, &QTimer::timeout,
|
||||
this, &IsmHandler::onBuildingsChanged);
|
||||
@@ -58,13 +57,13 @@ bool IsmHandler::init()
|
||||
!m_dtcIsm->enableMountingPointAsset() ||
|
||||
!m_dtcIsm->enableBridgeChangeStatus())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can not read data from ISM";
|
||||
ERROR_LOG() << "Can not read data from ISM";
|
||||
return false;
|
||||
}
|
||||
m_ftcIsm = InfrastructureManagement::Interface::Ftc::create(m_mainHandler->ddsHandler()->ddsConnector());
|
||||
if (!m_ftcIsm->enableStructureElementUpdateEffectOverride())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can not read data from ISM";
|
||||
ERROR_LOG() << "Can not read data from ISM";
|
||||
return false;
|
||||
}
|
||||
m_changeTimeoutTimerInit->start();
|
||||
@@ -106,14 +105,14 @@ void IsmHandler::onInstrumentationAssetChanged(const InfrastructureManagement::I
|
||||
case DataModification::eModified:
|
||||
{
|
||||
const int exerciseId = data.availableInExercise().size() == 0 ? 0 : data.availableInExercise().at(0);
|
||||
DEBUG_LOG(m_logger) << "setting asset " << data.id() << " available in exercise " << exerciseId;
|
||||
DEBUG_LOG() << "setting asset " << data.id() << " available in exercise " << exerciseId;
|
||||
m_assetMainStructureElementInExercise.insert(data.id(), exerciseId);
|
||||
break;
|
||||
}
|
||||
case DataModification::eRemoved:
|
||||
{
|
||||
const int exerciseId = data.availableInExercise().size() == 0 ? 0 : data.availableInExercise().at(0);
|
||||
DEBUG_LOG(m_logger) << "removing asset " << data.id() << " from exercise " << exerciseId;
|
||||
DEBUG_LOG() << "removing asset " << data.id() << " from exercise " << exerciseId;
|
||||
m_assetMainStructureElementInExercise.remove(data.id());
|
||||
break;
|
||||
}
|
||||
@@ -128,11 +127,11 @@ void IsmHandler::onMountingPointAssetChanged(const InfrastructureManagement::Mou
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
DEBUG_LOG(m_logger) << "mounting asset " << data.assetId() << " on structure element id " << data.structureElementId();
|
||||
DEBUG_LOG() << "mounting asset " << data.assetId() << " on structure element id " << data.structureElementId();
|
||||
m_structureElementId2AssetId.insert(data.structureElementId(), data.assetId());
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
DEBUG_LOG(m_logger) << "unmounting asset " << m_structureElementId2AssetId.value(data.structureElementId()) << " from structure element " << data.structureElementId();
|
||||
DEBUG_LOG() << "unmounting asset " << m_structureElementId2AssetId.value(data.structureElementId()) << " from structure element " << data.structureElementId();
|
||||
m_structureElementId2AssetId.remove(data.structureElementId());
|
||||
break;
|
||||
}
|
||||
@@ -141,7 +140,7 @@ void IsmHandler::onMountingPointAssetChanged(const InfrastructureManagement::Mou
|
||||
|
||||
void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION;
|
||||
DEBUG_LOG() << Q_FUNC_INFO;
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
@@ -150,10 +149,10 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
|
||||
if (!isElementAssignedToExercise (data.id(),m_mainHandler->exerciseId() ) )
|
||||
{
|
||||
m_mainStructureElements.remove(data.id());
|
||||
DEBUG_LOG(m_logger) << "Building not in exercise id=" << data.id();
|
||||
DEBUG_LOG() << "Building not in exercise id=" << data.id();
|
||||
return;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "Building=" << data.name()
|
||||
DEBUG_LOG() << "Building=" << data.name()
|
||||
<< " properties=" << data.properties();
|
||||
QJsonParseError parserError;
|
||||
QByteArray content = QByteArray::fromStdString(data.properties());
|
||||
@@ -161,24 +160,24 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
|
||||
if (parserError.error != QJsonParseError::NoError)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Error parsing json document: " << parserError.errorString();
|
||||
WARNING_LOG() << "Error parsing json document: " << parserError.errorString();
|
||||
return;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "json to parse: " << doc.toJson();
|
||||
DEBUG_LOG() << "json to parse: " << doc.toJson();
|
||||
const QJsonObject objProperties(doc.object());
|
||||
if ( objProperties.contains(QStringLiteral("start_building_process")))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "properties contains start_building_process";
|
||||
DEBUG_LOG() << "properties contains start_building_process";
|
||||
bool startBuildingProcess = objProperties.value(QStringLiteral("start_building_process")).toBool();
|
||||
if (!startBuildingProcess)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Building=" << data.name()
|
||||
DEBUG_LOG() << "Building=" << data.name()
|
||||
<< " start_building_process = false ";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "##### onMainStructureElementChanged - ID = " << data.id();
|
||||
DEBUG_LOG() << "##### onMainStructureElementChanged - ID = " << data.id();
|
||||
checkOverride( m_mainStructureElements[data.id()], data);
|
||||
m_mainStructureElements[data.id()] = data;
|
||||
break;
|
||||
@@ -193,13 +192,13 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
|
||||
void IsmHandler::onBridgeStatusChanged(const InfrastructureManagement::BridgeChangeStatus &data, DataModification modType)
|
||||
{
|
||||
static int s_id = 1;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << "s_id=" << s_id;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << "s_id=" << s_id;
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "##### onBridgeStatusChanged - buildingId = " << data.buildingId();
|
||||
DEBUG_LOG() << "##### onBridgeStatusChanged - buildingId = " << data.buildingId();
|
||||
BridgeStatus bs;
|
||||
bs.id(s_id++);
|
||||
bs.buildingId(data.buildingId());
|
||||
@@ -216,17 +215,17 @@ void IsmHandler::onBridgeStatusChanged(const InfrastructureManagement::BridgeCha
|
||||
|
||||
void IsmHandler::getEgcuToRoom(const InfrastructureManagement::MainStructureElement &mse, QVector<EgcuInfo> &eis)
|
||||
{
|
||||
INFO_LOG(m_logger) << "properties=" << mse.properties();
|
||||
INFO_LOG() << "properties=" << mse.properties();
|
||||
QJsonParseError parserError;
|
||||
QByteArray content = QByteArray::fromStdString(mse.properties());
|
||||
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
|
||||
if (parserError.error != QJsonParseError::NoError)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Error parsing json document: " << parserError.errorString();
|
||||
WARNING_LOG() << "Error parsing json document: " << parserError.errorString();
|
||||
return;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "json to parse: " << doc.toJson();
|
||||
DEBUG_LOG() << "json to parse: " << doc.toJson();
|
||||
const QJsonObject objEgcus(doc.object());
|
||||
const QJsonArray arrEgcus(objEgcus.value(QStringLiteral("egcusToRooms")).toArray());
|
||||
for (int i = 0; i < arrEgcus.size(); ++i)
|
||||
@@ -234,19 +233,19 @@ void IsmHandler::getEgcuToRoom(const InfrastructureManagement::MainStructureElem
|
||||
|
||||
const QJsonObject objRooms(arrEgcus.at(i).toObject());
|
||||
const int mountpointEgcuId = objRooms[QStringLiteral("mountpointEgcu")].toInt();
|
||||
INFO_LOG(m_logger) << "mountpointEgcu=" << mountpointEgcuId;
|
||||
INFO_LOG(m_logger) << "i=" <<i;
|
||||
INFO_LOG() << "mountpointEgcu=" << mountpointEgcuId;
|
||||
INFO_LOG() << "i=" <<i;
|
||||
const QJsonArray arrRooms(objRooms.value(QStringLiteral("rooms")).toArray());
|
||||
INFO_LOG(m_logger) << "bi.egcus.size()=" << eis.size();
|
||||
INFO_LOG() << "bi.egcus.size()=" << eis.size();
|
||||
|
||||
|
||||
for (EgcuInfo &egcuInfo : eis)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "bi.egcus.at(k).mountPointId=" << egcuInfo.mountPointId
|
||||
DEBUG_LOG() << "bi.egcus.at(k).mountPointId=" << egcuInfo.mountPointId
|
||||
<< " mountpointEgcu=" << mountpointEgcuId;
|
||||
if (egcuInfo.mountPointId == mountpointEgcuId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "mountpointEgcu=" << mountpointEgcuId;
|
||||
DEBUG_LOG() << "mountpointEgcu=" << mountpointEgcuId;
|
||||
|
||||
egcuInfo.roomIds.clear();
|
||||
egcuInfo.roomIds.reserve(arrRooms.size());
|
||||
@@ -274,10 +273,10 @@ void IsmHandler::buildingsChanged(bool init)
|
||||
QSet<int> availableBuildingIds;
|
||||
QMap<int, BuildingInfo> newBuildingConfiguration;
|
||||
availableBuildingIds.reserve(m_mainStructureElements.size());
|
||||
INFO_LOG(m_logger) << "Updating building config m_mainStructureElements.size=" << m_mainStructureElements.size();
|
||||
INFO_LOG() << "Updating building config m_mainStructureElements.size=" << m_mainStructureElements.size();
|
||||
for (const InfrastructureManagement::MainStructureElement &mse : std::as_const(m_mainStructureElements))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Checking building " << mse.id() << " - " << mse.name();
|
||||
DEBUG_LOG() << "Checking building " << mse.id() << " - " << mse.name();
|
||||
BuildingInfo bi;
|
||||
bi.mseId = mse.id();
|
||||
bi.modelId = mse.modelId();
|
||||
@@ -301,7 +300,7 @@ void IsmHandler::buildingsChanged(bool init)
|
||||
bi.subId2RoomId.insert(se.mountingPointId(), se.id());
|
||||
bi.roomId2SubId.insert(se.id(), se.mountingPointId());
|
||||
bi.roomName2RoomId.insert(QString::fromStdString(se.name()), se.mountingPointId());
|
||||
INFO_LOG(m_logger) << " Room: mountingPointId: " << se.mountingPointId()
|
||||
INFO_LOG() << " Room: mountingPointId: " << se.mountingPointId()
|
||||
<< ", roomId: " << se.id()
|
||||
<< ", Name: " << se.name();
|
||||
m_roomId2RoomName.insert(se.id(), QString::fromStdString(se.name()));
|
||||
@@ -309,13 +308,13 @@ void IsmHandler::buildingsChanged(bool init)
|
||||
}
|
||||
if (m_mainHandler->exerciseId() != bi.currentExerciseId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Exercise id of building does not match current exercise: " << bi.currentExerciseId
|
||||
DEBUG_LOG() << "Exercise id of building does not match current exercise: " << bi.currentExerciseId
|
||||
<< " != " << m_mainHandler->exerciseId()
|
||||
<< " buildingId=" << bi.mseId
|
||||
<< " buildingName" << bi.name;
|
||||
continue;
|
||||
}
|
||||
INFO_LOG(m_logger) << "Adding building configuration for " << mse.id() << " - " << mse.name();
|
||||
INFO_LOG() << "Adding building configuration for " << mse.id() << " - " << mse.name();
|
||||
availableBuildingIds += mse.id();
|
||||
getEgcuToRoom(mse, bi.egcus);
|
||||
newBuildingConfiguration.insert(bi.mseId, bi);
|
||||
@@ -326,7 +325,7 @@ void IsmHandler::buildingsChanged(bool init)
|
||||
if (!availableBuildingIds.contains(buildingId))
|
||||
{
|
||||
|
||||
INFO_LOG(m_logger) << "Building " << buildingId << " no longer exists in this exercise - removing";
|
||||
INFO_LOG() << "Building " << buildingId << " no longer exists in this exercise - removing";
|
||||
emit buildingRemoved(buildingId);
|
||||
continue;
|
||||
}
|
||||
@@ -334,11 +333,11 @@ void IsmHandler::buildingsChanged(bool init)
|
||||
const BuildingInfo &biNew = newBuildingConfiguration.value(buildingId);
|
||||
if (biOld == biNew)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Building " << buildingId << " did not change - nothing to do";
|
||||
INFO_LOG() << "Building " << buildingId << " did not change - nothing to do";
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG(m_logger) << "setHistoryState Building " << buildingId << " changed -> updating configuration"
|
||||
INFO_LOG() << "setHistoryState Building " << buildingId << " changed -> updating configuration"
|
||||
<< " biNew mseId=" << biNew.mseId
|
||||
<< " init=" << init;
|
||||
bool initBuildingChanged = true;
|
||||
@@ -349,7 +348,7 @@ void IsmHandler::buildingsChanged(bool init)
|
||||
{
|
||||
if (m_currentBuildingConfiguration.contains(it.key()))
|
||||
continue;
|
||||
INFO_LOG(m_logger) << "setHistoryState New building added key= " << it.key()
|
||||
INFO_LOG() << "setHistoryState New building added key= " << it.key()
|
||||
<< " init=" << init;
|
||||
emit buildingChanged(it.value(), init);
|
||||
}
|
||||
@@ -373,7 +372,7 @@ void IsmHandler::handleBuildingSensorModule(const InfrastructureManagement::Stru
|
||||
bsi.port = getBsmPortFromJSon(ia.properties());
|
||||
bsi.relPosition = se.relPosition();
|
||||
bsi.orientation = se.orientation();
|
||||
DEBUG_LOG(m_logger) << "adding bsm sensor module to building " << bi.mseId << ": " << bsi.assetId << ", " << bsi.bsmId << ", " << bsi.hostname;
|
||||
DEBUG_LOG() << "adding bsm sensor module to building " << bi.mseId << ": " << bsi.assetId << ", " << bsi.bsmId << ", " << bsi.hostname;
|
||||
bi.bsms.insert(bsi.assetId, bsi);
|
||||
}
|
||||
|
||||
@@ -388,7 +387,7 @@ void IsmHandler::handleBuildingControlUnit(const InfrastructureManagement::Struc
|
||||
auto itMpa = m_structureElementId2AssetId.find(se.id());
|
||||
if (itMpa == m_structureElementId2AssetId.end())
|
||||
{
|
||||
INFO_LOG(m_logger) << "structure element id " << se.id() << " not (yet)found"
|
||||
INFO_LOG() << "structure element id " << se.id() << " not (yet)found"
|
||||
<< " bi.mseId=" << bi.mseId
|
||||
<< " bi.assetId=" << bi.assetId
|
||||
<< " bi.egcus.size=" << bi.egcus.size()
|
||||
@@ -399,31 +398,31 @@ void IsmHandler::handleBuildingControlUnit(const InfrastructureManagement::Struc
|
||||
const auto itAsset = m_assetMainStructureElementInExercise.find(assetId);
|
||||
if (itAsset == m_assetMainStructureElementInExercise.end())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "asset id " << assetId << " not found";
|
||||
ERROR_LOG() << "asset id " << assetId << " not found";
|
||||
Q_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
bi.currentExerciseId = itAsset.value();
|
||||
bi.assetId = itAsset.key();
|
||||
|
||||
DEBUG_LOG(m_logger) << "adding bsm control unit (virtual) to building " << bi.mseId << ": " << bi.assetId << ", " << bi.currentExerciseId;
|
||||
DEBUG_LOG() << "adding bsm control unit (virtual) to building " << bi.mseId << ": " << bi.assetId << ", " << bi.currentExerciseId;
|
||||
}
|
||||
|
||||
void IsmHandler::handleEffectGenerationControlUnit(const InfrastructureManagement::StructureElement &se, BuildingInfo &bi) const
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BuildingId=" << bi.mseId
|
||||
DEBUG_LOG() << "BuildingId=" << bi.mseId
|
||||
<< " se.id=" << se.id();
|
||||
auto itMpa = m_structureElementId2AssetId.find(se.id());
|
||||
if (itMpa == m_structureElementId2AssetId.end())
|
||||
{
|
||||
INFO_LOG(m_logger) << "Return m_structureElementId2AssetId.size()=" << m_structureElementId2AssetId.size();
|
||||
INFO_LOG() << "Return m_structureElementId2AssetId.size()=" << m_structureElementId2AssetId.size();
|
||||
return;
|
||||
}
|
||||
const int assetId = itMpa.value();
|
||||
const auto itAsset = m_instAssets.find(assetId);
|
||||
if (itAsset == m_instAssets.end())
|
||||
{
|
||||
INFO_LOG(m_logger) << "Return m_instAssets.size()=" << m_instAssets.size();
|
||||
INFO_LOG() << "Return m_instAssets.size()=" << m_instAssets.size();
|
||||
return;
|
||||
}
|
||||
const InfrastructureManagement::InstrumentationAsset &ia = itAsset.value();
|
||||
@@ -434,12 +433,12 @@ void IsmHandler::handleEffectGenerationControlUnit(const InfrastructureManagemen
|
||||
egcu.mountPointId = se.mountingPointId();
|
||||
egcu.hostname = QString::fromStdString(ia.hostname());
|
||||
egcu.assetId = assetId;
|
||||
DEBUG_LOG(m_logger) << "Egcu.hostname=" << egcu.hostname;
|
||||
INFO_LOG(m_logger) << "properties=" << ia.properties();
|
||||
DEBUG_LOG() << "Egcu.hostname=" << egcu.hostname;
|
||||
INFO_LOG() << "properties=" << ia.properties();
|
||||
|
||||
bi.egcus.push_back(egcu);
|
||||
|
||||
DEBUG_LOG(m_logger) << "adding egcu to building " << bi.mseId << ": " << egcu.hostname
|
||||
DEBUG_LOG() << "adding egcu to building " << bi.mseId << ": " << egcu.hostname
|
||||
<< " name=" << egcu.buildingName
|
||||
<< " mountPointName=" << egcu.mountPointName
|
||||
<< " mountPointId=" << egcu.mountPointId
|
||||
@@ -471,37 +470,37 @@ void IsmHandler::checkOverride(const InfrastructureManagement::MainStructureElem
|
||||
const InfrastructureManagement::MainStructureElement &mseNew)
|
||||
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION;
|
||||
DEBUG_LOG(m_logger) << "mseOld.elements().size()=" << mseOld.elements().size()
|
||||
DEBUG_LOG() << Q_FUNC_INFO;
|
||||
DEBUG_LOG() << "mseOld.elements().size()=" << mseOld.elements().size()
|
||||
<< " mseNew.elements().size()=" << mseNew.elements().size();
|
||||
|
||||
|
||||
for (const InfrastructureManagement::StructureElement &se : mseNew.elements())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "se=" << se.id()
|
||||
DEBUG_LOG() << "se=" << se.id()
|
||||
<< " name=" << se.name()
|
||||
<< " displayName=" << se.displayName()
|
||||
<< " properties=" << se.properties();
|
||||
|
||||
for (const InfrastructureManagement::StructureElement &seOld : mseOld.elements())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "seOld.id=" << seOld.id()
|
||||
DEBUG_LOG() << "seOld.id=" << seOld.id()
|
||||
<< " se.id=" << se.id();
|
||||
if ( seOld.id() == se.id())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Properties =" << se.properties()
|
||||
DEBUG_LOG() << "Properties =" << se.properties()
|
||||
<< " se.id=" << se.id()
|
||||
<< " se.name=" << se.name()
|
||||
<< " mountingPointId=" << se.mountingPointId();
|
||||
DEBUG_LOG(m_logger) << "se.properties()=" << se.properties()
|
||||
DEBUG_LOG() << "se.properties()=" << se.properties()
|
||||
<< " seOld.properties()=" << seOld.properties();
|
||||
if (se.properties() != seOld.properties() )
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "HandleOverrides"
|
||||
DEBUG_LOG() << "HandleOverrides"
|
||||
"<< m_currentBuildingConfiguration.size=" << m_currentBuildingConfiguration.size();
|
||||
if ( se.structureElementTypeId() == InfrastructureManagement::StructureElementType::Building)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BSM-Flash, no EGCU";
|
||||
DEBUG_LOG() << "BSM-Flash, no EGCU";
|
||||
QByteArray properties = QByteArray::fromStdString(se.properties());
|
||||
emit setEffectStates(mseNew.id(), 0, properties );
|
||||
continue;
|
||||
@@ -509,13 +508,13 @@ void IsmHandler::checkOverride(const InfrastructureManagement::MainStructureElem
|
||||
for (auto it = m_currentBuildingConfiguration.begin(); it != m_currentBuildingConfiguration.end(); ++it)
|
||||
{
|
||||
BuildingInfo &bi = it.value();
|
||||
DEBUG_LOG(m_logger) << "key=" << it.key()
|
||||
DEBUG_LOG() << "key=" << it.key()
|
||||
<< " id=" << bi.mseId
|
||||
<< " assetId=" << bi.assetId
|
||||
<< " egcus.size=" << bi.egcus.size();
|
||||
for (const auto &egcu : std::as_const(bi.egcus))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "AssetId=" << egcu.assetId
|
||||
DEBUG_LOG() << "AssetId=" << egcu.assetId
|
||||
<< " assetName=" << egcu.assetName
|
||||
<< " hostname=" << egcu.hostname
|
||||
<< " egcu.mountPointId=" << egcu.mountPointId
|
||||
@@ -523,7 +522,7 @@ void IsmHandler::checkOverride(const InfrastructureManagement::MainStructureElem
|
||||
if (egcu.mountPointId == se.mountingPointId())
|
||||
{
|
||||
QByteArray properties = QByteArray::fromStdString(se.properties());
|
||||
DEBUG_LOG(m_logger) << "Send Json SetEffectStates to BuildingProcess"
|
||||
DEBUG_LOG() << "Send Json SetEffectStates to BuildingProcess"
|
||||
<< " buildingId="
|
||||
<< " assetId="<< egcu.assetId
|
||||
<< " properties =" << properties;
|
||||
@@ -536,7 +535,7 @@ void IsmHandler::checkOverride(const InfrastructureManagement::MainStructureElem
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_LOG(m_logger) << "No changes do not HandleOverrides";
|
||||
TRACE_LOG() << "No changes do not HandleOverrides";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,7 +549,7 @@ void IsmHandler::checkOverride(const InfrastructureManagement::MainStructureElem
|
||||
|
||||
int assetId;
|
||||
bool foundAssetId = m_dtcIsm->getAssetIdFromMountingPoint(se.id(), se.mountingPointId(), assetId);
|
||||
DEBUG_LOG(m_logger) << "Send Overrides to BuildingProcess (EGCU)"
|
||||
DEBUG_LOG() << "Send Overrides to BuildingProcess (EGCU)"
|
||||
<< " foundAssetId=" << foundAssetId
|
||||
<< " structureElementId=" << mseNew.id()
|
||||
<< " se.id=" << se.id()
|
||||
|
||||
@@ -193,7 +193,6 @@ private:
|
||||
|
||||
QTimer *m_changeTimeoutTimer;
|
||||
QTimer *m_changeTimeoutTimerInit;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include "bld_export.h"
|
||||
#include "svcbldcommon_export.h"
|
||||
|
||||
namespace Buildings
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Buildings
|
||||
{
|
||||
MainHandler::MainHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_logger(getLogger("MainHandler"))
|
||||
{}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
@@ -31,17 +30,17 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
bool bRet = initInternal(domainId, exerciseId);
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << "WebSocketInterfaceHandler initialized Port=" << m_webSocketHandler->listenPort();
|
||||
DEBUG_LOG() << "WebSocketInterfaceHandler initialized Port=" << m_webSocketHandler->listenPort();
|
||||
m_ddsHandler->pacemaker()->addPort(m_webSocketHandler->listenPort(), Core::PortType::WebSocketServer);
|
||||
|
||||
if (bRet)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "svcBuildings successfully initialized";
|
||||
DEBUG_LOG() << "svcBuildings successfully initialized";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error initializing svcBuildings...";
|
||||
ERROR_LOG() << "Error initializing svcBuildings...";
|
||||
if (m_ddsHandler && m_ddsHandler->pacemaker())
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
}
|
||||
@@ -50,16 +49,16 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
|
||||
bool MainHandler::initInternal(int domainId, int exerciseId)
|
||||
{
|
||||
INFO_LOG(m_logger) << "MainHandler::init domainId = " << domainId
|
||||
INFO_LOG() << "MainHandler::init domainId = " << domainId
|
||||
<< " exerciseId = " << exerciseId;
|
||||
|
||||
m_dbHandler = std::make_shared<DbHandler>();
|
||||
if (!m_dbHandler->init(exerciseId, Settings::settings()))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not init DbHandler";
|
||||
ERROR_LOG() << "Could not init DbHandler";
|
||||
return false;
|
||||
}
|
||||
INFO_LOG(m_logger) << "DbHandler initialized";
|
||||
INFO_LOG() << "DbHandler initialized";
|
||||
|
||||
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(domainId, exerciseId);
|
||||
|
||||
@@ -64,7 +64,5 @@ private:
|
||||
std::shared_ptr<RelayInfoHandler> m_relayInfoHandler;
|
||||
std::shared_ptr<AssetManagement::Interface::Dtc> m_asmDtc;
|
||||
std::shared_ptr<WebSocketHandler> m_webSocketHandler;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
@@ -10,7 +10,6 @@ namespace Buildings
|
||||
PdmHandler::PdmHandler(MainHandler *mainHandler)
|
||||
: m_mainHandler(mainHandler)
|
||||
, m_bPdmInitialized(false)
|
||||
, m_logger(getLogger("PdmHandler"))
|
||||
{}
|
||||
|
||||
PdmHandler::~PdmHandler()
|
||||
@@ -27,7 +26,7 @@ void PdmHandler::initializePdm()
|
||||
!dtcPdm->waitForHistoricalDataChargeType(20000) ||
|
||||
!dtcPdm->waitForHistoricalDataBuildingChargeEffect(20000))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can not read charge/gear types from PDM";
|
||||
ERROR_LOG() << "Can not read charge/gear types from PDM";
|
||||
m_bPdmInitialized = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,5 @@ private:
|
||||
QMap<int, ProjectDataManagement::BuildingChargeEffect> m_buildingChargeEffects;
|
||||
MainHandler *m_mainHandler;
|
||||
bool m_bPdmInitialized;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
@@ -8,7 +8,6 @@ namespace Buildings
|
||||
{
|
||||
PpmHandler::PpmHandler(MainHandler *mainHandler)
|
||||
: m_mainHandler(mainHandler)
|
||||
, m_logger(getLogger("PpmHandler"))
|
||||
{}
|
||||
|
||||
PpmHandler::~PpmHandler()
|
||||
@@ -23,12 +22,12 @@ bool PpmHandler::init()
|
||||
this, &PpmHandler::onParticipantPositionChanged);
|
||||
if (!m_ppmDtc->enableEquipmentExerciseMapping())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can not read equipment/exercise mappings from PPM";
|
||||
ERROR_LOG() << "Can not read equipment/exercise mappings from PPM";
|
||||
return false;
|
||||
}
|
||||
if (!m_ppmDtc->enableParticipantPosition())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can not read ParticipantPositions from PPM";
|
||||
ERROR_LOG() << "Can not read ParticipantPositions from PPM";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -38,7 +37,7 @@ int PpmHandler::equipmentNumberToParticipantId(int equipmentNumber) const
|
||||
{
|
||||
const int ret = m_equipmentNumber2ParticipantId.value(equipmentNumber, -1);
|
||||
if (ret < 0)
|
||||
WARNING_LOG(m_logger) << "Can not map equipment number " << equipmentNumber << " to a valid participant id - using -1";
|
||||
WARNING_LOG() << "Can not map equipment number " << equipmentNumber << " to a valid participant id - using -1";
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,5 @@ private:
|
||||
QHash<int, int> m_equipmentNumber2ParticipantId;
|
||||
QHash<int, ParticipantManagement::ParticipantPosition> m_participantPositions;
|
||||
MainHandler *m_mainHandler;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
@@ -10,7 +10,6 @@ RelayInfoHandler::RelayInfoHandler(MainHandler *mainHandler)
|
||||
: QObject()
|
||||
, Interface::Fts::SetRelayInfoRequestHandler(mainHandler->ddsHandler()->fts())
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_logger(getLogger("RelayInfoHandler"))
|
||||
{}
|
||||
|
||||
RelayInfoHandler::~RelayInfoHandler()
|
||||
@@ -24,10 +23,10 @@ bool RelayInfoHandler::init()
|
||||
void RelayInfoHandler::onSetRelayInfoRequest(const rti::core::SampleIdentity &cookie,
|
||||
const SetRelayInfoRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSetRelayInfoRequest " << request;
|
||||
DEBUG_LOG() << "onSetRelayInfoRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onSetRelayInfoRequestInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
WARNING_LOG() << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->setRelayInfoReply(cookie, fro);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,5 @@ private:
|
||||
const SetRelayInfoRequest &request) override;
|
||||
Core::FunctionReplyObject onSetRelayInfoRequestInternal(const SetRelayInfoRequest &data);
|
||||
MainHandler *m_mainHandler;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
@@ -33,10 +33,10 @@ WebSocketHandler::~WebSocketHandler()
|
||||
|
||||
bool WebSocketHandler::init(quint16 listenPort)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "init";
|
||||
DEBUG_LOG() << "init";
|
||||
if (!m_webSocketServer->listen(QHostAddress::Any, listenPort))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Can not listen on port " << listenPort << " - aborting";
|
||||
WARNING_LOG() << "Can not listen on port " << listenPort << " - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ bool WebSocketHandler::init(quint16 listenPort)
|
||||
this, &WebSocketHandler::onNewConnection);
|
||||
|
||||
|
||||
INFO_LOG(m_logger) << "Listening on port " << m_webSocketServer->serverPort();
|
||||
INFO_LOG() << "Listening on port " << m_webSocketServer->serverPort();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ bool WebSocketHandler::init(const QPair<quint16, quint16> &portRange)
|
||||
|
||||
bool WebSocketHandler::sendTelegramInternal() const
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "sendTelegramInternal";
|
||||
DEBUG_LOG() << "sendTelegramInternal";
|
||||
QJsonObject obj;
|
||||
obj[QStringLiteral("participantId")] = 1;
|
||||
obj[QStringLiteral("equipmentNumber")] = 2;
|
||||
@@ -82,7 +82,7 @@ bool WebSocketHandler::sendTelegramInternal() const
|
||||
|
||||
bool WebSocketHandler::sendbuildingInfos() const
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "sendbuildingInfos";
|
||||
DEBUG_LOG() << "sendbuildingInfos";
|
||||
QJsonObject obj;
|
||||
QJsonArray arr;
|
||||
|
||||
@@ -93,7 +93,7 @@ bool WebSocketHandler::sendbuildingInfos() const
|
||||
BuildingProcess* buildingProcess = i.value();
|
||||
BuildingInfo buildingInfo = buildingProcess->buildingInfo();
|
||||
quint16 port = buildingProcess->getWebsocketPort();
|
||||
DEBUG_LOG(m_logger) << "key=" << i.key()
|
||||
DEBUG_LOG() << "key=" << i.key()
|
||||
<< " port= " << port
|
||||
<< " buildingInfo.name=" << buildingInfo.name;
|
||||
QJsonObject objIter;
|
||||
@@ -119,8 +119,8 @@ bool WebSocketHandler::sendbuildingInfos() const
|
||||
|
||||
void WebSocketHandler::onNewMessage(const QString &message)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onNewMessage='" << message << "'";
|
||||
DEBUG_LOG(m_logger) << "m_buildingControlHandler->m_buildings.size()=" << m_buildingControlHandler->getBuildings().size();
|
||||
DEBUG_LOG() << "onNewMessage='" << message << "'";
|
||||
DEBUG_LOG() << "m_buildingControlHandler->m_buildings.size()=" << m_buildingControlHandler->getBuildings().size();
|
||||
|
||||
if (message.indexOf(QStringLiteral("buildingRequest")) > 0)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ void WebSocketHandler::onNewMessage(const QString &message)
|
||||
}
|
||||
if (message.indexOf(QStringLiteral("triggerFlashlight")) > 0)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "triggerFlashlight" ;
|
||||
DEBUG_LOG() << "triggerFlashlight" ;
|
||||
triggerFlashlight(message);
|
||||
}
|
||||
}
|
||||
@@ -148,12 +148,12 @@ QJsonObject WebSocketHandler::ObjectFromString(const QString& in)
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Document is not an object";
|
||||
WARNING_LOG() << "Document is not an object";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Invalid JSON...\n" << in ;
|
||||
WARNING_LOG() << "Invalid JSON...\n" << in ;
|
||||
}
|
||||
|
||||
return obj;
|
||||
@@ -162,20 +162,20 @@ QJsonObject WebSocketHandler::ObjectFromString(const QString& in)
|
||||
|
||||
void WebSocketHandler::triggerFlashlight(const QString &message)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "triggerFlashlight message=" << message;
|
||||
DEBUG_LOG() << "triggerFlashlight message=" << message;
|
||||
QJsonObject obj = ObjectFromString(message);
|
||||
QJsonObject dataObj = obj.value(QStringLiteral("data")).toObject();
|
||||
int structureElementId = dataObj.value(QStringLiteral("structureElementId")).toInt();
|
||||
QString hostnameBsm = dataObj.value(QStringLiteral("hostnameBsm")).toString();
|
||||
|
||||
DEBUG_LOG(m_logger) << "hostnameBsm=" << hostnameBsm
|
||||
DEBUG_LOG() << "hostnameBsm=" << hostnameBsm
|
||||
<< " structureElementId=" << structureElementId;
|
||||
|
||||
}
|
||||
|
||||
void WebSocketHandler::onNewConnection()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onNewConnection";
|
||||
DEBUG_LOG() << "onNewConnection";
|
||||
QWebSocket *ws = m_webSocketServer->nextPendingConnection();
|
||||
|
||||
if (!ws)
|
||||
@@ -188,12 +188,12 @@ void WebSocketHandler::onNewConnection()
|
||||
|
||||
m_webSockets += ws;
|
||||
|
||||
INFO_LOG(m_logger) << "New websocket connected";
|
||||
INFO_LOG() << "New websocket connected";
|
||||
}
|
||||
|
||||
void WebSocketHandler::onWebSocketDisconnected()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onWebSocketDisconnected";
|
||||
DEBUG_LOG() << "onWebSocketDisconnected";
|
||||
QWebSocket *ws = qobject_cast<QWebSocket *>(sender());
|
||||
if (!ws)
|
||||
return;
|
||||
@@ -201,7 +201,7 @@ void WebSocketHandler::onWebSocketDisconnected()
|
||||
m_webSockets.removeAll(ws);
|
||||
ws->deleteLater();
|
||||
|
||||
INFO_LOG(m_logger) << "A websocket disconnected";
|
||||
INFO_LOG() << "A websocket disconnected";
|
||||
}
|
||||
|
||||
bool WebSocketHandler::sendPosition()
|
||||
|
||||
@@ -42,8 +42,6 @@ private:
|
||||
std::shared_ptr<BuildingControlHandler> m_buildingControlHandler;
|
||||
QWebSocketServer* m_webSocketServer = nullptr;
|
||||
QVector<QWebSocket*> m_webSockets;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <QJsonDocument>
|
||||
#include <AudioVideoManagement/avm_enums.hpp>
|
||||
#include <CombatNetRadio/svccnrhelper_export.h>
|
||||
#include "svccnrhelper_export.h"
|
||||
#include <CombatNetRadio/Helper/cnr_frequency_planning_helper.h>
|
||||
|
||||
namespace AudioVideoManagement {
|
||||
|
||||
+7
-7
@@ -30,7 +30,7 @@ bool ClientConnection::init()
|
||||
{
|
||||
if (m_socket == nullptr)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation failed due to an invalid socket";
|
||||
ERROR_LOG() << "Initialisation failed due to an invalid socket";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -51,17 +51,17 @@ void ClientConnection::addMessage(const CombatNetRadio::WebSocketInterface::Mess
|
||||
if (!m_socket || m_socket->state() != QAbstractSocket::ConnectedState)
|
||||
{
|
||||
m_messageQueue.enqueue(message);
|
||||
DEBUG_LOG(m_logger) << "Adding message to queue, size: " << m_messageQueue.size();
|
||||
DEBUG_LOG() << "Adding message to queue, size: " << m_messageQueue.size();
|
||||
return;
|
||||
}
|
||||
const QString msg(message.toJsonString());
|
||||
DEBUG_LOG(m_logger) << "Send msg: " << msg;
|
||||
DEBUG_LOG() << "Send msg: " << msg;
|
||||
m_socket->sendTextMessage(msg);
|
||||
}
|
||||
|
||||
void ClientConnection::onNewTextMessageFromSocket(const QString &message)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Recv msg: " << message;
|
||||
DEBUG_LOG() << "Recv msg: " << message;
|
||||
emit newTextMessage(this, message);
|
||||
}
|
||||
|
||||
@@ -73,15 +73,15 @@ void ClientConnection::sendMessagesFromQueue()
|
||||
{
|
||||
Messages::ReplyMessage message = m_messageQueue.dequeue();
|
||||
const QString msg(message.toJsonString());
|
||||
TRACE_LOG(m_logger) << "Send msg: " << msg;
|
||||
TRACE_LOG() << "Send msg: " << msg;
|
||||
m_socket->sendTextMessage(msg);
|
||||
DEBUG_LOG(m_logger) << "Sent message from queue, new size: " << m_messageQueue.size();
|
||||
DEBUG_LOG() << "Sent message from queue, new size: " << m_messageQueue.size();
|
||||
}
|
||||
}
|
||||
|
||||
void ClientConnection::onSocketDisconnect()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Client with ip "
|
||||
DEBUG_LOG() << "Client with ip "
|
||||
<< m_ip.toString()
|
||||
<< " disconnected";
|
||||
emit disconnected(this);
|
||||
|
||||
-2
@@ -46,8 +46,6 @@ private:
|
||||
QWebSocket *m_socket;
|
||||
QQueue<Messages::ReplyMessage> m_messageQueue;
|
||||
QHostAddress m_ip;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+6
-7
@@ -12,7 +12,6 @@ using namespace CombatNetRadio::WebSocketInterface::Connection;
|
||||
|
||||
ConnectionHandler::ConnectionHandler()
|
||||
: m_server(nullptr)
|
||||
, m_logger(getLogger("ConnectionHandler"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -39,13 +38,13 @@ bool ConnectionHandler::init()
|
||||
|
||||
|
||||
quint16 port = 2081;
|
||||
DEBUG_LOG(m_logger) << "Trying to listen to port " << port;
|
||||
DEBUG_LOG() << "Trying to listen to port " << port;
|
||||
if (!m_server->listen(QHostAddress::Any, port))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Not possible to listen to port " << port;
|
||||
ERROR_LOG() << "Not possible to listen to port " << port;
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
DEBUG_LOG() << "... ok";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -64,7 +63,7 @@ void ConnectionHandler::onNewMessage(CombatNetRadio::WebSocketInterface::Message
|
||||
|
||||
void ConnectionHandler::onServerError(QWebSocketProtocol::CloseCode closeCode)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Got server error with close code " << closeCode;
|
||||
ERROR_LOG() << "Got server error with close code " << closeCode;
|
||||
}
|
||||
|
||||
void ConnectionHandler::onNewConnection()
|
||||
@@ -76,7 +75,7 @@ void ConnectionHandler::onNewConnection()
|
||||
|
||||
if (!newConnection->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Failed to initialise new client";
|
||||
ERROR_LOG() << "Failed to initialise new client";
|
||||
delete newConnection;
|
||||
newConnection = nullptr;
|
||||
continue;
|
||||
@@ -86,7 +85,7 @@ void ConnectionHandler::onNewConnection()
|
||||
connect(newConnection, &ClientConnection::disconnected, this, &ConnectionHandler::onDisconnected);
|
||||
|
||||
m_connections.append(newConnection);
|
||||
DEBUG_LOG(m_logger) << "New client with ip " << newConnection->ip().toString() << " connected";
|
||||
DEBUG_LOG() << "New client with ip " << newConnection->ip().toString() << " connected";
|
||||
emit newClientConnection((qint64) static_cast<WebSocketInterface::Connection::ClientConnection::MessageTransmitter*>(newConnection));
|
||||
}
|
||||
}
|
||||
|
||||
-2
@@ -52,8 +52,6 @@ private Q_SLOTS:
|
||||
private:
|
||||
QWebSocketServer *m_server;
|
||||
QVector<ClientConnection *> m_connections;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -14,7 +14,6 @@ namespace Messages
|
||||
|
||||
MessageHandler::MessageHandler(ExerciseManager *exerciseManager)
|
||||
: m_exerciseManager(exerciseManager)
|
||||
, m_logger(getLogger("MessageHandler"))
|
||||
{
|
||||
Q_ASSERT(exerciseManager);
|
||||
}
|
||||
|
||||
-2
@@ -29,8 +29,6 @@ public Q_SLOTS:
|
||||
|
||||
private:
|
||||
ExerciseManager *m_exerciseManager;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -17,7 +17,6 @@ WebSocketInterfaceHandler::WebSocketInterfaceHandler(ExerciseManager *exerciseMa
|
||||
: m_exerciseManager(exerciseManager)
|
||||
, m_connectionHandler(nullptr)
|
||||
, m_messageHandler(nullptr)
|
||||
, m_logger(getLogger("WebSocketInterfaceHandler"))
|
||||
{
|
||||
Q_ASSERT(exerciseManager);
|
||||
}
|
||||
@@ -40,7 +39,7 @@ bool WebSocketInterfaceHandler::init()
|
||||
|
||||
if (!m_connectionHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Failed to initialise ConnectionHandler";
|
||||
ERROR_LOG() << "Failed to initialise ConnectionHandler";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ ConfigCnr::ConfigCnr(int exerciseId, AudioVideoManagement::Interface::Dtc *avmDt
|
||||
: m_exerciseId(exerciseId)
|
||||
, m_avmDtc(avmDtc)
|
||||
, m_ismDtc(ismDtc)
|
||||
, m_logger(getLogger("ConfigCnr"))
|
||||
, m_loggerJson(getLogger("ConfigCnr.Json"))
|
||||
{
|
||||
Q_ASSERT(avmDtc);
|
||||
@@ -200,7 +199,7 @@ boost::optional<AudioVideoManagement::FrequencyPlanning> ConfigCnr::activePlan()
|
||||
|
||||
void ConfigCnr::onActiveFrequencyPlanningChanged(const AudioVideoManagement::ActiveFrequencyPlanning &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << ": " << data;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << ": " << data;
|
||||
|
||||
Q_UNUSED(modType);
|
||||
if (data.exerciseId() == m_exerciseId)
|
||||
@@ -209,7 +208,7 @@ void ConfigCnr::onActiveFrequencyPlanningChanged(const AudioVideoManagement::Act
|
||||
|
||||
void ConfigCnr::onFrequencyPlanningChanged(const AudioVideoManagement::FrequencyPlanning &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << ": " << data;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << ": " << data;
|
||||
|
||||
Q_UNUSED(modType);
|
||||
|
||||
@@ -224,7 +223,7 @@ void ConfigCnr::onFrequencyPlanningChanged(const AudioVideoManagement::Frequency
|
||||
|
||||
void ConfigCnr::onCnrConfigChanged(const AudioVideoManagement::CnrConfig &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << ": " << data;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << ": " << data;
|
||||
|
||||
Q_UNUSED(modType);
|
||||
bool isGlobal = !data.exerciseId().is_set();
|
||||
|
||||
@@ -14,18 +14,17 @@ namespace CombatNetRadio
|
||||
|
||||
DdsHandler::DdsHandler(int domainId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Global))
|
||||
, m_logger(getLogger("DdsHandler"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION;
|
||||
DEBUG_LOG() << Q_FUNC_INFO;
|
||||
|
||||
if (!m_ddsConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
||||
ERROR_LOG() << "Error initializing dds connections - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,8 +83,6 @@ private:
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Ftc> m_avmFtc;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -67,7 +67,6 @@ public:
|
||||
ExerciseManager::ExerciseManager(ActiveExercises *activeExercises, DdsHandler *ddsHandler)
|
||||
: m_activeExercises(activeExercises)
|
||||
, m_ddsHandler(ddsHandler)
|
||||
, m_logger(getLogger("ExerciseManager"))
|
||||
{
|
||||
Q_ASSERT(activeExercises);
|
||||
Q_ASSERT(ddsHandler);
|
||||
@@ -112,13 +111,13 @@ std::vector<WebSocketInterface::Messages::ReplyMessage> ExerciseManager::radioSt
|
||||
|
||||
WebSocketInterface::Messages::ReplyMessage ExerciseManager::configCnr(const QString &uuid)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION;
|
||||
DEBUG_LOG() << Q_FUNC_INFO;
|
||||
|
||||
const WebSocketInterface::Messages::ErrorMessage noActivePlanning(1, uuid, QStringLiteral("No active frequency planning found"));
|
||||
|
||||
if (m_parts.empty())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "No active frequency planning due to empty m_parts.";
|
||||
DEBUG_LOG() << "No active frequency planning due to empty m_parts.";
|
||||
|
||||
return noActivePlanning;
|
||||
}
|
||||
@@ -142,7 +141,7 @@ WebSocketInterface::Messages::ReplyMessage ExerciseManager::configCnr(const QStr
|
||||
|
||||
if (configCnrData.radioCircuit.empty())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "No active frequency planning due to empty radio circuits.";
|
||||
DEBUG_LOG() << "No active frequency planning due to empty radio circuits.";
|
||||
|
||||
return noActivePlanning;
|
||||
}
|
||||
@@ -183,25 +182,25 @@ WebSocketInterface::Messages::ReplyMessage ExerciseManager::positionsCnr(const Q
|
||||
void ExerciseManager::onModifyFrequencyPlanningStatusReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
if (replyObject.error())
|
||||
ERROR_LOG(m_logger) << "Error while modifying FrequencyPlanningStatus: " << replyObject.str();
|
||||
ERROR_LOG() << "Error while modifying FrequencyPlanningStatus: " << replyObject.str();
|
||||
else
|
||||
INFO_LOG(m_logger) << "onModifyFrequencyPlanningStatusReply ok";
|
||||
INFO_LOG() << "onModifyFrequencyPlanningStatusReply ok";
|
||||
}
|
||||
|
||||
void ExerciseManager::onClearFrequencyPlanningStatusReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
if (replyObject.error())
|
||||
ERROR_LOG(m_logger) << "Error while clearing FrequencyPlanningStatus: " << replyObject.str();
|
||||
ERROR_LOG() << "Error while clearing FrequencyPlanningStatus: " << replyObject.str();
|
||||
else
|
||||
INFO_LOG(m_logger) << "onClearFrequencyPlanningStatusReply ok";
|
||||
INFO_LOG() << "onClearFrequencyPlanningStatusReply ok";
|
||||
}
|
||||
|
||||
void ExerciseManager::onRemoveFrequencyPlanningStatusByClientReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
if (replyObject.error())
|
||||
ERROR_LOG(m_logger) << "Error while removing FrequencyPlanningStatus: " << replyObject.str();
|
||||
ERROR_LOG() << "Error while removing FrequencyPlanningStatus: " << replyObject.str();
|
||||
else
|
||||
INFO_LOG(m_logger) << "onRemoveFrequencyPlanningStatusByClientReply ok";
|
||||
INFO_LOG() << "onRemoveFrequencyPlanningStatusByClientReply ok";
|
||||
}
|
||||
|
||||
void ExerciseManager::setPositionsUpdateInterval(std::chrono::milliseconds interval)
|
||||
|
||||
@@ -79,9 +79,7 @@ private:
|
||||
std::map<int, ExerciseParts> m_parts;
|
||||
std::unique_ptr<TrainingArea> m_trainingArea;
|
||||
QTimer m_positionsUpdateTimer;
|
||||
QTimer m_essentialsUpdateTimer;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
QTimer m_essentialsUpdateTimer;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -19,12 +19,12 @@ MainHandler::~MainHandler() = default;
|
||||
|
||||
bool MainHandler::init(int domainId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION;
|
||||
DEBUG_LOG() << Q_FUNC_INFO;
|
||||
|
||||
m_ddsHandler.reset(new DdsHandler(domainId));
|
||||
if (!m_ddsHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation DdsHandler failed.";
|
||||
ERROR_LOG() << "Initialisation DdsHandler failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
@@ -35,7 +35,7 @@ bool MainHandler::init(int domainId)
|
||||
m_webSocketInterfaceHandler.reset(new WebSocketInterface::WebSocketInterfaceHandler(m_exerciseManager.get()));
|
||||
if (!m_webSocketInterfaceHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation WebSocketInterfaceHandler failed.";
|
||||
ERROR_LOG() << "Initialisation WebSocketInterfaceHandler failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ void TrainingArea::getRadioStations(InfrastructureManagement::Interface::Dtc *is
|
||||
data.id = stationId(mse);
|
||||
if (data.id == 0)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Got MainStructureElement of type 'RadioStation' but property 'stationId' was not set"
|
||||
WARNING_LOG() << "Got MainStructureElement of type 'RadioStation' but property 'stationId' was not set"
|
||||
<< " - database id: " << mse.id() << " - ignoring!";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
|
||||
# Generate cmo_[d|f]tc.h
|
||||
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY(SV WS svcCmoCommon SHARED ${SRCS_common})
|
||||
NGL_ADD_LIBRARY2(SV WS svcCmoCommon SHARED ${SRCS_common})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcCmoCommon
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
@@ -60,7 +60,7 @@ SET(SRCS_client
|
||||
# generate cmo_[d|f]tc.h, cmo_[d|f]tc_impl.[cpp|h]
|
||||
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY(SV WS svcCmoClient SHARED ${SRCS_client})
|
||||
NGL_ADD_LIBRARY2(SV WS svcCmoClient SHARED ${SRCS_client})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcCmoClient
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
@@ -89,7 +89,7 @@ SET(SRCS_server
|
||||
# generate cmo_[d|f]ts.h, cmo_[d|f]ts_impl.[cpp|h]
|
||||
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY(SV svcCmoServer SHARED ${SRCS_server})
|
||||
NGL_ADD_LIBRARY2(SV svcCmoServer SHARED ${SRCS_server})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcCmoServer
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
|
||||
@@ -17,25 +17,24 @@ namespace ComponentMonitor
|
||||
CheckmkHandler::CheckmkHandler()
|
||||
: QObject()
|
||||
, m_socket(new QTcpSocket(this))
|
||||
, m_logger(getLogger("CheckmkHandler"))
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
CheckmkHandler::~CheckmkHandler()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
if (m_timer)
|
||||
m_timer->stop();
|
||||
delete m_socket;
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
bool CheckmkHandler::initialize(const QString &checkMkServerHostname, int checkMkServerPort,
|
||||
int checkIntervalSec)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START"
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START"
|
||||
<< " , hostname=" << checkMkServerHostname
|
||||
<< " , port=" << checkMkServerPort
|
||||
<< " , m_checkIntervalSec=" << checkIntervalSec;
|
||||
@@ -59,22 +58,22 @@ bool CheckmkHandler::initialize(const QString &checkMkServerHostname, int checkM
|
||||
this, &CheckmkHandler::onConnected);
|
||||
connect(m_socket, &QTcpSocket::readyRead, this, &CheckmkHandler::readData);
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
INFO_LOG() << Q_FUNC_INFO << " END";
|
||||
return true;
|
||||
}
|
||||
|
||||
void CheckmkHandler::run()
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
INFO_LOG() << Q_FUNC_INFO << " START";
|
||||
m_timer->start();
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
INFO_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
void CheckmkHandler::stop()
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
INFO_LOG() << Q_FUNC_INFO << " START";
|
||||
m_timer->stop();
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
INFO_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
void CheckmkHandler::onTimeout()
|
||||
@@ -87,7 +86,7 @@ void CheckmkHandler::onTimeout()
|
||||
m_timer->setInterval(m_checkIntervalSec*1000);
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " Timeout, m_highFrequencyCheck=" << m_highFrequencyCheck
|
||||
INFO_LOG() << Q_FUNC_INFO << " Timeout, m_highFrequencyCheck=" << m_highFrequencyCheck
|
||||
<< ", current Interval=" << m_timer->interval() << " [msec]";
|
||||
|
||||
if (m_socket->state() == QAbstractSocket::SocketState::ConnectedState)
|
||||
@@ -100,37 +99,37 @@ void CheckmkHandler::onTimeout()
|
||||
|
||||
bool CheckmkHandler::doConnect()
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " START, (int)m_socket->state()=" << (int)m_socket->state();
|
||||
INFO_LOG() << Q_FUNC_INFO << " START, (int)m_socket->state()=" << (int)m_socket->state();
|
||||
|
||||
|
||||
m_socket->connectToHost(m_checkMkHost, m_checkMkPort);
|
||||
if (!m_socket->waitForConnected(5000))
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " Could not (re)open tcp destination " << m_checkMkHost << ":" << m_checkMkPort << ", error: " << m_socket->errorString();
|
||||
ERROR_LOG() << Q_FUNC_INFO << " Could not (re)open tcp destination " << m_checkMkHost << ":" << m_checkMkPort << ", error: " << m_socket->errorString();
|
||||
return false;
|
||||
}
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " (Re)openend tcp destination " << m_checkMkHost << ":" << m_checkMkPort;
|
||||
INFO_LOG() << Q_FUNC_INFO << " (Re)openend tcp destination " << m_checkMkHost << ":" << m_checkMkPort;
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
INFO_LOG() << Q_FUNC_INFO << " END";
|
||||
return true;
|
||||
}
|
||||
|
||||
void CheckmkHandler::onImmediateGetStateRequested()
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
INFO_LOG() << Q_FUNC_INFO << " START";
|
||||
|
||||
|
||||
m_highFrequencyCheck = 3;
|
||||
onTimeout();
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
INFO_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
bool CheckmkHandler::writeGetStateRequest()
|
||||
{
|
||||
if (!m_socket->isOpen())
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " socket not open";
|
||||
ERROR_LOG() << Q_FUNC_INFO << " socket not open";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -161,16 +160,16 @@ bool CheckmkHandler::writeGetStateRequest()
|
||||
|
||||
const char* cmdCheck = "GET hosts\nResponseHeader: fixed16\nColumns: name state last_check \nKeepAlive: on\n\n";
|
||||
int bWritten = m_socket->write(cmdCheck);
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " cmdCheck= '" << cmdCheck << "'";
|
||||
INFO_LOG() << Q_FUNC_INFO << " cmdCheck= '" << cmdCheck << "'";
|
||||
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " bWritten= " << bWritten;
|
||||
INFO_LOG() << Q_FUNC_INFO << " bWritten= " << bWritten;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CheckmkHandler::readData()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
|
||||
|
||||
while (m_socket->canReadLine())
|
||||
processLine(m_socket->readLine().trimmed());
|
||||
@@ -205,10 +204,10 @@ bool CheckmkHandler::processLine(const QByteArray &line)
|
||||
if (sl.size() < 2)
|
||||
{
|
||||
if (str.startsWith(QStringLiteral("200")))
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " size to small " << sl.size()
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " size to small " << sl.size()
|
||||
<< ", line='" << str << "'";
|
||||
else
|
||||
WARNING_LOG(m_logger) << LOGFUNCTION << " size to small " << sl.size()
|
||||
WARNING_LOG() << Q_FUNC_INFO << " size to small " << sl.size()
|
||||
<< ", line='" << str << "'";
|
||||
return false;
|
||||
}
|
||||
@@ -239,7 +238,7 @@ bool CheckmkHandler::processLine(const QByteArray &line)
|
||||
lastCheck = lastCheckStr.toLongLong();
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION
|
||||
DEBUG_LOG() << Q_FUNC_INFO
|
||||
<< " name: '" << name << "'"
|
||||
<< ", stateInt: '" << stateInt << "'"
|
||||
<< ", reachable: '" << reachable << "'"
|
||||
|
||||
@@ -67,8 +67,6 @@ private:
|
||||
QTimer *m_timer{nullptr};
|
||||
|
||||
QTcpSocket *m_socket{nullptr};
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+28
-29
@@ -16,28 +16,27 @@ CheckmkHandlerScheduleCheck::CheckmkHandlerScheduleCheck(const std::shared_ptr<D
|
||||
, TriggerUpdateRequestHandler(ddsHandler->fts())
|
||||
, m_socket(new QTcpSocket(this))
|
||||
, m_ddsHandler(ddsHandler)
|
||||
, m_logger(getLogger("CheckmkHandlerScheduleCheck"))
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
CheckmkHandlerScheduleCheck::~CheckmkHandlerScheduleCheck()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
if (m_timer)
|
||||
m_timer->stop();
|
||||
delete m_socket;
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
bool CheckmkHandlerScheduleCheck::initialize(const QString &checkMkServerHostname, int checkMkServerPort)
|
||||
{
|
||||
NOTICE_LOG(m_logger) << LOGFUNCTION << " START"
|
||||
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " START"
|
||||
<< " , hostname=" << checkMkServerHostname
|
||||
<< " , port=" << checkMkServerPort;
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " ddsHandler referenced";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " ddsHandler referenced";
|
||||
|
||||
m_checkMkHost = checkMkServerHostname;
|
||||
m_checkMkPort = checkMkServerPort;
|
||||
@@ -56,22 +55,22 @@ bool CheckmkHandlerScheduleCheck::initialize(const QString &checkMkServerHostnam
|
||||
connect(m_socket, &QTcpSocket::connected,
|
||||
this, &CheckmkHandlerScheduleCheck::onConnected);
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
INFO_LOG() << Q_FUNC_INFO << " END";
|
||||
return true;
|
||||
}
|
||||
|
||||
void CheckmkHandlerScheduleCheck::run(int timoutMsec)
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " START, timoutMsec=" << timoutMsec;
|
||||
INFO_LOG() << Q_FUNC_INFO << " START, timoutMsec=" << timoutMsec;
|
||||
m_timer->start(timoutMsec);
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
INFO_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
void CheckmkHandlerScheduleCheck::stop()
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
INFO_LOG() << Q_FUNC_INFO << " START";
|
||||
m_timer->stop();
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
INFO_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
void CheckmkHandlerScheduleCheck::onTimeout()
|
||||
@@ -86,7 +85,7 @@ void CheckmkHandlerScheduleCheck::onTimeout()
|
||||
|
||||
bool CheckmkHandlerScheduleCheck::doConnect()
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " START, (int)m_socket->state()=" << (int)m_socket->state();
|
||||
INFO_LOG() << Q_FUNC_INFO << " START, (int)m_socket->state()=" << (int)m_socket->state();
|
||||
|
||||
|
||||
|
||||
@@ -94,30 +93,30 @@ bool CheckmkHandlerScheduleCheck::doConnect()
|
||||
m_socket->connectToHost(m_checkMkHost, m_checkMkPort);
|
||||
if (!m_socket->waitForConnected(5000))
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " Could not (re)open tcp destination " << m_checkMkHost << ":" << m_checkMkPort << ", error: " << m_socket->errorString();
|
||||
ERROR_LOG() << Q_FUNC_INFO << " Could not (re)open tcp destination " << m_checkMkHost << ":" << m_checkMkPort << ", error: " << m_socket->errorString();
|
||||
return false;
|
||||
}
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " (Re)openend tcp destination " << m_checkMkHost << ":" << m_checkMkPort;
|
||||
INFO_LOG() << Q_FUNC_INFO << " (Re)openend tcp destination " << m_checkMkHost << ":" << m_checkMkPort;
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
INFO_LOG() << Q_FUNC_INFO << " END";
|
||||
return true;
|
||||
}
|
||||
|
||||
void CheckmkHandlerScheduleCheck::addScheduleCheckHostnames(const QStringList &hostnames)
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " hostnames: " << hostnames.join(QStringLiteral(";"));
|
||||
INFO_LOG() << Q_FUNC_INFO << " hostnames: " << hostnames.join(QStringLiteral(";"));
|
||||
m_scheduleCheckHostnames += hostnames;
|
||||
}
|
||||
|
||||
bool CheckmkHandlerScheduleCheck::writeScheduleUpdateRequest()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION
|
||||
DEBUG_LOG() << Q_FUNC_INFO
|
||||
<< " state " << (int)m_socket->state()
|
||||
<< ", isOpen " << m_socket->isOpen();
|
||||
|
||||
if (!m_socket->isOpen() || (m_socket->state() != QAbstractSocket::SocketState::ConnectedState))
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " socket not open or connected "
|
||||
ERROR_LOG() << Q_FUNC_INFO << " socket not open or connected "
|
||||
<< " host/port: " << m_checkMkHost << ":" << m_checkMkPort;
|
||||
return false;
|
||||
}
|
||||
@@ -138,13 +137,13 @@ bool CheckmkHandlerScheduleCheck::writeScheduleUpdateRequest()
|
||||
qint64 now = QDateTime::currentSecsSinceEpoch();
|
||||
|
||||
const QString cmd = QString(QStringLiteral("COMMAND [%1] SCHEDULE_FORCED_HOST_CHECK;%2;%3")).arg(now).arg(hostname.toUpper()).arg(now);
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " cmd= '" << cmd << "'";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " cmd= '" << cmd << "'";
|
||||
int bWritten = m_socket->write(cmd.toUtf8()) + m_socket->write("\n\n");
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " bWritten= " << bWritten;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " bWritten= " << bWritten;
|
||||
bWrittenAll += bWritten;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " bWrittenAll= " << bWrittenAll;
|
||||
INFO_LOG() << Q_FUNC_INFO << " bWrittenAll= " << bWrittenAll;
|
||||
|
||||
|
||||
m_scheduleCheckHostnames.clear();
|
||||
@@ -166,7 +165,7 @@ void CheckmkHandlerScheduleCheck::onConnected()
|
||||
|
||||
void CheckmkHandlerScheduleCheck::onStateChanged(const QAbstractSocket::SocketState &newState)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " SocketState changed to: " << newState;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " SocketState changed to: " << newState;
|
||||
qInfo() << " CheckmkHandlerScheduleCheck: SocketState changed to: " << newState;
|
||||
}
|
||||
|
||||
@@ -178,8 +177,8 @@ void CheckmkHandlerScheduleCheck::onSocketError(const QAbstractSocket::SocketErr
|
||||
|
||||
void CheckmkHandlerScheduleCheck::onTriggerUpdateRequest(const rti::core::SampleIdentity &cookie, const TriggerUpdate &request)
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " request=" << request;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " m_socket->state=" << (int)m_socket->state();
|
||||
INFO_LOG() << Q_FUNC_INFO << " request=" << request;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " m_socket->state=" << (int)m_socket->state();
|
||||
|
||||
|
||||
|
||||
@@ -231,7 +230,7 @@ void CheckmkHandlerScheduleCheck::onTriggerUpdateRequest(const rti::core::Sample
|
||||
}
|
||||
} else {
|
||||
|
||||
WARNING_LOG(m_logger) << LOGFUNCTION << " socket not connected"
|
||||
WARNING_LOG() << Q_FUNC_INFO << " socket not connected"
|
||||
<< ", (int)m_socket->state()=" << (int)m_socket->state()
|
||||
<< ", destination " << m_checkMkHost << ":" << m_checkMkPort
|
||||
<< ", -> queued cmd/request: " << request;
|
||||
@@ -239,13 +238,13 @@ void CheckmkHandlerScheduleCheck::onTriggerUpdateRequest(const rti::core::Sample
|
||||
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " m_ddsHandler = " << m_ddsHandler;
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " m_ddsHandler->fts() = " << m_ddsHandler->fts();
|
||||
INFO_LOG() << Q_FUNC_INFO << " m_ddsHandler = " << m_ddsHandler;
|
||||
INFO_LOG() << Q_FUNC_INFO << " m_ddsHandler->fts() = " << m_ddsHandler->fts();
|
||||
|
||||
if (m_ddsHandler && m_ddsHandler->fts())
|
||||
m_ddsHandler->fts()->triggerUpdateReply(cookie, ret);
|
||||
else
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " no m_ddsHandler or m_ddsHandler->fts()";
|
||||
ERROR_LOG() << Q_FUNC_INFO << " no m_ddsHandler or m_ddsHandler->fts()";
|
||||
|
||||
|
||||
if (!connected)
|
||||
|
||||
-3
@@ -73,9 +73,6 @@ private:
|
||||
QTcpSocket *m_socket{nullptr};
|
||||
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+39
-40
@@ -14,34 +14,33 @@ namespace ComponentMonitor
|
||||
|
||||
ComponentStatusHandler::ComponentStatusHandler()
|
||||
: QObject()
|
||||
, m_logger(getLogger("ComponentStatusHandler"))
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
ComponentStatusHandler::~ComponentStatusHandler()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
m_ddsHandler = nullptr;
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
bool ComponentStatusHandler::initialize(const std::shared_ptr<DdsHandler> &ddsHandler)
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " START initialize ComponentStatusHandler";
|
||||
INFO_LOG() << Q_FUNC_INFO << " START initialize ComponentStatusHandler";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
m_ddsHandler = ddsHandler;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " ddsHandler referenced";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " ddsHandler referenced";
|
||||
|
||||
m_ismDtc = m_ddsHandler->ismDtc();
|
||||
if (!m_ismDtc)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " Failure: no ismDtc";
|
||||
ERROR_LOG() << Q_FUNC_INFO << " Failure: no ismDtc";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -49,7 +48,7 @@ bool ComponentStatusHandler::initialize(const std::shared_ptr<DdsHandler> &ddsHa
|
||||
m_ismDtc->enableInstrumentationAsset();
|
||||
m_ismDtc->waitForHistoricalDataInstrumentationAsset(2000);
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " instrumentationAssets-size = " << m_ismDtc->instrumentationAssets().size();
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " instrumentationAssets-size = " << m_ismDtc->instrumentationAssets().size();
|
||||
|
||||
|
||||
|
||||
@@ -66,8 +65,8 @@ bool ComponentStatusHandler::initialize(const std::shared_ptr<DdsHandler> &ddsHa
|
||||
QTimer::singleShot(35000, this, &ComponentStatusHandler::dump);
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << "initialize succesful, statusMapSize=" << statusMapSize();
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END initialize ComponentStatusHandler, statusMapSize=" << statusMapSize();
|
||||
DEBUG_LOG() << Q_FUNC_INFO << "initialize succesful, statusMapSize=" << statusMapSize();
|
||||
INFO_LOG() << Q_FUNC_INFO << " END initialize ComponentStatusHandler, statusMapSize=" << statusMapSize();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -96,7 +95,7 @@ void ComponentStatusHandler::onInstrumentationAssetChanged(const InfrastructureM
|
||||
static int assetChangedCounter = 0;
|
||||
|
||||
const int iAssetId = iAsset.id();
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION
|
||||
DEBUG_LOG() << Q_FUNC_INFO
|
||||
<< ", iAssetId=" << iAssetId
|
||||
<< " (assetChangedCounter=" << ++assetChangedCounter << ")";
|
||||
|
||||
@@ -140,62 +139,62 @@ void ComponentStatusHandler::onInstrumentationAssetChanged(const InfrastructureM
|
||||
|
||||
void ComponentStatusHandler::dump()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " DUMP START";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " DUMP START";
|
||||
|
||||
int counter = 0;
|
||||
|
||||
|
||||
counter = 0;
|
||||
DEBUG_LOG(m_logger) << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG(m_logger) << " REACHABLE:";
|
||||
DEBUG_LOG() << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG() << " REACHABLE:";
|
||||
for (const ComponentStatus &status : std::as_const(m_statusMap))
|
||||
{
|
||||
if (status.state().underlying() == ComponentState_def::Reachable)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " id=" << status.id() << ", host '" << status.hostname().c_str() << " -> Reachable";
|
||||
DEBUG_LOG() << " id=" << status.id() << ", host '" << status.hostname().c_str() << " -> Reachable";
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
DEBUG_LOG(m_logger) << " REACHABLE hostCounter = " << counter;
|
||||
DEBUG_LOG() << " REACHABLE hostCounter = " << counter;
|
||||
|
||||
|
||||
counter = 0;
|
||||
DEBUG_LOG(m_logger) << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG(m_logger) << " UNREACHABLE:";
|
||||
DEBUG_LOG() << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG() << " UNREACHABLE:";
|
||||
for (const ComponentStatus &status : std::as_const(m_statusMap))
|
||||
{
|
||||
if (status.state().underlying() == ComponentState_def::Unreachable)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " id=" << status.id() << ", host '" << status.hostname().c_str() << " -> Unreachable";
|
||||
DEBUG_LOG() << " id=" << status.id() << ", host '" << status.hostname().c_str() << " -> Unreachable";
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
DEBUG_LOG(m_logger) << " UNREACHABLE hostCounter = " << counter;
|
||||
DEBUG_LOG() << " UNREACHABLE hostCounter = " << counter;
|
||||
|
||||
|
||||
counter = 0;
|
||||
DEBUG_LOG(m_logger) << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG(m_logger) << " UNDEFINED:";
|
||||
DEBUG_LOG() << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG() << " UNDEFINED:";
|
||||
for (const ComponentStatus &status : std::as_const(m_statusMap))
|
||||
{
|
||||
if (status.state().underlying() == ComponentState_def::Undefined)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " id=" << status.id() << ", host '" << status.hostname().c_str() << " -> Undefined";
|
||||
DEBUG_LOG() << " id=" << status.id() << ", host '" << status.hostname().c_str() << " -> Undefined";
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
DEBUG_LOG(m_logger) << " UNDEFINED hostCounter = " << counter;
|
||||
DEBUG_LOG() << " UNDEFINED hostCounter = " << counter;
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " DUMP END";
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " DUMP END";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " +++++++++++++++++++++++++++++++++++++++++++++";
|
||||
}
|
||||
|
||||
void ComponentStatusHandler::onNewState(const QString &hostname, bool reachable, long long lastCheckSec)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " hostname=" << hostname
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " hostname=" << hostname
|
||||
<< ", reachable=" << reachable
|
||||
<< ", lastCheckSec=" << lastCheckSec;
|
||||
|
||||
@@ -220,7 +219,7 @@ void ComponentStatusHandler::onNewState(const QString &hostname, bool reachable,
|
||||
|
||||
void ComponentStatusHandler::onUpdateLastCheckTimeDirect(const QStringList &hostnamesForUpdateLastCheckTime, qint64 lastCheckSec)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START hostnamesForLastCheckTime=" << hostnamesForUpdateLastCheckTime.join(QStringLiteral(";"));
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START hostnamesForLastCheckTime=" << hostnamesForUpdateLastCheckTime.join(QStringLiteral(";"));
|
||||
|
||||
for (ITERATOR_T it = m_statusMap.begin(); it != m_statusMap.end(); ++it)
|
||||
{
|
||||
@@ -237,12 +236,12 @@ void ComponentStatusHandler::onUpdateLastCheckTimeDirect(const QStringList &host
|
||||
if ((curState == ComponentState_def::Reachable) ||
|
||||
(curState == ComponentState_def::Unreachable))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " updateLastCheckTimeDirect"
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " updateLastCheckTimeDirect"
|
||||
<< " host: '" << curHostname << "'"
|
||||
<< " newLastCheck= " << lastCheckSec;
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " DIFF_2a (*it) " << (*it);
|
||||
INFO_LOG() << Q_FUNC_INFO << " DIFF_2a (*it) " << (*it);
|
||||
cs.last_check(lastCheckSec);
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " DIFF_2b (*it) " << (*it);
|
||||
INFO_LOG() << Q_FUNC_INFO << " DIFF_2b (*it) " << (*it);
|
||||
m_ddsHandler->dts()->publish(cs);
|
||||
}
|
||||
}
|
||||
@@ -251,7 +250,7 @@ void ComponentStatusHandler::onUpdateLastCheckTimeDirect(const QStringList &host
|
||||
bool ComponentStatusHandler::addUpdateInstrumentationAsset(ComponentStatusHandler::ITERATOR_T it,
|
||||
const ComponentStatus &cs)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START add/Update: cs=" << cs
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START add/Update: cs=" << cs
|
||||
<< ", curSize=" << m_statusMap.size() << ")";
|
||||
const int id = cs.id();
|
||||
|
||||
@@ -261,8 +260,8 @@ bool ComponentStatusHandler::addUpdateInstrumentationAsset(ComponentStatusHandle
|
||||
|
||||
if ((*it) != cs)
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " DIFF (*it) " << (*it);
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " DIFF cs " << cs;
|
||||
INFO_LOG() << Q_FUNC_INFO << " DIFF (*it) " << (*it);
|
||||
INFO_LOG() << Q_FUNC_INFO << " DIFF cs " << cs;
|
||||
|
||||
(*it) = cs;
|
||||
m_ddsHandler->dts()->publish(cs);
|
||||
@@ -275,7 +274,7 @@ bool ComponentStatusHandler::addUpdateInstrumentationAsset(ComponentStatusHandle
|
||||
m_statusMap.insert(id, cs);
|
||||
m_ddsHandler->dts()->publish(cs);
|
||||
}
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " END add/Update: cs=" << cs
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " END add/Update: cs=" << cs
|
||||
<< ", curSize=" << m_statusMap.size() << ")";
|
||||
return true;
|
||||
}
|
||||
@@ -283,7 +282,7 @@ bool ComponentStatusHandler::addUpdateInstrumentationAsset(ComponentStatusHandle
|
||||
bool ComponentStatusHandler::removeInstrumentationAsset(ComponentStatusHandler::ITERATOR_T it)
|
||||
{
|
||||
const int id = it.value().id();
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " remove: id=" << id;
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " remove: id=" << id;
|
||||
m_statusMap.remove(id);
|
||||
m_ddsHandler->dts()->removeComponentStatusByKey(id);
|
||||
return true;
|
||||
|
||||
+1
-3
@@ -57,9 +57,7 @@ private:
|
||||
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
|
||||
|
||||
CONT_T m_statusMap;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
CONT_T m_statusMap;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -16,9 +16,8 @@ namespace ComponentMonitor
|
||||
|
||||
DdsHandler::DdsHandler(int domainId, int exerciseId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Global, exerciseId))
|
||||
, m_logger(getLogger("DdsHandler"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
DdsHandler::~DdsHandler()
|
||||
@@ -28,7 +27,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
if (!m_ddsConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
||||
ERROR_LOG() << "Error initializing dds connections - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -46,10 +45,10 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
m_ddsFts = ComponentMonitor::Interface::Fts::create(m_ddsConnector);
|
||||
|
||||
bool bRet = m_ddsDts->enableAll();
|
||||
INFO_LOG(m_logger) << "Dts initialised";
|
||||
INFO_LOG() << "Dts initialised";
|
||||
|
||||
bRet &= m_ddsFts->enableAll();
|
||||
INFO_LOG(m_logger) << "Fts initialised";
|
||||
INFO_LOG() << "Fts initialised";
|
||||
|
||||
m_ismDtc = InfrastructureManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
|
||||
@@ -61,9 +60,9 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
|
||||
void DdsHandler::enableDtcs()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START Enable DTCs(" << m_ddsConnector->getDomainId() << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " START Enable DTCs(" << m_ddsConnector->getDomainId() << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
m_ismDtc->enableInstrumentationAsset();
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " END Enable DTCs(" << m_ddsConnector->getDomainId() << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " END Enable DTCs(" << m_ddsConnector->getDomainId() << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> DdsHandler::ismDtc() const
|
||||
|
||||
@@ -61,10 +61,6 @@ private:
|
||||
std::shared_ptr<ComponentMonitor::Interface::Fts> m_ddsFts;
|
||||
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
|
||||
|
||||
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -14,29 +14,29 @@ namespace ComponentMonitor
|
||||
Initialization::Initialization()
|
||||
: m_logger(getLogger("Initialization"))
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
Initialization::~Initialization()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
m_checkmkHandler = nullptr;
|
||||
m_componentStatusHandler = nullptr;
|
||||
m_ddsHandler = nullptr;
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
bool Initialization::initialize(const std::shared_ptr<DdsHandler> &ddsHandler)
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
INFO_LOG() << Q_FUNC_INFO << " START";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
m_ddsHandler = ddsHandler;
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << "ddsHandler referenced";
|
||||
DEBUG_LOG() << Q_FUNC_INFO << "ddsHandler referenced";
|
||||
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ bool Initialization::initialize(const std::shared_ptr<DdsHandler> &ddsHandler)
|
||||
|
||||
if (!m_checkmkHandler->initialize(host, port, intervalSec))
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " CheckmkHandler::initialize failed";
|
||||
ERROR_LOG() << Q_FUNC_INFO << " CheckmkHandler::initialize failed";
|
||||
return false;
|
||||
}
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " CheckmkHandler:initialize succesful";
|
||||
INFO_LOG() << Q_FUNC_INFO << " CheckmkHandler:initialize succesful";
|
||||
|
||||
QObject::connect(m_checkmkHandler.get(), &CheckmkHandler::newState,
|
||||
m_componentStatusHandler.get(), &ComponentStatusHandler::onNewState, Qt::UniqueConnection);
|
||||
@@ -88,10 +88,10 @@ bool Initialization::initialize(const std::shared_ptr<DdsHandler> &ddsHandler)
|
||||
m_checkmkHandlerScheduleCheck = std::make_shared<CheckmkHandlerScheduleCheck>(m_ddsHandler);
|
||||
if (!m_checkmkHandlerScheduleCheck->initialize(host, port))
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " CheckmkHandlerScheduleCheck::initialize failed";
|
||||
ERROR_LOG() << Q_FUNC_INFO << " CheckmkHandlerScheduleCheck::initialize failed";
|
||||
return false;
|
||||
}
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " CheckmkHandlerScheduleCheck:initialize succesful";
|
||||
INFO_LOG() << Q_FUNC_INFO << " CheckmkHandlerScheduleCheck:initialize succesful";
|
||||
|
||||
|
||||
#ifdef LTS_DEBUG
|
||||
@@ -110,21 +110,21 @@ bool Initialization::initialize(const std::shared_ptr<DdsHandler> &ddsHandler)
|
||||
#endif
|
||||
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
INFO_LOG() << Q_FUNC_INFO << " END";
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Initialization::delayedInit()
|
||||
{
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
INFO_LOG() << Q_FUNC_INFO << " START";
|
||||
bool success = true;
|
||||
if (!m_componentStatusHandler->initialize(m_ddsHandler))
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " initialize failed for ComponentStatusHandler";
|
||||
ERROR_LOG() << Q_FUNC_INFO << " initialize failed for ComponentStatusHandler";
|
||||
success = false;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " ComponentStatusHandler, statusMapSize=" << m_componentStatusHandler->getHostnames().size();
|
||||
INFO_LOG() << Q_FUNC_INFO << " ComponentStatusHandler, statusMapSize=" << m_componentStatusHandler->getHostnames().size();
|
||||
|
||||
m_checkmkHandler->run();
|
||||
|
||||
@@ -134,17 +134,17 @@ bool Initialization::delayedInit()
|
||||
|
||||
|
||||
const bool updateLastCheckTimeDirect = Settings::updateLastCheckTimeDirect();
|
||||
NOTICE_LOG(m_logger) << LOGFUNCTION << " updateLastCheckTimeDirect [bool] = " << updateLastCheckTimeDirect;
|
||||
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " updateLastCheckTimeDirect [bool] = " << updateLastCheckTimeDirect;
|
||||
if (updateLastCheckTimeDirect)
|
||||
{
|
||||
NOTICE_LOG(m_logger) << LOGFUNCTION << " updateLastCheckTimeDirect is enabled";
|
||||
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " updateLastCheckTimeDirect is enabled";
|
||||
QObject::connect(m_checkmkHandlerScheduleCheck.get(), &CheckmkHandlerScheduleCheck::updateLastCheckTimeDirect,
|
||||
m_componentStatusHandler.get(), &ComponentStatusHandler::onUpdateLastCheckTimeDirect, Qt::DirectConnection);
|
||||
}
|
||||
|
||||
|
||||
|
||||
INFO_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
INFO_LOG() << Q_FUNC_INFO << " END";
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,6 @@ private:
|
||||
std::shared_ptr<ComponentStatusHandler> m_componentStatusHandler;
|
||||
std::shared_ptr<CheckmkHandler> m_checkmkHandler;
|
||||
std::shared_ptr<CheckmkHandlerScheduleCheck> m_checkmkHandlerScheduleCheck;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include "cmo_export.h"
|
||||
#include "svccmocommon_export.h"
|
||||
|
||||
namespace ComponentMonitor
|
||||
{
|
||||
|
||||
@@ -13,18 +13,17 @@ namespace ComponentMonitor
|
||||
|
||||
MainHandler::MainHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_logger(getLogger("MainHandler"))
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " START";
|
||||
m_cmoService = nullptr;
|
||||
m_ddsHandler = nullptr;
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
TRACE_LOG() << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
bool MainHandler::init(int domainId)
|
||||
@@ -34,11 +33,11 @@ bool MainHandler::init(int domainId)
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(domainId, excerciseId);
|
||||
if (!m_ddsHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation ddsHandler failed.";
|
||||
ERROR_LOG() << "Initialisation ddsHandler failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "Initialisation ddsHandler succesful.";
|
||||
DEBUG_LOG() << "Initialisation ddsHandler succesful.";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -27,8 +27,5 @@ public:
|
||||
private:
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<ComponentMonitor::Initialization> m_cmoService;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
}
|
||||
@@ -9,20 +9,19 @@ namespace DifferentialGPS
|
||||
|
||||
DdsHandler::DdsHandler(int domainId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Global))
|
||||
, m_logger(getLogger("DdsHandler"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
INFO_LOG(m_logger) << "--- Start DifferentialGPS DDSHandler.";
|
||||
INFO_LOG() << "--- Start DifferentialGPS DDSHandler.";
|
||||
|
||||
if (!m_ddsConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
||||
ERROR_LOG() << "Error initializing dds connections - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ public:
|
||||
private:
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<Core::Pacemaker> m_pacemaker;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -18,7 +18,6 @@ MainThread::MainThread(QObject *parent)
|
||||
, m_dgpsTimer(new QTimer(this))
|
||||
, m_tetraIfNum(0)
|
||||
, m_trimbleIfNum(0)
|
||||
, m_logger(getLogger("MainThread"))
|
||||
, m_broadcastTime(QTime::currentTime())
|
||||
, m_broadcastCycle_ms(10000)
|
||||
{
|
||||
@@ -60,7 +59,7 @@ bool MainThread::init(int domainId)
|
||||
m_ddsHandler.reset(new DdsHandler(domainId));
|
||||
if (!m_ddsHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation DdsHandler failed.";
|
||||
ERROR_LOG() << "Initialisation DdsHandler failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -39,9 +39,7 @@ protected:
|
||||
int m_tetraIfNum;
|
||||
|
||||
TrimbleIF *m_trimbleIF[2];
|
||||
int m_trimbleIfNum;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
int m_trimbleIfNum;
|
||||
QTime m_broadcastTime;
|
||||
int m_broadcastCycle_ms;
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ void TcpSocket::startThreadInternal(const QString &hostName, quint16 port)
|
||||
|
||||
void TcpSocket::run()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Starting thread";
|
||||
DEBUG_LOG() << "Starting thread";
|
||||
m_reconnectTimer = new QTimer(this);
|
||||
doConnect();
|
||||
exec();
|
||||
@@ -54,14 +54,14 @@ void TcpSocket::doConnect()
|
||||
connect(m_socket, &QTcpSocket::readyRead,
|
||||
this, &TcpSocket::onReadyRead);
|
||||
|
||||
INFO_LOG(m_logger) << "Connecting to tcp server at "
|
||||
INFO_LOG() << "Connecting to tcp server at "
|
||||
<< m_hostName << ":" << m_hostPort;
|
||||
m_socket->connectToHost(m_hostName, m_hostPort);
|
||||
}
|
||||
|
||||
void TcpSocket::onConnected()
|
||||
{
|
||||
INFO_LOG(m_logger) << "Connected to "
|
||||
INFO_LOG() << "Connected to "
|
||||
<< m_socket->peerAddress().toString()
|
||||
<< ":" << m_socket->peerPort();
|
||||
m_waitTime = 1;
|
||||
@@ -69,13 +69,13 @@ void TcpSocket::onConnected()
|
||||
|
||||
void TcpSocket::onDisconnected()
|
||||
{
|
||||
INFO_LOG(m_logger) << "Disconnected from " << m_socket->peerAddress().toString()
|
||||
INFO_LOG() << "Disconnected from " << m_socket->peerAddress().toString()
|
||||
<< ":" << m_socket->peerPort();
|
||||
}
|
||||
|
||||
void TcpSocket::onError(QAbstractSocket::SocketError err)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Socket error: " << err
|
||||
ERROR_LOG() << "Socket error: " << err
|
||||
<< " " << m_socket->errorString()
|
||||
<< ":" << m_socket->peerPort()
|
||||
<< " - trying to reconnect in " << m_waitTime << " seconds";
|
||||
|
||||
@@ -36,7 +36,6 @@ protected:
|
||||
QString m_hostName;
|
||||
quint16 m_hostPort;
|
||||
QTcpSocket *m_socket;
|
||||
NGL::INGLLogger &m_logger;
|
||||
private:
|
||||
qint32 m_waitTime;
|
||||
QTimer *m_reconnectTimer;
|
||||
|
||||
@@ -21,7 +21,6 @@ FeedGeoJson::FeedGeoJson(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_bTestsSuccessful(true)
|
||||
, m_refPos(LtsCoordTrans::UtmCoordinate::fromMgrs(QStringLiteral("32UMD8000090000")))
|
||||
, m_logger(getLogger("CesTestGasPipe"))
|
||||
{}
|
||||
|
||||
FeedGeoJson::~FeedGeoJson()
|
||||
@@ -31,7 +30,7 @@ bool FeedGeoJson::init(const int domainId, const int exerciseId, WebSocketServe
|
||||
{
|
||||
m_websocketServer = &webSocketServer;
|
||||
bool bRet = true;
|
||||
INFO_LOG(m_logger) << "init begin";
|
||||
INFO_LOG() << "init begin";
|
||||
|
||||
m_ddsConnector42 = std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Exercise, exerciseId);
|
||||
m_ddsConnector42->init();
|
||||
@@ -105,15 +104,15 @@ return message;
|
||||
void FeedGeoJson::onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType)
|
||||
{
|
||||
NOTICE_LOG(m_logger) << "onParticipantPositionChanged: " << data;
|
||||
DEBUG_LOG(m_logger) << "onParticipantPositionChanged: " << data;
|
||||
DEBUG_LOG() << "onParticipantPositionChanged: " << data;
|
||||
if (modType == DataModification::eRemoved)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "m_participantsOutsideMap.remove participantId: " << data.participantId();
|
||||
DEBUG_LOG() << "m_participantsOutsideMap.remove participantId: " << data.participantId();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Handle ParticipantPosition";
|
||||
DEBUG_LOG() << "Handle ParticipantPosition";
|
||||
QString posGeoJson = getGeoJsonPosition(data);
|
||||
m_websocketServer->sendMessage(posGeoJson);
|
||||
}
|
||||
@@ -121,7 +120,7 @@ void FeedGeoJson::onParticipantPositionChanged(const ParticipantManagement::Part
|
||||
|
||||
void FeedGeoJson::onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onDynamicParticipantDataChanged";
|
||||
DEBUG_LOG() << "onDynamicParticipantDataChanged";
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
@@ -130,14 +129,14 @@ void FeedGeoJson::onDynamicParticipantDataChanged(const ParticipantManagement::D
|
||||
|
||||
void FeedGeoJson::failExit()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "FailExit";
|
||||
DEBUG_LOG() << "FailExit";
|
||||
m_bTestsSuccessful = false;
|
||||
QTimer::singleShot(50, qApp, QCoreApplication::quit);
|
||||
}
|
||||
|
||||
void FeedGeoJson::ExitSuccess()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ExitSuccess";
|
||||
DEBUG_LOG() << "ExitSuccess";
|
||||
m_bTestsSuccessful = true;
|
||||
QTimer::singleShot(200, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
|
||||
@@ -75,8 +75,6 @@ private:
|
||||
bool m_bTestsSuccessful;
|
||||
|
||||
LtsCoordTrans::UtmCoordinate m_refPos;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
QVector<Participant> m_participants;
|
||||
WebSocketServer* m_websocketServer;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
Loaded 100 of 2785 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user