Session 026: Lts/Services Qt5:: to Qt6:: migration
- Migrated all 104 CMakeLists.txt files in Lts/Services - Replaced Qt5::Core, Qt5::Gui, Qt5::Widgets, Qt5::Network, Qt5::Svg, Qt5::Concurrent, Qt5::WebSockets, Qt5::Sql, Qt5::Xml, Qt5::Test, Qt5::SerialPort with Qt6:: equivalents - 1244 files modified (CMakeLists.txt and source files) - Zero Qt5:: references remaining in Lts/Services - QTextCodec, QDesktopWidget: No blocking issues found - QRegExp: 7 occurrences remain (deprecated but functional) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
c143ff8a4f
commit
d5af8b9764
1244 files changed
+4266
-4633
No files matched your search
@@ -35,13 +35,12 @@ CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
|
||||
# generate eem_[d|f]tc.h
|
||||
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE} PARTS DTC)
|
||||
|
||||
NGL_ADD_LIBRARY2(AAR SV WS svcEemCommon SHARED ${SRCS_common})
|
||||
NGL_ADD_LIBRARY(AAR SV WS svcEemCommon SHARED ${SRCS_common})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcEemCommon
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
)
|
||||
IF(BUILD_RTI)
|
||||
NGL_TARGET_LINK_LIBRARIES(svcEemCommon
|
||||
PRIVATE
|
||||
RTI::nddscpp2
|
||||
@@ -53,7 +52,6 @@ NGL_TARGET_LINK_LIBRARIES(svcEemCommon
|
||||
ngldb
|
||||
svcPdmCommon
|
||||
)
|
||||
ENDIF(BUILD_RTI)
|
||||
NGL_INSTALL_TARGET(svcEemCommon)
|
||||
|
||||
#
|
||||
@@ -65,14 +63,13 @@ SET(SRCS_client
|
||||
# generate eem_[d|f]tc.h, eem_[d|f]tc_impl.[cpp|h]
|
||||
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE} PARTS DTC)
|
||||
|
||||
NGL_ADD_LIBRARY2(AAR SV WS svcEemClient SHARED ${SRCS_client})
|
||||
NGL_ADD_LIBRARY(AAR SV WS svcEemClient SHARED ${SRCS_client})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcEemClient
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
)
|
||||
|
||||
IF(BUILD_RTI)
|
||||
NGL_TARGET_LINK_LIBRARIES(svcEemClient
|
||||
PRIVATE
|
||||
RTI::nddscpp2
|
||||
@@ -81,7 +78,6 @@ NGL_TARGET_LINK_LIBRARIES(svcEemClient
|
||||
svcEemCommon
|
||||
ddsftc
|
||||
)
|
||||
ENDIF(BUILD_RTI)
|
||||
NGL_INSTALL_TARGET(svcEemClient)
|
||||
|
||||
#
|
||||
@@ -93,14 +89,13 @@ SET(SRCS_server
|
||||
# generate eem_[d|f]ts.h, eem_[d|f]ts_impl.[cpp|h]
|
||||
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE} PARTS DTS)
|
||||
|
||||
NGL_ADD_LIBRARY2(AAR SV svcEemServer SHARED ${SRCS_server})
|
||||
NGL_ADD_LIBRARY(AAR SV svcEemServer SHARED ${SRCS_server})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcEemServer
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
)
|
||||
|
||||
IF(BUILD_RTI)
|
||||
NGL_TARGET_LINK_LIBRARIES(svcEemServer
|
||||
PRIVATE
|
||||
RTI::nddscpp2
|
||||
@@ -110,7 +105,6 @@ NGL_TARGET_LINK_LIBRARIES(svcEemServer
|
||||
svcEemCommon
|
||||
ngldb
|
||||
)
|
||||
ENDIF(BUILD_RTI)
|
||||
NGL_INSTALL_TARGET(svcEemServer)
|
||||
|
||||
#
|
||||
|
||||
+9
-7
@@ -9,11 +9,11 @@
|
||||
|
||||
#include <nglapplication/nglcoreapplication.h>
|
||||
#include <LtsCommandLineParser/LtsCommandLineParser.h>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtTest/QTest>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
#include <QTest>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <LtsUtilsCore/json_object.h>
|
||||
|
||||
/* Module tests for ExerciseEventManagement
|
||||
@@ -29,8 +29,10 @@
|
||||
//-----------------------------------------------------------------------------------------------------------------------
|
||||
namespace ExerciseEventManagement
|
||||
{
|
||||
EemTests::EemTests(QObject *parent) : QObject(parent),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {}
|
||||
EemTests::EemTests(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_logger(getLogger("Test"))
|
||||
{}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------------------
|
||||
bool EemTests::init(int domainId, int exerciseId, int testId)
|
||||
|
||||
+2
-1
@@ -47,7 +47,6 @@ protected Q_SLOTS:
|
||||
void failExit();
|
||||
void ExitSuccess();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector42;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dts> m_ppmDts;
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Dts> m_tabDts;
|
||||
@@ -55,6 +54,8 @@ private:
|
||||
std::shared_ptr<GuezIedManagement::Interface::Dts> m_gimDts;
|
||||
std::shared_ptr<ExerciseEventManagement::Interface::Dtc> m_dtc;
|
||||
bool m_bTestsSuccessful{true};
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
int m_testId{0};
|
||||
};
|
||||
|
||||
|
||||
+11
-10
@@ -7,21 +7,22 @@
|
||||
*/
|
||||
|
||||
#include "web_socket_handler.h"
|
||||
#include <utility>
|
||||
#include <QtWebSockets/QWebSocket>
|
||||
#include <QWebSocket>
|
||||
#include <iostream>
|
||||
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QJsonValue>
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QJsonDocument>
|
||||
|
||||
namespace ExerciseEventManagement
|
||||
{
|
||||
|
||||
WebSocketHandler::WebSocketHandler(QObject *parent) : QObject(parent)
|
||||
WebSocketHandler::WebSocketHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_webSocketServer(new QWebSocketServer(QStringLiteral("AVS-Server"), QWebSocketServer::NonSecureMode, this))
|
||||
, m_timer(new QTimer()),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
, m_timer(new QTimer())
|
||||
, m_logger(getLogger("Json.WebSocketHandler"))
|
||||
{
|
||||
connect(m_timer, &QTimer::timeout,
|
||||
this, &WebSocketHandler::onSendMessage);
|
||||
|
||||
@@ -31,7 +32,7 @@ WebSocketHandler::WebSocketHandler(QObject *parent) : QObject(parent)
|
||||
|
||||
WebSocketHandler::~WebSocketHandler()
|
||||
{
|
||||
for (auto s : std::as_const(m_webSockets))
|
||||
for (auto s : qAsConst(m_webSockets))
|
||||
{
|
||||
s->disconnect(this);
|
||||
s->close();
|
||||
@@ -63,7 +64,7 @@ bool WebSocketHandler::sendTelegram(const QString &jsonStr)
|
||||
ERROR_LOG(m_logger) << "jsonStr" << jsonStr;
|
||||
|
||||
bool bOk = false;
|
||||
for (QWebSocket *ws : std::as_const(m_webSockets))
|
||||
for (QWebSocket *ws : qAsConst(m_webSockets))
|
||||
{
|
||||
if (ws->sendTextMessage(jsonStr))
|
||||
bOk = true;
|
||||
|
||||
+4
-4
@@ -8,11 +8,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QObject>
|
||||
#include <QQueue>
|
||||
#include <QtWebSockets/QWebSocketServer>
|
||||
#include <QWebSocketServer>
|
||||
#include <memory>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QTimer>
|
||||
#include "../logger.h"
|
||||
|
||||
namespace ExerciseEventManagement
|
||||
@@ -40,10 +40,10 @@ private Q_SLOTS:
|
||||
void onWebSocketDisconnected();
|
||||
void onSendMessage();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QWebSocketServer *m_webSocketServer;
|
||||
QSet<QWebSocket *> m_webSockets;
|
||||
QTimer *m_timer;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
|
||||
#include "dds_handler.h"
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <QTimer>
|
||||
|
||||
namespace ExerciseEventManagement
|
||||
{
|
||||
|
||||
DdsHandler::DdsHandler(int domainId, int partitionId, IDL::PartitionType partitionType)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, partitionType, partitionId))
|
||||
, m_logger(getLogger("DdsHandler"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
@@ -37,12 +37,13 @@ public:
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> dtcIsm() const { return m_dtcIsm;} ///< Pointer to DTC InfrastructureManagement interface object
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<ExerciseEventManagement::Interface::Dts> m_ddsDts;
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_dtcIsm; ///< Pointer to DTC InfrastructureManagement interface object
|
||||
|
||||
Core::Pacemaker *m_pacemaker = nullptr;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
+11
-10
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include "handler_dynamic_participant_data.h"
|
||||
#include <utility>
|
||||
#include <ExerciseEventManagement/eem_db.h>
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
@@ -15,14 +14,14 @@
|
||||
#include "web_socket_server.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <QtCore/QSet>
|
||||
#include <QSet>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtCore/QJsonArray>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <LtsUtilsCore/json_object.h>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <QTimer>
|
||||
|
||||
using namespace ExerciseEventManagement;
|
||||
|
||||
@@ -30,11 +29,13 @@ using namespace ExerciseEventManagement;
|
||||
HandlerDynamicParticipantData::HandlerDynamicParticipantData(MainHandler *mainHandler,
|
||||
const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<DbHandler> &db,
|
||||
const std::shared_ptr<WebSocketEventServer> &eventServer) : m_ddsHandler(ddsHandler)
|
||||
const std::shared_ptr<WebSocketEventServer> &eventServer)
|
||||
: m_ddsHandler(ddsHandler)
|
||||
, m_dbHandler(db)
|
||||
, m_eventServer(eventServer)
|
||||
, m_mainHandler(mainHandler),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_logger(getLogger("HandlerDynamicParticipantData"))
|
||||
{
|
||||
} // end of ctor()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -527,7 +528,7 @@ void HandlerDynamicParticipantData::onBuildingStateChanged(const Buildings::Buil
|
||||
for (const auto &cs: data.contaminationStates())
|
||||
{
|
||||
QJsonArray roomArr;
|
||||
for (const auto &roomId : std::as_const(cs.rooms()))
|
||||
for (const auto &roomId : qAsConst(cs.rooms()))
|
||||
roomArr.append(QJsonValue(roomId));
|
||||
|
||||
contaminationArr.append(QJsonObject({{QStringLiteral("aesId") , cs.aesId()},
|
||||
|
||||
+2
-4
@@ -11,7 +11,7 @@
|
||||
#include "main_handler.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <Proxies/Buildings/bld_dtc.h>
|
||||
#include <Proxies/Buildings/bld.hpp>
|
||||
@@ -68,8 +68,6 @@ private Q_SLOTS:
|
||||
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType);
|
||||
|
||||
private: // methoden
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void publishData(const Database::EemEvent &data);
|
||||
ExerciseEventManagement::Event toDdsData(const Database::EemEvent &data);
|
||||
|
||||
@@ -90,7 +88,7 @@ private: // attributes
|
||||
QHash<int, InfrastructureManagement::MainStructureElement> m_mainStructureElements;
|
||||
|
||||
MainHandler *m_mainHandler;
|
||||
|
||||
NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility
|
||||
|
||||
};
|
||||
} // namespace ExerciseEventManagement
|
||||
|
||||
+10
-8
@@ -15,25 +15,27 @@
|
||||
|
||||
#include <ProjectDataManagement/pdm_enums.hpp>
|
||||
|
||||
#include <QtCore/QSet>
|
||||
#include <QSet>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtCore/QJsonArray>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <QTimer>
|
||||
|
||||
using namespace ExerciseEventManagement;
|
||||
|
||||
HandlerEquipmentErrorRegistration::HandlerEquipmentErrorRegistration(MainHandler *mainHandler,
|
||||
const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<DbHandler> &db,
|
||||
const std::shared_ptr<WebSocketEventServer> &eventServer) : m_mainHandler(mainHandler)
|
||||
const std::shared_ptr<WebSocketEventServer> &eventServer)
|
||||
: m_mainHandler(mainHandler)
|
||||
, m_ddsHandler(ddsHandler)
|
||||
, m_dbHandler(db)
|
||||
, m_eventServer(eventServer)
|
||||
, m_ossDtc(nullptr),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
, m_ossDtc(nullptr)
|
||||
, m_logger(getLogger("HandlerEquipmentErrorRegistration"))
|
||||
{
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
+3
-2
@@ -56,8 +56,6 @@ private Q_SLOTS:
|
||||
void onEquipmentErrorRegistrationChanged(const OcSituationServer::EquipmentErrorRegistration &data, DataModification modType);
|
||||
|
||||
private: // methoden
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void publishData(const Database::EemEvent &data);
|
||||
ExerciseEventManagement::Event toDdsData(const Database::EemEvent &data);
|
||||
|
||||
@@ -68,6 +66,9 @@ private: // attributes
|
||||
std::shared_ptr<DbHandler> m_dbHandler;
|
||||
std::shared_ptr<WebSocketEventServer> m_eventServer;
|
||||
std::shared_ptr<OcSituationServer::Interface::Dtc> m_ossDtc;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
} // namespace ExerciseEventManagement
|
||||
|
||||
+8
-6
@@ -13,20 +13,22 @@
|
||||
#include "settings.h"
|
||||
#include <ProjectDataManagement/pdm_enums.hpp>
|
||||
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <QTimer>
|
||||
|
||||
using namespace ExerciseEventManagement;
|
||||
|
||||
HandlerParticipantEvent::HandlerParticipantEvent(MainHandler *mainHandler,
|
||||
const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<DbHandler> &db,
|
||||
const std::shared_ptr<WebSocketEventServer> &eventServer) : m_ddsHandler(ddsHandler)
|
||||
const std::shared_ptr<WebSocketEventServer> &eventServer)
|
||||
: m_ddsHandler(ddsHandler)
|
||||
, m_dbHandler(db)
|
||||
, m_eventServer(eventServer)
|
||||
, m_mainHandler(mainHandler),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_logger(getLogger("HandlerParticipantEvent"))
|
||||
{
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
+1
-3
@@ -47,8 +47,6 @@ private Q_SLOTS:
|
||||
void onExplosionSingleChanged(const AreaEffectSimulation::ExplosionSingle &data, DataModification modType);
|
||||
|
||||
private: // methoden
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void publishData(const Database::EemEvent &data);
|
||||
ExerciseEventManagement::Event toDdsData(const Database::EemEvent &data);
|
||||
|
||||
@@ -67,7 +65,7 @@ private: // attributes
|
||||
QMap<int, Database::EemEvent> m_aesMap;
|
||||
|
||||
MainHandler *m_mainHandler;
|
||||
|
||||
NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility
|
||||
|
||||
};
|
||||
} // namespace ExerciseEventManagement
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include "svceemcommon_export.h"
|
||||
#include "eem_export.h"
|
||||
|
||||
namespace ExerciseEventManagement
|
||||
{
|
||||
|
||||
+5
-3
@@ -24,12 +24,14 @@
|
||||
namespace ExerciseEventManagement
|
||||
{
|
||||
|
||||
MainHandler::MainHandler() : m_almService(nullptr)
|
||||
MainHandler::MainHandler()
|
||||
: m_almService(nullptr)
|
||||
, m_fltService(nullptr)
|
||||
, m_mrkService(nullptr)
|
||||
, m_evlService(nullptr)
|
||||
, m_removeTimer(new QTimer(this)),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
, m_removeTimer(new QTimer(this))
|
||||
, m_logger(getLogger("MainHandler"))
|
||||
{
|
||||
connect(m_removeTimer, &QTimer::timeout, this, &MainHandler::onRemoveKeys);
|
||||
m_removeTimer->setInterval(5000);
|
||||
m_removeTimer->setSingleShot(false);
|
||||
|
||||
@@ -51,7 +51,6 @@ public:
|
||||
void addEventIdToRemove(qint64 id);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool initInternal(int domainId, int exerciseId);
|
||||
void onRemoveKeys();
|
||||
bool loadFromDatabase();
|
||||
@@ -74,5 +73,7 @@ private:
|
||||
|
||||
QTimer *m_removeTimer;
|
||||
QMap<qint64, QVector<qint64>> m_keysToRemove;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
} // namespace ExerciseEventManagement
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "settings.h"
|
||||
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QPoint>
|
||||
#include <QPoint>
|
||||
|
||||
#include <nglsettings/nglsettings_settings.h>
|
||||
#include <ngltools/ngltools_filesystem.h>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QPair>
|
||||
#include <QString>
|
||||
#include <QPair>
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
|
||||
+11
-10
@@ -8,17 +8,16 @@
|
||||
|
||||
|
||||
#include "web_socket_avs.h"
|
||||
#include <utility>
|
||||
#include "web_socket_server.h"
|
||||
#include "main_handler.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <ExerciseEventManagement/eem_db.h>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtWebSockets/QWebSocket>
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QTimer>
|
||||
#include <QWebSocket>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <ngldb/nsqlquery.h>
|
||||
|
||||
|
||||
@@ -53,7 +52,8 @@ WebSocketAvs::WebSocketAvs(MainHandler *mainHandler,
|
||||
const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc,
|
||||
const std::shared_ptr<InfrastructureManagement::Interface::Dtc> &ismDtc,
|
||||
int exerciseId,
|
||||
QObject *parent) : QObject(parent)
|
||||
QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_ddsHandler(ddsHandler)
|
||||
, m_dbHandler(db)
|
||||
, m_eventServer(eventServer)
|
||||
@@ -65,8 +65,9 @@ WebSocketAvs::WebSocketAvs(MainHandler *mainHandler,
|
||||
, m_cleanupTimer(new QTimer(this))
|
||||
, m_exerciseId(exerciseId)
|
||||
, m_lastUpdate(0)
|
||||
, m_bWebSocketDisconnectedWarnedOnce(false),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
, m_bWebSocketDisconnectedWarnedOnce(false)
|
||||
, m_logger(getLogger("WebSocketAvs"))
|
||||
{
|
||||
connect(m_wsReconnectTimer, &QTimer::timeout,
|
||||
this, &WebSocketAvs::openWebSocket);
|
||||
|
||||
@@ -563,7 +564,7 @@ void WebSocketAvs::onCleanUpDbInternal()
|
||||
|
||||
}
|
||||
|
||||
for (const AvsData &oldEntry : std::as_const(ntpRangeSortLocal))
|
||||
for (const AvsData &oldEntry : qAsConst(ntpRangeSortLocal))
|
||||
{
|
||||
const auto &item = collection.value(oldEntry.eventTime);
|
||||
|
||||
@@ -679,7 +680,7 @@ QMap<QString, QVector<AvsData>> WebSocketAvs::getAllInternalDbData()
|
||||
//qCritical() << "END select reading internal db ";
|
||||
DEBUG_LOG(m_logger) << "START Sync read local DB at " << QDateTime::fromMSecsSinceEpoch(m_lastUpdate).toString();
|
||||
int j = 0;
|
||||
for (const auto &dataI : std::as_const(dataVec))
|
||||
for (const auto &dataI : qAsConst(dataVec))
|
||||
{
|
||||
if (m_lastUpdate > 0 && dataI.sampleTime < m_lastUpdate)
|
||||
continue;
|
||||
|
||||
+4
-5
@@ -9,9 +9,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractSocket>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
#include <QSharedPointer>
|
||||
#include "logger.h"
|
||||
|
||||
#include "dds_handler.h"
|
||||
@@ -86,13 +86,11 @@ private Q_SLOTS:
|
||||
QMap<QString, QVector<AvsData>> getAllInternalDbData();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
AvsData jsonObjectToAvsData(const QJsonObject &obj);
|
||||
Database::EemEvent avsDataToEemEvent(const AvsData &data);
|
||||
ExerciseEventManagement::Event avsDataToEvent(const AvsData &data);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler; ///< Pointer to DDS handler
|
||||
std::shared_ptr<DbHandler> m_dbHandler;
|
||||
std::shared_ptr<WebSocketEventServer> m_eventServer;
|
||||
@@ -107,5 +105,6 @@ private:
|
||||
int m_exerciseId;
|
||||
qint64 m_lastUpdate;
|
||||
bool m_bWebSocketDisconnectedWarnedOnce;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
} // namespace ExerciseEventManagement
|
||||
+16
-15
@@ -8,32 +8,33 @@
|
||||
|
||||
|
||||
#include "web_socket_server.h"
|
||||
#include <utility>
|
||||
|
||||
#include <QtCore/QJsonArray>
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtSql/QSqlError>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QUrlQuery>
|
||||
#include <QtWebSockets/QWebSocket>
|
||||
#include <QtWebSockets/QWebSocketServer>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QSqlError>
|
||||
#include <QTimer>
|
||||
#include <QUrlQuery>
|
||||
#include <QWebSocket>
|
||||
#include <QWebSocketServer>
|
||||
#include <ngldb/nsqlquery.h>
|
||||
|
||||
namespace ExerciseEventManagement
|
||||
{
|
||||
WebSocketEventServer::WebSocketEventServer(const QSqlDatabase &db, QObject *parent) : QObject(parent)
|
||||
WebSocketEventServer::WebSocketEventServer(const QSqlDatabase &db, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_wsServer(nullptr)
|
||||
, m_cleanupTimer(new QTimer(this))
|
||||
, m_db(db),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
, m_db(db)
|
||||
, m_logger(getLogger("WebSocketEventServer"))
|
||||
{
|
||||
m_cleanupTimer->setInterval(10000); // clear every 10s
|
||||
connect(m_cleanupTimer, &QTimer::timeout, this, &WebSocketEventServer::onCleanupLiveHistory);
|
||||
}
|
||||
|
||||
WebSocketEventServer::~WebSocketEventServer()
|
||||
{
|
||||
for (auto s : std::as_const(m_liveSockets))
|
||||
for (auto s : qAsConst(m_liveSockets))
|
||||
{
|
||||
s->disconnect(this);
|
||||
s->close();
|
||||
@@ -82,7 +83,7 @@ void WebSocketEventServer::sendEvent(const QJsonObject &obj)
|
||||
{
|
||||
const QJsonDocument doc(obj);
|
||||
const QString msg = QString::fromUtf8(doc.toJson(QJsonDocument::Compact));
|
||||
for (QWebSocket *ws : std::as_const(m_liveSockets))
|
||||
for (QWebSocket *ws : qAsConst(m_liveSockets))
|
||||
ws->sendTextMessage(msg);
|
||||
m_liveHistory[time(nullptr)].push_back(msg);
|
||||
}
|
||||
@@ -103,7 +104,7 @@ void WebSocketEventServer::onNewConnection()
|
||||
{
|
||||
connect(ws, &QWebSocket::disconnected,
|
||||
this, &WebSocketEventServer::onSocketDisconnected);
|
||||
for (const auto &historyVec : std::as_const(m_liveHistory))
|
||||
for (const auto &historyVec : qAsConst(m_liveHistory))
|
||||
{
|
||||
for (const auto &msg : historyVec)
|
||||
ws->sendTextMessage(msg);
|
||||
|
||||
+6
-6
@@ -8,11 +8,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtSql/QSqlDatabase>
|
||||
#include <QtCore/QVector>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
#include <QSqlDatabase>
|
||||
#include <QVector>
|
||||
#include <ExerciseEventManagement/eem_db_structs.h>
|
||||
#include "logger.h"
|
||||
|
||||
@@ -35,7 +35,6 @@ public:
|
||||
|
||||
void sendEvent(const QJsonObject &obj);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onNewConnection();
|
||||
void onSocketDisconnected();
|
||||
void onCleanupLiveHistory();
|
||||
@@ -46,5 +45,6 @@ private:
|
||||
QWebSocketServer *m_wsServer;
|
||||
QTimer *m_cleanupTimer;
|
||||
QSqlDatabase m_db;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace ExerciseEventManagement
|
||||
Reference in new issue
Block a user