Files
qt-migration-legatus/qt5-before/dlbo/TetraIF/PrtCnv/PrtCnvApplication.hpp
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

229 lines
5.9 KiB
C++

// **************************************************************************
//
// (C) Copyright 2009 Swiss SIMTEC AG
//
// **************************************************************************
//
// $HeadURL$
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
//
// Implementation of the Class PrtCnvApplication
// **************************************************************************
#pragma once
#include <QObject>
#include "AppComponent.hpp"
#include "logger.h"
#include <nglsettings/nglsettings_settings.h>
#include <QtCore/QMutex>
#include <PrtCnv/prtcnvlib_export.h>
#include <TrainingAreaBase/training_area_telegrams.h>
/**
* Here are all project specific classes of protocol-converter implemented.
*/
namespace PrtCnv
{
class PrtCnvThreadStarter;
/**
* The main-application of protocol-converter. It is responsible for starting and
* controlling the threads of this application.
*
* @author alois.wismer
* @version 1.0
* @created 23-Jun-2009 17:48:47
*/
class PRTCNVLIB_EXPORT PrtCnvApplication : public QObject, public N_AppComponent::AppComponent
{
Q_OBJECT
public:
/**
* This enum will be used to unique identify the threads
*
* @author alois.wismer
* @version 1.0
* @created 19-Jan-2010 17:09:00
*/
enum E_ThreadId
{
e_Central,
e_Radio,
e_Db,
e_Log,
e_Injection,
e_RadioTraffic,
e_ThreadIdMax
};
PrtCnvApplication();
~PrtCnvApplication();
/**
* Starts the main-application
*/
void startApp();
void shutdownApp();
static void setCleanDb(bool bCleanDb);
void setExerciseId(int exerciseId);
int exerciseId() const { return m_exerciseId; }
void setConfigFile(const QString &configFile);
/**
* Starts the childs and then the main application
*/
int32_t start() override;
/**
* Synchronisation of threads before init().
*
* @param a_threadId id of the calling thread
*/
void waitForInit(E_ThreadId a_threadId);
/**
* Synchronisation of threads before start().
*
* @param a_threadId id of the calling thread
*/
void waitForStart(E_ThreadId a_threadId);
/**
* Synchronisation of threads before create().
*
* @param a_threadId Id of the calling thread
*/
void waitForCreate(const E_ThreadId a_threadId);
/**
* Synchronisation of threads before execution of thread.
*
* @param a_threadId id of the calling thread
*/
void waitForExec(E_ThreadId a_threadId);
/**
* Returns the desired thread-starter
*
* @param a_threadId Id of the desired thread-started (corresponding thread has
* the same id)
*/
PrtCnvThreadStarter* getThreadStarter(const E_ThreadId a_threadId);
/**
* @brief Set the database connection parameter when used as library
*/
void setDatabaseConnectionParams(const QString &driver,
const QString &hostName,
const QString &database,
const QString &schemaName,
const QString &userName,
const QString &password);
QString databaseDriver() const { return m_dbDriver; }
QString databaseHostName() const { return m_dbHostName; }
QString databaseName() const { return m_dbDatabaseName; }
QString databaseSchemaName() const { return m_dbSchemaName; }
QString databaseUserName() const { return m_dbUserName; }
QString databasePassword() const { return m_dbPassword; }
public slots:
void logWlsTelegram(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *tele, bool bIsSend);
signals:
void textMessageFromPrtCnvToCentral(const QByteArray &ba);
void textMessageFromCentralToPrtCnv(const QByteArray &ba);
void outgoingBroadcastTelegramsRequest(int equipmentNumber, int broadcastIndex, int resetCounter);
void warehouseMessageFromPtrCnv(const QByteArray &jsonData);
protected:
/**
* Creates the childs
*/
int32_t createApplication();
/**
* Returns true when the specified thread is
* already constructed
*/
bool isConstructed(const E_ThreadId a_threadId) const;
/**
* The specifed thread is now constructed
*/
void setConstructed(const E_ThreadId a_threadId);
/**
* Returns true when the specified thread is
* already initialized
*/
bool isInitialized(const E_ThreadId a_threadId) const;
/**
* The specifed thread is now initialized
*/
void setInitialized(const E_ThreadId a_threadId);
/**
* Returns true when the specified thread is
* already created
*/
bool isCreated(const E_ThreadId a_threadId) const;
/**
* The specifed thread is now created
*/
void setCreated(const E_ThreadId a_threadId);
/**
* Returns true when the specified thread is
* already started
*/
bool isStarted(const E_ThreadId a_threadId) const;
/**
* The specifed thread is now started
*/
void setStarted(const E_ThreadId a_threadId);
protected:
/**
* Used to get configuration-parameter
*/
NGL::Settings *m_Config;
struct ThreadInfo
{
PrtCnvThreadStarter *thread = nullptr;
bool isConstructed = false;
bool isCreated = false;
bool isInitialized = false;
bool isStarted = false;
} m_threadInfo[e_ThreadIdMax];
/**
* The name of the config-file
*/
QString m_ConfigFileName;
/**
* The exerciseId (or zero if not set)
*/
int m_exerciseId;
/**
* Access Mutex
*/
mutable QMutex m_accessMutex;
QString m_dbDriver;
QString m_dbHostName;
QString m_dbDatabaseName;
QString m_dbSchemaName;
QString m_dbUserName;
QString m_dbPassword;
NGL::INGLLogger &m_logger;
};
}