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

103 lines
2.7 KiB
C++

/**
* Communication with A/V system - fm server
* $Id$
* $HeadURL$
* $Author$
*/
#include "fm_control.h"
#include "exercise_context.h"
namespace AudioVideoManagement
{
FMControl::FMControl(const QString &fmServerHost, quint16 fmServerPort, QObject *parent)
: AVSocket(fmServerHost, fmServerPort, getLogger("FMControl"), getLogger("FMControl.IO"), parent)
{
}
FMControl::~FMControl()
{
}
void FMControl::onReadyRead()
{
static const QByteArray baGreeter("RCP_FM/1.0");
while (m_avsSocket->canReadLine())
{
const QByteArray line = m_avsSocket->readLine().trimmed();
if (line.isEmpty())
continue;
DEBUG_LOG(m_loggerIO) << "From A/V: '" << line << "'";
if (line == baGreeter)
onRcpLogin();
else
{
const auto baList = parseLine(line);
bool bOk;
const Commands cmdId = static_cast<Commands>(baList.at(0).toInt(&bOk));
if (!bOk)
{
ERROR_LOG(m_logger) << "Error parsing command: '" << line << "'";
continue;
}
switch (cmdId)
{
case Commands::SyslogEvent:
break;
case Commands::AvEvent:
handleSubcommandAvEvent(line, baList);
break;
}
}
}
}
void FMControl::handleSubcommandAvEvent(const QByteArray &line, const QVector<QByteArray> &baList)
{
if (baList.size() < 2)
{
ERROR_LOG(m_logger) << "Got unknown command from fm server: '" << line << "'";
return;
}
bool bOk;
const Subcommands subCmdId = static_cast<Subcommands>(baList.at(1).toInt(&bOk));
if (!bOk)
{
ERROR_LOG(m_logger) << "Error parsing command: '" << line << "'";
return;
}
switch (subCmdId)
{
case Subcommands::AllFilesDeleted:
{
// 266 2306 1477395849 4 "ECCORSV01" "AVS_Server" "All files of directory /data/uebung_11/ECRS are deleted"
if (baList.size() < 7)
{
ERROR_LOG(m_logger) << "Can not parse command from fm server: '" << line << "'";
return;
}
const QByteArray &str = baList.at(6);
const QByteArray startsWith("All files of directory ");
if (!str.startsWith(startsWith))
ERROR_LOG(m_logger) << "Can not parse FileDeletion command: '" << line << "'";
const QList<QByteArray> dirParts = str.split(' ').at(4).split('/');
if (dirParts.size() < 2)
{
ERROR_LOG(m_logger) << "Can not parse command from fm server: '" << line << "'";
return;
}
const ExerciseContext context = ExerciseContext::fromByteArray(dirParts.at(dirParts.size() - 2)); // /foo/bar/ctx_42/ECRS
emit fileDeletionCompleted(context);
break;
}
case Subcommands::FileDeletionProgress:
DEBUG_LOG(m_logger) << "File deletion in progress: '" << line << "'";
break;
}
}
} // namespace AudioVideoManagement