Files
qt-migration-legatus/qt5-before/dlbo/Lts/Services/AudioVideoManagement/exercise_handler.h
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

123 lines
4.1 KiB
C++

/**
* Exercises Handler - Handle all information which is needed for AVS to create the proper AV-Streams for a specific context
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-10-20
*/
#pragma once
#include <QObject>
#include <QMultiMap>
#include <QTimer>
#include <AudioVideoManagement/avm_db.h>
#include <ExerciseManagement/exm_dtc.h>
#include <ExerciseManagement/exm_enums.hpp>
#include "av_control.h"
#include "fm_control.h"
#include "exercise_context.h"
#include "logger.h"
#include <string>
namespace AudioVideoManagement
{
class MainHandler;
class ExercisesHandler;
/**
* The ExerciseHandler observes the Exercise's state changes and translates
* our states into states known to AVS.
* The wanted AVS state is communicated to AVS via RCP/AVE (see AVControl).
*
* The ExerciseHandler also ensures that there exist two device_config entries --
* one for the playback and one for the record session.
*
* Furthermore the ExerciseHandler observes the lifetime of the Exercise.
* Once the Exercise is terminated, AVS is requested to delete all data
* related to that Exercise. Once that is done, the device_config entries are
* removed and removeMeImFinished() is signalled.
*/
class ExerciseHandler : public QObject
{
Q_OBJECT
public:
ExerciseHandler(MainHandler *mainHandler, int exerciseId);
static QString avTypeRecordSession() { return QStringLiteral("RECORD_SESSION"); }
static QString avTypePlaybackSession() { return QStringLiteral("PLAYBACK_SESSION"); }
const ExerciseContext &context() const { return m_exContext; }
QString contextString() const { return m_exContext.toString(); }
/**
* Called by ExercisesHandler whenever the exercise state changed.
*/
void setNewExerciseState(ExerciseManagement::ExerciseState newState);
/**
* Public as the ExercisesHandler adds the Record- and ReplaySession
* after instantiation in case they already exist when the application starts.
*/
void addDeviceConfig(const Database::AvmDeviceConfig &config);
/**
* Called once directly after instantiation if upon startup of the service
* there exists an entry in exercise_last_seen for this exercise.
*/
void setLastSeen(const Database::AvmExerciseLastSeen &lastSeen);
signals:
/**
* @name Signals that notify a state change regarding the notion of whether the
* context is active or not.
* A context is considered active when the corresponding excercise has one of the
* following states: Started, Paused, Resumed.
* The state can only change from activated to deactivated but not back.
*/
///@{
void contextActivated();
void contextDeactivated();
///@}
/** Signalled after the exercise has been removed from AVS. */
void removeMeImFinished(int exerciseId);
/** Signalled after device_config modifications. */
void avDbReloadNeeded();
private slots:
void onUpdateTimerTimeout();
void onLastSeenTimerTimeout();
void onOperatingModeChanged(const ExerciseContext &context, AVControl::Component comp, AVControl::OperatingMode om);
void onContextFilesDeleted(const ExerciseContext &context);
void onAvSuccessfullyLoggedIn();
private: // methods
void checkForRecordPlaybackSession();
static AVControl::OperatingMode avModeFromExerciseState(ExerciseManagement::ExerciseState state);
bool isTerminating() const;
AVControl *avControl() const;
FMControl *fmControl() const;
DatabaseInterface *db() const;
ExerciseManagement::Interface::Dtc *exmDtc() const;
private: // attributes
Database::AvmDeviceConfig m_recordSession;
Database::AvmDeviceConfig m_replaySession;
ExerciseContext m_exContext;
ExerciseManagement::ExerciseState m_curExerciseState;
Database::AvmExerciseLastSeen m_lastSeen;
AVControl::OperatingMode m_curAVOperatingMode;
MainHandler *m_mainHandler;
QTimer *m_updateTimer;
QTimer *m_lastSeenTimer;
bool m_bWarnedOnce;
LOGGER_T m_logger;
};
} // namespace AudioVideoManagement