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
@@ -32,13 +32,12 @@ CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
|
||||
# generate scm_[d|f]tc.h
|
||||
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY2(SV AAR WS svcScmCommon SHARED ${SRCS_common})
|
||||
NGL_ADD_LIBRARY(SV AAR WS svcScmCommon SHARED ${SRCS_common})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcScmCommon
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
)
|
||||
IF(BUILD_RTI)
|
||||
NGL_TARGET_LINK_LIBRARIES(svcScmCommon
|
||||
PRIVATE
|
||||
RTI::nddscpp2
|
||||
@@ -48,7 +47,6 @@ NGL_TARGET_LINK_LIBRARIES(svcScmCommon
|
||||
NGLLogger
|
||||
ngldb
|
||||
)
|
||||
ENDIF(BUILD_RTI)
|
||||
NGL_INSTALL_TARGET(svcScmCommon)
|
||||
|
||||
#
|
||||
@@ -60,14 +58,13 @@ SET(SRCS_client
|
||||
# generate scm_ftc_impl.[cpp|h]
|
||||
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY2(WS AAR SV svcScmClient SHARED ${SRCS_client})
|
||||
NGL_ADD_LIBRARY(WS AAR SV svcScmClient SHARED ${SRCS_client})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcScmClient
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
)
|
||||
|
||||
IF(BUILD_RTI)
|
||||
NGL_TARGET_LINK_LIBRARIES(svcScmClient
|
||||
PRIVATE
|
||||
RTI::nddscpp2
|
||||
@@ -76,7 +73,6 @@ NGL_TARGET_LINK_LIBRARIES(svcScmClient
|
||||
svcScmCommon
|
||||
ddsftc
|
||||
)
|
||||
ENDIF(BUILD_RTI)
|
||||
NGL_INSTALL_TARGET(svcScmClient)
|
||||
|
||||
#
|
||||
@@ -88,14 +84,13 @@ SET(SRCS_server
|
||||
# generate scm_[d|f]ts.h, scm_[d|f]ts_impl.[cpp|h]
|
||||
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY2(SV AAR svcScmServer SHARED ${SRCS_server})
|
||||
NGL_ADD_LIBRARY(SV AAR svcScmServer SHARED ${SRCS_server})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcScmServer
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
)
|
||||
|
||||
IF(BUILD_RTI)
|
||||
NGL_TARGET_LINK_LIBRARIES(svcScmServer
|
||||
PRIVATE
|
||||
RTI::nddscpp2
|
||||
@@ -105,7 +100,6 @@ NGL_TARGET_LINK_LIBRARIES(svcScmServer
|
||||
svcScmCommon
|
||||
ngldb
|
||||
)
|
||||
ENDIF(BUILD_RTI)
|
||||
NGL_INSTALL_TARGET(svcScmServer)
|
||||
|
||||
#
|
||||
|
||||
+7
-6
@@ -12,17 +12,18 @@
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <DDS/QosProfile/DDS_DefaultQos.h>
|
||||
#include <Lts/Common/ProjectConfig/project_defines.h>
|
||||
#include <Common/ProjectConfig/project_defines.h>
|
||||
#include <DDS/DTS/generic_dts_impl.h>
|
||||
#include <DDS/DTC/generic_dtc_impl.h>
|
||||
|
||||
#include <QtTest/QTest>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QThread>
|
||||
#include <QVariant>
|
||||
#include <QThread>
|
||||
|
||||
|
||||
|
||||
DataTopicTests::DataTopicTests() : m_domainParticipantPub(nullptr)
|
||||
DataTopicTests::DataTopicTests()
|
||||
: m_domainParticipantPub(nullptr)
|
||||
, m_domainParticipantSub(nullptr)
|
||||
, m_domainId(0)
|
||||
, m_ddsPublisher(nullptr)
|
||||
@@ -34,8 +35,8 @@ DataTopicTests::DataTopicTests() : m_domainParticipantPub(nullptr)
|
||||
, m_dtcServiceInformation(nullptr)
|
||||
, m_dtcGroupInformation(nullptr)
|
||||
, m_mainThreadId(QThread::currentThreadId())
|
||||
.getNGLLogger("UnitTests.DataTopicTests")),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("UnitTests.DataTopicTests"))
|
||||
{
|
||||
if (!DDS::QosProfile::setDefault())
|
||||
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
|
||||
|
||||
|
||||
+4
-3
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QObject>
|
||||
|
||||
// For Topic Exercise
|
||||
#include <ServiceManagement/scm_dtc_types.h>
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <ServiceManagement/scm.hpp>
|
||||
#include <DDS/Generic/subscriber_listener.h>
|
||||
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
|
||||
#include <LtsUtilsCore/data_modification_enum.h>
|
||||
#include <rti/core/ListenerBinder.hpp>
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ public:
|
||||
ServiceManagement::GroupInformation getReceivedGroupInformationData() const;
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
// Subscriber Methods
|
||||
void processData(const ServiceManagement::ServiceInformation& instance, DataModification modType);
|
||||
void processData(const ServiceManagement::GroupInformation& instance, DataModification modType);
|
||||
@@ -74,6 +73,8 @@ private:
|
||||
// For returning TestData
|
||||
ServiceManagement::ServiceInformation m_receivedServiceInformationData;
|
||||
ServiceManagement::GroupInformation m_receivedGroupInformationData;
|
||||
|
||||
NGL::INGLLogger& m_logger;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
#include "data_topic_tests_main.h"
|
||||
#include "data_topic_tests.h"
|
||||
|
||||
#include <Lts/Common/ProjectConfig/project_defines.h>
|
||||
#include <Common/ProjectConfig/project_defines.h>
|
||||
|
||||
#include <QtTest/QTest>
|
||||
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QObject>
|
||||
#include <QSignalSpy>
|
||||
#include <ServiceManagement/scm_dts_types.h>
|
||||
|
||||
@@ -35,11 +35,11 @@ private Q_SLOTS:
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
private:
|
||||
ServiceManagement::ServiceInformation m_sentServiceInformationData;
|
||||
ServiceManagement::GroupInformation m_sentGroupInformationData;
|
||||
QSignalSpy *m_serviceInformationDataArrivedSpy = nullptr;
|
||||
QSignalSpy *m_groupInformationDataArrivedSpy = nullptr;
|
||||
DataTopicTests *m_dtTest = nullptr;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
+2
-2
@@ -12,8 +12,8 @@
|
||||
|
||||
#include <DDS/Core/core.hpp>
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QMap>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QJsonObject>
|
||||
|
||||
+4
-4
@@ -11,10 +11,10 @@
|
||||
|
||||
#include "main_handler.h"
|
||||
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QVector>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QMap>
|
||||
#include <QVector>
|
||||
|
||||
namespace ServiceManagement
|
||||
{
|
||||
|
||||
+1
@@ -24,6 +24,7 @@ WebSocketInterfaceHandler::WebSocketInterfaceHandler(MainHandler *mainHandler, Q
|
||||
, m_messageFactory(nullptr)
|
||||
, m_dataManager(nullptr)
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_logger(getLogger("WebSocketInterfaceHandler"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace ServiceManagement
|
||||
|
||||
DdsHandler::DdsHandler(int domainId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Any))
|
||||
, m_logger(getLogger("DdsHandler"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
@@ -29,10 +29,11 @@ public:
|
||||
std::shared_ptr<ServiceManagement::Interface::Fts> fts() const;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> connector() const;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<ServiceManagement::Interface::Dts> m_ddsDts;
|
||||
std::shared_ptr<ServiceManagement::Interface::Fts> m_ddsFts;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
} // namespace ServiceManagement
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include "group.h"
|
||||
#include <utility>
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QThread>
|
||||
@@ -40,6 +39,7 @@ Group::Group(const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
, m_groupId(s_idCounter++)
|
||||
, m_groupData(groupData)
|
||||
, m_completeCoreTimeout(0)
|
||||
, m_logger(getLogger("Group"))
|
||||
{
|
||||
INFO_LOG(m_logger) << "Group "
|
||||
<< m_scheme->groupType
|
||||
@@ -52,7 +52,7 @@ Group::Group(const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
Group::~Group()
|
||||
{
|
||||
setRunningState(Core::RunningState::StoppedNormally);
|
||||
for (ServiceProcess *serviceProc :std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *serviceProc :qAsConst(m_serviceProcs))
|
||||
m_ddsHandler->dts()->removeServiceInformationByKey(serviceProc->serviceProcessId());
|
||||
qDeleteAll(m_serviceProcs); // in Service they are removed via ServiceProcess::destroyed signal
|
||||
m_ddsHandler->dts()->removeGroupInformationByKey(m_groupId);
|
||||
@@ -60,7 +60,7 @@ Group::~Group()
|
||||
|
||||
void Group::init()
|
||||
{
|
||||
for (int serviceId : std::as_const(m_scheme->services))
|
||||
for (int serviceId : qAsConst(m_scheme->services))
|
||||
{
|
||||
if (m_serviceProcs.contains(serviceId))
|
||||
continue;
|
||||
@@ -92,11 +92,11 @@ bool Group::setRunningState(Core::RunningState newState)
|
||||
case Core::RunningState::Starting:
|
||||
// make sure all services are there
|
||||
init();
|
||||
for (ServiceProcess *serviceProc : std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *serviceProc : qAsConst(m_serviceProcs))
|
||||
serviceProc->start();
|
||||
return true;
|
||||
case Core::RunningState::StoppedNormally:
|
||||
for (ServiceProcess *serviceProc : std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *serviceProc : qAsConst(m_serviceProcs))
|
||||
serviceProc->terminate();
|
||||
return true;
|
||||
default:
|
||||
@@ -118,7 +118,7 @@ void Group::startCore()
|
||||
init();
|
||||
|
||||
// ExerciseManagement must be started ...
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
{
|
||||
if (proc->serviceName() == QLatin1String("ExerciseManagement"))
|
||||
{
|
||||
@@ -160,7 +160,7 @@ void Group::start()
|
||||
// make sure all services are there
|
||||
init();
|
||||
// get list of prio
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
{
|
||||
if ( !prioList.contains(proc->prio()))
|
||||
{
|
||||
@@ -176,7 +176,7 @@ void Group::start()
|
||||
// m_actPrio = getNextPrio(prioList);
|
||||
//}
|
||||
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
{
|
||||
if ( m_actPrio == proc->prio())
|
||||
{
|
||||
@@ -198,7 +198,7 @@ void Group::start()
|
||||
|
||||
void Group::stop()
|
||||
{
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
{
|
||||
if (proc->state() != QProcess::NotRunning)
|
||||
proc->stopFromRequest();
|
||||
@@ -209,7 +209,7 @@ void Group::restart()
|
||||
{
|
||||
// make sure all services are there
|
||||
init();
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
proc->restart();
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ void Group::onNewServiceInfo()
|
||||
m_elapsedTimer.start();
|
||||
std::vector<int32_t> serviceIds;
|
||||
serviceIds.reserve(m_serviceProcs.size());
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
serviceIds.push_back(proc->serviceProcessId());
|
||||
|
||||
GroupInformation info(m_groupId,
|
||||
@@ -297,7 +297,7 @@ void Group::onCompleteCoreTick()
|
||||
ServiceProcess *exmProc = nullptr;
|
||||
|
||||
// get EXM proc
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
{
|
||||
if (proc->serviceName() == QLatin1String("ExerciseManagement"))
|
||||
{
|
||||
@@ -315,7 +315,7 @@ void Group::onCompleteCoreTick()
|
||||
if (exmProc->runningState() == Core::RunningState::Running)
|
||||
{
|
||||
// get list of prio
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
{
|
||||
if ( !prioList.contains(proc->prio()))
|
||||
{
|
||||
@@ -327,7 +327,7 @@ void Group::onCompleteCoreTick()
|
||||
}
|
||||
|
||||
// start rest of group core
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
{
|
||||
if (proc->state() != QProcess::Running && proc->prio() == m_actPrio)
|
||||
{
|
||||
@@ -352,7 +352,7 @@ void Group::onCompleteCoreTick()
|
||||
|
||||
ServiceProcess *Group::procFromPid(Q_PID pid)
|
||||
{
|
||||
for (ServiceProcess *proc :std::as_const(m_serviceProcs))
|
||||
for (ServiceProcess *proc :qAsConst(m_serviceProcs))
|
||||
{
|
||||
if (proc->pid() == pid)
|
||||
return proc;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include "group_handler.h"
|
||||
#include <utility>
|
||||
#include "group.h"
|
||||
#include "heartbeat_listener.h"
|
||||
#include "service_donator.h"
|
||||
@@ -24,6 +23,7 @@ GroupHandler::GroupHandler(const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
, m_serviceDonator(donator)
|
||||
, m_ddsHandler(ddsHandler)
|
||||
, m_heartbeatListener(new HeartbeatListener(ddsHandler->connector(), donator))
|
||||
, m_logger(getLogger("GroupHandler"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ QVector<Group *> GroupHandler::groups() const
|
||||
|
||||
GroupScheme *GroupHandler::groupSchemeFromType(Core::ServiceGroupType type)
|
||||
{
|
||||
for (GroupScheme *scheme : std::as_const(m_groupSchemes))
|
||||
for (GroupScheme *scheme : qAsConst(m_groupSchemes))
|
||||
{
|
||||
if (scheme->groupType == type)
|
||||
return scheme;
|
||||
@@ -240,7 +240,7 @@ Core::FunctionReplyObject GroupHandler::onStopAllForExercise(int domainId, int e
|
||||
|
||||
int cntStopped = 0;
|
||||
int cntAlive = 0;
|
||||
for (Group *group : std::as_const(m_groups))
|
||||
for (Group *group : qAsConst(m_groups))
|
||||
{
|
||||
if (group->exercisePartitionId() == exercisePartitionId &&
|
||||
group->domainId() == domainId)
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QVector>
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
|
||||
#include "logger.h"
|
||||
#include "dds_handler.h"
|
||||
|
||||
+5
-3
@@ -9,9 +9,11 @@
|
||||
#include "heartbeat_listener.h"
|
||||
#include "service_donator.h"
|
||||
|
||||
ServiceManagement::HeartbeatListener::HeartbeatListener(const std::shared_ptr<DDSConnector::DdsConnector> &connector, const std::shared_ptr<ServiceDonator> &serviceDonator) : m_ddsConnector(connector)
|
||||
, m_serviceDonator(serviceDonator),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {}
|
||||
ServiceManagement::HeartbeatListener::HeartbeatListener(const std::shared_ptr<DDSConnector::DdsConnector> &connector, const std::shared_ptr<ServiceDonator> &serviceDonator)
|
||||
: m_ddsConnector(connector)
|
||||
, m_serviceDonator(serviceDonator)
|
||||
, m_logger(getLogger("HeartbeatListener"))
|
||||
{}
|
||||
|
||||
ServiceManagement::HeartbeatListener::~HeartbeatListener()
|
||||
{}
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
*/
|
||||
|
||||
#include "licence_handler.h"
|
||||
#include <utility>
|
||||
#include "dds_handler.h"
|
||||
#include <QtCore/QFile>
|
||||
#include <QFile>
|
||||
#include <LtsLicence/aes_crypt.h>
|
||||
|
||||
|
||||
@@ -21,6 +20,7 @@ LicenceHandler::LicenceHandler(const std::shared_ptr<DdsHandler> &ddsHandler, co
|
||||
, Interface::Fts::FreeLicenceRequestHandler(ddsHandler->fts())
|
||||
, m_ddsHandler(ddsHandler)
|
||||
, m_xmlFileName(licenceFile)
|
||||
, m_logger(getLogger("LicenceHandler"))
|
||||
{
|
||||
INFO_LOG(m_logger) << "Start ServiceManagement LicenceHandler. Filename: " << m_xmlFileName;
|
||||
} // end of ctor()
|
||||
@@ -28,7 +28,7 @@ LicenceHandler::LicenceHandler(const std::shared_ptr<DdsHandler> &ddsHandler, co
|
||||
|
||||
LicenceHandler::~LicenceHandler()
|
||||
{
|
||||
for (const LtsLicence::Licence &info : std::as_const(m_licenceVec))
|
||||
for (const LtsLicence::Licence &info : qAsConst(m_licenceVec))
|
||||
m_ddsHandler->dts()->removeLicenceInformationByKey(info.name.toStdString());
|
||||
} // end of dtor()
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -302,7 +302,7 @@ QString LicenceHandler::dumpLicenceInformation(const LtsLicence::Licence &licenc
|
||||
|
||||
void LicenceHandler::publishAllData()
|
||||
{
|
||||
for (const LtsLicence::Licence &info : std::as_const(m_licenceVec))
|
||||
for (const LtsLicence::Licence &info : qAsConst(m_licenceVec))
|
||||
publishData(info);
|
||||
} // end of publishAllData()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
#include "licence_donator.h"
|
||||
#include "dds_handler.h"
|
||||
#include "logger.h"
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QVector>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <LtsLicence/lts_licence.h>
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@ public:
|
||||
bool freeLicence(const QString &licenceName) override;
|
||||
|
||||
private: // Methoden
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool readLicenceFile();
|
||||
|
||||
Core::FunctionReplyObject getLicenceInternal(const QString &licenceName);
|
||||
@@ -65,5 +63,7 @@ private: // attributes
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
QString m_xmlFileName;
|
||||
QVector<LtsLicence::Licence> m_licenceVec;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
}; // class LicenceHandler
|
||||
} // namespace ServiceManagement
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include "svcscmcommon_export.h"
|
||||
#include "scm_export.h"
|
||||
|
||||
namespace ServiceManagement
|
||||
{
|
||||
|
||||
@@ -24,13 +24,15 @@
|
||||
namespace ServiceManagement
|
||||
{
|
||||
|
||||
MainHandler::MainHandler(QObject *parent) : QObject(parent)
|
||||
MainHandler::MainHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_ddsHandler(nullptr)
|
||||
, m_groupHandler(nullptr)
|
||||
, m_licenceHandler(nullptr)
|
||||
, m_serviceHandler(nullptr)
|
||||
, m_websocketHandler(nullptr),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
, m_websocketHandler(nullptr)
|
||||
, m_logger(getLogger("MainHandler"))
|
||||
{
|
||||
QtSingleCoreApplication *sa = qobject_cast<QtSingleCoreApplication*>(QCoreApplication::instance());
|
||||
Q_ASSERT(sa);
|
||||
connect(sa, &QtSingleCoreApplication::messageReceived,
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include "service.h"
|
||||
#include <utility>
|
||||
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
@@ -26,6 +25,7 @@ ServiceManagement::Service::Service(const QString &name, const QString &exe, con
|
||||
, m_id(idCounter ++)
|
||||
, m_licenceDonator(nullptr)
|
||||
, m_prio(prio)
|
||||
, m_logger(getLogger("Service"))
|
||||
{}
|
||||
|
||||
int ServiceManagement::Service::id() const
|
||||
@@ -83,7 +83,7 @@ ServiceManagement::ServiceProcess *ServiceManagement::Service::toServiceProcess(
|
||||
|
||||
ServiceManagement::ServiceProcess *ServiceManagement::Service::procFromPid(qint64 pid)
|
||||
{
|
||||
for (ServiceProcess *currentProc : std::as_const(m_procs))
|
||||
for (ServiceProcess *currentProc : qAsConst(m_procs))
|
||||
{
|
||||
if (currentProc->usablePid() == pid)
|
||||
return currentProc;
|
||||
@@ -93,7 +93,7 @@ ServiceManagement::ServiceProcess *ServiceManagement::Service::procFromPid(qint6
|
||||
|
||||
ServiceManagement::ServiceProcess *ServiceManagement::Service::procFromServiceProcId(int32_t id)
|
||||
{
|
||||
for (ServiceProcess *currentProc : std::as_const(m_procs))
|
||||
for (ServiceProcess *currentProc : qAsConst(m_procs))
|
||||
{
|
||||
if (currentProc->serviceProcessId() == id)
|
||||
return currentProc;
|
||||
@@ -103,13 +103,13 @@ ServiceManagement::ServiceProcess *ServiceManagement::Service::procFromServicePr
|
||||
|
||||
void ServiceManagement::Service::stopAllProcs()
|
||||
{
|
||||
for (ServiceProcess *currentProc : std::as_const(m_procs))
|
||||
for (ServiceProcess *currentProc : qAsConst(m_procs))
|
||||
currentProc->terminate();
|
||||
}
|
||||
|
||||
void ServiceManagement::Service::waitForStopped()
|
||||
{
|
||||
for (ServiceProcess *currentProc : std::as_const(m_procs))
|
||||
for (ServiceProcess *currentProc : qAsConst(m_procs))
|
||||
currentProc->waitForFinished(5000);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QObject>
|
||||
|
||||
#include <ServiceManagement/scm.hpp>
|
||||
|
||||
|
||||
@@ -7,17 +7,16 @@
|
||||
*/
|
||||
|
||||
#include "service_handler.h"
|
||||
#include <utility>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QCoreApplication>
|
||||
#include <QDateTime>
|
||||
#include <QTimer>
|
||||
|
||||
#include "service.h"
|
||||
#include "service_process.h"
|
||||
#include "dds_handler.h"
|
||||
#include "settings.h"
|
||||
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
|
||||
#include <LtsUtilsCore/data_modification_enum.h>
|
||||
|
||||
ServiceManagement::ServiceHandler::ServiceHandler(const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<LicenceDonator> &licenceDonator)
|
||||
@@ -26,6 +25,7 @@ ServiceManagement::ServiceHandler::ServiceHandler(const std::shared_ptr<DdsHandl
|
||||
, m_heartBeatObserverTimer(new QTimer(this))
|
||||
, m_ddsHandler(ddsHandler)
|
||||
, m_licenceDonator(licenceDonator)
|
||||
, m_logger(getLogger("ServiceHandler"))
|
||||
{
|
||||
connect(qApp, &QCoreApplication::aboutToQuit,
|
||||
this, &ServiceHandler::stopAllServices);
|
||||
@@ -111,9 +111,9 @@ void ServiceManagement::ServiceHandler::stopAllServices()
|
||||
INFO_LOG(m_logger) << "Stopping all Services ...";
|
||||
|
||||
// shutdown async
|
||||
for (Service *service : std::as_const(m_services))
|
||||
for (Service *service : qAsConst(m_services))
|
||||
service->stopAllProcs();
|
||||
for (Service *service : std::as_const(m_services))
|
||||
for (Service *service : qAsConst(m_services))
|
||||
service->waitForStopped();
|
||||
|
||||
INFO_LOG(m_logger) << "... all Services stopped :)";
|
||||
@@ -147,9 +147,9 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
|
||||
if (proc == nullptr)
|
||||
{
|
||||
bool found = false;
|
||||
for (Service *currentService : std::as_const(m_services))
|
||||
for (Service *currentService : qAsConst(m_services))
|
||||
{
|
||||
for (ServiceProcess *currentProc : std::as_const(currentService->allProcs()))
|
||||
for (ServiceProcess *currentProc : qAsConst(currentService->allProcs()))
|
||||
{
|
||||
if (currentProc->remotePid() == data.pid())
|
||||
{
|
||||
@@ -182,7 +182,7 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
|
||||
|
||||
ServiceManagement::Service *ServiceManagement::ServiceHandler::serviceFromId(int id)
|
||||
{
|
||||
for (Service *service : std::as_const(m_services))
|
||||
for (Service *service : qAsConst(m_services))
|
||||
{
|
||||
if (service->id() == id)
|
||||
return service;
|
||||
@@ -192,7 +192,7 @@ ServiceManagement::Service *ServiceManagement::ServiceHandler::serviceFromId(int
|
||||
|
||||
ServiceManagement::ServiceProcess *ServiceManagement::ServiceHandler::serviceProcessFromPid(qint64 pid)
|
||||
{
|
||||
for (Service *service : std::as_const(m_services))
|
||||
for (Service *service : qAsConst(m_services))
|
||||
{
|
||||
ServiceProcess *result = service->procFromPid(pid);
|
||||
if (result)
|
||||
@@ -203,7 +203,7 @@ ServiceManagement::ServiceProcess *ServiceManagement::ServiceHandler::servicePro
|
||||
|
||||
ServiceManagement::ServiceProcess *ServiceManagement::ServiceHandler::serviceProcessFromServiceProcId(int32_t id)
|
||||
{
|
||||
for (Service *service : std::as_const(m_services))
|
||||
for (Service *service : qAsConst(m_services))
|
||||
{
|
||||
ServiceProcess *result = service->procFromServiceProcId(id);
|
||||
if (result)
|
||||
@@ -218,9 +218,9 @@ void ServiceManagement::ServiceHandler::onHeartBeatObserverTimerTimeout()
|
||||
const qint64 minHeartbeatAge = tNow - HEARTBEAT_OBSERVER_INTERVAL;
|
||||
const qint64 minHeartbeatAgeStartup = tNow - HEARTBEAT_OBSERVER_INTERVAL * 6;
|
||||
|
||||
for (Service *currentService : std::as_const(m_services))
|
||||
for (Service *currentService : qAsConst(m_services))
|
||||
{
|
||||
for (ServiceProcess *currentProc : std::as_const(currentService->allProcs()))
|
||||
for (ServiceProcess *currentProc : qAsConst(currentService->allProcs()))
|
||||
{
|
||||
// dev mode for this proc -> we're not repsonsible for
|
||||
if (currentProc->devMode())
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QVector>
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
|
||||
#include "logger.h"
|
||||
#include "service_donator.h"
|
||||
@@ -52,8 +52,6 @@ private Q_SLOTS:
|
||||
void onHeartBeatObserverTimerTimeout();
|
||||
|
||||
private: // methods
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
Service *serviceFromId(int id);
|
||||
ServiceProcess *serviceProcessFromPid(qint64 pid);
|
||||
ServiceProcess *serviceProcessFromServiceProcId(int32_t id);
|
||||
@@ -66,5 +64,7 @@ private: // attributes
|
||||
|
||||
int HEARTBEAT_OBSERVER_INTERVAL = 10000;
|
||||
QSet<qint64> m_unknownPidsWarned;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
} // namespace ServiceManagement
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
int ServiceManagement::ServiceProcess::s_serviceProcessIdCounter = 0;
|
||||
|
||||
ServiceManagement::ServiceProcess::ServiceProcess(const GroupRequest &groupData, ServiceManagement::Service *parentService) : QProcess(parentService)
|
||||
ServiceManagement::ServiceProcess::ServiceProcess(const GroupRequest &groupData, ServiceManagement::Service *parentService)
|
||||
: QProcess(parentService)
|
||||
, m_serviceId(parentService->id())
|
||||
, m_serviceProcessId(s_serviceProcessIdCounter++)
|
||||
, m_abbreviation(parentService->abbreviation())
|
||||
@@ -32,8 +33,9 @@ ServiceManagement::ServiceProcess::ServiceProcess(const GroupRequest &groupData,
|
||||
, m_isInDevMode(parentService->devMode())
|
||||
, m_failedStartAttemptCounter(0)
|
||||
, m_stoppedFromRequest(false)
|
||||
, m_pidProc(new QProcess(this)),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
, m_pidProc(new QProcess(this))
|
||||
, m_logger(getLogger("ServiceProcess"))
|
||||
{
|
||||
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId()),
|
||||
QStringLiteral("-d"), QString::number(m_groupData.domainId())});
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <QtCore/QString>
|
||||
#include <QString>
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user