Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
@@ -40,13 +40,13 @@ BuildingControlHandler::~BuildingControlHandler()
|
||||
|
||||
bool BuildingControlHandler::init()
|
||||
{
|
||||
DEBUG_LOG()<<"BuildingControlHandler::init exerciseId="<<m_mainHandler->exerciseId();
|
||||
DEBUG_LOG(m_logger)<<"BuildingControlHandler::init exerciseId="<<m_mainHandler->exerciseId();
|
||||
|
||||
const QString bcuName = QStringLiteral("BuildingControlUnit");
|
||||
m_bcuExecutableName = QStandardPaths::findExecutable(bcuName, { QCoreApplication::applicationDirPath()});
|
||||
if (m_bcuExecutableName.isEmpty())
|
||||
{
|
||||
WARNING_LOG() << "Executable " << bcuName << " not found - can not start building control unit processes!";
|
||||
WARNING_LOG(m_logger) << "Executable " << bcuName << " not found - can not start building control unit processes!";
|
||||
return false;
|
||||
}
|
||||
if (m_mainHandler->exerciseId() > 0)
|
||||
@@ -61,18 +61,18 @@ bool BuildingControlHandler::init()
|
||||
|
||||
const QMultiMap<qint64, Buildings::HistoryState> latestStates = recordReplay.getHistoryStateMap();
|
||||
|
||||
DEBUG_LOG() << "Starting to read HistoryStatedata from record replay. Size: "
|
||||
DEBUG_LOG(m_logger) << "Starting to read HistoryStatedata from record replay. Size: "
|
||||
<< latestStates.size();
|
||||
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() ))
|
||||
{
|
||||
DEBUG_LOG()<<"[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);
|
||||
DEBUG_LOG()<<"[INIT] [recordReplay]>>>>>>> "<<historyState;
|
||||
DEBUG_LOG(m_logger)<<"[INIT] [recordReplay]>>>>>>> "<<historyState;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -92,7 +92,7 @@ void BuildingControlHandler::onBuildingRemoved(int buildingId)
|
||||
|
||||
void BuildingControlHandler::onBuildingChanged(const BuildingInfo &buildingInfo, bool damageInit = false)
|
||||
{
|
||||
DEBUG_LOG() << "onBuildingChanged damageInit=" << damageInit
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged damageInit=" << damageInit
|
||||
<< " mseId=" << buildingInfo.mseId;
|
||||
auto it = m_buildings.find(buildingInfo.mseId);
|
||||
BuildingProcess *bldg = nullptr;
|
||||
@@ -103,7 +103,7 @@ void BuildingControlHandler::onBuildingChanged(const BuildingInfo &buildingInfo,
|
||||
buildingInfo,
|
||||
damageInit,
|
||||
this);
|
||||
DEBUG_LOG() << "onBuildingChanged m_buildings.insert mseId=" << buildingInfo.mseId;
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged m_buildings.insert mseId=" << buildingInfo.mseId;
|
||||
m_buildings.insert(buildingInfo.mseId, bldg);
|
||||
bldg->newRelayInfos(m_relayInfos);
|
||||
bldg->start();
|
||||
@@ -118,17 +118,17 @@ void BuildingControlHandler::onBuildingChanged(const BuildingInfo &buildingInfo,
|
||||
if ( m_historyStates.contains(buildingInfo.mseId))
|
||||
{
|
||||
historyState = m_historyStates.value(buildingInfo.mseId);
|
||||
DEBUG_LOG() << "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() << "onBuildingChanged setHistoryState insert historyState.mseId=" << historyState.mseId()
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState insert historyState.mseId=" << historyState.mseId()
|
||||
<< " buildingInfo.mseId=" << buildingInfo.mseId;
|
||||
m_historyStates.insert(historyState.mseId(), historyState);
|
||||
}
|
||||
DEBUG_LOG() << "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));
|
||||
}
|
||||
@@ -136,59 +136,59 @@ void BuildingControlHandler::onBuildingChanged(const BuildingInfo &buildingInfo,
|
||||
void BuildingControlHandler::onSetBuildingContaminationStateRequest(const rti::core::SampleIdentity &cookie,
|
||||
const SetBuildingContaminationStateRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onSetBuildingContaminationStateRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onSetBuildingContaminationStateRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onSetBuildingContaminationStateRequestInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG() << fro();
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->setBuildingContaminationStateReply(cookie, fro);
|
||||
}
|
||||
|
||||
void BuildingControlHandler::onSetBuildingStatesRequest(const rti::core::SampleIdentity &cookie,
|
||||
const SetBuildingStatesRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onSetBuildingStatesRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onSetBuildingStatesRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onSetBuildingStatesRequestInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG() << fro();
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->setBuildingStatesReply(cookie, fro);
|
||||
}
|
||||
|
||||
void BuildingControlHandler::onSetFortifyFactorRequest(const rti::core::SampleIdentity &cookie,
|
||||
const SetFortifyFactorRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onSetFortifyFactorRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onSetFortifyFactorRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onSetFortifyFactorRequestInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG() << fro();
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->setFortifyFactorReply(cookie, fro);
|
||||
}
|
||||
|
||||
void BuildingControlHandler::onSendCesHitOnBuildingRequest(const rti::core::SampleIdentity &cookie,
|
||||
const SendCesHitOnBuildingRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onSendCesHitOnBuildingRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onSendCesHitOnBuildingRequestInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG() << fro();
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->sendCesHitOnBuildingReply(cookie, fro);
|
||||
}
|
||||
|
||||
void BuildingControlHandler::onSendCesHit3DonBuildingRequest(const rti::core::SampleIdentity &cookie, const SendCesHit3DonBuildingRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onSendCesHit3DonBuildingRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onSendCesHit3DonBuildingRequestInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG() << fro();
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->sendCesHit3DonBuildingReply(cookie, fro);
|
||||
}
|
||||
|
||||
void BuildingControlHandler::onTriggerBsmFlashRequest(const rti::core::SampleIdentity &cookie,
|
||||
const TriggerBsmFlashRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onTriggerBsmFlashRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onTriggerBsmFlashRequest " << request;
|
||||
const Core::FunctionReplyObject fro = onTriggerBsmFlashInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG() << fro();
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->triggerBsmFlashReply(cookie, fro);
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ Core::FunctionReplyObject BuildingControlHandler::onSetFortifyFactorRequestInter
|
||||
|
||||
void BuildingControlHandler::setEffectStates(const int buildingId, const int assetId, const QByteArray &properties)
|
||||
{
|
||||
DEBUG_LOG() << "BuildingControlHandler::setEffectStates"
|
||||
DEBUG_LOG(m_logger) << "BuildingControlHandler::setEffectStates"
|
||||
<< " buildingId=" << buildingId
|
||||
<< " assetId=" << assetId
|
||||
<< " properties=" << properties;
|
||||
@@ -282,11 +282,11 @@ void BuildingControlHandler::onRelayInfoChanged(const AssetManagement::RelayInfo
|
||||
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSendCesHitOnBuildingRequestInternal(const SendCesHitOnBuildingRequest &data)
|
||||
{
|
||||
DEBUG_LOG() << "onSendCesHitOnBuildingRequestInternal";
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequestInternal";
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
if (it == m_buildings.end())
|
||||
{
|
||||
DEBUG_LOG() << "onSendCesHitOnBuildingRequestInternal return";
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequestInternal return";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
}
|
||||
|
||||
@@ -295,21 +295,21 @@ Core::FunctionReplyObject BuildingControlHandler::onSendCesHitOnBuildingRequestI
|
||||
data.aesId(), data.impactPosition(),
|
||||
QString::fromStdString(data.properties())))
|
||||
{
|
||||
DEBUG_LOG() << "onSendCesHitOnBuildingRequestInternal return Can not send ces hit to building control process";
|
||||
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."));
|
||||
}
|
||||
DEBUG_LOG() << "FunctionReplyObject";
|
||||
DEBUG_LOG(m_logger) << "FunctionReplyObject";
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSendCesHit3DonBuildingRequestInternal(const SendCesHit3DonBuildingRequest &data)
|
||||
{
|
||||
|
||||
DEBUG_LOG() << "onSendCesHit3DonBuildingRequestInternal";
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequestInternal";
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
if (it == m_buildings.end())
|
||||
{
|
||||
DEBUG_LOG() << "onSendCesHit3DonBuildingRequestInternal return";
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequestInternal return";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
}
|
||||
|
||||
@@ -318,16 +318,16 @@ Core::FunctionReplyObject BuildingControlHandler::onSendCesHit3DonBuildingReques
|
||||
data.aesId(), data.impactPosition(), data.detonationLocation(), data.detonationDistance(),
|
||||
QString::fromStdString(data.properties())))
|
||||
{
|
||||
DEBUG_LOG() << "onSendCesHit3DonBuildingRequestInternal return Can not send ces hit to building control process";
|
||||
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."));
|
||||
}
|
||||
DEBUG_LOG() << "FunctionReplyObject";
|
||||
DEBUG_LOG(m_logger) << "FunctionReplyObject";
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject BuildingControlHandler::onTriggerBsmFlashInternal(const TriggerBsmFlashRequest &data)
|
||||
{
|
||||
DEBUG_LOG() << "onTriggerBsmFlashInternal";
|
||||
DEBUG_LOG(m_logger) << "onTriggerBsmFlashInternal";
|
||||
|
||||
|
||||
{
|
||||
@@ -340,34 +340,34 @@ Core::FunctionReplyObject BuildingControlHandler::onTriggerBsmFlashInternal(cons
|
||||
BuildingInfo buildingInfo= bldg->buildingInfo();
|
||||
BsmInfo bsmInfo = buildingInfo.bsms.value(data.assetId());
|
||||
|
||||
DEBUG_LOG() << " BuildingId=" << data.buildingId()
|
||||
DEBUG_LOG(m_logger) << " BuildingId=" << data.buildingId()
|
||||
<< " assetId=" << bsmInfo.assetId
|
||||
<< " hostname=" << bsmInfo.hostname;
|
||||
|
||||
if (!bldg->triggerFlashlight(data))
|
||||
{
|
||||
DEBUG_LOG() << "onTriggerBsmFlashInternal return Can not send trigger flashlight to building control process";
|
||||
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"));
|
||||
}
|
||||
}
|
||||
DEBUG_LOG() << "FunctionReplyObject";
|
||||
DEBUG_LOG(m_logger) << "FunctionReplyObject";
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
void BuildingControlHandler::onSwitchRelayRequest(const rti::core::SampleIdentity &cookie,
|
||||
const SwitchRelayRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "SwitchRelayRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "SwitchRelayRequest " << request;
|
||||
|
||||
const Core::FunctionReplyObject fro = onSwitchRelayInternal(request);
|
||||
if (fro.error())
|
||||
WARNING_LOG() << fro();
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
m_mainHandler->ddsHandler()->fts()->switchRelayReply(cookie, fro);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSwitchRelayInternal(const SwitchRelayRequest &data)
|
||||
{
|
||||
DEBUG_LOG() << "onSwitchRelayInternal " << data;
|
||||
DEBUG_LOG(m_logger) << "onSwitchRelayInternal " << data;
|
||||
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());
|
||||
|
||||
Reference in new issue
Block a user