Files
qt5-legatus-legacy/Lts/Services/AssetManagement/asm_dtc_impl_custom.cpp
T
2026-08-13 18:33:10 +02:00

71 lines
1.3 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Custom asm dtc functions (extends asm_dtc_impl.cpp/.h)
* $Id$
* $HeadURL$
* $Author$
* Created by Iuliana Ojog, 2022-04-25
*/
#include "asm_dtc_impl_custom.h"
#include <DDS/DTC/generic_dtc.h>
#include <DDS/Generic/generic_data_reader.h>
namespace AssetManagement
{
namespace Interface
{
DtcImplCustom::DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector)
: DtcImpl(ddsConnector)
{
}
bool DtcImplCustom::isAARWorkstation(const QString &wsName)
{
if (!isAssetEnabled())
{
enableAsset();
waitForHistoricalDataAsset(4000);
}
int wsId = -1;
for (const auto &at : m_dtcAsset->readAlive())
{
if (at.data().assetTypeId() == AssetManagement::AssetType::MobileAfterActionVehicle &&
QString::fromStdString(at.data().name()).toUpper() == wsName.toUpper())
{
wsId = at.data().id();
break;
}
}
return (wsId > 0);
}
int DtcImplCustom::getAssetId(const QString &wsName)
{
if (!isAssetEnabled())
{
enableAsset();
waitForHistoricalDataAsset(4000);
}
int wsId = -1;
for (const auto &at : m_dtcAsset->readAlive())
{
if ( QString::fromStdString(at.data().name()).toUpper() == wsName.toUpper())
{
wsId = at.data().id();
break;
}
}
return (wsId);
}
}//Interface
}//namespace AssetManagement