Migrates residual Lts sources to generated rtiddsgen API
Adds NmeaManagement tests, fixes codegen includes and Qt6 SerialPort CMake target.
This commit is contained in:
1 parent
5485a90385
commit
881d44f4dd
512 files changed
+6887
-6426
No files matched your search
+2
-2
@@ -12,7 +12,7 @@ namespace BuildingControlUnit
|
||||
|
||||
XmlReader::XmlReader(QObject *parent)
|
||||
: QObject(parent)
|
||||
.getNGLLogger("XmlReader"))
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("XmlReader"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ Action *XmlReader::parseAction(QXmlStreamReader &xml)
|
||||
if (xml.name() == QStringLiteral("bsm"))
|
||||
return parseBsmAction(xml);
|
||||
|
||||
WARNING_LOG(m_logger) << "--- parseUnknownAction with name '" << xml.name().string() << "'cannot be handled.";
|
||||
WARNING_LOG(m_logger) << "--- parseUnknownAction with name '" << xml.name().toString() << "'cannot be handled.";
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -40,6 +40,7 @@ if(QT6_GUI_AVAILABLE)
|
||||
Qt6::Core
|
||||
${Qt6_Gui}
|
||||
LtsUtilsCoreHeaderOnly
|
||||
LtsUtilsCore
|
||||
BuildingControlCommon
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -26,6 +26,7 @@ BuildingControlHandler::BuildingControlHandler(MainHandler *mainHandler)
|
||||
, Interface::Fts::TriggerBsmFlashRequestHandler(mainHandler->ddsHandler()->fts())
|
||||
, Interface::Fts::SwitchRelayRequestHandler(mainHandler->ddsHandler()->fts())
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_logger(getLogger("BuildingControlHandler"))
|
||||
{}
|
||||
|
||||
BuildingControlHandler::~BuildingControlHandler()
|
||||
@@ -66,12 +67,12 @@ bool BuildingControlHandler::init()
|
||||
for (auto it = latestStates.begin(); it != latestStates.end(); ++it)
|
||||
{
|
||||
const Buildings::HistoryState &historyState = it.value();
|
||||
if (!m_mainHandler->ismHandler()->isElementAssignedToExercise(historyState.mseId(),m_mainHandler->exerciseId() ))
|
||||
if (!m_mainHandler->ismHandler()->isElementAssignedToExercise(historyState.mseId,m_mainHandler->exerciseId() ))
|
||||
{
|
||||
DEBUG_LOG(m_logger)<<"[INIT] [recordReplay]>>>>>>> mseId=" << historyState.mseId() << " not in execise";
|
||||
DEBUG_LOG(m_logger)<<"[INIT] [recordReplay]>>>>>>> mseId=" << historyState.mseId << " not in execise";
|
||||
continue;
|
||||
}
|
||||
m_historyStates.insert(historyState.mseId(), historyState);
|
||||
m_historyStates.insert(historyState.mseId, historyState);
|
||||
DEBUG_LOG(m_logger)<<"[INIT] [recordReplay]>>>>>>> "<<historyState;
|
||||
}
|
||||
}
|
||||
@@ -118,17 +119,17 @@ void BuildingControlHandler::onBuildingChanged(const BuildingInfo &buildingInfo,
|
||||
if ( m_historyStates.contains(buildingInfo.mseId))
|
||||
{
|
||||
historyState = m_historyStates.value(buildingInfo.mseId);
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState contains historyState.mseId=" << historyState.mseId()
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState contains historyState.mseId=" << historyState.mseId
|
||||
<< " buildingInfo.mseId=" << buildingInfo.mseId;
|
||||
}
|
||||
else
|
||||
{
|
||||
historyState.mseId (buildingInfo.mseId);
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState insert historyState.mseId=" << historyState.mseId()
|
||||
historyState.mseId = buildingInfo.mseId;
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState insert historyState.mseId=" << historyState.mseId
|
||||
<< " buildingInfo.mseId=" << buildingInfo.mseId;
|
||||
m_historyStates.insert(historyState.mseId(), historyState);
|
||||
m_historyStates.insert(historyState.mseId, historyState);
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState historyState.mseId=" << historyState.mseId()
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState historyState.mseId=" << historyState.mseId
|
||||
<< " buildingInfo.mseId=" << buildingInfo.mseId;
|
||||
bldg->setHistoryState(m_historyStates.value(buildingInfo.mseId));
|
||||
}
|
||||
@@ -196,13 +197,13 @@ void BuildingControlHandler::onTriggerBsmFlashRequest(const rti::core::SampleIde
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSetBuildingContaminationStateRequestInternal(const SetBuildingContaminationStateRequest &data)
|
||||
{
|
||||
|
||||
const auto it = m_buildings.find(data.buildingId());
|
||||
const auto it = m_buildings.find(data.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId);
|
||||
|
||||
BuildingProcess *bldg = it.value();
|
||||
if (!bldg->setContaminationState(data.buildingId(), data.contaminationState()))
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send contamination state to building control process."));
|
||||
if (!bldg->setContaminationState(data.buildingId, data.contaminationState))
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Can not send contamination state to building control process."));
|
||||
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
@@ -210,45 +211,45 @@ Core::FunctionReplyObject BuildingControlHandler::onSetBuildingContaminationStat
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSetBuildingStatesRequestInternal(const SetBuildingStatesRequest &data)
|
||||
{
|
||||
std::vector<int> roomIds;
|
||||
for (const auto &building : data.buildings())
|
||||
for (const auto &building : data.buildings)
|
||||
{
|
||||
const auto it = m_buildings.find(building.buildingId());
|
||||
const auto it = m_buildings.find(building.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
return Core::FunctionReplyObject(building.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(building.buildingId());
|
||||
return Core::FunctionReplyObject(building.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(building.buildingId);
|
||||
|
||||
BuildingProcess *bldg = it.value();
|
||||
|
||||
if (data.resetContamination().is_set())
|
||||
if (data.resetContamination.is_set())
|
||||
{
|
||||
if (data.resetContamination().get() && !bldg->resetContaminationState())
|
||||
return Core::FunctionReplyObject(building.buildingId(), tr_lts("dds", "reset contamination of building with id %1 failed.")).arg(building.buildingId());
|
||||
if (data.resetContamination.get() && !bldg->resetContaminationState())
|
||||
return Core::FunctionReplyObject(building.buildingId, tr_lts("dds", "reset contamination of building with id %1 failed.")).arg(building.buildingId);
|
||||
}
|
||||
|
||||
if (data.vulnerabilityState() == ProjectDataManagement::VulnerabilityState::NoChange)
|
||||
if (data.vulnerabilityState == ProjectDataManagement::VulnerabilityState::VulnerabilityState_NoChange)
|
||||
continue;
|
||||
|
||||
if (data.vulnerabilityState() != ProjectDataManagement::VulnerabilityState::CatastrophicKill &&
|
||||
data.vulnerabilityState() != ProjectDataManagement::VulnerabilityState::CombatReady )
|
||||
return Core::FunctionReplyObject(building.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(building.buildingId());
|
||||
if (data.vulnerabilityState != ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill &&
|
||||
data.vulnerabilityState != ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady )
|
||||
return Core::FunctionReplyObject(building.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(building.buildingId);
|
||||
|
||||
if (building.roomIds().is_set())
|
||||
roomIds = building.roomIds().get();
|
||||
if (building.roomIds.is_set())
|
||||
roomIds = building.roomIds.get();
|
||||
|
||||
if (!bldg->setVulnerabilityState(data.vulnerabilityState(), roomIds))
|
||||
return Core::FunctionReplyObject(building.buildingId(), tr_lts("dds", "Can not send vulnerability state to building control process."));
|
||||
if (!bldg->setVulnerabilityState(data.vulnerabilityState, roomIds))
|
||||
return Core::FunctionReplyObject(building.buildingId, tr_lts("dds", "Can not send vulnerability state to building control process."));
|
||||
}
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSetFortifyFactorRequestInternal(const SetFortifyFactorRequest &data)
|
||||
{
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
auto it = m_buildings.find(data.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId);
|
||||
|
||||
BuildingProcess *bldg = it.value();
|
||||
if (!bldg->setFortifyFactors(data.fortifyFactors()))
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send fortify factors to building control process."));
|
||||
if (!bldg->setFortifyFactors(data.fortifyFactors))
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Can not send fortify factors to building control process."));
|
||||
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
@@ -271,9 +272,9 @@ void BuildingControlHandler::setEffectStates(const int buildingId, const int ass
|
||||
void BuildingControlHandler::onRelayInfoChanged(const AssetManagement::RelayInfo &info, const DataModification mod)
|
||||
{
|
||||
if (mod != DataModification::eRemoved)
|
||||
m_relayInfos.insert(info.id(), info);
|
||||
m_relayInfos.insert(info.id, info);
|
||||
else
|
||||
m_relayInfos.remove(info.id());
|
||||
m_relayInfos.remove(info.id);
|
||||
|
||||
for(auto *bldg : std::as_const(m_buildings))
|
||||
bldg->newRelayInfos(m_relayInfos);
|
||||
@@ -283,20 +284,20 @@ void BuildingControlHandler::onRelayInfoChanged(const AssetManagement::RelayInfo
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSendCesHitOnBuildingRequestInternal(const SendCesHitOnBuildingRequest &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequestInternal";
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
auto it = m_buildings.find(data.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequestInternal return";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId);
|
||||
}
|
||||
|
||||
BuildingProcess *bldg = it.value();
|
||||
if (!bldg->sendCesHitOnBuilding(data.effectTime(), data.chargeTypeId(), data.destructiveFactor(), data.penetrationFactor(),
|
||||
data.aesId(), data.impactPosition(),
|
||||
QString::fromStdString(data.properties())))
|
||||
if (!bldg->sendCesHitOnBuilding(data.effectTime, data.chargeTypeId, data.destructiveFactor, data.penetrationFactor,
|
||||
data.aesId, data.impactPosition,
|
||||
QString::fromStdString(data.properties)))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequestInternal return Can not send ces hit to building control process";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send ces hit to building control process."));
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Can not send ces hit to building control process."));
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "FunctionReplyObject";
|
||||
return Core::FunctionReplyObject();
|
||||
@@ -306,20 +307,20 @@ Core::FunctionReplyObject BuildingControlHandler::onSendCesHit3DonBuildingReques
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequestInternal";
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
auto it = m_buildings.find(data.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequestInternal return";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId);
|
||||
}
|
||||
|
||||
BuildingProcess *bldg = it.value();
|
||||
if (!bldg->sendCesHit3DonBuilding(data.effectTime(), data.chargeTypeId(), data.destructiveFactor(), data.penetrationFactor(),
|
||||
data.aesId(), data.impactPosition(), data.detonationLocation(), data.detonationDistance(),
|
||||
QString::fromStdString(data.properties())))
|
||||
if (!bldg->sendCesHit3DonBuilding(data.effectTime, data.chargeTypeId, data.destructiveFactor, data.penetrationFactor,
|
||||
data.aesId, data.impactPosition, data.detonationLocation, data.detonationDistance,
|
||||
QString::fromStdString(data.properties)))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequestInternal return Can not send ces hit to building control process";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send ces hit to building control process."));
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Can not send ces hit to building control process."));
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "FunctionReplyObject";
|
||||
return Core::FunctionReplyObject();
|
||||
@@ -332,22 +333,22 @@ Core::FunctionReplyObject BuildingControlHandler::onTriggerBsmFlashInternal(cons
|
||||
|
||||
{
|
||||
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
auto it = m_buildings.find(data.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId);
|
||||
|
||||
BuildingProcess *bldg = it.value();
|
||||
BuildingInfo buildingInfo= bldg->buildingInfo();
|
||||
BsmInfo bsmInfo = buildingInfo.bsms.value(data.assetId());
|
||||
BsmInfo bsmInfo = buildingInfo.bsms.value(data.assetId);
|
||||
|
||||
DEBUG_LOG(m_logger) << " BuildingId=" << data.buildingId()
|
||||
DEBUG_LOG(m_logger) << " BuildingId=" << data.buildingId
|
||||
<< " assetId=" << bsmInfo.assetId
|
||||
<< " hostname=" << bsmInfo.hostname;
|
||||
|
||||
if (!bldg->triggerFlashlight(data))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onTriggerBsmFlashInternal return Can not send trigger flashlight to building control process";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send trigger flashlight to building control process"));
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Can not send trigger flashlight to building control process"));
|
||||
}
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "FunctionReplyObject";
|
||||
@@ -368,12 +369,12 @@ void BuildingControlHandler::onSwitchRelayRequest(const rti::core::SampleIdentit
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSwitchRelayInternal(const SwitchRelayRequest &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSwitchRelayInternal " << data;
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
auto it = m_buildings.find(data.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId);
|
||||
BuildingProcess *bldg = it.value();
|
||||
if (!bldg->switchRelay(data))
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not set relay to building control process."));
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Can not set relay to building control process."));
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ BuildingProcess::BuildingProcess(MainHandler *mainHandler,
|
||||
, m_hitLineInfoTimer(new QTimer(this))
|
||||
, m_hitLineId(info.mseId << 16)
|
||||
, m_initBuilding(initBuilding)
|
||||
, m_logger(getLogger("BuildingProcess"))
|
||||
{
|
||||
m_proc.setProgram(procName);
|
||||
m_proc.setReadChannel(QProcess::StandardOutput);
|
||||
@@ -86,7 +87,7 @@ void BuildingProcess::onStructureElementUpdateEffectOverrideReply(const Core::Fu
|
||||
bool BuildingProcess::start()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::start mseId = " << m_buildingInfo.mseId
|
||||
<< " m_historyState.size() = " << m_historyState.stateHistory().size()
|
||||
<< " m_historyState.size() = " << m_historyState.stateHistory.size()
|
||||
<< " m_initBuilding=" << m_initBuilding;
|
||||
if (m_buildingInfo.mseId <= 0)
|
||||
{
|
||||
@@ -201,11 +202,11 @@ void BuildingProcess::shutdown()
|
||||
|
||||
void BuildingProcess::setHistoryState(const Buildings::HistoryState &historyState)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::setHistoryState size =" << historyState.stateHistory().size();
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::setHistoryState size =" << historyState.stateHistory.size();
|
||||
|
||||
ERROR_LOG(m_logger) << "[BuildingProcess::setHistoryState]>>> history =" << historyState;
|
||||
m_historyState = historyState;
|
||||
m_historyState.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
m_historyState.sampleTime = QDateTime::currentMSecsSinceEpoch();
|
||||
m_mainHandler->ddsHandler()->dts()->publish(m_historyState);
|
||||
}
|
||||
|
||||
@@ -215,7 +216,7 @@ bool BuildingProcess::setVulnerabilityState(ProjectDataManagement::Vulnerability
|
||||
if (!m_wsSocket || !m_wsSocket->isValid())
|
||||
return false;
|
||||
BuildingControlUnit::Json::Telegrams::SetDamageState tele;
|
||||
tele.damageState = (state == ProjectDataManagement::VulnerabilityState::CatastrophicKill ?
|
||||
tele.damageState = (state == ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill ?
|
||||
BuildingControlUnit::DamageState::Destroyed :
|
||||
BuildingControlUnit::DamageState::NoDamage);
|
||||
tele.roomIds.reserve(roomIds.size());
|
||||
@@ -236,12 +237,12 @@ bool BuildingProcess::setContaminationState(const int &bldId, const Contaminatio
|
||||
return false;
|
||||
BuildingControlUnit::Json::Telegrams::SetContaminationState tele;
|
||||
BuildingControlUnit::ContaminationState contState;
|
||||
contState.aesId = contaminationState.aesId();
|
||||
if ( contaminationState.vulnerabilityState() == ProjectDataManagement::VulnerabilityState::CatastrophicKill )
|
||||
contState.aesId = contaminationState.aesId;
|
||||
if ( contaminationState.vulnerabilityState == ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill )
|
||||
contState.damagePercentNew = 100;
|
||||
else
|
||||
contState.damagePercentNew = 0;
|
||||
contState.rooms = contaminationState.rooms();
|
||||
contState.rooms = contaminationState.rooms;
|
||||
tele.contaminationStates.push_back(contState);
|
||||
|
||||
DEBUG_LOG(m_logger) << "SetContaminationState websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
@@ -271,8 +272,8 @@ bool BuildingProcess::setFortifyFactors(const std::vector<Buildings::FortifyFact
|
||||
for (const auto &ff : fortifyFactors)
|
||||
{
|
||||
BuildingControlUnit::Json::Telegrams::SetFortifyFactor::FortifyInfo info;
|
||||
info.roomId = m_buildingInfo.roomId2SubId.value(ff.roomId());
|
||||
info.fortifyFactor = ff.fortifyFactor();
|
||||
info.roomId = m_buildingInfo.roomId2SubId.value(ff.roomId);
|
||||
info.fortifyFactor = ff.fortifyFactor;
|
||||
|
||||
tele.fortifyFactors.push_back(info);
|
||||
}
|
||||
@@ -402,8 +403,8 @@ bool BuildingProcess::relayState(const std::vector<Buildings::RelayStateItem> &r
|
||||
for (const auto &ff : relayStates)
|
||||
{
|
||||
BuildingControlUnit::Json::Telegrams::RelayState::RelayStateInfo info;
|
||||
info.id = ff.id();
|
||||
info.state = ff.state();
|
||||
info.id = ff.id;
|
||||
info.state = ff.state;
|
||||
|
||||
tele.relayStates.push_back(info);
|
||||
}
|
||||
@@ -427,21 +428,21 @@ bool BuildingProcess::sendCesHitOnBuilding(const qint64 effectTimeMSec,
|
||||
return false;
|
||||
|
||||
|
||||
const LtsCoordTrans::UtmCoordinate coord(LtsCoordTrans::UtmCoordinate::fromGeographic(m_buildingInfo.absPosition.lon(),
|
||||
m_buildingInfo.absPosition.lat()));
|
||||
const LtsCoordTrans::UtmCoordinate impact(LtsCoordTrans::UtmCoordinate::fromGeographic(impactPosition.lon(),
|
||||
impactPosition.lat(),
|
||||
const LtsCoordTrans::UtmCoordinate coord(LtsCoordTrans::UtmCoordinate::fromGeographic(m_buildingInfo.absPosition.lon,
|
||||
m_buildingInfo.absPosition.lat));
|
||||
const LtsCoordTrans::UtmCoordinate impact(LtsCoordTrans::UtmCoordinate::fromGeographic(impactPosition.lon,
|
||||
impactPosition.lat,
|
||||
coord.zone));
|
||||
Core::RelativePosition relPos(impact.x - coord.x,
|
||||
impact.y - coord.y,
|
||||
impactPosition.z() - m_buildingInfo.absPosition.z());
|
||||
impactPosition.z - m_buildingInfo.absPosition.z);
|
||||
double xRot, yRot;
|
||||
QTransform m;
|
||||
|
||||
m.rotate(-m_buildingInfo.angle);
|
||||
m.map(relPos.offsetX(), relPos.offsetY(), &xRot, &yRot);
|
||||
relPos.offsetX(xRot);
|
||||
relPos.offsetY(yRot);
|
||||
m.map(relPos.offsetX, relPos.offsetY, &xRot, &yRot);
|
||||
relPos.offsetX = xRot;
|
||||
relPos.offsetY = yRot;
|
||||
|
||||
|
||||
BuildingControlUnit::Json::Telegrams::CentralEffectSimulationHit tele;
|
||||
@@ -450,9 +451,9 @@ bool BuildingProcess::sendCesHitOnBuilding(const qint64 effectTimeMSec,
|
||||
tele.destructiveFactor = destructiveFactor;
|
||||
tele.penetrationFactor = penetrationFactor;
|
||||
tele.aesId = aesId;
|
||||
tele.relPosition.x = relPos.offsetX();
|
||||
tele.relPosition.y = relPos.offsetY();
|
||||
tele.relPosition.z = relPos.offsetZ();
|
||||
tele.relPosition.x = relPos.offsetX;
|
||||
tele.relPosition.y = relPos.offsetY;
|
||||
tele.relPosition.z = relPos.offsetZ;
|
||||
tele.properties = properties;
|
||||
|
||||
DEBUG_LOG(m_logger) << "sendCesHitOnBuilding websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
@@ -469,27 +470,27 @@ bool BuildingProcess::sendCesHit3DonBuilding(const qint64 effectTimeMSec, const
|
||||
return false;
|
||||
|
||||
|
||||
const LtsCoordTrans::UtmCoordinate &coord(LtsCoordTrans::UtmCoordinate::fromGeographic(m_buildingInfo.absPosition.lon(),
|
||||
m_buildingInfo.absPosition.lat()));
|
||||
const LtsCoordTrans::UtmCoordinate &coord(LtsCoordTrans::UtmCoordinate::fromGeographic(m_buildingInfo.absPosition.lon,
|
||||
m_buildingInfo.absPosition.lat));
|
||||
|
||||
Core::RelativePosition relImpactPos;
|
||||
{
|
||||
const LtsCoordTrans::UtmCoordinate &impactUtm(LtsCoordTrans::UtmCoordinate::fromGeographic(impactPosition.lon(),
|
||||
impactPosition.lat(),
|
||||
const LtsCoordTrans::UtmCoordinate &impactUtm(LtsCoordTrans::UtmCoordinate::fromGeographic(impactPosition.lon,
|
||||
impactPosition.lat,
|
||||
coord.zone));
|
||||
relImpactPos = Core::RelativePosition(impactUtm.x - coord.x,
|
||||
impactUtm.y - coord.y,
|
||||
impactPosition.z() - m_buildingInfo.absPosition.z());
|
||||
impactPosition.z - m_buildingInfo.absPosition.z);
|
||||
}
|
||||
|
||||
Core::RelativePosition relDetoLoc;
|
||||
{
|
||||
const LtsCoordTrans::UtmCoordinate &detonationLocationUtm(LtsCoordTrans::UtmCoordinate::fromGeographic(detonationLocation.lon(),
|
||||
detonationLocation.lat(),
|
||||
const LtsCoordTrans::UtmCoordinate &detonationLocationUtm(LtsCoordTrans::UtmCoordinate::fromGeographic(detonationLocation.lon,
|
||||
detonationLocation.lat,
|
||||
coord.zone));
|
||||
relDetoLoc = Core::RelativePosition(detonationLocationUtm.x - coord.x,
|
||||
detonationLocationUtm.y - coord.y,
|
||||
detonationLocation.z() - m_buildingInfo.absPosition.z());
|
||||
detonationLocation.z - m_buildingInfo.absPosition.z);
|
||||
}
|
||||
|
||||
|
||||
@@ -498,13 +499,13 @@ bool BuildingProcess::sendCesHit3DonBuilding(const qint64 effectTimeMSec, const
|
||||
|
||||
m.rotate(-m_buildingInfo.angle);
|
||||
|
||||
m.map(relImpactPos.offsetX(), relImpactPos.offsetY(), &xRot, &yRot);
|
||||
relImpactPos.offsetX(xRot);
|
||||
relImpactPos.offsetY(yRot);
|
||||
m.map(relImpactPos.offsetX, relImpactPos.offsetY, &xRot, &yRot);
|
||||
relImpactPos.offsetX = xRot;
|
||||
relImpactPos.offsetY = yRot;
|
||||
|
||||
m.map(relDetoLoc.offsetX(), relDetoLoc.offsetY(), &xRot, &yRot);
|
||||
relDetoLoc.offsetX(xRot);
|
||||
relDetoLoc.offsetY(yRot);
|
||||
m.map(relDetoLoc.offsetX, relDetoLoc.offsetY, &xRot, &yRot);
|
||||
relDetoLoc.offsetX = xRot;
|
||||
relDetoLoc.offsetY = yRot;
|
||||
|
||||
|
||||
BuildingControlUnit::Json::Telegrams::CentralEffectSimulationHit3D tele;
|
||||
@@ -514,13 +515,13 @@ bool BuildingProcess::sendCesHit3DonBuilding(const qint64 effectTimeMSec, const
|
||||
tele.penetrationFactor = penetrationFactor;
|
||||
tele.aesId = aesId;
|
||||
|
||||
tele.impactPosition.x = relImpactPos.offsetX();
|
||||
tele.impactPosition.y = relImpactPos.offsetY();
|
||||
tele.impactPosition.z = relImpactPos.offsetZ();
|
||||
tele.impactPosition.x = relImpactPos.offsetX;
|
||||
tele.impactPosition.y = relImpactPos.offsetY;
|
||||
tele.impactPosition.z = relImpactPos.offsetZ;
|
||||
|
||||
tele.detonationLocation.x = relDetoLoc.offsetX();
|
||||
tele.detonationLocation.y = relDetoLoc.offsetY();
|
||||
tele.detonationLocation.z = relDetoLoc.offsetZ();
|
||||
tele.detonationLocation.x = relDetoLoc.offsetX;
|
||||
tele.detonationLocation.y = relDetoLoc.offsetY;
|
||||
tele.detonationLocation.z = relDetoLoc.offsetZ;
|
||||
|
||||
tele.detonationDistance = detonationDistance;
|
||||
tele.properties = properties;
|
||||
@@ -537,9 +538,9 @@ bool BuildingProcess::switchRelay(const SwitchRelayRequest &data)
|
||||
if (!m_wsSocket || !m_wsSocket->isValid())
|
||||
return false;
|
||||
DEBUG_LOG(m_logger) << "switchRelay"
|
||||
<< " buildingId=" << data.buildingId()
|
||||
<< " assetId=" << data.assetId()
|
||||
<< data.state();
|
||||
<< " buildingId=" << data.buildingId
|
||||
<< " assetId=" << data.assetId
|
||||
<< data.state;
|
||||
|
||||
|
||||
for (const EgcuInfo &egcu : std::as_const(m_buildingInfo.egcus))
|
||||
@@ -547,19 +548,19 @@ bool BuildingProcess::switchRelay(const SwitchRelayRequest &data)
|
||||
DEBUG_LOG(m_logger) << "EGCU: " << egcu.assetName
|
||||
<< " assetId=" << egcu.assetId
|
||||
<< " hostname=" << egcu.hostname;
|
||||
DEBUG_LOG(m_logger) << "data.assetId()=" << data.assetId()
|
||||
DEBUG_LOG(m_logger) << "data.assetId()=" << data.assetId
|
||||
<< "egcu.assetId=" << egcu.assetId;
|
||||
if ( data.assetId() != egcu.assetId)
|
||||
if ( data.assetId != egcu.assetId)
|
||||
continue;
|
||||
|
||||
tele.segment = egcu.hostname;
|
||||
tele.switchRelayValues.id = data.number();
|
||||
tele.switchRelayValues.bcuRelayState = static_cast <BuildingControlUnit::BcuRelayState>(data.state().underlying());
|
||||
if ( data.state() == StateSetRelay_def::Pulse)
|
||||
tele.switchRelayValues.id = data.number;
|
||||
tele.switchRelayValues.bcuRelayState = static_cast <BuildingControlUnit::BcuRelayState>(static_cast<int>(data.state));
|
||||
if ( data.state == StateSetRelay::Pulse)
|
||||
{
|
||||
tele.switchRelayValues.count = data.pulseAttributes().get().count();
|
||||
tele.switchRelayValues.delay = data.pulseAttributes().get().delay();
|
||||
tele.switchRelayValues.pulse = data.pulseAttributes().get().pulse();
|
||||
tele.switchRelayValues.count = data.pulseAttributes.get().count;
|
||||
tele.switchRelayValues.delay = data.pulseAttributes.get().delay;
|
||||
tele.switchRelayValues.pulse = data.pulseAttributes.get().pulse;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "switchRelay websocket send: " << QString::fromUtf8(tele.toJson());
|
||||
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
|
||||
@@ -575,8 +576,8 @@ bool BuildingProcess::triggerFlashlight(const TriggerBsmFlashRequest data)
|
||||
if (!m_wsSocket || !m_wsSocket->isValid())
|
||||
return false;
|
||||
DEBUG_LOG(m_logger) << "triggerFlashlight"
|
||||
<< " BuildingId=" << data.buildingId()
|
||||
<< " assetId=" << data.assetId()
|
||||
<< " BuildingId=" << data.buildingId
|
||||
<< " assetId=" << data.assetId
|
||||
<< " m_buildingInfo.bsms.size()" << m_buildingInfo.bsms.size();
|
||||
|
||||
QMapIterator<int, BsmInfo> i(m_buildingInfo.bsms);
|
||||
@@ -589,10 +590,10 @@ bool BuildingProcess::triggerFlashlight(const TriggerBsmFlashRequest data)
|
||||
<< " port=" << i.value().port;
|
||||
|
||||
}
|
||||
if ( m_buildingInfo.bsms.contains(data.assetId()))
|
||||
if ( m_buildingInfo.bsms.contains(data.assetId))
|
||||
{
|
||||
BsmInfo bsmInfo = m_buildingInfo.bsms.value(data.assetId());
|
||||
DEBUG_LOG(m_logger) << " BuildingId=" << data.buildingId()
|
||||
BsmInfo bsmInfo = m_buildingInfo.bsms.value(data.assetId);
|
||||
DEBUG_LOG(m_logger) << " BuildingId=" << data.buildingId
|
||||
<< " assetId=" << bsmInfo.assetId
|
||||
<< " hostname=" << bsmInfo.hostname;
|
||||
|
||||
@@ -664,21 +665,21 @@ void BuildingProcess::onTextMessageReceived(const QString &message)
|
||||
void BuildingProcess::handleBsmState(BuildingControlUnit::Json::Telegrams::BsmState *tel)
|
||||
{
|
||||
BuildingStateTechnical state;
|
||||
state.id(m_buildingInfo.mseId);
|
||||
state.assetId(m_buildingInfo.assetId);
|
||||
state.structureElementId(m_buildingInfo.structureElementId);
|
||||
state.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
state.bsmStates().resize(tel->bsmStates.size());
|
||||
state.id = m_buildingInfo.mseId;
|
||||
state.assetId = m_buildingInfo.assetId;
|
||||
state.structureElementId = m_buildingInfo.structureElementId;
|
||||
state.sampleTime = QDateTime::currentMSecsSinceEpoch();
|
||||
state.bsmStates.resize(tel->bsmStates.size());
|
||||
BsmState s;
|
||||
for (int i = 0; i < tel->bsmStates.size(); ++i)
|
||||
{
|
||||
const BuildingControlUnit::Json::Telegrams::BsmState::BsmStateInfo &info = tel->bsmStates.at(i);
|
||||
s.id(info.id);
|
||||
s.connected(info.connected);
|
||||
s.hostport(info.port);
|
||||
s.hostname(info.hostname.toStdString());
|
||||
s.versionInfo(info.versionInfo.toStdString());
|
||||
state.bsmStates()[i] = s;
|
||||
s.id = info.id;
|
||||
s.connected = info.connected;
|
||||
s.hostport = info.port;
|
||||
s.hostname = info.hostname.toStdString();
|
||||
s.versionInfo = info.versionInfo.toStdString();
|
||||
state.bsmStates[i] = s;
|
||||
m_bsmStates.insert(info.id, s);
|
||||
}
|
||||
|
||||
@@ -687,32 +688,32 @@ void BuildingProcess::handleBsmState(BuildingControlUnit::Json::Telegrams::BsmSt
|
||||
|
||||
void BuildingProcess::historyState(const BuildingState &state)
|
||||
{
|
||||
if (state.vulnerabilityState() == ProjectDataManagement::VulnerabilityState::CombatReady
|
||||
&& state.damagePercent() == 0
|
||||
&& state.originatorParticipantId() == 0
|
||||
&& state.contaminationStates().size() == 0)
|
||||
if (state.vulnerabilityState == ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady
|
||||
&& state.damagePercent == 0
|
||||
&& state.originatorParticipantId == 0
|
||||
&& state.contaminationStates.size() == 0)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "setVulnerabilityState->removeHistoryStateByKey:" << state.id();
|
||||
m_historyState.stateHistory().resize(0);
|
||||
DEBUG_LOG(m_logger) << "setVulnerabilityState->removeHistoryStateByKey:" << state.id;
|
||||
m_historyState.stateHistory.resize(0);
|
||||
}
|
||||
|
||||
HistoryStateItem historyStateItem;
|
||||
historyStateItem.aesId(state.aesId());
|
||||
historyStateItem.chargeTypeId(state.chargeTypeId());
|
||||
historyStateItem.damagePercent(state.damagePercent());
|
||||
historyStateItem.damagePercentOld(state.damagePercentOld());
|
||||
historyStateItem.originatorParticipantId(state.originatorParticipantId());
|
||||
historyStateItem.originatorType() = state.originatorType();
|
||||
historyStateItem.time(state.sampleTime());
|
||||
historyStateItem.vulnerabilityState() = state.vulnerabilityState();
|
||||
historyStateItem.contaminationStates() = state.contaminationStates();
|
||||
historyStateItem.aesId = state.aesId;
|
||||
historyStateItem.chargeTypeId = state.chargeTypeId;
|
||||
historyStateItem.damagePercent = state.damagePercent;
|
||||
historyStateItem.damagePercentOld = state.damagePercentOld;
|
||||
historyStateItem.originatorParticipantId = state.originatorParticipantId;
|
||||
historyStateItem.originatorType = state.originatorType;
|
||||
historyStateItem.time = state.sampleTime;
|
||||
historyStateItem.vulnerabilityState = state.vulnerabilityState;
|
||||
historyStateItem.contaminationStates = state.contaminationStates;
|
||||
|
||||
m_historyState.stateHistory().push_back(std::move(historyStateItem));
|
||||
m_historyState.stateHistory.push_back(std::move(historyStateItem));
|
||||
DEBUG_LOG(m_logger) << "BuildingProcess::historyState contaminationStates:" << state;
|
||||
|
||||
m_historyState.mseId(state.id());
|
||||
DEBUG_LOG(m_logger) << "setVulnerabilityState->removeHistoryStateByKey:" << m_historyState.mseId();
|
||||
m_historyState.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
m_historyState.mseId = state.id;
|
||||
DEBUG_LOG(m_logger) << "setVulnerabilityState->removeHistoryStateByKey:" << m_historyState.mseId;
|
||||
m_historyState.sampleTime = QDateTime::currentMSecsSinceEpoch();
|
||||
m_mainHandler->ddsHandler()->dts()->publish(m_historyState);
|
||||
}
|
||||
|
||||
@@ -722,78 +723,78 @@ void BuildingProcess::handleHitResult(BuildingControlUnit::Json::Telegrams::HitR
|
||||
BuildingState state;
|
||||
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " data.hitOnRoomId=" << data.hitOnRoomId;
|
||||
state.id(m_buildingInfo.mseId);
|
||||
state.id = m_buildingInfo.mseId;
|
||||
|
||||
int assetId = m_mainHandler->ddsHandler()->dtcIsm()->getAssetIdFromMountingPointId(m_buildingInfo.mseId, data.sensorId);
|
||||
DEBUG_LOG(m_logger) << "handleHitResult assetId=" << assetId;
|
||||
state.assetId(assetId);
|
||||
state.assetId = assetId;
|
||||
|
||||
InfrastructureManagement::StructureElement se;
|
||||
m_mainHandler->ddsHandler()->dtcIsm()->getStructureElementInMntPointAssetByAssetId(assetId, se);
|
||||
DEBUG_LOG(m_logger) << "handleHitResult structureElementId=" << se.id();
|
||||
state.structureElementId(se.id());
|
||||
state.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
DEBUG_LOG(m_logger) << "handleHitResult structureElementId=" << se.id;
|
||||
state.structureElementId = se.id;
|
||||
state.sampleTime = QDateTime::currentMSecsSinceEpoch();
|
||||
if (data.originatorType == BuildingControlUnit::OriginatorType::DirectHit)
|
||||
{
|
||||
|
||||
state.originatorParticipantId(m_mainHandler->ppmHandler()->equipmentNumberToParticipantId(data.originatorId));
|
||||
state.chargeTypeId(data.chargeTypeId);
|
||||
state.originatorType(ProjectDataManagement::StateChangeOriginator_def::Participant);
|
||||
state.originatorParticipantId = m_mainHandler->ppmHandler()->equipmentNumberToParticipantId(data.originatorId);
|
||||
state.chargeTypeId = data.chargeTypeId;
|
||||
state.originatorType = ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Participant;
|
||||
}
|
||||
else if (data.originatorType == BuildingControlUnit::OriginatorType::CesHit)
|
||||
{
|
||||
|
||||
state.aesId(data.originatorId);
|
||||
state.aesId = data.originatorId;
|
||||
|
||||
state.chargeTypeId(data.chargeTypeId);
|
||||
state.originatorType(ProjectDataManagement::StateChangeOriginator_def::AreaEffectSimulation);
|
||||
state.chargeTypeId = data.chargeTypeId;
|
||||
state.originatorType = ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_AreaEffectSimulation;
|
||||
}
|
||||
else if (data.originatorType == BuildingControlUnit::OriginatorType::OC)
|
||||
{
|
||||
state.originatorParticipantId(0);
|
||||
state.chargeTypeId(data.chargeTypeId);
|
||||
state.originatorType(ProjectDataManagement::StateChangeOriginator_def::ObserverController);
|
||||
state.originatorParticipantId = 0;
|
||||
state.chargeTypeId = data.chargeTypeId;
|
||||
state.originatorType = ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ObserverController;
|
||||
}
|
||||
else
|
||||
{
|
||||
state.originatorParticipantId(0);
|
||||
state.chargeTypeId(data.chargeTypeId);
|
||||
state.originatorType(ProjectDataManagement::StateChangeOriginator_def::ExerciseControl);
|
||||
state.originatorParticipantId = 0;
|
||||
state.chargeTypeId = data.chargeTypeId;
|
||||
state.originatorType = ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ExerciseControl;
|
||||
}
|
||||
state.damagePercent(data.damagePercentNew);
|
||||
state.damagePercentOld(data.damagePercentOld);
|
||||
state.vulnerabilityState(data.damageState == BuildingControlUnit::DamageState::Destroyed ?
|
||||
ProjectDataManagement::VulnerabilityState::CatastrophicKill :
|
||||
ProjectDataManagement::VulnerabilityState::CombatReady);
|
||||
state.hitOnRoomId(data.hitOnRoomId);
|
||||
state.roomStates().reserve(data.rooms.size());
|
||||
state.damagePercent = data.damagePercentNew;
|
||||
state.damagePercentOld = data.damagePercentOld;
|
||||
state.vulnerabilityState = data.damageState == BuildingControlUnit::DamageState::Destroyed ?
|
||||
ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill :
|
||||
ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady;
|
||||
state.hitOnRoomId = data.hitOnRoomId;
|
||||
state.roomStates.reserve(data.rooms.size());
|
||||
RoomState s;
|
||||
for (const auto &info : data.rooms)
|
||||
{
|
||||
s.id(m_buildingInfo.subId2RoomId.value(info.roomId));
|
||||
s.mountingPointId(info.roomId);
|
||||
s.damagePercent(info.damagePercent);
|
||||
s.remainingEffectPercent(info.remainingEffectPercent);
|
||||
s.fortifyFactor(info.fortifyFactor);
|
||||
state.roomStates().push_back(s);
|
||||
s.id = m_buildingInfo.subId2RoomId.value(info.roomId);
|
||||
s.mountingPointId = info.roomId;
|
||||
s.damagePercent = info.damagePercent;
|
||||
s.remainingEffectPercent = info.remainingEffectPercent;
|
||||
s.fortifyFactor = info.fortifyFactor;
|
||||
state.roomStates.push_back(s);
|
||||
}
|
||||
|
||||
ContaminationState cs;
|
||||
state.contaminationStates().reserve(data.contaminations.count());
|
||||
state.contaminationStates.reserve(data.contaminations.count());
|
||||
for (const auto &csi : data.contaminations)
|
||||
{
|
||||
cs.aesId(csi.aesId);
|
||||
cs.rooms().assign(csi.rooms.begin(), csi.rooms.end());
|
||||
state.contaminationStates().push_back(cs);
|
||||
cs.aesId = csi.aesId;
|
||||
cs.rooms.assign(csi.rooms.begin(), csi.rooms.end());
|
||||
state.contaminationStates.push_back(cs);
|
||||
}
|
||||
|
||||
|
||||
if (m_historyState.mseId() != 0)
|
||||
if (m_historyState.mseId != 0)
|
||||
historyState(state);
|
||||
else
|
||||
{
|
||||
|
||||
m_historyState.mseId(m_buildingInfo.mseId);
|
||||
m_historyState.mseId = m_buildingInfo.mseId;
|
||||
}
|
||||
|
||||
m_mainHandler->ddsHandler()->dts()->publish(state);
|
||||
@@ -823,7 +824,7 @@ void BuildingProcess::handleReconnectEgcu(const QString &segment)
|
||||
if (m_effectOverridesReconnect.value(relayId) >= 0)
|
||||
{
|
||||
|
||||
InfrastructureManagement::EffectOverride override = InfrastructureManagement::EffectOverride_def::PermanentOff;
|
||||
InfrastructureManagement::EffectOverride override = InfrastructureManagement::EffectOverride::PermanentOff;
|
||||
|
||||
int structureElementIdMp = m_mainHandler->ddsHandler()->dtcIsm()->getStructueElementIdFromAssetId(egcu.assetId);
|
||||
|
||||
@@ -837,9 +838,9 @@ void BuildingProcess::handleReconnectEgcu(const QString &segment)
|
||||
|
||||
|
||||
InfrastructureManagement::StructureElementUpdateEffectOverrideRequest request;
|
||||
request.structureElementId(structureElementIdMp);
|
||||
request.effectId(relayId);
|
||||
request.effectOverride(override);
|
||||
request.structureElementId = structureElementIdMp;
|
||||
request.effectId = relayId;
|
||||
request.effectOverride = override;
|
||||
DEBUG_LOG(m_logger) << "Vor structureElementUpdateEffectOverrideRequest";
|
||||
int result = m_mainHandler->ismHandler()->ftcIsm()->structureElementUpdateEffectOverrideRequest(request, this);
|
||||
DEBUG_LOG(m_logger) << "Nach structureElementUpdateEffectOverrideRequest result=" << result;
|
||||
@@ -875,9 +876,9 @@ void BuildingProcess::handleRelayState(BuildingControlUnit::Json::Telegrams::Rel
|
||||
<< " assetId=" << egcu.assetId
|
||||
<< " hostname='" << egcu.hostname
|
||||
<< "' buildingName=" << egcu.buildingName;
|
||||
state.id(egcu.assetId);
|
||||
state.stateTime(tel->stateTime);
|
||||
state.offlineTime(tel->offlineTime);
|
||||
state.id = egcu.assetId;
|
||||
state.stateTime = tel->stateTime;
|
||||
state.offlineTime = tel->offlineTime;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -885,10 +886,10 @@ void BuildingProcess::handleRelayState(BuildingControlUnit::Json::Telegrams::Rel
|
||||
RelayStateItem item;
|
||||
for (const auto &info : std::as_const(tel->relayStates))
|
||||
{
|
||||
item.id(info.id);
|
||||
item.state(info.state);
|
||||
item.id = info.id;
|
||||
item.state = info.state;
|
||||
|
||||
state.relayStates().push_back(item);
|
||||
state.relayStates.push_back(item);
|
||||
}
|
||||
|
||||
|
||||
@@ -914,85 +915,85 @@ void BuildingProcess::handleEffectOverride(BuildingControlUnit::Json::Telegrams:
|
||||
<< " structureElementId=" << m_buildingInfo.structureElementId
|
||||
<< " structureElementIdMp=" << structureElementIdMp;
|
||||
|
||||
request.structureElementId(structureElementIdMp);
|
||||
request.structureElementId = structureElementIdMp;
|
||||
}
|
||||
for ( int j = 0; j < tel->overrides.size(); j++ )
|
||||
{
|
||||
|
||||
request.effectId(tel->overrides.at(j).id);
|
||||
request.effectId = tel->overrides.at(j).id;
|
||||
switch (tel->overrides.at(j).effectOverride)
|
||||
{
|
||||
case -1:
|
||||
{
|
||||
request.effectOverride(InfrastructureManagement::EffectOverride_def::Automatic);
|
||||
request.effectOverride = InfrastructureManagement::EffectOverride::Automatic;
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
request.effectOverride(InfrastructureManagement::EffectOverride_def::PermanentOff);
|
||||
request.effectOverride = InfrastructureManagement::EffectOverride::PermanentOff;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
request.effectOverride(InfrastructureManagement::EffectOverride_def::PermanentOn);
|
||||
request.effectOverride = InfrastructureManagement::EffectOverride::PermanentOn;
|
||||
break;
|
||||
}
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "Send Override Request"
|
||||
<< " structureElementId=" << request.structureElementId()
|
||||
<< " effectId=" << request.effectId()
|
||||
<< " effectOverride=" << request.effectOverride();
|
||||
if ( request.structureElementId() > 0)
|
||||
<< " structureElementId=" << request.structureElementId
|
||||
<< " effectId=" << request.effectId
|
||||
<< " effectOverride=" << request.effectOverride;
|
||||
if ( request.structureElementId > 0)
|
||||
m_mainHandler->ddsHandler()->ftcIsm()->structureElementUpdateEffectOverrideRequest(request, this);
|
||||
else
|
||||
ERROR_LOG(m_logger) << "request.structureElementId() =" << request.structureElementId() << " NOT VALID!!!";
|
||||
ERROR_LOG(m_logger) << "request.structureElementId() =" << request.structureElementId << " NOT VALID!!!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool BuildingProcess::isValidPos(const Core::GeoPosition &pos)
|
||||
{
|
||||
if (qFuzzyIsNull(pos.lat()) && qFuzzyIsNull(pos.lon()))
|
||||
if (qFuzzyIsNull(pos.lat) && qFuzzyIsNull(pos.lon))
|
||||
return false;
|
||||
return !std::isnan(pos.lat()) && !std::isnan(pos.lon());
|
||||
return !std::isnan(pos.lat) && !std::isnan(pos.lon);
|
||||
}
|
||||
|
||||
void BuildingProcess::sendHitLine(const BuildingState &state)
|
||||
{
|
||||
if (state.originatorParticipantId() <= 0)
|
||||
if (state.originatorParticipantId <= 0)
|
||||
return;
|
||||
const ParticipantManagement::ParticipantPosition participantPosition = m_mainHandler->ppmHandler()->participantPosition(state.originatorParticipantId());
|
||||
if (!isValidPos(participantPosition.pos()))
|
||||
const ParticipantManagement::ParticipantPosition participantPosition = m_mainHandler->ppmHandler()->participantPosition(state.originatorParticipantId);
|
||||
if (!isValidPos(participantPosition.pos))
|
||||
return;
|
||||
BuildingHitLineInfo buildingHitLineInfo;
|
||||
InfrastructureManagement::MainStructureElement mainStructureElement = m_mainHandler->ismHandler()->mainStructureElement(state.id());
|
||||
InfrastructureManagement::MainStructureElement mainStructureElement = m_mainHandler->ismHandler()->mainStructureElement(state.id);
|
||||
|
||||
buildingHitLineInfo.id(m_hitLineId);
|
||||
buildingHitLineInfo.buildingId(m_buildingInfo.mseId);
|
||||
buildingHitLineInfo.buildingPos(mainStructureElement.geoPosition());
|
||||
if (state.hitOnRoomId() > 0)
|
||||
buildingHitLineInfo.id = m_hitLineId;
|
||||
buildingHitLineInfo.buildingId = m_buildingInfo.mseId;
|
||||
buildingHitLineInfo.buildingPos = mainStructureElement.geoPosition;
|
||||
if (state.hitOnRoomId > 0)
|
||||
{
|
||||
for (const auto &se : mainStructureElement.elements())
|
||||
for (const auto &se : mainStructureElement.elements)
|
||||
{
|
||||
if (se.structureElementTypeId() == InfrastructureManagement::StructureElementType::Room &&
|
||||
se.mountingPointId() == state.hitOnRoomId())
|
||||
if (se.structureElementTypeId == InfrastructureManagement::StructureElementType::Room &&
|
||||
se.mountingPointId == state.hitOnRoomId)
|
||||
{
|
||||
buildingHitLineInfo.buildingPos(se.geoPosition());
|
||||
buildingHitLineInfo.buildingPos = se.geoPosition;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
buildingHitLineInfo.chargeTypeId(state.chargeTypeId());
|
||||
buildingHitLineInfo.originatorParticipantId(state.originatorParticipantId());
|
||||
buildingHitLineInfo.originatorPos(participantPosition.pos());
|
||||
buildingHitLineInfo.originatorPartyId(participantPosition.partyId());
|
||||
buildingHitLineInfo.sampleTime(state.sampleTime());
|
||||
buildingHitLineInfo.hitOnRoomId(state.hitOnRoomId());
|
||||
buildingHitLineInfo.contaminationStates(state.contaminationStates());
|
||||
buildingHitLineInfo.chargeTypeId = state.chargeTypeId;
|
||||
buildingHitLineInfo.originatorParticipantId = state.originatorParticipantId;
|
||||
buildingHitLineInfo.originatorPos = participantPosition.pos;
|
||||
buildingHitLineInfo.originatorPartyId = participantPosition.partyId;
|
||||
buildingHitLineInfo.sampleTime = state.sampleTime;
|
||||
buildingHitLineInfo.hitOnRoomId = state.hitOnRoomId;
|
||||
buildingHitLineInfo.contaminationStates = state.contaminationStates;
|
||||
|
||||
m_mainHandler->ddsHandler()->dts()->publish(buildingHitLineInfo);
|
||||
|
||||
m_hitLineInfoMap.insert(buildingHitLineInfo.id(), buildingHitLineInfo);
|
||||
m_hitLineInfoMap.insert(buildingHitLineInfo.id, buildingHitLineInfo);
|
||||
++m_hitLineId;
|
||||
}
|
||||
|
||||
@@ -1003,9 +1004,9 @@ void BuildingProcess::onHitLineInfoTimeout()
|
||||
auto it = m_hitLineInfoMap.begin();
|
||||
while (it != m_hitLineInfoMap.end())
|
||||
{
|
||||
if (!LtsUtils::isPositionTimeOutdated(tNow, it.value().sampleTime()))
|
||||
if (!LtsUtils::isPositionTimeOutdated(tNow, it.value().sampleTime))
|
||||
break;
|
||||
m_mainHandler->ddsHandler()->dts()->removeBuildingHitLineInfoByKey(it.value().id());
|
||||
m_mainHandler->ddsHandler()->dts()->removeBuildingHitLineInfoByKey(it.value().id);
|
||||
|
||||
it = m_hitLineInfoMap.erase(it);
|
||||
}
|
||||
@@ -1037,16 +1038,16 @@ static void outputBsmData(QXmlStreamWriter &sw, const BsmInfo &bsm)
|
||||
|
||||
sw.writeStartElement(QStringLiteral("Position"));
|
||||
{
|
||||
sw.writeAttribute(QStringLiteral("x"), QString::number(bsm.relPosition.offsetX(), 'f', 10));
|
||||
sw.writeAttribute(QStringLiteral("y"), QString::number(bsm.relPosition.offsetY(), 'f', 10));
|
||||
sw.writeAttribute(QStringLiteral("z"), QString::number(bsm.relPosition.offsetZ(), 'f', 10));
|
||||
sw.writeAttribute(QStringLiteral("x"), QString::number(bsm.relPosition.offsetX, 'f', 10));
|
||||
sw.writeAttribute(QStringLiteral("y"), QString::number(bsm.relPosition.offsetY, 'f', 10));
|
||||
sw.writeAttribute(QStringLiteral("z"), QString::number(bsm.relPosition.offsetZ, 'f', 10));
|
||||
}
|
||||
sw.writeEndElement();
|
||||
sw.writeStartElement(QStringLiteral("Direction"));
|
||||
{
|
||||
sw.writeAttribute(QStringLiteral("x"), QString::number(bsm.orientation.heave(), 'f', 10));
|
||||
sw.writeAttribute(QStringLiteral("y"), QString::number(bsm.orientation.pitch(), 'f', 10));
|
||||
sw.writeAttribute(QStringLiteral("z"), QString::number(bsm.orientation.roll(), 'f', 10));
|
||||
sw.writeAttribute(QStringLiteral("x"), QString::number(bsm.orientation.heave, 'f', 10));
|
||||
sw.writeAttribute(QStringLiteral("y"), QString::number(bsm.orientation.pitch, 'f', 10));
|
||||
sw.writeAttribute(QStringLiteral("z"), QString::number(bsm.orientation.roll, 'f', 10));
|
||||
}
|
||||
sw.writeEndElement();
|
||||
}
|
||||
@@ -1077,7 +1078,6 @@ QByteArray BuildingProcess::generateBuildingConfigData() const
|
||||
QXmlStreamWriter sw(&ret);
|
||||
sw.setAutoFormatting(true);
|
||||
sw.setAutoFormattingIndent(2);
|
||||
sw.setCodec("UTF-8");
|
||||
sw.writeStartDocument(QStringLiteral("1.0"), true);
|
||||
sw.writeStartElement(QStringLiteral("BuildingConfiguration"));
|
||||
{
|
||||
@@ -1103,31 +1103,30 @@ QByteArray BuildingProcess::generateChargesData() const
|
||||
QXmlStreamWriter sw(&ret);
|
||||
sw.setAutoFormatting(true);
|
||||
sw.setAutoFormattingIndent(2);
|
||||
sw.setCodec("UTF-8");
|
||||
sw.writeStartDocument(QStringLiteral("1.0"), true);
|
||||
sw.writeStartElement(QStringLiteral("Charges"));
|
||||
{
|
||||
for (const ProjectDataManagement::BuildingChargeEffect &charge : buildingCharges)
|
||||
{
|
||||
auto it = chargeTypes.find(charge.chargeTypeId());
|
||||
auto it = chargeTypes.find(charge.chargeTypeId);
|
||||
if (it == chargeTypes.end())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Could not find charge type with id " << charge.chargeTypeId() << " - skipping";
|
||||
WARNING_LOG(m_logger) << "Could not find charge type with id " << charge.chargeTypeId << " - skipping";
|
||||
continue;
|
||||
}
|
||||
|
||||
ProjectDataManagement::ChargeTypeProperty chargeTypeProperty = m_mainHandler->ddsHandler()->dtcPdm()->getChargeTypeSpecialProperty(charge.chargeTypeId(),0,0);
|
||||
ProjectDataManagement::ChargeTypeProperty chargeTypeProperty = m_mainHandler->ddsHandler()->dtcPdm()->getChargeTypeSpecialProperty(charge.chargeTypeId,0,0);
|
||||
sw.writeStartElement(QStringLiteral("Charge"));
|
||||
sw.writeTextElement(QStringLiteral("Id"), QString::number(charge.id()));
|
||||
sw.writeTextElement(QStringLiteral("ChargeTypeId"), QString::number(charge.chargeTypeId()));
|
||||
sw.writeTextElement(QStringLiteral("DestructiveFactor"), QString::number(charge.destructiveFactor()));
|
||||
sw.writeTextElement(QStringLiteral("PenetrationEffect"), QString::number(charge.penetrationFactor()));
|
||||
sw.writeTextElement(QStringLiteral("Id"), QString::number(charge.id));
|
||||
sw.writeTextElement(QStringLiteral("ChargeTypeId"), QString::number(charge.chargeTypeId));
|
||||
sw.writeTextElement(QStringLiteral("DestructiveFactor"), QString::number(charge.destructiveFactor));
|
||||
sw.writeTextElement(QStringLiteral("PenetrationEffect"), QString::number(charge.penetrationFactor));
|
||||
sw.writeTextElement(QStringLiteral("properties"), properties);
|
||||
sw.writeTextElement(QStringLiteral("EffectSound"), QString::number(charge.hitSound()));
|
||||
sw.writeTextElement(QStringLiteral("DifcueLight"), QString::number(charge.difcueLight()));
|
||||
sw.writeTextElement(QStringLiteral("DifcuePyro"), QString::number(charge.difcuePyro()));
|
||||
if (chargeTypeProperty == ProjectDataManagement::ChargeTypeProperty_def::None)
|
||||
if (charge.destructiveFactor() > 0)
|
||||
sw.writeTextElement(QStringLiteral("EffectSound"), QString::number(charge.hitSound));
|
||||
sw.writeTextElement(QStringLiteral("DifcueLight"), QString::number(charge.difcueLight));
|
||||
sw.writeTextElement(QStringLiteral("DifcuePyro"), QString::number(charge.difcuePyro));
|
||||
if (chargeTypeProperty == ProjectDataManagement::ChargeTypeProperty::None)
|
||||
if (charge.destructiveFactor > 0)
|
||||
sw.writeTextElement(QStringLiteral("showHitLine"), QString::number(1));
|
||||
else
|
||||
sw.writeTextElement(QStringLiteral("showHitLine"), QString::number(0));
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << "WebSocketInterfaceHandler initialized Port=" << m_webSocketHandler->listenPort();
|
||||
m_ddsHandler->pacemaker()->addPort(m_webSocketHandler->listenPort(), Core::PortType::WebSocketServer);
|
||||
m_ddsHandler->pacemaker()->addPort(m_webSocketHandler->listenPort(), Core::CorePortType::WebSocketServer);
|
||||
|
||||
if (bRet)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "pdm_handler.h"
|
||||
#include "main_handler.h"
|
||||
#include <ProjectDataManagement/pdm_dtc.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
namespace Buildings
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "ppm_handler.h"
|
||||
#include "main_handler.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
namespace Buildings
|
||||
{
|
||||
@@ -47,7 +48,7 @@ ParticipantManagement::ParticipantPosition PpmHandler::participantPosition(int p
|
||||
|
||||
void PpmHandler::onEquipmentExerciseMappingChanged(const ParticipantManagement::EquipmentExerciseMapping &data, DataModification modType)
|
||||
{
|
||||
if (data.exerciseId() != m_mainHandler->exerciseId())
|
||||
if (data.exerciseId != m_mainHandler->exerciseId())
|
||||
return;
|
||||
|
||||
m_equipmentNumber2ParticipantId.clear();
|
||||
@@ -55,8 +56,8 @@ void PpmHandler::onEquipmentExerciseMappingChanged(const ParticipantManagement::
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
for (const ParticipantManagement::Equipment2ParticipantId &e2p : data.mapping())
|
||||
m_equipmentNumber2ParticipantId[e2p.equipmentNumber()] = e2p.participantId();
|
||||
for (const ParticipantManagement::Equipment2ParticipantId &e2p : data.mapping)
|
||||
m_equipmentNumber2ParticipantId[e2p.equipmentNumber] = e2p.participantId;
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
break;
|
||||
@@ -69,10 +70,10 @@ void PpmHandler::onParticipantPositionChanged(const ParticipantManagement::Parti
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
m_participantPositions[data.participantId()] = data;
|
||||
m_participantPositions[data.participantId] = data;
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
m_participantPositions.remove(data.participantId());
|
||||
m_participantPositions.remove(data.participantId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <QtCore/QHash>
|
||||
#include "logger.h"
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ RelayInfoHandler::RelayInfoHandler(MainHandler *mainHandler)
|
||||
: QObject()
|
||||
, Interface::Fts::SetRelayInfoRequestHandler(mainHandler->ddsHandler()->fts())
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_logger(getLogger("RelayInfoHandler"))
|
||||
{}
|
||||
|
||||
RelayInfoHandler::~RelayInfoHandler()
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QHash>
|
||||
#include "logger.h"
|
||||
#include <bld_fts.h>
|
||||
|
||||
Reference in new issue
Block a user