Migrates residual Lts sources to generated rtiddsgen API

Adds NmeaManagement tests, fixes codegen includes and Qt6 SerialPort CMake target.
This commit is contained in:
berrux-dev committed 2026-09-23 12:05:37 +02:00
1 parent 5485a90385
commit 881d44f4dd
512 files changed
+6887 -6426

No files matched your search

@@ -5,6 +5,7 @@
#include <utility>
#include "main_handler.h"
#include "settings.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QtCore/QJsonDocument>
#include <QJsonParseError>
#include <QtCore/QJsonObject>
@@ -114,8 +115,8 @@ IsmHandler::OpsData IsmHandler::dataFromOpsCode(int ipsCode)
void IsmHandler::onInstrumentationAssetChanged(const InfrastructureManagement::InstrumentationAsset &data, DataModification modType)
{
if (data.mountingPointTypeId() != InfrastructureManagement::MountingPointType::IndoorIPS &&
data.mountingPointTypeId() != InfrastructureManagement::MountingPointType::OutdoorIPS)
if (data.mountingPointTypeId != InfrastructureManagement::MountingPointType::IndoorIPS &&
data.mountingPointTypeId != InfrastructureManagement::MountingPointType::OutdoorIPS)
return;
switch (modType)
{
@@ -127,19 +128,19 @@ void IsmHandler::onInstrumentationAssetChanged(const InfrastructureManagement::I
QHashIterator<int, OpsData> i(m_opsData);
while (i.hasNext()) {
i.next();
if ( i.value().assetId == data.id())
if ( i.value().assetId == data.id)
{
opsCode = i.value().opsCode;
DEBUG_LOG(m_logger) << "onInstrumentationAssetChanged assetId=" << data.id();
DEBUG_LOG(m_logger) << "onInstrumentationAssetChanged assetId=" << data.id;
break;
}
}
OpsData &d = m_opsData[opsCode];
d.assetId = data.id();
d.opsCode = getOpsCodeFromJSon(data.properties());
d.opsTunnel = getIsOpsTunnel(data.properties());
d.mountingPointTypeId = data.mountingPointTypeId().underlying();
d.assetId = data.id;
d.opsCode = getOpsCodeFromJSon(data.properties);
d.opsTunnel = getIsOpsTunnel(data.properties);
d.mountingPointTypeId = static_cast<int>(data.mountingPointTypeId);
updateOpsData(d);
break;
}
@@ -149,10 +150,10 @@ void IsmHandler::onInstrumentationAssetChanged(const InfrastructureManagement::I
QHashIterator<int, OpsData> i(m_opsData);
while (i.hasNext()) {
i.next();
if ( i.value().assetId == data.id())
if ( i.value().assetId == data.id)
{
opsCode = i.value().opsCode;
DEBUG_LOG(m_logger) << "onInstrumentationAssetChanged assetId=" << data.id();
DEBUG_LOG(m_logger) << "onInstrumentationAssetChanged assetId=" << data.id;
break;
}
}
@@ -171,17 +172,17 @@ void IsmHandler::onMountingPointAssetChanged(const InfrastructureManagement::Mou
{
OpsData opsData;
opsData.opsCode = m_dtcIsm->getOpticalCodeFromAssetId(data.assetId());
opsData.assetId = data.assetId();
opsData.opsCode = m_dtcIsm->getOpticalCodeFromAssetId(data.assetId);
opsData.assetId = data.assetId;
updateOpsData(opsData, true);
break;
}
case DataModification::eRemoved:
DEBUG_LOG(m_logger) << "onMountingPointAssetChanged Unmount id=" << data.id()
<< " assetId=" << data.assetId();
DEBUG_LOG(m_logger) << "onMountingPointAssetChanged Unmount id=" << data.id
<< " assetId=" << data.assetId;
removeOpsAsset(data.assetId());
removeOpsAsset(data.assetId);
break;
}
}
@@ -196,12 +197,12 @@ void IsmHandler::rotateBuildingFootprint(int mseId)
return;
}
InfrastructureManagement::MainStructureElement mse = m_dtcIsm->mainStructureElement(mseId);
TetraIcd::RelativePosition relBldgPosition = m_mainHandler->posHandler()->geographicToRelative(mse.geoPosition());
TetraIcd::RelativePosition relBldgPosition = m_mainHandler->posHandler()->geographicToRelative(mse.geoPosition);
DEBUG_LOG(m_logger) << " mainStructureElements.Rotate id=" << mseId;
QTransform matrix;
QPolygonF relBuildingFootprintMgrs;
qreal angle = mse.angle();
qreal angle = mse.angle;
matrix.rotate(angle);
const QPolygonF relBuildingFootprint = m_relBuildingFootprints.value(mseId);
const QPolygonF relBuildingFootprintRotated = matrix.map(relBuildingFootprint);
@@ -233,21 +234,21 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
int exerciseId = m_mainHandler->ddsHandler()->getExerciseId();
if ( !m_dtcIsm->isElementAssignedToExercise(data, exerciseId))
{
INFO_LOG(m_logger) << "HandlerBuildingData::onMainStructureElementChanged() id=" << data.id() << " remove";
INFO_LOG(m_logger) << "HandlerBuildingData::onMainStructureElementChanged() id=" << data.id << " remove";
m_buildingBoundingBoxes.remove(data.id());
m_relBuildingFootprints.remove(data.id());
m_relBuildingFootprintsRotated.remove((data.id()));
m_buildingBoundingBoxesMgrs.remove(data.id());
m_relBuildingFootprintsRotatedMgrs.remove(data.id());
m_buildingBoundingBoxes.remove(data.id);
m_relBuildingFootprints.remove(data.id);
m_relBuildingFootprintsRotated.remove((data.id));
m_buildingBoundingBoxesMgrs.remove(data.id);
m_relBuildingFootprintsRotatedMgrs.remove(data.id);
for (const auto &se : data.elements())
for (const auto &se : data.elements)
{
if (se.mountingPointTypeId() != InfrastructureManagement::MountingPointType::IndoorIPS &&
se.mountingPointTypeId() != InfrastructureManagement::MountingPointType::OutdoorIPS)
if (se.mountingPointTypeId != InfrastructureManagement::MountingPointType::IndoorIPS &&
se.mountingPointTypeId != InfrastructureManagement::MountingPointType::OutdoorIPS)
continue;
removeOpsDataByStructureElementId(se.id());
removeOpsDataByStructureElementId(se.id);
}
@@ -255,7 +256,7 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
while (iter.hasNext())
{
iter.next();
if (iter.value().mainStructureElementId == data.id())
if (iter.value().mainStructureElementId == data.id)
{
DEBUG_LOG(m_logger) << "remove from m_opsData, key=" << iter.key();
iter.remove();
@@ -270,36 +271,36 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
for (const InfrastructureManagement::StructureElement &se : data.elements())
for (const InfrastructureManagement::StructureElement &se : data.elements)
{
if (se.mountingPointTypeId() != InfrastructureManagement::MountingPointType::IndoorIPS &&
se.mountingPointTypeId() != InfrastructureManagement::MountingPointType::OutdoorIPS)
if (se.mountingPointTypeId != InfrastructureManagement::MountingPointType::IndoorIPS &&
se.mountingPointTypeId != InfrastructureManagement::MountingPointType::OutdoorIPS)
continue;
auto it = std::find_if(m_opsData.begin(), m_opsData.end(), [se](const OpsData & d)
{
return d.structureElementId == se.id();
return d.structureElementId == se.id;
});
if (it != m_opsData.end())
updateOpsData(it.value());
}
DEBUG_LOG(m_logger) << " mainStructureElements Vor Rotate id=" << data.id();
DEBUG_LOG(m_logger) << " mainStructureElements Vor Rotate id=" << data.id;
QMap<int, InfrastructureManagement::MainFootprint> mainFootprints = m_dtcIsm->getFootprintsByExerciseId(exerciseId);
if (mainFootprints.contains(data.id()))
if (mainFootprints.contains(data.id))
{
rotateBuildingFootprint(data.id());
rotateBuildingFootprint(data.id);
}
break;
}
case DataModification::eRemoved:
for (const auto &se : data.elements())
for (const auto &se : data.elements)
{
if (se.mountingPointTypeId() != InfrastructureManagement::MountingPointType::IndoorIPS &&
se.mountingPointTypeId() != InfrastructureManagement::MountingPointType::OutdoorIPS)
if (se.mountingPointTypeId != InfrastructureManagement::MountingPointType::IndoorIPS &&
se.mountingPointTypeId != InfrastructureManagement::MountingPointType::OutdoorIPS)
continue;
removeOpsDataByStructureElementId(se.id());
removeOpsDataByStructureElementId(se.id);
}
break;
}
@@ -307,8 +308,8 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
void IsmHandler::onMainFootprintChanged(const InfrastructureManagement::MainFootprint &data, DataModification modType)
{
DEBUG_LOG(m_logger) << "onMainFootprintChanged id=" << data.id()
<< " size=" << data.elements().size();
DEBUG_LOG(m_logger) << "onMainFootprintChanged id=" << data.id
<< " size=" << data.elements.size();
switch (modType)
{
@@ -317,22 +318,22 @@ void IsmHandler::onMainFootprintChanged(const InfrastructureManagement::MainFoot
{
DEBUG_LOG(m_logger) << "mainStructureElements onMainFootprintChanged id=" << data.id();
DEBUG_LOG(m_logger) << "mainStructureElements onMainFootprintChanged id=" << data.id;
double minX = 0;
double maxX = 0;
double minY = 0;
double maxY = 0;
QPolygonF relBuildingFootprint;
relBuildingFootprint.reserve(data.elements().size());
for (const InfrastructureManagement::FootprintElement &fpElem : data.elements())
relBuildingFootprint.reserve(data.elements.size());
for (const InfrastructureManagement::FootprintElement &fpElem : data.elements)
{
const Core::RelativePosition &relPos = fpElem.relPosition();
minX = std::min(minX, relPos.offsetX());
maxX = std::max(maxX, relPos.offsetX());
minY = std::min(minY, relPos.offsetY());
maxY = std::min(maxY, relPos.offsetY());
const Core::RelativePosition &relPos = fpElem.relPosition;
minX = std::min(minX, relPos.offsetX);
maxX = std::max(maxX, relPos.offsetX);
minY = std::min(minY, relPos.offsetY);
maxY = std::min(maxY, relPos.offsetY);
QPointF point(relPos.offsetX(), relPos.offsetY());
QPointF point(relPos.offsetX, relPos.offsetY);
relBuildingFootprint.append(point);
DEBUG_LOG(m_logger) << "relBuildingFootprint.append() " << point.x() << "/" << point.y() << ")";
@@ -349,12 +350,12 @@ void IsmHandler::onMainFootprintChanged(const InfrastructureManagement::MainFoot
QPointF boundingBoxBottomRight(maxX + m_distanceIpsToGps, minY - m_distanceIpsToGps);
QRectF BoundingBox(boundingBoxTopLeft, boundingBoxBottomRight);
m_buildingBoundingBoxes.insert(data.id(), BoundingBox);
m_buildingBoundingBoxes.insert(data.id, BoundingBox);
m_relBuildingFootprints.insert(data.id(), relBuildingFootprint);
m_relBuildingFootprints.insert(data.id, relBuildingFootprint);
for (const QPointF &p : std::as_const(relBuildingFootprint))
DEBUG_LOG(m_logger) << "relBuildingFootprint = " << p.x() << "/" << p.y();
rotateBuildingFootprint(data.id());
rotateBuildingFootprint(data.id);
break;
}
case DataModification::eRemoved:
@@ -451,24 +452,24 @@ void IsmHandler::updateOpsData(OpsData &data, bool force)
if (!force && !m_dtcIsm->isElementAssignedToExercise(mse, exerciseId))
continue;
for (const InfrastructureManagement::StructureElement &se : mse.elements())
for (const InfrastructureManagement::StructureElement &se : mse.elements)
{
if (se.id() == seId)
if (se.id == seId)
{
data.structureElementId = seId;
data.mainStructureElementId = mse.id();
data.mainStructureElementId = mse.id;
if (se.path().size() > 1)
data.roomId = se.path().at(se.path().size() - 2);
data.position = se.geoPosition();
data.position.z(data.position.z() - mse.geoPosition().z());
m_structure_ElementId2AssetTypeId[seId] = se.mountingPointTypeId().underlying();
if (se.path.size() > 1)
data.roomId = se.path.at(se.path.size() - 2);
data.position = se.geoPosition;
data.position.z = data.position.z - mse.geoPosition.z;
m_structure_ElementId2AssetTypeId[seId] = static_cast<int>(se.mountingPointTypeId);
DEBUG_LOG(m_logger) << "found position for asset " << data.assetId << " with se id " << seId
<< " " << data.position.lon() << "/" << data.position.lat() << "/" << data.position.z()
<< " name=" << se.name()
<< " type=" << se.mountingPointTypeId()
<< " " << data.position.lon << "/" << data.position.lat << "/" << data.position.z
<< " name=" << se.name
<< " type=" << se.mountingPointTypeId
<< " m_structure_ElementId2AssetTypeId.size()=" << m_structure_ElementId2AssetTypeId.size();
data.mountingPointTypeId = se.mountingPointTypeId().underlying();
data.mountingPointTypeId = static_cast<int>(se.mountingPointTypeId);
m_opsData[data.opsCode] = data;
return;
@@ -487,11 +488,11 @@ bool IsmHandler::posInExtendedBuildingFootprint(int mainStructureElementId, cons
return false;
switch (mountPointTypeId) {
case InfrastructureManagement::MountingPointType_def::OutdoorIPS:
case static_cast<int>(InfrastructureManagement::MountingPointType::OutdoorIPS):
DEBUG_LOG(m_logger) << "posInExtendedBuildingFootprint Distance = m_distanceOpsToGps";
distance = m_distanceOpsToGps;
break;
case InfrastructureManagement::MountingPointType_def::IndoorIPS:
case static_cast<int>(InfrastructureManagement::MountingPointType::IndoorIPS):
DEBUG_LOG(m_logger) << "posInExtendedBuildingFootprint Distance = m_distanceIpsToGps";
distance = m_distanceIpsToGps;
break;
@@ -516,7 +517,7 @@ bool IsmHandler::posInExtendedBuildingFootprint(int mainStructureElementId, cons
return false;
TetraIcd::RelativePosition relBldgPosition = m_mainHandler->posHandler()->geographicToRelative(mse.geoPosition());
TetraIcd::RelativePosition relBldgPosition = m_mainHandler->posHandler()->geographicToRelative(mse.geoPosition);
TetraIcd::RelativePosition relPosition = m_mainHandler->posHandler()->geographicToRelative(position);
DEBUG_LOG(m_logger) << "relBldgPosition=" << relBldgPosition.offsetX << "/" << relBldgPosition.offsetY
<< ", relPosition=" << relPosition.offsetX << "/" << relPosition.offsetY;