Migrates InfrastructureManagement to generated rtiddsgen API

Converts accessor calls to plain member access across ism service.
This commit is contained in:
berrux-dev committed 2026-09-21 02:45:09 +02:00
1 parent 472f537313
commit 82356f23e5
30 files changed
+1322 -1314

No files matched your search

@@ -47,7 +47,7 @@ int determineFloorNumber(ObjectStructureElement *floor)
Q_ASSERT(floor);
Q_ASSERT(floor->getStructureElementTypeId() == StructureElementType::Floor);
QString name = QString::fromStdString(floor->getData().name()).toLower();
QString name = QString::fromStdString(floor->getData().name).toLower();
if (!name.startsWith(FLOOR_PATTERN))
return 0;
@@ -102,36 +102,36 @@ DataManager::EinruestEssentials DataManager::getEssentials(const QString &uuid)
path.clear();
// bottom left
UtmCoordinate bl(UtmCoordinate::fromGeographic({currentArea.bottomLeft().lon(), currentArea.bottomLeft().lat()}));
point.lon = currentArea.bottomLeft().lon();
point.lat = currentArea.bottomLeft().lat();
UtmCoordinate bl(UtmCoordinate::fromGeographic({currentArea.bottomLeft.lon, currentArea.bottomLeft.lat}));
point.lon = currentArea.bottomLeft.lon;
point.lat = currentArea.bottomLeft.lat;
trainingAreaData.path.append(point);
areaData.path.append(point);
// upper left
UtmCoordinate ul(UtmCoordinate::fromGeographic(bl.geographic(0, currentArea.height())));
UtmCoordinate ul(UtmCoordinate::fromGeographic(bl.geographic(0, currentArea.height)));
point.lon = ul.geographic().x();
point.lat = ul.geographic().y();
trainingAreaData.path.append(point);
areaData.path.append(point);
// upper right
UtmCoordinate ur(UtmCoordinate::fromGeographic(bl.geographic(currentArea.width(), currentArea.height())));
UtmCoordinate ur(UtmCoordinate::fromGeographic(bl.geographic(currentArea.width, currentArea.height)));
point.lon = ur.geographic().x();
point.lat = ur.geographic().y();
trainingAreaData.path.append(point);
areaData.path.append(point);
// lower right
UtmCoordinate lr(UtmCoordinate::fromGeographic(bl.geographic(currentArea.width(), 0)));
UtmCoordinate lr(UtmCoordinate::fromGeographic(bl.geographic(currentArea.width, 0)));
point.lon = lr.geographic().x();
point.lat = lr.geographic().y();
trainingAreaData.path.append(point);
areaData.path.append(point);
trainingAreaData.designation = QString::fromStdString(currentArea.name());
trainingAreaData.id = currentArea.id();
trainingAreaData.designation = QString::fromStdString(currentArea.name);
trainingAreaData.id = currentArea.id;
areaData.id = currentArea.id();
areaData.trainingAreaId = currentArea.id();
areaData.designation = QString::fromStdString(currentArea.name());
areaData.id = currentArea.id;
areaData.trainingAreaId = currentArea.id;
areaData.designation = QString::fromStdString(currentArea.name);
result.trainingAreas.append(TrainingAreaMessage(trainingAreaData, uuid));
result.areas.append(AreaMessage(areaData, uuid));
@@ -144,7 +144,7 @@ DataManager::EinruestEssentials DataManager::getEssentials(const QString &uuid)
{
ObjectStructureElement *currentElement = it.value();
switch (currentElement->getStructureElementTypeId().underlying())
switch (currentElement->getStructureElementTypeId())
{
case StructureElementType::TrainingArea:
case StructureElementType::City:
@@ -160,16 +160,16 @@ DataManager::EinruestEssentials DataManager::getEssentials(const QString &uuid)
ObjectMessage::ObjectMessageData objectData;
ReplyMessage::LonLatPoint refPoint;
refPoint.lat = currentElement->getGeoPosition().lat();
refPoint.lon = currentElement->getGeoPosition().lon();
refPoint.lat = currentElement->getGeoPosition().lat;
refPoint.lon = currentElement->getGeoPosition().lon;
objectData.z = currentElement->getGeoPosition().z();
objectData.z = currentElement->getGeoPosition().z;
objectData.refPoint = refPoint;
objectData.pathRelative = pathForStructureId(currentElement->getId());
objectData.path = relativeToGeographic(objectData.refPoint, objectData.pathRelative);
objectData.designation = (currentElement->getData().displayName().size() > 0) ?
QString::fromStdString(currentElement->getData().displayName()) :
QString::fromStdString(currentElement->getData().name());
objectData.designation = (currentElement->getData().displayName.size() > 0) ?
QString::fromStdString(currentElement->getData().displayName) :
QString::fromStdString(currentElement->getData().name);
objectData.id = currentElement->getId();
objectData.areaId = 6; // TODO: HACK - calculate from position
objectData.mseId = currentElement->getMainStructureElementId();
@@ -182,7 +182,7 @@ DataManager::EinruestEssentials DataManager::getEssentials(const QString &uuid)
objectData.street = description.value(QStringLiteral("street")).toString();
objectData.number = description.value(QStringLiteral("number")).toString();
objectData.rotationDegree = mse->getData().angle();
objectData.rotationDegree = mse->getData().angle;
}
result.objects.append(ObjectMessage(objectData, uuid));
@@ -194,12 +194,12 @@ DataManager::EinruestEssentials DataManager::getEssentials(const QString &uuid)
levelData.id = currentElement->getId();
levelData.objectid = currentElement->getPath().at(0);
levelData.designation = (currentElement->getData().displayName().size() > 0) ?
QString::fromStdString(currentElement->getData().displayName()) :
QString::fromStdString(currentElement->getData().name());
levelData.designation = (currentElement->getData().displayName.size() > 0) ?
QString::fromStdString(currentElement->getData().displayName) :
QString::fromStdString(currentElement->getData().name);
levelData.number = determineFloorNumber(currentElement);
levelData.path = pathForStructureId(currentElement->getId());
levelData.zPos = currentElement->getRelativePosition().offsetZ();
levelData.zPos = currentElement->getRelativePosition().offsetZ;
result.levels.append(LevelMessage(levelData, uuid));
break;
@@ -209,9 +209,9 @@ DataManager::EinruestEssentials DataManager::getEssentials(const QString &uuid)
RoomMessage::RoomData roomData;
roomData.id = currentElement->getId();
roomData.designation = (currentElement->getData().displayName().size() > 0) ?
QString::fromStdString(currentElement->getData().displayName()) :
QString::fromStdString(currentElement->getData().name());
roomData.designation = (currentElement->getData().displayName.size() > 0) ?
QString::fromStdString(currentElement->getData().displayName) :
QString::fromStdString(currentElement->getData().name);
roomData.path = pathForStructureId(currentElement->getId());
roomData.levelId = currentElement->getPath().at(1);
@@ -223,17 +223,17 @@ DataManager::EinruestEssentials DataManager::getEssentials(const QString &uuid)
MountingPointMessage::MountingPointData mountingPointData;
mountingPointData.id = currentElement->getId();
mountingPointData.designation = (currentElement->getData().displayName().size() > 0) ?
QString::fromStdString(currentElement->getData().displayName()) :
QString::fromStdString(currentElement->getData().name());
mountingPointData.tag = QString::fromStdString(currentElement->getData().barcode());
mountingPointData.designation = (currentElement->getData().displayName.size() > 0) ?
QString::fromStdString(currentElement->getData().displayName) :
QString::fromStdString(currentElement->getData().name);
mountingPointData.tag = QString::fromStdString(currentElement->getData().barcode);
mountingPointData.objectId = currentElement->getPath().at(0);
mountingPointData.levelId = currentElement->getPath().size() > 2 ? currentElement->getPath().at(1) : -1;
mountingPointData.roomId = currentElement->getPath().size() > 2 ? currentElement->getPath().at(2) : -1;
mountingPointData.position3d.x = currentElement->getRelativePosition().offsetX();
mountingPointData.position3d.y = currentElement->getRelativePosition().offsetY();
mountingPointData.position3d.z = currentElement->getRelativePosition().offsetZ();
mountingPointData.supportedAssetTypIds.append(currentElement->getData().mountingPointTypeId().underlying());
mountingPointData.position3d.x = currentElement->getRelativePosition().offsetX;
mountingPointData.position3d.y = currentElement->getRelativePosition().offsetY;
mountingPointData.position3d.z = currentElement->getRelativePosition().offsetZ;
mountingPointData.supportedAssetTypIds.append(currentElement->getData().mountingPointTypeId);
mountingPointData.assetId = getMountedAssetId(currentElement->getId());
result.mountingPoints.append(MountingPointMessage(mountingPointData, uuid));
@@ -244,13 +244,13 @@ DataManager::EinruestEssentials DataManager::getEssentials(const QString &uuid)
// No BuildingNetworkSwitch and no AnnouncementUnit (see GUEZE-1548/1459)
AssetTypeMessage::AssetTypeData assetTypeData;
for (int i = MountingPointType::Unknown; i <= MountingPointType::EffectGenerationControlUnit; ++i)
for (int i = MountingPointType::Unknown; i <= static_cast<int>(MountingPointType::EffectGenerationControlUnit); ++i)
{
if (i == MountingPointType_def::AnnouncementUnit)
if (i == static_cast<int>(MountingPointType::AnnouncementUnit))
continue;
assetTypeData.id = i;
assetTypeData.designation = toString(static_cast<MountingPointType::type>(i));
assetTypeData.designation = toString(static_cast<MountingPointType>(i));
if (assetTypeData.designation.endsWith(QLatin1Char(')')))
continue;
assetTypeData.deviceClass = 1; // device class is just a dumy value here ...
@@ -274,13 +274,13 @@ QVector<Messages::PlannedMountingMessage> DataManager::getPlannedMounting(const
{
const MainSchedule &data = sched->getData();
if (data.statusId() == ScheduleStatus::Inactive)
if (data.statusId == ScheduleStatus::Inactive)
continue;
mountingData.areaId = areaIdForScheduleId(data.id());
mountingData.plannedMountingId = data.id();
mountingData.designation = QString::fromStdString(data.name());
mountingData.mounting = entriesForScheduleId(data.id());
mountingData.areaId = areaIdForScheduleId(data.id);
mountingData.plannedMountingId = data.id;
mountingData.designation = QString::fromStdString(data.name);
mountingData.mounting = entriesForScheduleId(data.id);
result.append(PlannedMountingMessage(mountingData, uuid));
}
@@ -320,7 +320,7 @@ LtsWebSocket::ReplyMessage *DataManager::getObjectMounting(int plannedMountingId
errorData.errorMessage = QObject::tr("Building id is invalid", "DataManager");
errorData.uuid = uuid;
WARNING_LOG(m_logger) << errorData.errorMessage << " - " << (buildingEle ? buildingEle->getStructureElementTypeId().underlying() : -1)
WARNING_LOG(m_logger) << errorData.errorMessage << " - " << (buildingEle ? buildingEle->getStructureElementTypeId() : -1)
<< ", " << plannedMountingId << ", " << objectId;
LtsWebSocket::ReplyMessage *reply = new LtsWebSocket::ErrorMessage(errorData);
return reply;
@@ -404,7 +404,7 @@ LtsWebSocket::ReplyMessage *DataManager::mountTag(const QString &mountingPointTa
if(assetId > 0)
{
ObjectInstrumentationAsset *asset = m_mainHandler->getHandlerInstrumentationAsset()->getAssetFromId(assetId);
if(asset->getData().assetStateId() == InstrumentationAssetState::Defect)
if(asset->getData().assetStateId == InstrumentationAssetState::Defect)
{
LtsWebSocket::ErrorMessage::ErrorData data;
data.errorClass = 1;
@@ -667,10 +667,10 @@ LtsWebSocket::ReplyMessage *DataManager::unmountArea(int32_t areaId, const QStri
{
if (seElem->getStructureElementTypeId() == StructureElementType::MountingPoint)
{
if (!seElem->getData().path().size())
if (!seElem->getData().path.size())
continue;
int32_t buildingId = seElem->getData().path()[0];
int32_t buildingId = seElem->getData().path[0];
if (structEleMap.value(buildingId)->getParentId() == areaId)
{
@@ -732,11 +732,11 @@ LtsWebSocket::ReplyMessage *DataManager::objectMountingReady(int32_t plannedMoun
for (const auto &mpp : mountingPointPlans)
{
int32_t structEleId = mpp.structureElementId();
int32_t structEleId = mpp.structureElementId;
int32_t buildingId = -1;
if (structEleMap.value(structEleId)->getData().path().size())
buildingId = structEleMap.value(structEleId)->getData().path()[0];
if (structEleMap.value(structEleId)->getData().path.size())
buildingId = structEleMap.value(structEleId)->getData().path[0];
if (buildingId == objectId)
{
@@ -831,7 +831,7 @@ LtsWebSocket::ReplyMessage *DataManager::getAssets(const QSet<int> &assetTypeIds
QVector<AssetData> assets;
for (const ObjectInstrumentationAsset *asset : m)
{
if (assetTypeIds.contains(asset->getData().mountingPointTypeId().underlying()))
if (assetTypeIds.contains(asset->getData().mountingPointTypeId))
assets += assetData(asset);
}
@@ -873,9 +873,9 @@ LtsWebSocket::ReplyMessage *DataManager::getBuildingState(int32_t buildingId, co
for (const StructureElement &currentElement : mse->getElements())
{
if (currentElement.structureElementTypeId() == InfrastructureManagement::StructureElementType::MountingPoint)
if (currentElement.structureElementTypeId == InfrastructureManagement::StructureElementType::MountingPoint)
{
int32_t assetId = mountingPointAssetHandler->getMountedAssetId(currentElement.id());
int32_t assetId = mountingPointAssetHandler->getMountedAssetId(currentElement.id);
if (assetId)
{
const AssetData assetDat = assetData(assetId);
@@ -976,11 +976,11 @@ QVector<Messages::ReplyMessage::XYPoint> DataManager::pathForStructureId(int32_t
const MainFootprint &footprint = mse->getFootprint();
ReplyMessage::XYPoint newPoint;
result.reserve(footprint.elements().size());
const double angleDegree = mse->getData().angle();
for (const FootprintElement &fpElem : footprint.elements())
result.reserve(footprint.elements.size());
const double angleDegree = mse->getData().angle;
for (const FootprintElement &fpElem : footprint.elements)
{
const QPointF offset = rotatePoint(fpElem.relPosition().offsetX(), fpElem.relPosition().offsetY(), angleDegree);
const QPointF offset = rotatePoint(fpElem.relPosition.offsetX, fpElem.relPosition.offsetY, angleDegree);
newPoint.x = offset.x();
newPoint.y = offset.y();
@@ -1003,7 +1003,7 @@ QVector<Messages::PlannedMountingMessage::MountingEntry> DataManager::entriesFor
for (const MountingPointPlan &currentPlan : m_mainHandler->getHandlerMainSchedule()->getMountingPointPlans(scheduleId))
{
const auto path = structEleHandler->getStructureElement(currentPlan.structureElementId())->getPath();
const auto path = structEleHandler->getStructureElement(currentPlan.structureElementId)->getPath();
int32_t buildingId = -1;
@@ -1030,7 +1030,7 @@ int32_t DataManager::areaIdForScheduleId(int32_t scheduleId) const
for (const auto &data : mountingPointPlans)
{
int32_t buildingId = structureElementHandler->getStructureElement(data.structureElementId())->getPath()[0];
int32_t buildingId = structureElementHandler->getStructureElement(data.structureElementId)->getPath()[0];
return structureElementHandler->getStructureElement(buildingId)->getParentId();
}
return -1;
@@ -1049,7 +1049,7 @@ int32_t DataManager::stateForBuilding(int32_t buildingId) const
const auto seElements = objMse->getStructureElements();
for (ObjectStructureElement *currentElement : seElements)
{
if (currentElement->getStructureElementTypeId().underlying() == StructureElementType::MountingPoint)
if (currentElement->getStructureElementTypeId() == StructureElementType::MountingPoint)
{
bool isMountingPointMounted = isMounted(currentElement->getId());
isFullyMounted &= isMountingPointMounted;
@@ -1079,7 +1079,7 @@ bool DataManager::isPlannedObject(int32_t objectId) const
{
for (const auto &mpp : m_mainHandler->getHandlerMainSchedule()->getMountingPointPlans(mainScheduleId))
{
const auto path = structEleHandler->getStructureElement(mpp.structureElementId())->getPath();
const auto path = structEleHandler->getStructureElement(mpp.structureElementId)->getPath();
if (!path.size())
continue;
@@ -1107,7 +1107,7 @@ QVector<Messages::ObjectMountingMessage::PlannedEntry> DataManager::entriesForBu
const auto seElements = objMse->getStructureElements();
for (ObjectStructureElement *currentElement : seElements)
{
if (currentElement->getStructureElementTypeId().underlying() == StructureElementType::MountingPoint)
if (currentElement->getStructureElementTypeId() == StructureElementType::MountingPoint)
{
MountingPointState mountingPointState = getMountingPointState(currentElement->getId(), scheduleId);
@@ -1147,8 +1147,8 @@ int32_t DataManager::mountingPointIdFromBarcode(const QString &barcode) const
const auto barcodeStd(barcode.toStdString());
for (const auto &p : structEleMap)
{
if (p->getStructureElementTypeId().underlying() == StructureElementType::MountingPoint &&
p->getData().barcode() == barcodeStd)
if (p->getStructureElementTypeId() == StructureElementType::MountingPoint &&
p->getData().barcode == barcodeStd)
return p->getId();
}
@@ -1163,7 +1163,7 @@ int32_t DataManager::assetIdFromBarcode(const QString &barcode) const
const auto barcodeStd(barcode.toStdString());
for (const auto &p : assetMap)
{
if (p->getData().barcode() == barcodeStd)
if (p->getData().barcode == barcodeStd)
return p->getId();
}
@@ -1196,14 +1196,14 @@ Messages::AssetData DataManager::assetData(const ObjectInstrumentationAsset *ass
}
result.id = asset->getId();
result.assetTypeId = asset->getData().mountingPointTypeId().underlying();
result.assetTag = QString::fromStdString(asset->getData().barcode());
result.designation = QString::fromStdString(asset->getData().name());
result.hostname = QString::fromStdString(asset->getData().hostname());
result.state = toString(asset->getData().assetStateId());
result.time = QDateTime::fromMSecsSinceEpoch(asset->getData().lastUpdated()).toString(QStringLiteral("dd:MM:yy hh:mm"));
result.assetTypeId = asset->getData().mountingPointTypeId;
result.assetTag = QString::fromStdString(asset->getData().barcode);
result.designation = QString::fromStdString(asset->getData().name);
result.hostname = QString::fromStdString(asset->getData().hostname);
result.state = toString(asset->getData().assetStateId);
result.time = QDateTime::fromMSecsSinceEpoch(asset->getData().lastUpdated).toString(QStringLiteral("dd:MM:yy hh:mm"));
if (asset->getData().assetStateId() == InstrumentationAssetState::Defect)
if (asset->getData().assetStateId == InstrumentationAssetState::Defect)
result.errorDescription = QObject::tr("Instrumentation asset not working properly");
return result;
@@ -1214,8 +1214,8 @@ MountingPointState DataManager::getMountingPointState(int32_t mountingPointId, i
{
for (const auto &data : m_mainHandler->getHandlerMainSchedule()->getMountingPointPlans(scheduleId))
{
if (data.structureElementId() == mountingPointId)
return data.mountingPointState();
if (data.structureElementId == mountingPointId)
return data.mountingPointState;
}
return MountingPointState::Idle;