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

140 lines
4.8 KiB
C++

/**
* CombatNetRadioHandler - reads TetraChannel and TvcConfig data from the database and publishes the data to dds,
* reacts to TvcConfig related Function topics
* $Id$
* $HeadURL$
* $Author$
* Created by Hannes Baeuerle, SLSE, 2017-07-25
*/
#pragma once
#include "logger.h"
#include "avm_fts.h"
#include <AudioVideoManagement/avm_db.h>
#include <QObject>
#include <QHash>
#include <QVector>
#include <QMap>
#include <QString>
#include <boost/optional.hpp>
#include <memory>
#include <functional>
namespace InfrastructureManagement
{
class MainStructureElement;
namespace Interface
{
class Dtc;
}
} // namespace InfrastructureManagement
enum class DataModification;
namespace AudioVideoManagement
{
namespace Interface
{
class Dts;
class Fts;
}
class ExerciseContext;
class ActiveExercises;
class FrequencyPlanningHandler;
class CnrHandler
: public QObject
, protected Interface::Fts::ModifyCnrConfigRequestHandler
, protected Interface::Fts::RemoveCnrConfigRequestHandler
{
Q_OBJECT
public:
CnrHandler(Interface::Dts *dts, Interface::Fts *fts, InfrastructureManagement::Interface::Dtc *ismDtc, FrequencyPlanningHandler *frequencyPlanningHandler, DatabaseInterface *db, ActiveExercises *activeExercises);
~CnrHandler();
bool init();
bool hasConfig(int32_t configId) const;
const CnrConfig &config(int32_t configId) const;
void onRemoveCnrConfigRequest(const rti::core::SampleIdentity &cookie,
const Core::RemoveElementRequest &request) override final;
void onModifyCnrConfigRequest(const rti::core::SampleIdentity &cookie,
const ModifyCnrConfigRequest &request) override final;
signals:
/** Signalled after device_config modifications. */
void avDbReloadNeeded();
/** Only emitted on change, i.e. not on create or remove. */
void cnrConfigChanged(const CnrConfig &tvcConfig);
void cnrConfigRemoved(int cnrConfigId);
private slots:
void onContextActivated(const ExerciseContext &context);
void onContextDeactivated(const ExerciseContext &context);
void onFrequencyPlanningChanged();
void onDbDeleteAvmCnrConfig(const QVariant &id);
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType);
void onRadioStationChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType);
private:
void reevalutate();
void updateDeviceConfig();
CnrConfig toDds(const Database::AvmCnrConfig &config) const;
Database::AvmDeviceConfig toDeviceConfig(const CnrConfig &cnrConfig) const;
Core::FunctionReplyObject validateRequest(const ModifyCnrConfigRequest &request);
bool checkConstraint(const std::function<bool (const CnrConfig &)> &constraint, const boost::optional<int> &exerciseId, const boost::optional<int32_t> &excludeId) const;
bool isValidChannel(int64_t channelId) const;
bool isFreeChannel(const ModifyCnrConfigRequest &request) const;
bool isFreeChannel(int32_t channelId, const boost::optional<int> &exerciseId, const boost::optional<int32_t> &excludeId = boost::none) const;
bool isNameUnique(const ModifyCnrConfigRequest &request);
bool isNameUnique(const std::string &name, const boost::optional<int> &exerciseId, const boost::optional<int32_t> &excludeId = boost::none) const;
Core::FunctionReplyObject createCnrConfig(const ModifyCnrConfigRequest &request, const boost::optional<int32_t> &dbId = boost::none);
Core::FunctionReplyObject modifyCnrConfig(const ModifyCnrConfigRequest &request);
Core::FunctionReplyObject removeCnrConfig(const Core::RemoveElementRequest &request);
void onRadioStationAdded(int id, const QString &name, const QString &hostname);
void onRadioStationRemoved(int id);
bool isActiveExercise(int exerciseId) const;
bool needDeviceConfig(const CnrConfig &config) const;
bool haveActiveFrequencyPlanning() const;
QString exerciseList(const CnrConfig &config) const;
QString stationList(int addacChannel) const;
int normalizedAddacChannel(int addacChannel) const;
Database::AvmCnrChannel channelById(int32_t id) const;
class DeviceConfig;
Interface::Dts *m_dts;
Interface::Fts *m_fts;
FrequencyPlanningHandler *m_frequencyPlanningHandler;
DatabaseInterface *m_db;
ActiveExercises *m_activeExercises;
QMap<int32_t, CnrConfig> m_cache;
QVector<Database::AvmCnrChannel> m_channels;
QHash<int, QString> m_cnrRadioStations;
LOGGER_T &m_logger;
std::unique_ptr<DeviceConfig> m_deviceConfig;
};
} // namespace AudioVideoManagement