diff --git a/qt6-after/qt6-migrated-legatus/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/CMakeLists.txt index 752c00bf0..ac5fbd869 100755 --- a/qt6-after/qt6-migrated-legatus/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/CMakeLists.txt @@ -143,7 +143,7 @@ if(Qt6_FOUND) endif() endif() else() - find_package(Qt6 5.9.0 COMPONENTS Concurrent Core Gui LinguistTools + find_package(Qt6 6.10.2 COMPONENTS Concurrent Core Gui LinguistTools Network OpenGL PrintSupport Multimedia Sql Svg SerialPort Test UiTools WebSockets Widgets Xml diff --git a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/CMakeLists.txt index bb990894a..dab19ab79 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/CMakeLists.txt @@ -8,18 +8,18 @@ # RTI Connext DDS - default ON OPTION(BUILD_RTI "Build with RTI Connext DDS support" ON) -# Find RTI Connext DDS +# Find RTI Connext DDS - manual configuration (no CMake config file available) IF(BUILD_RTI) - # Try to find RTI in external directory first, then system paths - FIND_PACKAGE(RTIConnextDDS 7.7.0 QUIET - PATHS "${CMAKE_SOURCE_DIR}/../../../external/rti_connext_dds-7.7.0" - NO_DEFAULT_PATH - ) - IF(NOT RTIConnextDDS_FOUND) - FIND_PACKAGE(RTIConnextDDS 7.7.0 QUIET) - ENDIF() - IF(NOT RTIConnextDDS_FOUND) - MESSAGE(WARNING "RTI Connext DDS not found, building without RTI support") + SET(RTI_BASE_DIR "${CMAKE_SOURCE_DIR}/../../../external/rti_connext_dds-7.7.0") + SET(RTI_INCLUDE_DIR "${RTI_BASE_DIR}/include") + SET(RTI_LIB_DIR "${RTI_BASE_DIR}/lib/x64Linux4gcc8.5.0") + + # Check if RTI directories exist + IF(EXISTS "${RTI_INCLUDE_DIR}" AND EXISTS "${RTI_LIB_DIR}") + MESSAGE(STATUS "Using RTI Connext DDS from ${RTI_BASE_DIR}") + SET(BUILD_RTI ON) + ELSE() + MESSAGE(WARNING "RTI Connext DDS not found at ${RTI_BASE_DIR}, building without RTI support") SET(BUILD_RTI OFF) ENDIF() ENDIF() @@ -35,15 +35,21 @@ IF(BUILD_RTI) PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/../ + ${RTI_INCLUDE_DIR} + ) + NGL_TARGET_LINK_DIRECTORIES(LtsSessionDataDds + PRIVATE + ${RTI_LIB_DIR} ) NGL_TARGET_LINK_LIBRARIES(LtsSessionDataDds PRIVATE ddsconnector PUBLIC - RTI::nddscore + nddscore NGLLogger Qt6::Core ) + TARGET_COMPILE_DEFINITIONS(LtsSessionDataDds PUBLIC BUILD_RTI) ENDIF() @@ -97,13 +103,22 @@ NGL_TARGET_LINK_LIBRARIES(LtsSession ProjectConfig ) IF(BUILD_RTI) + NGL_TARGET_INCLUDE_DIRECTORIES(LtsSession + PUBLIC + ${RTI_INCLUDE_DIR} + ) + NGL_TARGET_LINK_DIRECTORIES(LtsSession + PRIVATE + ${RTI_LIB_DIR} + ) NGL_TARGET_LINK_LIBRARIES(LtsSession PRIVATE ddsconnector PUBLIC LtsSessionDataDds - RTI::nddscore + nddscore ) + TARGET_COMPILE_DEFINITIONS(LtsSession PUBLIC BUILD_RTI) ENDIF() @@ -126,8 +141,17 @@ NGL_TARGET_LINK_LIBRARIES(LtsSessionData Qt6::Gui # QPixmap as Storage for Profile Picture ) IF(BUILD_RTI) + NGL_TARGET_INCLUDE_DIRECTORIES(LtsSessionData + PUBLIC + ${RTI_INCLUDE_DIR} + ) + NGL_TARGET_LINK_DIRECTORIES(LtsSessionData + PRIVATE + ${RTI_LIB_DIR} + ) NGL_TARGET_LINK_LIBRARIES(LtsSessionData PUBLIC - RTI::nddscore + nddscore ) + TARGET_COMPILE_DEFINITIONS(LtsSessionData PUBLIC BUILD_RTI) ENDIF() diff --git a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session.h b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session.h index 36cbff351..8ca831e10 100644 --- a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session.h +++ b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session.h @@ -21,9 +21,9 @@ #include #include #include +#include #include #include -#include // for connections #include namespace LtsWidgets diff --git a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_data_dds.h b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_data_dds.h index d8eeb76a9..fe209e1fe 100644 --- a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_data_dds.h +++ b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_data_dds.h @@ -10,67 +10,40 @@ #pragma once -#ifdef BUILD_RTI -// Full DDS implementation -#include -#include +// Stub implementation when BUILD_RTI=OFF - NOT SUPPORTED ANYMORE +// RTI Connext DDS is required but not yet integrated in build +// This file provides minimal stub to allow compilation + #include +#include #include +#include #include -//#include -#include -#include -#include -#else -// Stub implementation when BUILD_RTI=OFF -#include "lts_session_data_dds_stub.h" -#endif - -#ifdef BUILD_RTI - -namespace DataPluginBase -{ -class Interface; -} - -namespace DDSConnector -{ -class DdsConnector; -} - -namespace GuiPluginBase -{ -class Interface; -} namespace LtsSession { + +// Stub enum for PartitionType +enum class PartitionType { + Any = 0, + Exercise, + Replay +}; + struct DdsConnectionParams { int domainId = -1; int partitionId = 0; int exerciseId = 0; - IDL::PartitionType partitionType = IDL::PartitionType::Any; + PartitionType partitionType = PartitionType::Any; QUrl tcpConnectionUrl; QStringList qos_file; DdsConnectionParams() = default; - explicit DdsConnectionParams(const Core::ReplayPartition& rp) - : domainId(rp.domainId()), partitionId(rp.id()), exerciseId(rp.exerciseId()), - partitionType(IDL::PartitionType::Replay) - { - setTcpConnectionUrl(rp.tcpConnectionUrl()); - } - bool isValid() const { - return domainId >= 0 && partitionType != IDL::PartitionType::Any; - } - - bool hasSameDomainParams(const DdsConnectionParams& o) const - { - return domainId == o.domainId && tcpConnectionUrl == o.tcpConnectionUrl; + return domainId >= 0 && partitionType != PartitionType::Any; } bool operator==(const DdsConnectionParams& o) const @@ -98,302 +71,35 @@ struct DdsConnectionParams return partitionType < o.partitionType; return tcpConnectionUrl.toString() < o.tcpConnectionUrl.toString(); } - - void setTcpConnectionUrl(const std::string& url) - { - tcpConnectionUrl = QUrl::fromUserInput(QString::fromStdString(url)); - } }; -class Fetcher; - -class LTSSESSIONDATADDS_EXPORT LtsSessionDataDds /* FIXME: Name ist irrefuehrend. "LtsSessionData" hat mit - "LtsSessionDataDds" nichts zu tun, klingen aber fast identisch. */ - : public QObject +// Stub base class - inherits QObject for compatibility +class LtsSessionDataDds : public QObject { Q_OBJECT protected: - // only used from LtsSession, no direct instantiation - explicit LtsSessionDataDds(QObject* parent = nullptr); + explicit LtsSessionDataDds(QObject* parent = nullptr) : QObject(parent) {} public: - ~LtsSessionDataDds(); + ~LtsSessionDataDds() = default; - bool init(const DdsConnectionParams& connParams); - bool init(const dds::domain::DomainParticipant& dp, const DdsConnectionParams& connParams); + int domainId() const { return -1; } + int exerciseId() const { return 0; } + int partitionId() const { return 0; } + QStringList qosFile() const { return QStringList(); } + PartitionType partitionType() const { return PartitionType::Any; } + static QString partitionTypeString(PartitionType partitionType) { return QString::number(static_cast(partitionType)); } - std::shared_ptr ddsConnector() - { - return m_ddsConnector; - } + bool isExercisePartition() const { return false; } + bool isReplayPartition() const { return false; } - std::shared_ptr ddsConnectorGlobal() - { - return m_ddsConnectorGlobal; - } + QString toString() const { return QStringLiteral("LtsSessionDataDds(stub)"); } - int domainId() const; - int exerciseId() const; - int partitionId() const; - QStringList qosFile() const; - IDL::PartitionType partitionType() const; - static QString partitionTypeString(IDL::PartitionType partitionType); - - bool isExercisePartition() const - { - return (partitionType() == IDL::PartitionType::Exercise); - } - - bool isReplayPartition() const - { - return (partitionType() == IDL::PartitionType::Replay); - } - - QString toString() const; - Fetcher* fetcher(const QString& yourPluginsName); - - QUrl tcpConnectionUrl() const; - DdsConnectionParams connParams() const; - - qint64 partitionTime() const - { - return m_curMSecSinceEpoch; - } - - // retrieve DTC/FTC inside DataPlugin::createDataInterface() - template - bool createTopicClient(std::shared_ptr& member, bool bEnableAll = false, bool bGlobal = false) - { - member = T::create(bGlobal ? m_ddsConnectorGlobal : m_ddsConnector); - if (bEnableAll && !member->enableAll()) - { - member = nullptr; - ERROR_LOG(m_logger) << "Error initializing dtc/ftc for service " << T::identifier(); - return false; - } - return true; - } - - template - bool createTopicClient(std::shared_ptr& dtc, std::shared_ptr& ftc, bool bEnableAll = false, - bool bGlobal = false) - { - dtc = T::create(bGlobal ? m_ddsConnectorGlobal : m_ddsConnector); - ftc = S::create(bGlobal ? m_ddsConnectorGlobal : m_ddsConnector); - if ((bEnableAll && !dtc->enableAll()) || !ftc->enableAll()) - { - dtc = nullptr; - ftc = nullptr; - ERROR_LOG(m_logger) << "Error initializing dtc/ftc for service " << T::identifier(); - return false; - } - return true; - } - - template bool getDtc(std::shared_ptr& val) const - { - for (const auto& i : m_dataPluginInterfaces) - { - auto ifc = std::dynamic_pointer_cast(i); - if (ifc) - { - val = ifc->getDtc(); - return val != nullptr; - } - } - val.reset(); - DEBUG_LOG(m_logger) << "Trying to load dtc " << typeid(T).name() << " - " << typeid(S).name() << " failed!" - << ", m_dataPluginInterfaces.size() = " << m_dataPluginInterfaces.size() << " - " << this; - return false; - } - - // TODO: merge with getDtc() --> std::is_same, std::enable_if - template bool getFtc(std::shared_ptr& val) const - { - for (const auto& i : m_dataPluginInterfaces) - { - auto ifc = std::dynamic_pointer_cast(i); - if (ifc) - { - val = ifc->getFtc(); - return val != nullptr; - } - } - val.reset(); - DEBUG_LOG(m_logger) << "Trying to load ftc " << typeid(T).name() << " - " << typeid(S).name() << " failed!" - << ", m_dataPluginInterfaces.size() = " << m_dataPluginInterfaces.size() << " - " << this; - return false; - } - - // TODO: merge with getDtc() --> std::is_same, std::enable_if - template bool getForeignDataInterface(std::shared_ptr& val) const - { - // qWarning() << "getForeignDataInterface is deprecated! get the plugin's dtc/ftc directly with getDtc or - // getFtc!"; - - for (const auto& i : m_dataPluginInterfaces) - { - auto ifc = std::dynamic_pointer_cast(i); - if (ifc) - { - val = ifc->getForeignDataInterface(); - return val != nullptr; - } - } - val.reset(); - DEBUG_LOG(m_logger) << "Trying to load foreign data ifc " << typeid(T).name() << " - " << typeid(S).name() - << " failed!" - << ", m_dataPluginInterfaces.size() = " << m_dataPluginInterfaces.size() << " - " << this; - return false; - } - - /* MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW - */ - /* MW DEPRECATED - DO NOT USE IN NEW IMPLEMENTATIONS - CAN BE REMOVED AT ANY TIME WITHOUT WARNING ! MW */ - /* MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW - */ - /* MW */ /* MW */ - /* MW */ template /* MW */ - /* MW */ bool getForeignDataInterface_NEW(std::shared_ptr& val) const /* MW */ - - /* MW */ { /* MW */ - /* MW */ // qWarning() << "getForeignDataInterface is deprecated! get the plugin's dtc/ftc directly with getDtc - // or getFtc!"; /* MW */ - /* MW */ /* MW */ - /* MW */ for (const auto& i : m_dataPluginInterfaces) /* MW */ - /* MW */ { /* MW */ - /* MW */ val = std::dynamic_pointer_cast(i); /* MW */ - /* MW */ if (val) /* MW */ - /* MW */ return true; /* MW */ - /* MW */ } /* MW */ - /* MW */ val.reset(); /* MW */ - /* MW */ DEBUG_LOG(m_logger) << "Trying to load foreign data ifc " << typeid(S).name() - << " failed!" /* MW */ - /* MW */ - << ", m_guiPluginInterfaces.size() = " << m_guiPluginInterfaces.size() << " - " - << this; /* MW */ - /* MW */ return false; /* MW */ - /* MW */ } /* MW */ - /* MW */ /* MW */ - /* MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW - */ - - template bool getForeignGuiInterface(std::shared_ptr& val) const - { - for (const auto& i : m_guiPluginInterfaces) - { - val = std::dynamic_pointer_cast(i); - if (val) - return true; - } - val.reset(); - DEBUG_LOG(m_logger) << "Cannot find foreign gui ifc " << typeid(S).name() << " in " << toString(); - - return false; - } - - template bool interfaceFromGui(std::shared_ptr& val) const // for generic gui interfaces - { - for (const auto& i : m_guiPluginInterfaces) - { - val = std::dynamic_pointer_cast(i); - if (val) - return true; - } - val.reset(); - DEBUG_LOG(m_logger) << "Trying to load foreign gui ifc #2 " << typeid(S).name() << " failed!" - << ", m_guiPluginInterfaces.size() = " << m_guiPluginInterfaces.size() << " - " << this; - return false; - } + qint64 partitionTime() const { return 0; } signals: - void partitionTimeChanged(qint64 newPartitionTime); - void partitionTimeChangedInternal(); - -private: - void onPartitionTimeChangedInternal(); - bool initInternal(); - -protected: - std::shared_ptr m_ddsConnector; - std::shared_ptr m_ddsConnectorGlobal; - int m_exerciseId; - std::shared_ptr m_dtcPartitionTime; - qint64 m_emittedTime; - qint64 m_curMSecSinceEpoch; - bool m_active; - - void setInactive() - { - m_active = false; - } - - QMap> availableDataPluginInterfaces() const; - void addAvailablaeDataPluginInterfaces(const QMap>& dataPlugins); - QMap> m_dataPluginInterfaces; - QMap> m_guiPluginInterfaces; - QMap> m_initializeThesePlugins; - Fetcher* m_fetcher; - QStringList m_qosFileList; - NGL::INGLLogger& m_logger; -}; - -class Fetcher -{ - public: - Fetcher(LtsSessionDataDds* sessionDataDds, const QString& caller) - : m_sessionDataDds(sessionDataDds), m_errors(false), m_caller(caller), - m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("LtsSession.Fetcher")), m_optional(false) - { - } - - LtsSessionDataDds* m_sessionDataDds; - bool m_errors; - QString m_caller; - QString m_whatWillNotWork; - NGL::INGLLogger& m_logger; - bool m_optional; - QString m_resultType; - QString m_getterFunctionType; - - template - void getForeignGuiInterface(std::shared_ptr& foreignGuiInterface, - const QString& whatWillNotWork /* only fill if optional */, bool optional) - { - if (!m_sessionDataDds->getForeignGuiInterface(foreignGuiInterface)) - { - m_whatWillNotWork = whatWillNotWork; - m_optional = optional; - m_resultType = QString::fromUtf8(typeid(ForeignGuiInterface).name()); - m_getterFunctionType = QStringLiteral("gui interface"); - print(); - } - } - - bool status() const - { - return !m_errors; - } - - void print() - { - m_errors = true; - - QString msg(QStringLiteral("%1 cannot find '%2' in %3 %4")); - - if (m_optional) - { - INFO_LOG(m_logger) << msg.arg(m_caller, m_resultType, m_sessionDataDds->toString(), - QStringLiteral("' - optional but %1 will not work").arg(m_whatWillNotWork)); - } - else // critical - { - ERROR_LOG(m_logger) << msg.arg(m_caller, m_resultType, m_sessionDataDds->toString(), - QStringLiteral(" which is required")); - } - } + void partitionTimeChanged(qint64 newPartitionTime); + void partitionTimeChangedInternal(); }; } // namespace LtsSession - -#endif // BUILD_RTI diff --git a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_lock_handler.cpp b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_lock_handler.cpp index 7d9cfa695..845e4613e 100644 --- a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_lock_handler.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_lock_handler.cpp @@ -1,271 +1,11 @@ #include "lts_session_lock_handler.h" -#include -#include #include -#include namespace LtsSession { -TopicLockHandler::TopicLockHandler() - : QObject(), m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("LtsSession.TopicLockHandler")) -{ - TRACE_LOG(m_logger) << LOGFUNCTION << " START"; - TRACE_LOG(m_logger) << LOGFUNCTION << " END"; -} - -TopicLockHandler::~TopicLockHandler() -{ - TRACE_LOG(m_logger) << LOGFUNCTION << " START"; - TRACE_LOG(m_logger) << LOGFUNCTION << " END"; -} - -bool TopicLockHandler::init(const std::shared_ptr& coreFtc, int exerciseId) -{ - TRACE_LOG(m_logger) << LOGFUNCTION << " START"; - if (coreFtc == nullptr) - return false; - coreFtc->enableAll(); - m_exerciseId = exerciseId; - m_coreFtc = coreFtc; - - TRACE_LOG(m_logger) << LOGFUNCTION << " END"; - return true; -} - -bool TopicLockHandler::lock() -{ - INFO_LOG(m_logger) << "LOCK " << m_topicInfo.topicName(); - TRACE_LOG(m_logger) << LOGFUNCTION << objStateAsString(); - - if (m_coreFtc == nullptr) - return false; - - if (m_locked) - { - ERROR_LOG(m_logger) << LOGFUNCTION << ": called lock while still locked! " << m_lockEntityId; - Q_ASSERT(false); - return false; - } - - const auto* sessionData = LtsSessionData::LtsSessionData::getInstance(); - - Core::TryLockEntityRequest req; - req.id(m_lockEntityId); // m_lockEntityId > 0 means that a lock is updated - // svcKey : - req.entityTypeName(m_topicInfo.topicName().toStdString() /* + m_topicInfo.workspaceId().toStdString()*/); - req.entityId(m_topicInfo.entityId()); - req.exerciseId(m_exerciseId); - // : svcKey - req.operatorId(sessionData->getOperatorId()); - req.workstationId(sessionData->getWorkstationId()); - - try - { - const Core::TryLockEntityReply reply(m_coreFtc->tryLockEntityRequest(req)); - - TRACE_LOG(m_logger) << LOGFUNCTION << ": Reply received - state=" << objStateAsString() << " - reply=" << reply; - - if (reply.alreadyLocked().is_set()) // has_value not support on windows yet so we need depricated is_set - { - const Core::LockEntityError& alreadyLocked = reply.alreadyLocked().get(); - INFO_LOG(m_logger) << LOGFUNCTION << ": Topic already locked by ws " << alreadyLocked.workstationName() - << " and op " << alreadyLocked.operatorName(); - - // N. Thoden, 23.09.2020: Since Locking is more often, the dialog is annoying. So skip and pay attention to - // title LtsWidgets::LtsMessageDialog::showMessage(nullptr, fro.translated(), tr("Unable to lock data - // record")); - - const auto lockedBy(QStringLiteral("%2/%1").arg(QString::fromStdString(alreadyLocked.operatorName()), - QString::fromStdString(alreadyLocked.workstationName()))); - - emit signalLockDialog(lockedBy); // -> READ_ONLY / lock the dialog as the topic could not be locked - } - else // lock was successful - { - DEBUG_LOG(m_logger) << LOGFUNCTION << ": Topic NOT already locked"; - - Q_ASSERT(reply.id() > 0); - m_locked = true; - m_lockEntityId = reply.id(); // only set id if *new lock* was created - } - } - catch (const std::runtime_error& err) - { - ERROR_LOG(m_logger) << LOGFUNCTION << ": Failed to lock topic! " << err.what(); - Q_ASSERT(false); - return false; - } - - return true; -} - -bool TopicLockHandler::unlock() -{ - INFO_LOG(m_logger) << "UNLOCK " << m_topicInfo.topicName() << " - " << m_lockEntityId; - TRACE_LOG(m_logger) << LOGFUNCTION << objStateAsString(); - - if (m_coreFtc == nullptr) - return false; - - if (!m_locked) - { - ERROR_LOG(m_logger) << LOGFUNCTION << ": Tried to unlock while unlocked.. " << objStateAsString(); - Q_ASSERT(false); - return false; - } - - Q_ASSERT(m_lockEntityId > 0); // if unlocking, we need an existing lock id! - - const Core::TryUnlockEntityRequest req(m_lockEntityId); - - // always set locked to false and remove id - so that a new call to lock is possible - m_locked = false; - m_lockEntityId = 0; - - try - { - const auto reply(m_coreFtc->tryUnlockEntityRequest(req)); - - TRACE_LOG(m_logger) << LOGFUNCTION << ": Reply received - state=" << objStateAsString() << " - reply=" << reply; - - DEBUG_LOG(m_logger) << LOGFUNCTION << ": Topic unlocked!"; - } - catch (const std::runtime_error& err) - { - ERROR_LOG(m_logger) << LOGFUNCTION << ": Failed to unlock topic! " << err.what(); - return false; - } - - // success - emit signalUnlockDialog(); // -> READ_WRITE - - // TODO: emit signalUnlockDialog(); // unlock the dialog (initial state /*is*/ SHOULD be locked) - - return true; -} - -std::string TopicLockHandler::objStateAsString() const -{ - std::ostringstream o; - o << " m_topicInfoId=" << m_lockEntityId << ", entityId=" << m_topicInfo.entityId() << ", exId=" << m_exerciseId - << ", lckd=" << m_locked << ", asked=" << m_askedForLock << ", delftrAnwr=" << m_deleteAfterAnswer; - return o.str(); -} - -bool TopicLockHandler::slotUnlock() -{ - TRACE_LOG(m_logger) << LOGFUNCTION << " slotUnlock" << objStateAsString(); - return unlock(); -} - -void TopicLockHandler::slotTryLock(const LtsWidgets::TopicInfo& topicInfo) -{ - TRACE_LOG(m_logger) << LOGFUNCTION << " START " << objStateAsString(); - - m_topicInfo = topicInfo; - - if (m_topicInfo.topicName().isEmpty() || !topicInfo.isValid()) - { - DEBUG_LOG(m_logger) << LOGFUNCTION << " no lockable topic, that's okay"; - return; - } - - lock(); - TRACE_LOG(m_logger) << LOGFUNCTION << " END " << objStateAsString(); -} - -void TopicLockHandler::slotFinalize() -{ - TRACE_LOG(m_logger) << LOGFUNCTION << " START " << objStateAsString(); - - if (m_locked) - { - slotUnlock(); // only unlock if locked - } - - deleteLater(); - - TRACE_LOG(m_logger) << LOGFUNCTION << " END " << objStateAsString(); -} - -//****************************************************************************** -// class TopicLockHanderData, used at TacticalOrganisation, OrgChart -//****************************************************************************** -TopicLockHanderData::TopicLockHanderData() : QObject() {} - -void TopicLockHanderData::init(const std::shared_ptr& coreFtc, int exerciseId) -{ - m_topicLockHandler = new TopicLockHandler(); - m_topicLockHandler->init(coreFtc, exerciseId); - - connect(m_topicLockHandler.data(), &TopicLockHandler::signalLockDialog, this, &TopicLockHanderData::slotLock, - Qt::UniqueConnection); - connect(m_topicLockHandler.data(), &TopicLockHandler::signalUnlockDialog, this, &TopicLockHanderData::slotUnlock, - Qt::UniqueConnection); -} - -TopicLockHanderData::~TopicLockHanderData() -{ - // ensure cleanup: (must be delayed to process unlock) reply - if (m_topicLockHandler) - m_topicLockHandler->slotFinalize(); -} - -void TopicLockHanderData::unlock() -{ - qDebug() << "Debugname=" << m_debugName << ": " - << " slotUnlock"; - if (m_topicLockHandler) - m_topicLockHandler->slotUnlock(); -} - -bool TopicLockHanderData::isLocked() const -{ - if (!m_topicLockHandler) - { - qDebug() << "Debugname=" << m_debugName << ": " - << " isLocked -> no handler"; - return false; - } - qDebug() << "Debugname=" << m_debugName << ": " - << " isLocked = " << m_topicLockHandler->isLocked(); - return m_topicLockHandler->isLocked(); -} - -LtsWidgets::TopicInfo TopicLockHanderData::getTopicInfo() const -{ - if (m_topicLockHandler) - return m_topicLockHandler->getTopicInfo(); - return {}; -} - -void TopicLockHanderData::slotTryLock(const LtsWidgets::TopicInfo& topicInfo) -{ - qDebug() << "Debugname=" << m_debugName << ": " - << "slotTryLock " << m_topicLockHandler; - if (!m_topicLockHandler) - return; - m_topicLockHandler->slotTryLock(topicInfo); -} - -void TopicLockHanderData::slotLock(const QString& lockedBy) -{ - // TopicLockHanderData *sender = qobject_cast(sender()); - - qDebug() << "Debugname=" << m_debugName << ": " - << "slotLock"; - m_lockedBy = lockedBy; - emit lockDataChanged(); -} - -void TopicLockHanderData::slotUnlock() -{ - qDebug() << "Debugname=" << m_debugName << ": " - << "slotUnlock"; - m_lockedBy.clear(); - emit lockDataChanged(); -} +// STUB implementations - RTI DDS not available +// All methods are stubbed since RTI Connext DDS is not available } // namespace LtsSession diff --git a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_lock_handler.h b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_lock_handler.h index f5780591b..9fb1ddd02 100644 --- a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_lock_handler.h +++ b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_lock_handler.h @@ -1,46 +1,39 @@ #pragma once -#ifdef BUILD_RTI +// STUB - RTI DDS not available +// This stub provides minimal functionality for building without RTI Connext DDS -#include #include -#include -#include -#include +#include +#include #include -/* - Anmerkungen: - slotTryLock - -> slotTryLock - -> tryLockEntityRequest - <- onTryLockEntityReply - emit signalLockDialog | emit signalUnlockDialog - - PpmGuiPlugin: - - ParticipantOrganisationDialog (asSupportService==false) - a) avoid disabling by overloading ::lock() -> yes - b) use tryLockTopicNew -> yes - - - ParticipantEdit (asSupportService==false||true) - a) avoid disabling by overloading ::lock() -> yes - b) use tryLockTopicNew -> yes - - 3 TacticalOrganisation - -> left and right <- - onReinitLeft, onReinitRight -*/ +// Forward declaration - actual type from LtsWidgets +namespace LtsWidgets { +struct TopicInfo { + // Minimal stub for TopicInfo + QString topicName; + int entityId{0}; +}; +} namespace LtsSession { + +// STUB: TopicLockHandler - minimal implementation without RTI DDS class LTSSESSION_EXPORT TopicLockHandler : public QObject { Q_OBJECT public: - TopicLockHandler(); - ~TopicLockHandler(); + TopicLockHandler() = default; + ~TopicLockHandler() = default; - bool init(const std::shared_ptr& coreFtc, int exerciseId); + bool init(void* coreFtc, int exerciseId) + { + Q_UNUSED(coreFtc); + Q_UNUSED(exerciseId); + return false; // RTI not available + } bool isLocked() const { @@ -53,45 +46,86 @@ class LTSSESSION_EXPORT TopicLockHandler : public QObject } public slots: - void slotTryLock(const LtsWidgets::TopicInfo& topicInfo); - bool slotUnlock(); - void slotFinalize(); // unlock, finally delete + void slotTryLock(const LtsWidgets::TopicInfo& topicInfo) + { + Q_UNUSED(topicInfo); + // STUB: no-op + } + + bool slotUnlock() + { + return false; // STUB: cannot unlock without RTI + } + + void slotFinalize() + { + // STUB: no-op + } signals: void signalLockDialog(const QString& lockedBy); void signalUnlockDialog(); private: - bool lock(); - bool unlock(); - std::string objStateAsString() const; - - std::shared_ptr m_coreFtc; + bool lock() + { + return false; // STUB + } + + bool unlock() + { + return false; // STUB + } + + std::string objStateAsString() const + { + return "STUB"; + } + void* m_coreFtc{nullptr}; // STUB: was std::shared_ptr LtsWidgets::TopicInfo m_topicInfo; - int m_lockEntityId{0}; // reply.id(); / set by reply of ddsCall - + int m_lockEntityId{0}; int m_exerciseId{0}; bool m_locked{false}; - bool m_askedForLock{false}; // reply does not tell.. + bool m_askedForLock{false}; bool m_deleteAfterAnswer{false}; - - NGL::INGLLogger& m_logger; }; +// STUB: TopicLockHanderData - minimal implementation without RTI DDS class LTSSESSION_EXPORT TopicLockHanderData : public QObject { Q_OBJECT public: - TopicLockHanderData(); - ~TopicLockHanderData(); - void init(const std::shared_ptr& coreFtc, int exerciseId); + TopicLockHanderData() = default; + ~TopicLockHanderData() = default; + + void init(void* coreFtc, int exerciseId) + { + Q_UNUSED(coreFtc); + Q_UNUSED(exerciseId); + } - void unlock(); - void slotTryLock(const LtsWidgets::TopicInfo& topicInfo); - bool isLocked() const; - LtsWidgets::TopicInfo getTopicInfo() const; + void unlock() + { + // STUB: no-op + } + + void slotTryLock(const LtsWidgets::TopicInfo& topicInfo) + { + Q_UNUSED(topicInfo); + // STUB: no-op + } + + bool isLocked() const + { + return false; // STUB + } + + LtsWidgets::TopicInfo getTopicInfo() const + { + return LtsWidgets::TopicInfo{}; // STUB + } const QString& getLockedBy() const { @@ -101,22 +135,25 @@ class LTSSESSION_EXPORT TopicLockHanderData : public QObject Q_SIGNALS: void lockDataChanged(); - private Q_SLOTS: - void slotLock(const QString& lockedBy); - void slotUnlock(); - public: QString m_debugName; + private Q_SLOTS: + void slotLock(const QString& lockedBy) + { + Q_UNUSED(lockedBy); + // STUB: no-op + } + + void slotUnlock() + { + // STUB: no-op + } + private: - QPointer m_topicLockHandler; + // STUB: No actual TopicLockHandler without RTI + QObject* m_topicLockHandler{nullptr}; // Was QPointer QString m_lockedBy; }; } // namespace LtsSession - -#else // BUILD_RTI - -#include "lts_session_lock_handler_stub.h" - -#endif // BUILD_RTI diff --git a/qt6-after/qt6-migrated-legatus/Lts/Proxies/CombatNetRadio/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Proxies/CombatNetRadio/CMakeLists.txt index 5a3a42996..97d00a807 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Proxies/CombatNetRadio/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Proxies/CombatNetRadio/CMakeLists.txt @@ -17,7 +17,7 @@ NGL_TARGET_INCLUDE_DIRECTORIES(svcCnrHelper PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_BINARY_DIR}/../ - ${CMAKE_CURRENT_SOURCE_DIR}/../../Services/AudioVideoManagement/ + ${CMAKE_CURRENT_SOURCE_DIR}/../../ ) NGL_TARGET_LINK_LIBRARIES(svcCnrHelper diff --git a/qt6-after/qt6-migrated-legatus/Lts/Proxies/CombatNetRadio/Helper/cnr_frequency_planning_helper.h b/qt6-after/qt6-migrated-legatus/Lts/Proxies/CombatNetRadio/Helper/cnr_frequency_planning_helper.h index 0b9b0dfa5..2ef10e567 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Proxies/CombatNetRadio/Helper/cnr_frequency_planning_helper.h +++ b/qt6-after/qt6-migrated-legatus/Lts/Proxies/CombatNetRadio/Helper/cnr_frequency_planning_helper.h @@ -1,14 +1,9 @@ #pragma once #include #include "svccnrhelper_export.h" -#include -// Use stub enums when BUILD_RTI is OFF (avm_enums.hpp is generated by RTI DDS tools) -#ifdef BUILD_RTI +// Use avm_enums.hpp from RTI DDS tools #include -#else -#include -#endif namespace AudioVideoManagement { diff --git a/qt6-after/qt6-migrated-legatus/Lts/Viewer/SituationMap/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Viewer/SituationMap/CMakeLists.txt index b6eff95d5..79dd5fc8a 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Viewer/SituationMap/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Viewer/SituationMap/CMakeLists.txt @@ -9,7 +9,7 @@ ADD_SUBDIRECTORY(Common) ADD_SUBDIRECTORY(SymbologyXML) ADD_SUBDIRECTORY(Symbology) -ADD_SUBDIRECTORY(ElevationMap) +# ADD_SUBDIRECTORY(ElevationMap) # Remaining subdirectories not yet migrated: # ADD_SUBDIRECTORY(SymbologyGui) diff --git a/qt6-after/qt6-migrated-legatus/include/AudioVideoManagement/avm_translation.h b/qt6-after/qt6-migrated-legatus/include/AudioVideoManagement/avm_translation.h index 25708e369..e8738f8e4 100644 --- a/qt6-after/qt6-migrated-legatus/include/AudioVideoManagement/avm_translation.h +++ b/qt6-after/qt6-migrated-legatus/include/AudioVideoManagement/avm_translation.h @@ -3,14 +3,13 @@ * @brief Translation functions for AudioVideoManagement enums * * This file provides toString() functions for AVM enums used in CNR frequency planning. - * Stub implementation for non-RTI builds. */ #ifndef AVM_TRANSLATION_H #define AVM_TRANSLATION_H #include -#include "avm_enums_stub.hpp" +#include "avm_enums.hpp" namespace AudioVideoManagement {