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>
This commit is contained in:
18662 files changed
+4115092
-5435
No files matched your search
@@ -0,0 +1,272 @@
|
||||
/**
|
||||
* Exercises Handler - checks the avilable exercises and creates subhandlers fort each of them
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-04-14
|
||||
*/
|
||||
|
||||
#include "exercise_participant_handler.h"
|
||||
#include "exercises_handler.h"
|
||||
#include "dds_handler_exercise.h"
|
||||
|
||||
using namespace WarehouseManagement;
|
||||
|
||||
ExerciseParticipantHandler::ExerciseParticipantHandler(const dds::domain::DomainParticipant &domainParticipant,
|
||||
int exerciseId,
|
||||
ExercisesHandler *exercisesHandler)
|
||||
: m_exerciseId(exerciseId)
|
||||
, m_ddsHandlerExercise(new DdsHandlerExercise(domainParticipant, exerciseId))
|
||||
, m_exercisesHandler(exercisesHandler)
|
||||
, m_logger(getLogger(QLatin1String("ExerciseParticipantHandler.") + QString::number(exerciseId)))
|
||||
{}
|
||||
|
||||
ExerciseParticipantHandler::~ExerciseParticipantHandler()
|
||||
{
|
||||
m_ddsHandlerExercise.reset();
|
||||
}
|
||||
|
||||
bool ExerciseParticipantHandler::init()
|
||||
{
|
||||
if (!m_ddsHandlerExercise->init())
|
||||
return false;
|
||||
|
||||
auto cbParty = [this](const ParticipantManagement::Party &party)
|
||||
{
|
||||
onPartyChanged(party, DataModification::eAdded);
|
||||
};
|
||||
m_ddsHandlerExercise->ppmDtc()->partys(cbParty);
|
||||
|
||||
auto cpParticipant = [this](const ParticipantManagement::Participant &participant)
|
||||
{
|
||||
onParticipantChanged(participant, DataModification::eAdded);
|
||||
};
|
||||
m_ddsHandlerExercise->ppmDtc()->participants(cpParticipant);
|
||||
|
||||
|
||||
connect(m_ddsHandlerExercise->ppmDtc().get(), &ParticipantManagement::Interface::Dtc::participantChanged,
|
||||
this, &ExerciseParticipantHandler::onParticipantChanged);
|
||||
connect(m_ddsHandlerExercise->ppmDtc().get(), &ParticipantManagement::Interface::Dtc::partyChanged,
|
||||
this, &ExerciseParticipantHandler::onPartyChanged);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ParticipantManagement::Party ExerciseParticipantHandler::getParty(int partyId) const
|
||||
{
|
||||
return m_partyMap.value(partyId);
|
||||
}
|
||||
|
||||
QString ExerciseParticipantHandler::getHierarchyFromParticipant(int participantId, const QMap<int, ParticipantManagement::Participant> &allParticipants) const
|
||||
{
|
||||
return allParticipants.isEmpty() ?
|
||||
m_ddsHandlerExercise->ppmDtc()->hierarchyFromParticipant(participantId) :
|
||||
m_ddsHandlerExercise->ppmDtc()->hierarchyFromParticipant(participantId, allParticipants);
|
||||
}
|
||||
|
||||
ParticipantManagement::Participant ExerciseParticipantHandler::getParticipant(int participantId) const
|
||||
{
|
||||
return m_ddsHandlerExercise->ppmDtc()->participant(participantId);
|
||||
}
|
||||
|
||||
QMap<qint32, ParticipantManagement::Participant> ExerciseParticipantHandler::getParticipants() const
|
||||
{
|
||||
return m_ddsHandlerExercise->ppmDtc()->participants();
|
||||
}
|
||||
|
||||
void ExerciseParticipantHandler::registerParticipant(qint32 participantId,
|
||||
ParticipantManagement::ParticipantAssignState assignState,
|
||||
const dds::core::optional<int> &equipNo,
|
||||
const dds::core::optional<QString> &identification,
|
||||
const dds::core::optional<QString> &info)
|
||||
{
|
||||
ParticipantManagement::RegisterParticipantRequest req;
|
||||
req.assignState(assignState);
|
||||
|
||||
if (equipNo.is_set())
|
||||
req.equipmentNumber(equipNo.get());
|
||||
if (identification.is_set())
|
||||
req.identification(identification.get().toStdString());
|
||||
if (info.is_set())
|
||||
req.info(info.get().toStdString());
|
||||
if (!equipNo.is_set() || !info.is_set() || !identification.is_set())
|
||||
{
|
||||
const auto participant = m_ddsHandlerExercise->ppmDtc()->participant(participantId);
|
||||
if (!equipNo.is_set() && participant.equipmentNumber().is_set())
|
||||
req.equipmentNumber(participant.equipmentNumber().get());
|
||||
if (!info.is_set())
|
||||
req.info(participant.info());
|
||||
if (!identification.is_set())
|
||||
req.identification(participant.identification());
|
||||
}
|
||||
req.participantId(participantId);
|
||||
|
||||
INFO_LOG(m_logger) << "IN ::registerParticipant, ParticipantId: " << participantId
|
||||
<< ", equipNo: " << equipNo << ", assignState: " << assignState;
|
||||
|
||||
m_ddsHandlerExercise->ppmFtc()->registerParticipantRequest(req, this);
|
||||
}
|
||||
|
||||
void ExerciseParticipantHandler::onRegisterParticipantReply(const ParticipantManagement::RegisterReply &reply)
|
||||
{
|
||||
INFO_LOG(m_logger) << "RegisterReply id " << reply.id()
|
||||
<< " - registerReturnValue: " << reply.registerReturnValue()
|
||||
<< " for exercise " << reply.exerciseId();
|
||||
|
||||
// TODO: better idea please :)
|
||||
Core::FunctionReplyObject fro;
|
||||
fro.setStr(reply.errorString().c_str());
|
||||
for (const auto &arg : reply.errorParams())
|
||||
fro = fro.arg(arg);
|
||||
// send data via signal
|
||||
|
||||
emit registrationReturnValue(reply.exerciseId(), reply.id(), reply.registerReturnValue());
|
||||
|
||||
if (fro.error())
|
||||
ERROR_LOG(m_logger) << "Error: " << fro();
|
||||
}
|
||||
|
||||
void ExerciseParticipantHandler::participantAdded(const ParticipantManagement::Participant &participant)
|
||||
{
|
||||
// check if participant has equipment number
|
||||
if (!participant.equipmentNumber().is_set() || participant.equipmentNumber().get() == 0)
|
||||
{
|
||||
// no -> all ok
|
||||
INFO_LOG(m_logger) << "New participant but no equipment number - ignoring";
|
||||
return;
|
||||
}
|
||||
addParticipant(participant.id(), participant.equipmentNumber().get());
|
||||
}
|
||||
|
||||
void ExerciseParticipantHandler::participantModified(const ParticipantManagement::Participant &participant)
|
||||
{
|
||||
// what can happen:
|
||||
// - 1: participant is not in our map
|
||||
// - 1.1: participant has no equipment number -> ignore
|
||||
// - 1.2: participant has equipment number -> add participant to our map
|
||||
// - 2_ participant is in our map -> participant had an equipment number
|
||||
// - 2.1: participant has same equipment number -> ignore
|
||||
// - 2.2: participant has no longer an equipment number -> remove participant from our map
|
||||
// - 2.3: participant has other equipment number -> modify participant for new equipment number
|
||||
|
||||
const auto itEquipNumber = m_participantId2EquipmentNumber.constFind(participant.id());
|
||||
if (itEquipNumber == m_participantId2EquipmentNumber.constEnd())
|
||||
{
|
||||
// 1: participant is not in our map
|
||||
// no entry for this participant in our map ...
|
||||
if (!participant.equipmentNumber().is_set() || participant.equipmentNumber() == 0)
|
||||
{
|
||||
// 1.1: participant has no equipment number -> ignore
|
||||
return;
|
||||
}
|
||||
// 1.2: participant has equipment number -> add participant to our map
|
||||
addParticipant(participant.id(), participant.equipmentNumber().get());
|
||||
return;
|
||||
}
|
||||
|
||||
// 2: participant is in our map -> participant had an equipment number
|
||||
if (itEquipNumber.value() == participant.equipmentNumber())
|
||||
{
|
||||
// 2.1: participant has same equipment number -> ignore
|
||||
return;
|
||||
}
|
||||
if (participant.equipmentNumber().is_set())
|
||||
{
|
||||
INFO_LOG(m_logger) << "Participant with id " << participant.id() << " changed its equipment number from "
|
||||
<< itEquipNumber.value() << " to " << participant.equipmentNumber().get();
|
||||
}
|
||||
|
||||
if (participant.equipmentNumber() == 0)
|
||||
{
|
||||
// 2.2: participant has no longer an equipment number -> remove participant from our map
|
||||
removeParticipant(participant.id(), participant.equipmentNumber().get());
|
||||
return;
|
||||
}
|
||||
|
||||
// 2.3: participant has other equipment number -> modify participant for new equipment number
|
||||
removeParticipant(itEquipNumber.key(), itEquipNumber.value());
|
||||
if (participant.equipmentNumber().is_set())
|
||||
addParticipant(participant.id(), participant.equipmentNumber().get());
|
||||
}
|
||||
|
||||
void ExerciseParticipantHandler::participantRemoved(const ParticipantManagement::Participant &participant)
|
||||
{
|
||||
// check if participant is in our map
|
||||
const auto itEquipNumber = m_participantId2EquipmentNumber.find(participant.id());
|
||||
if (itEquipNumber == m_participantId2EquipmentNumber.end())
|
||||
{
|
||||
// no -> all ok
|
||||
INFO_LOG(m_logger) << "Participant was removed but has no equipment number - ignoring";
|
||||
return;
|
||||
}
|
||||
removeParticipant(itEquipNumber.key(), itEquipNumber.value());
|
||||
}
|
||||
|
||||
void ExerciseParticipantHandler::emitChangedForInferiors(const ParticipantManagement::Participant &participant)
|
||||
{
|
||||
for (const int inferior : participant.inferiorIds())
|
||||
{
|
||||
const auto inf = m_ddsHandlerExercise->ppmDtc()->participant(inferior);
|
||||
if (inf.id() != 0)
|
||||
emit participantChanged(inf, DataModification::eModified, m_exerciseId);
|
||||
emitChangedForInferiors(inf);
|
||||
}
|
||||
}
|
||||
|
||||
void ExerciseParticipantHandler::addParticipant(int participantId, int equipmentNumber)
|
||||
{
|
||||
m_participantId2EquipmentNumber.insert(participantId, equipmentNumber);
|
||||
|
||||
ParticipantInfoStruct pis;
|
||||
pis.equipmentNumber = equipmentNumber;
|
||||
pis.participantId = participantId;
|
||||
pis.exerciseId = m_ddsHandlerExercise->getExerciseId();
|
||||
|
||||
m_exercisesHandler->addParticipant(pis);
|
||||
}
|
||||
|
||||
void ExerciseParticipantHandler::removeParticipant(int participantId, int equipmentNumber)
|
||||
{
|
||||
m_participantId2EquipmentNumber.remove(participantId);
|
||||
|
||||
ParticipantInfoStruct pis;
|
||||
pis.equipmentNumber = equipmentNumber;
|
||||
pis.participantId = participantId;
|
||||
pis.exerciseId = m_ddsHandlerExercise->getExerciseId();
|
||||
|
||||
m_exercisesHandler->removeParticipant(pis);
|
||||
}
|
||||
|
||||
|
||||
void ExerciseParticipantHandler::onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType)
|
||||
{
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
participantAdded(data);
|
||||
break;
|
||||
case DataModification::eModified:
|
||||
participantModified(data);
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
participantRemoved(data);
|
||||
break;
|
||||
}
|
||||
emit participantChanged(data, modType, m_exerciseId);
|
||||
emitChangedForInferiors(data);
|
||||
}
|
||||
|
||||
void ExerciseParticipantHandler::onPartyChanged(const ParticipantManagement::Party &data, DataModification modType)
|
||||
{
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
m_partyMap[data.id()] = data;
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
m_partyMap.remove(data.id());
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user