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

@@ -4,6 +4,7 @@
#include "ism_handler.h"
#include <utility>
#include "main_handler.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QtCore/QTimer>
#include <QtCore/QJsonDocument>
#include <QJsonParseError>
@@ -79,40 +80,40 @@ bool IsmHandler::isElementAssignedToExercise(const int mseId, int exerciseId)
void IsmHandler::onInstrumentationAssetChanged(const InfrastructureManagement::InstrumentationAsset &data, DataModification modType)
{
if (data.mountingPointTypeId() == InfrastructureManagement::MountingPointType::BuildingSensorModule ||
data.mountingPointTypeId() == InfrastructureManagement::MountingPointType::EffectGenerationControlUnit)
if (data.mountingPointTypeId == InfrastructureManagement::MountingPointType::BuildingSensorModule ||
data.mountingPointTypeId == InfrastructureManagement::MountingPointType::EffectGenerationControlUnit)
{
switch (modType)
{
case DataModification::eAdded:
case DataModification::eModified:
m_instAssets.insert(data.id(), data);
m_instAssets.insert(data.id, data);
break;
case DataModification::eRemoved:
m_instAssets.remove(data.id());
m_instAssets.remove(data.id);
break;
}
m_changeTimeoutTimer->start();
return;
}
if (data.mountingPointTypeId() == InfrastructureManagement::MountingPointType::BuildingControlUnit)
if (data.mountingPointTypeId == InfrastructureManagement::MountingPointType::BuildingControlUnit)
{
switch (modType)
{
case DataModification::eAdded:
case DataModification::eModified:
{
const int exerciseId = data.availableInExercise().size() == 0 ? 0 : data.availableInExercise().at(0);
DEBUG_LOG(m_logger) << "setting asset " << data.id() << " available in exercise " << exerciseId;
m_assetMainStructureElementInExercise.insert(data.id(), exerciseId);
const int exerciseId = data.availableInExercise.size() == 0 ? 0 : data.availableInExercise.at(0);
DEBUG_LOG(m_logger) << "setting asset " << data.id << " available in exercise " << exerciseId;
m_assetMainStructureElementInExercise.insert(data.id, exerciseId);
break;
}
case DataModification::eRemoved:
{
const int exerciseId = data.availableInExercise().size() == 0 ? 0 : data.availableInExercise().at(0);
DEBUG_LOG(m_logger) << "removing asset " << data.id() << " from exercise " << exerciseId;
m_assetMainStructureElementInExercise.remove(data.id());
const int exerciseId = data.availableInExercise.size() == 0 ? 0 : data.availableInExercise.at(0);
DEBUG_LOG(m_logger) << "removing asset " << data.id << " from exercise " << exerciseId;
m_assetMainStructureElementInExercise.remove(data.id);
break;
}
}
@@ -126,12 +127,12 @@ void IsmHandler::onMountingPointAssetChanged(const InfrastructureManagement::Mou
{
case DataModification::eAdded:
case DataModification::eModified:
DEBUG_LOG(m_logger) << "mounting asset " << data.assetId() << " on structure element id " << data.structureElementId();
m_structureElementId2AssetId.insert(data.structureElementId(), data.assetId());
DEBUG_LOG(m_logger) << "mounting asset " << data.assetId << " on structure element id " << data.structureElementId;
m_structureElementId2AssetId.insert(data.structureElementId, data.assetId);
break;
case DataModification::eRemoved:
DEBUG_LOG(m_logger) << "unmounting asset " << m_structureElementId2AssetId.value(data.structureElementId()) << " from structure element " << data.structureElementId();
m_structureElementId2AssetId.remove(data.structureElementId());
DEBUG_LOG(m_logger) << "unmounting asset " << m_structureElementId2AssetId.value(data.structureElementId) << " from structure element " << data.structureElementId;
m_structureElementId2AssetId.remove(data.structureElementId);
break;
}
m_changeTimeoutTimer->start();
@@ -145,16 +146,16 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
case DataModification::eAdded:
case DataModification::eModified:
{
if (!isElementAssignedToExercise (data.id(),m_mainHandler->exerciseId() ) )
if (!isElementAssignedToExercise (data.id,m_mainHandler->exerciseId() ) )
{
m_mainStructureElements.remove(data.id());
DEBUG_LOG(m_logger) << "Building not in exercise id=" << data.id();
m_mainStructureElements.remove(data.id);
DEBUG_LOG(m_logger) << "Building not in exercise id=" << data.id;
return;
}
DEBUG_LOG(m_logger) << "Building=" << data.name()
<< " properties=" << data.properties();
DEBUG_LOG(m_logger) << "Building=" << data.name
<< " properties=" << data.properties;
QJsonParseError parserError;
QByteArray content = QByteArray::fromStdString(data.properties());
QByteArray content = QByteArray::fromStdString(data.properties);
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
if (parserError.error != QJsonParseError::NoError)
@@ -170,19 +171,19 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
bool startBuildingProcess = objProperties.value(QStringLiteral("start_building_process")).toBool();
if (!startBuildingProcess)
{
DEBUG_LOG(m_logger) << "Building=" << data.name()
DEBUG_LOG(m_logger) << "Building=" << data.name
<< " start_building_process = false ";
return;
}
}
DEBUG_LOG(m_logger) << "##### onMainStructureElementChanged - ID = " << data.id();
checkOverride( m_mainStructureElements[data.id()], data);
m_mainStructureElements[data.id()] = data;
DEBUG_LOG(m_logger) << "##### onMainStructureElementChanged - ID = " << data.id;
checkOverride( m_mainStructureElements[data.id], data);
m_mainStructureElements[data.id] = data;
break;
}
case DataModification::eRemoved:
m_mainStructureElements.remove(data.id());
m_mainStructureElements.remove(data.id);
break;
}
m_changeTimeoutTimer->start();
@@ -197,12 +198,12 @@ void IsmHandler::onBridgeStatusChanged(const InfrastructureManagement::BridgeCha
case DataModification::eAdded:
case DataModification::eModified:
{
DEBUG_LOG(m_logger) << "##### onBridgeStatusChanged - buildingId = " << data.buildingId();
DEBUG_LOG(m_logger) << "##### onBridgeStatusChanged - buildingId = " << data.buildingId;
BridgeStatus bs;
bs.id(s_id++);
bs.buildingId(data.buildingId());
bs.sampleTime(data.sampleTime());
bs.status(m_dtcIsm->getBridgeStatus(data.buildingId()).underlying());
bs.id = s_id++;
bs.buildingId = data.buildingId;
bs.sampleTime = data.sampleTime;
bs.status = static_cast<int>(m_dtcIsm->getBridgeStatus(data.buildingId));
m_mainHandler->ddsHandler()->dts()->publish(bs);
break;
}
@@ -214,9 +215,9 @@ void IsmHandler::onBridgeStatusChanged(const InfrastructureManagement::BridgeCha
void IsmHandler::getEgcuToRoom(const InfrastructureManagement::MainStructureElement &mse, QVector<EgcuInfo> &eis)
{
INFO_LOG(m_logger) << "properties=" << mse.properties();
INFO_LOG(m_logger) << "properties=" << mse.properties;
QJsonParseError parserError;
QByteArray content = QByteArray::fromStdString(mse.properties());
QByteArray content = QByteArray::fromStdString(mse.properties);
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
if (parserError.error != QJsonParseError::NoError)
@@ -275,34 +276,34 @@ void IsmHandler::buildingsChanged(bool init)
INFO_LOG(m_logger) << "Updating building config m_mainStructureElements.size=" << m_mainStructureElements.size();
for (const InfrastructureManagement::MainStructureElement &mse : std::as_const(m_mainStructureElements))
{
DEBUG_LOG(m_logger) << "Checking building " << mse.id() << " - " << mse.name();
DEBUG_LOG(m_logger) << "Checking building " << mse.id << " - " << mse.name;
BuildingInfo bi;
bi.mseId = mse.id();
bi.modelId = mse.modelId();
bi.externalWlsId = mse.externalWlsId();
bi.name = QString::fromStdString(mse.name());
bi.absPosition = mse.geoPosition();
bi.angle = mse.angle();
bi.structureElementId = mse.structureElementId();
bi.mseId = mse.id;
bi.modelId = mse.modelId;
bi.externalWlsId = mse.externalWlsId;
bi.name = QString::fromStdString(mse.name);
bi.absPosition = mse.geoPosition;
bi.angle = mse.angle;
bi.structureElementId = mse.structureElementId;
for (const InfrastructureManagement::StructureElement &se : mse.elements())
for (const InfrastructureManagement::StructureElement &se : mse.elements)
{
if (se.mountingPointTypeId() == InfrastructureManagement::MountingPointType::BuildingSensorModule)
if (se.mountingPointTypeId == InfrastructureManagement::MountingPointType::BuildingSensorModule)
handleBuildingSensorModule(se, bi);
else if (se.mountingPointTypeId() == InfrastructureManagement::MountingPointType::BuildingControlUnit)
else if (se.mountingPointTypeId == InfrastructureManagement::MountingPointType::BuildingControlUnit)
handleBuildingControlUnit(se, bi);
else if (se.mountingPointTypeId() == InfrastructureManagement::MountingPointType::EffectGenerationControlUnit)
else if (se.mountingPointTypeId == InfrastructureManagement::MountingPointType::EffectGenerationControlUnit)
handleEffectGenerationControlUnit(se, bi);
else if (se.structureElementTypeId() == InfrastructureManagement::StructureElementType::Room)
else if (se.structureElementTypeId == InfrastructureManagement::StructureElementType::Room)
{
bi.subId2RoomId.insert(se.mountingPointId(), se.id());
bi.roomId2SubId.insert(se.id(), se.mountingPointId());
bi.roomName2RoomId.insert(QString::fromStdString(se.name()), se.mountingPointId());
INFO_LOG(m_logger) << " Room: mountingPointId: " << se.mountingPointId()
<< ", roomId: " << se.id()
<< ", Name: " << se.name();
m_roomId2RoomName.insert(se.id(), QString::fromStdString(se.name()));
bi.subId2RoomId.insert(se.mountingPointId, se.id);
bi.roomId2SubId.insert(se.id, se.mountingPointId);
bi.roomName2RoomId.insert(QString::fromStdString(se.name), se.mountingPointId);
INFO_LOG(m_logger) << " Room: mountingPointId: " << se.mountingPointId
<< ", roomId: " << se.id
<< ", Name: " << se.name;
m_roomId2RoomName.insert(se.id, QString::fromStdString(se.name));
}
}
if (m_mainHandler->exerciseId() != bi.currentExerciseId)
@@ -313,8 +314,8 @@ void IsmHandler::buildingsChanged(bool init)
<< " buildingName" << bi.name;
continue;
}
INFO_LOG(m_logger) << "Adding building configuration for " << mse.id() << " - " << mse.name();
availableBuildingIds += mse.id();
INFO_LOG(m_logger) << "Adding building configuration for " << mse.id << " - " << mse.name;
availableBuildingIds += mse.id;
getEgcuToRoom(mse, bi.egcus);
newBuildingConfiguration.insert(bi.mseId, bi);
}
@@ -356,7 +357,7 @@ void IsmHandler::buildingsChanged(bool init)
void IsmHandler::handleBuildingSensorModule(const InfrastructureManagement::StructureElement &se, BuildingInfo &bi) const
{
auto itMpa = m_structureElementId2AssetId.find(se.id());
auto itMpa = m_structureElementId2AssetId.find(se.id);
if (itMpa == m_structureElementId2AssetId.end())
return;
const int assetId = itMpa.value();
@@ -366,11 +367,11 @@ void IsmHandler::handleBuildingSensorModule(const InfrastructureManagement::Stru
const InfrastructureManagement::InstrumentationAsset &ia = itAsset.value();
BsmInfo bsi;
bsi.assetId = assetId;
bsi.bsmId = se.mountingPointId();
bsi.hostname = QString::fromStdString(ia.hostname());
bsi.port = getBsmPortFromJSon(ia.properties());
bsi.relPosition = se.relPosition();
bsi.orientation = se.orientation();
bsi.bsmId = se.mountingPointId;
bsi.hostname = QString::fromStdString(ia.hostname);
bsi.port = getBsmPortFromJSon(ia.properties);
bsi.relPosition = se.relPosition;
bsi.orientation = se.orientation;
DEBUG_LOG(m_logger) << "adding bsm sensor module to building " << bi.mseId << ": " << bsi.assetId << ", " << bsi.bsmId << ", " << bsi.hostname;
bi.bsms.insert(bsi.assetId, bsi);
}
@@ -383,10 +384,10 @@ void IsmHandler::handleBuildingControlUnit(const InfrastructureManagement::Struc
auto itMpa = m_structureElementId2AssetId.find(se.id());
auto itMpa = m_structureElementId2AssetId.find(se.id);
if (itMpa == m_structureElementId2AssetId.end())
{
INFO_LOG(m_logger) << "structure element id " << se.id() << " not (yet)found"
INFO_LOG(m_logger) << "structure element id " << se.id << " not (yet)found"
<< " bi.mseId=" << bi.mseId
<< " bi.assetId=" << bi.assetId
<< " bi.egcus.size=" << bi.egcus.size()
@@ -410,8 +411,8 @@ void IsmHandler::handleBuildingControlUnit(const InfrastructureManagement::Struc
void IsmHandler::handleEffectGenerationControlUnit(const InfrastructureManagement::StructureElement &se, BuildingInfo &bi) const
{
DEBUG_LOG(m_logger) << "BuildingId=" << bi.mseId
<< " se.id=" << se.id();
auto itMpa = m_structureElementId2AssetId.find(se.id());
<< " se.id=" << se.id;
auto itMpa = m_structureElementId2AssetId.find(se.id);
if (itMpa == m_structureElementId2AssetId.end())
{
INFO_LOG(m_logger) << "Return m_structureElementId2AssetId.size()=" << m_structureElementId2AssetId.size();
@@ -428,12 +429,12 @@ void IsmHandler::handleEffectGenerationControlUnit(const InfrastructureManagemen
EgcuInfo egcu;
egcu.buildingName = bi.name;
egcu.mountPointName = QString::fromStdString(se.name());
egcu.mountPointId = se.mountingPointId();
egcu.hostname = QString::fromStdString(ia.hostname());
egcu.mountPointName = QString::fromStdString(se.name);
egcu.mountPointId = se.mountingPointId;
egcu.hostname = QString::fromStdString(ia.hostname);
egcu.assetId = assetId;
DEBUG_LOG(m_logger) << "Egcu.hostname=" << egcu.hostname;
INFO_LOG(m_logger) << "properties=" << ia.properties();
INFO_LOG(m_logger) << "properties=" << ia.properties;
bi.egcus.push_back(egcu);
@@ -470,38 +471,38 @@ void IsmHandler::checkOverride(const InfrastructureManagement::MainStructureElem
{
DEBUG_LOG(m_logger) << Q_FUNC_INFO;
DEBUG_LOG(m_logger) << "mseOld.elements().size()=" << mseOld.elements().size()
<< " mseNew.elements().size()=" << mseNew.elements().size();
DEBUG_LOG(m_logger) << "mseOld.elements.size()=" << mseOld.elements.size()
<< " mseNew.elements.size()=" << mseNew.elements.size();
for (const InfrastructureManagement::StructureElement &se : mseNew.elements())
for (const InfrastructureManagement::StructureElement &se : mseNew.elements)
{
DEBUG_LOG(m_logger) << "se=" << se.id()
<< " name=" << se.name()
<< " displayName=" << se.displayName()
<< " properties=" << se.properties();
DEBUG_LOG(m_logger) << "se=" << se.id
<< " name=" << se.name
<< " displayName=" << se.displayName
<< " properties=" << se.properties;
for (const InfrastructureManagement::StructureElement &seOld : mseOld.elements())
for (const InfrastructureManagement::StructureElement &seOld : mseOld.elements)
{
DEBUG_LOG(m_logger) << "seOld.id=" << seOld.id()
<< " se.id=" << se.id();
if ( seOld.id() == se.id())
DEBUG_LOG(m_logger) << "seOld.id=" << seOld.id
<< " se.id=" << se.id;
if ( seOld.id == se.id)
{
DEBUG_LOG(m_logger) << "Properties =" << se.properties()
<< " se.id=" << se.id()
<< " se.name=" << se.name()
<< " mountingPointId=" << se.mountingPointId();
DEBUG_LOG(m_logger) << "se.properties()=" << se.properties()
<< " seOld.properties()=" << seOld.properties();
if (se.properties() != seOld.properties() )
DEBUG_LOG(m_logger) << "Properties =" << se.properties
<< " se.id=" << se.id
<< " se.name=" << se.name
<< " mountingPointId=" << se.mountingPointId;
DEBUG_LOG(m_logger) << "se.properties=" << se.properties
<< " seOld.properties=" << seOld.properties;
if (se.properties != seOld.properties )
{
DEBUG_LOG(m_logger) << "HandleOverrides"
"<< m_currentBuildingConfiguration.size=" << m_currentBuildingConfiguration.size();
if ( se.structureElementTypeId() == InfrastructureManagement::StructureElementType::Building)
if ( se.structureElementTypeId == InfrastructureManagement::StructureElementType::Building)
{
DEBUG_LOG(m_logger) << "BSM-Flash, no EGCU";
QByteArray properties = QByteArray::fromStdString(se.properties());
emit setEffectStates(mseNew.id(), 0, properties );
QByteArray properties = QByteArray::fromStdString(se.properties);
emit setEffectStates(mseNew.id, 0, properties );
continue;
}
for (auto it = m_currentBuildingConfiguration.begin(); it != m_currentBuildingConfiguration.end(); ++it)
@@ -517,15 +518,15 @@ void IsmHandler::checkOverride(const InfrastructureManagement::MainStructureElem
<< " assetName=" << egcu.assetName
<< " hostname=" << egcu.hostname
<< " egcu.mountPointId=" << egcu.mountPointId
<< " se.mountingPointId()=" << se.mountingPointId();
if (egcu.mountPointId == se.mountingPointId())
<< " se.mountingPointId=" << se.mountingPointId;
if (egcu.mountPointId == se.mountingPointId)
{
QByteArray properties = QByteArray::fromStdString(se.properties());
QByteArray properties = QByteArray::fromStdString(se.properties);
DEBUG_LOG(m_logger) << "Send Json SetEffectStates to BuildingProcess"
<< " buildingId="
<< " assetId="<< egcu.assetId
<< " properties =" << properties;
emit setEffectStates(mseNew.id(), egcu.assetId, properties );
emit setEffectStates(mseNew.id, egcu.assetId, properties );
}
}
}
@@ -539,22 +540,22 @@ void IsmHandler::checkOverride(const InfrastructureManagement::MainStructureElem
}
if (mseOld.elements().size() == 0)
if (mseOld.elements.size() == 0)
{
QByteArray properties = QByteArray::fromStdString(se.properties());
QByteArray properties = QByteArray::fromStdString(se.properties);
QByteArray overrides("Overrides");
if (properties.contains(overrides))
{
int assetId;
bool foundAssetId = m_dtcIsm->getAssetIdFromMountingPoint(se.id(), se.mountingPointId(), assetId);
bool foundAssetId = m_dtcIsm->getAssetIdFromMountingPoint(se.id, se.mountingPointId, assetId);
DEBUG_LOG(m_logger) << "Send Overrides to BuildingProcess (EGCU)"
<< " foundAssetId=" << foundAssetId
<< " structureElementId=" << mseNew.id()
<< " se.id=" << se.id()
<< " mountingPointId=" << se.mountingPointId()
<< " structureElementId=" << mseNew.id
<< " se.id=" << se.id
<< " mountingPointId=" << se.mountingPointId
<< " assetId=" << assetId;
emit setEffectStates(mseNew.id(), assetId, properties );
emit setEffectStates(mseNew.id, assetId, properties );
}
}