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

119 lines
2.9 KiB
C++

/**
* Communication with A/V system
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "av_socket.h"
#include "exercise_context.h"
#include "logger.h"
#include <boost/optional.hpp>
#include <queue>
namespace AudioVideoManagement
{
class AVControl final : public AVSocket
{
Q_OBJECT
public:
enum class BasicOperatingMode
{
Unknown = -1,
Reset = 0,
Shutdown = 1,
Service = 2,
PowerOn = 3
};
Q_ENUM(BasicOperatingMode)
enum class OperatingMode
{
Unknown = -1,
PowerOn = 3,
Initialization = 4,
Recording = 5,
Pause = 6,
SaveData = 8,
Cleanup = 10
};
Q_ENUM(OperatingMode)
enum class Commands
{
WrongSessionPriority = 102,
Ok = 200,
SessionDisabled = 207,
SessionEnabled = 208,
Context = 240,
BasicOperatingMode = 250,
ComponentBasicOperatingMode = 251,
OperatingMode = 255,
FMServerState = 260,
KeppAlive = 298,
WrongCommand = 400,
BadArguments = 401,
CommandTooLong = 403,
CommandNotAllowed = 405,
CommandNotImplemented = 410,
CommandNotStateValid = 455,
InternalError = 500,
InvalidRCPVersion = 505
};
Q_ENUM(Commands)
enum class Component
{
Unknown = 0,
Audio = 1,
Video = 2,
AudioAndVideo = 3
};
Q_ENUM(Component)
public:
AVControl(const QString &avsServerHost, quint16 avsServerPort, QObject *parent = nullptr);
~AVControl();
Q_SIGNALS:
void operatingModeChanged(const ExerciseContext &context, Component comp, OperatingMode om);
void successfullyLoggedIn();
public Q_SLOTS:
bool triggerAVUpdate();
bool setOperatingModeForContext(const ExerciseContext &context, OperatingMode om);
private Q_SLOTS:
void onReadyRead() override;
void onSendKeepAlive();
void onCheckKeepAlive();
private:
void sendNextPendingCommand();
bool trySendCommand(const boost::optional<ExerciseContext> &ctx, const QByteArray &cmd);
void checkBasicOperatingMode(BasicOperatingMode mode);
bool setOperatingMode(const ExerciseContext &context, Component component, OperatingMode mode);
BasicOperatingMode m_basicOperatingMode;
bool m_bWaitingForSwitchContext;
time_t m_keepAliveTime;
QTimer *m_keepAliveTimer;
boost::optional<ExerciseContext> m_currentContext;
struct CommandToSend
{
boost::optional<ExerciseContext> ctx; //!< some commands don't require a context, e.g. SetBasicOperatingMode
QByteArray cmd;
};
std::queue<CommandToSend> m_commandsToSend;
};
std::ostream &operator <<(std::ostream &stream, AVControl::BasicOperatingMode bom);
std::ostream &operator <<(std::ostream &stream, AVControl::OperatingMode om);
std::ostream &operator <<(std::ostream &stream, AVControl::Commands cmd);
std::ostream &operator <<(std::ostream &stream, AVControl::Component comp);
} // namespace AudioVideoManagement