Adds immediate migration results in progress

This commit is contained in:
torsten committed 2026-08-19 11:18:24 +02:00
1 parent 8453e104c5
commit 3bb6e89496
2102 files changed
+17482 -15071

No files matched your search

@@ -80,22 +80,22 @@ void BuildingProcess::setBuildingInfo(const BuildingInfo &info)
void BuildingProcess::onStructureElementUpdateEffectOverrideReply(const Core::FunctionReplyObject &replyObject)
{
DEBUG_LOG() << "onSendCesHitReply for id " << replyObject.id() << " success= " << replyObject.error();
DEBUG_LOG(m_logger) << "onSendCesHitReply for id " << replyObject.id() << " success= " << replyObject.error();
}
bool BuildingProcess::start()
{
DEBUG_LOG() << "BuildingProcess::start mseId = " << m_buildingInfo.mseId
DEBUG_LOG(m_logger) << "BuildingProcess::start mseId = " << m_buildingInfo.mseId
<< " m_historyState.size() = " << m_historyState.stateHistory().size()
<< " m_initBuilding=" << m_initBuilding;
if (m_buildingInfo.mseId <= 0)
{
WARNING_LOG() << "No valid building information set - can not start building process";
WARNING_LOG(m_logger) << "No valid building information set - can not start building process";
return false;
}
if (m_proc.state() != QProcess::NotRunning)
{
WARNING_LOG() << "Process for building " << m_buildingInfo.mseId << " is already running!";
WARNING_LOG(m_logger) << "Process for building " << m_buildingInfo.mseId << " is already running!";
return false;
}
@@ -120,13 +120,13 @@ bool BuildingProcess::start()
const QByteArray bldCfgData = generateBuildingConfigData();
const QString effectConfigFilename = NGL::findFile(NGL::FileType::ConfigFile, QStringLiteral("effect_config.xml"));
WARNING_LOG() << "(effectConfigFilename) = " << effectConfigFilename;
WARNING_LOG(m_logger) << "(effectConfigFilename) = " << effectConfigFilename;
const QString bldDataFilename = tmpPath + QStringLiteral("bldg_%1_building_config.xml").arg(m_buildingInfo.mseId);
if (!writeFile(bldDataFilename, bldCfgData))
{
WARNING_LOG() << "(!writeFile(bldDataFilename, bldCfgData)";
WARNING_LOG(m_logger) << "(!writeFile(bldDataFilename, bldCfgData)";
return false;
}
@@ -134,7 +134,7 @@ bool BuildingProcess::start()
const QString chargesDataFilename = tmpPath + QStringLiteral("bldg_%1_charges.xml").arg(m_buildingInfo.mseId);
if (!writeFile(chargesDataFilename, chargesData))
{
WARNING_LOG() << "(!writeFile(chargesDataFilename, chargesData)";
WARNING_LOG(m_logger) << "(!writeFile(chargesDataFilename, chargesData)";
return false;
}
@@ -148,7 +148,7 @@ bool BuildingProcess::start()
if (!effectPtr)
continue;
DEBUG_LOG() << "effect->id=" << effectPtr->id
DEBUG_LOG(m_logger) << "effect->id=" << effectPtr->id
<< " effect->category=" << effectPtr->category
<< " effect->effectType=" << effectPtr->effectType
<< " effect->override=" << static_cast<int>(effectPtr->override);
@@ -201,9 +201,9 @@ void BuildingProcess::shutdown()
void BuildingProcess::setHistoryState(const Buildings::HistoryState &historyState)
{
DEBUG_LOG() << "BuildingProcess::setHistoryState size =" << historyState.stateHistory().size();
DEBUG_LOG(m_logger) << "BuildingProcess::setHistoryState size =" << historyState.stateHistory().size();
ERROR_LOG() << "[BuildingProcess::setHistoryState]>>> history =" << historyState;
ERROR_LOG(m_logger) << "[BuildingProcess::setHistoryState]>>> history =" << historyState;
m_historyState = historyState;
m_historyState.sampleTime(QDateTime::currentMSecsSinceEpoch());
m_mainHandler->ddsHandler()->dts()->publish(m_historyState);
@@ -211,7 +211,7 @@ void BuildingProcess::setHistoryState(const Buildings::HistoryState &historyStat
bool BuildingProcess::setVulnerabilityState(ProjectDataManagement::VulnerabilityState state, const std::vector<int> &roomIds)
{
DEBUG_LOG() << "BuildingProcess::setVulnerabilityState:" << state;
DEBUG_LOG(m_logger) << "BuildingProcess::setVulnerabilityState:" << state;
if (!m_wsSocket || !m_wsSocket->isValid())
return false;
BuildingControlUnit::Json::Telegrams::SetDamageState tele;
@@ -223,7 +223,7 @@ bool BuildingProcess::setVulnerabilityState(ProjectDataManagement::Vulnerability
tele.roomIds += m_buildingInfo.roomId2SubId.value(id);
tele.originatorId = 0;
DEBUG_LOG() << "setVulnerabilityState websocket send: " << QString::fromUtf8(tele.toJson());
DEBUG_LOG(m_logger) << "setVulnerabilityState websocket send: " << QString::fromUtf8(tele.toJson());
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
return true;
@@ -231,7 +231,7 @@ bool BuildingProcess::setVulnerabilityState(ProjectDataManagement::Vulnerability
bool BuildingProcess::setContaminationState(const int &bldId, const ContaminationState &contaminationState)
{
DEBUG_LOG() << "BuildingProcess::setContaminationState bldId: "<<bldId;
DEBUG_LOG(m_logger) << "BuildingProcess::setContaminationState bldId: "<<bldId;
if (!m_wsSocket || !m_wsSocket->isValid())
return false;
BuildingControlUnit::Json::Telegrams::SetContaminationState tele;
@@ -244,18 +244,18 @@ bool BuildingProcess::setContaminationState(const int &bldId, const Contaminatio
contState.rooms = contaminationState.rooms();
tele.contaminationStates.push_back(contState);
DEBUG_LOG() << "SetContaminationState websocket send: " << QString::fromUtf8(tele.toJson());
DEBUG_LOG(m_logger) << "SetContaminationState websocket send: " << QString::fromUtf8(tele.toJson());
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
return true;
}
bool BuildingProcess::resetContaminationState()
{
DEBUG_LOG() << "BuildingProcess::resetContaminationState" ;
DEBUG_LOG(m_logger) << "BuildingProcess::resetContaminationState" ;
if (!m_wsSocket || !m_wsSocket->isValid())
return false;
BuildingControlUnit::Json::Telegrams::ResetContaminationState tele;
DEBUG_LOG() << "ResetContaminationState websocket send: " << QString::fromUtf8(tele.toJson());
DEBUG_LOG(m_logger) << "ResetContaminationState websocket send: " << QString::fromUtf8(tele.toJson());
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
return true;
@@ -276,7 +276,7 @@ bool BuildingProcess::setFortifyFactors(const std::vector<Buildings::FortifyFact
tele.fortifyFactors.push_back(info);
}
DEBUG_LOG() << "setFortifyFactors websocket send: " << QString::fromUtf8(tele.toJson());
DEBUG_LOG(m_logger) << "setFortifyFactors websocket send: " << QString::fromUtf8(tele.toJson());
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
return true;
}
@@ -293,7 +293,7 @@ bool BuildingProcess::setEffectStates( const int assetId, const QByteArray &prop
if (!m_wsSocket || !m_wsSocket->isValid())
return false;
DEBUG_LOG() << "setEffectStates"
DEBUG_LOG(m_logger) << "setEffectStates"
<< " assetId=" << assetId
<< " properties=" << properties;
@@ -301,24 +301,24 @@ bool BuildingProcess::setEffectStates( const int assetId, const QByteArray &prop
{
for (const EgcuInfo &egcu : std::as_const(m_buildingInfo.egcus))
{
DEBUG_LOG() << "EGCU: " << egcu.assetName
DEBUG_LOG(m_logger) << "EGCU: " << egcu.assetName
<< " assetId=" << egcu.assetId
<< " egcu.assetId=" << egcu.assetId
<< " hostname=" << egcu.hostname;
if ( assetId == egcu.assetId)
{
DEBUG_LOG() << "segment=" << egcu.hostname;
DEBUG_LOG(m_logger) << "segment=" << egcu.hostname;
tele.segment = egcu.hostname;
}
}
if (tele.segment.isEmpty())
{
WARNING_LOG() << "Asset with id " << assetId << " not found in this building";
WARNING_LOG(m_logger) << "Asset with id " << assetId << " not found in this building";
return false;
}
if (tele.segment == QString())
{
ERROR_LOG() << "Asset with id=" << assetId << " has no Hostname!!!!";
ERROR_LOG(m_logger) << "Asset with id=" << assetId << " has no Hostname!!!!";
return false;
}
}
@@ -385,9 +385,9 @@ bool BuildingProcess::setEffectStates( const int assetId, const QByteArray &prop
}
QString valueStr = QString::fromUtf8(tele.toJson());
DEBUG_LOG() << "setEffectStates websocket send: " << valueStr;
DEBUG_LOG(m_logger) << "setEffectStates websocket send: " << valueStr;
qint64 sendBytesCount = m_wsSocket->sendTextMessage(valueStr);
DEBUG_LOG() << "sendBytesCount= " << sendBytesCount;
DEBUG_LOG(m_logger) << "sendBytesCount= " << sendBytesCount;
m_effectStates.insert(assetId, valueStr);
return true;
@@ -408,7 +408,7 @@ bool BuildingProcess::relayState(const std::vector<Buildings::RelayStateItem> &r
tele.relayStates.push_back(info);
}
DEBUG_LOG() << "relayState websocket send: " << QString::fromUtf8(tele.toJson());
DEBUG_LOG(m_logger) << "relayState websocket send: " << QString::fromUtf8(tele.toJson());
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
return true;
@@ -455,7 +455,7 @@ bool BuildingProcess::sendCesHitOnBuilding(const qint64 effectTimeMSec,
tele.relPosition.z = relPos.offsetZ();
tele.properties = properties;
DEBUG_LOG() << "sendCesHitOnBuilding websocket send: " << QString::fromUtf8(tele.toJson());
DEBUG_LOG(m_logger) << "sendCesHitOnBuilding websocket send: " << QString::fromUtf8(tele.toJson());
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
return true;
}
@@ -525,7 +525,7 @@ bool BuildingProcess::sendCesHit3DonBuilding(const qint64 effectTimeMSec, const
tele.detonationDistance = detonationDistance;
tele.properties = properties;
DEBUG_LOG() << "sendCesHit3DonBuilding websocket send: " << QString::fromUtf8(tele.toJson());
DEBUG_LOG(m_logger) << "sendCesHit3DonBuilding websocket send: " << QString::fromUtf8(tele.toJson());
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
return true;
}
@@ -536,7 +536,7 @@ bool BuildingProcess::switchRelay(const SwitchRelayRequest &data)
if (!m_wsSocket || !m_wsSocket->isValid())
return false;
DEBUG_LOG() << "switchRelay"
DEBUG_LOG(m_logger) << "switchRelay"
<< " buildingId=" << data.buildingId()
<< " assetId=" << data.assetId()
<< data.state();
@@ -544,10 +544,10 @@ bool BuildingProcess::switchRelay(const SwitchRelayRequest &data)
for (const EgcuInfo &egcu : std::as_const(m_buildingInfo.egcus))
{
DEBUG_LOG() << "EGCU: " << egcu.assetName
DEBUG_LOG(m_logger) << "EGCU: " << egcu.assetName
<< " assetId=" << egcu.assetId
<< " hostname=" << egcu.hostname;
DEBUG_LOG() << "data.assetId()=" << data.assetId()
DEBUG_LOG(m_logger) << "data.assetId()=" << data.assetId()
<< "egcu.assetId=" << egcu.assetId;
if ( data.assetId() != egcu.assetId)
continue;
@@ -561,7 +561,7 @@ bool BuildingProcess::switchRelay(const SwitchRelayRequest &data)
tele.switchRelayValues.delay = data.pulseAttributes().get().delay();
tele.switchRelayValues.pulse = data.pulseAttributes().get().pulse();
}
DEBUG_LOG() << "switchRelay websocket send: " << QString::fromUtf8(tele.toJson());
DEBUG_LOG(m_logger) << "switchRelay websocket send: " << QString::fromUtf8(tele.toJson());
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
return true;
}
@@ -574,7 +574,7 @@ bool BuildingProcess::triggerFlashlight(const TriggerBsmFlashRequest data)
if (!m_wsSocket || !m_wsSocket->isValid())
return false;
DEBUG_LOG() << "triggerFlashlight"
DEBUG_LOG(m_logger) << "triggerFlashlight"
<< " BuildingId=" << data.buildingId()
<< " assetId=" << data.assetId()
<< " m_buildingInfo.bsms.size()" << m_buildingInfo.bsms.size();
@@ -582,7 +582,7 @@ bool BuildingProcess::triggerFlashlight(const TriggerBsmFlashRequest data)
QMapIterator<int, BsmInfo> i(m_buildingInfo.bsms);
while (i.hasNext()) {
i.next();
DEBUG_LOG() << "key=" << i.key()
DEBUG_LOG(m_logger) << "key=" << i.key()
<< " assetId=" << i.value().assetId
<< " bsmId=" << i.value().bsmId
<< " hostname=" << i.value().hostname
@@ -592,7 +592,7 @@ bool BuildingProcess::triggerFlashlight(const TriggerBsmFlashRequest data)
if ( m_buildingInfo.bsms.contains(data.assetId()))
{
BsmInfo bsmInfo = m_buildingInfo.bsms.value(data.assetId());
DEBUG_LOG() << " BuildingId=" << data.buildingId()
DEBUG_LOG(m_logger) << " BuildingId=" << data.buildingId()
<< " assetId=" << bsmInfo.assetId
<< " hostname=" << bsmInfo.hostname;
@@ -601,7 +601,7 @@ bool BuildingProcess::triggerFlashlight(const TriggerBsmFlashRequest data)
tele.pauseBetweenFlashesSec = 0;
tele.sensorId = 0;
DEBUG_LOG() << "triggerFlashlight websocket send: " << QString::fromUtf8(tele.toJson());
DEBUG_LOG(m_logger) << "triggerFlashlight websocket send: " << QString::fromUtf8(tele.toJson());
m_wsSocket->sendTextMessage(QString::fromUtf8(tele.toJson()));
return true;
}
@@ -615,7 +615,7 @@ void BuildingProcess::onReadyRead()
if (data.contains(strToSearch))
{
m_wsUrl = data.split(strToSearch).at(1).split(QLatin1Char('\n')).at(0).trimmed();
INFO_LOG() << "Using web socket url '" << m_wsUrl << "' for building " << m_buildingInfo.mseId;
INFO_LOG(m_logger) << "Using web socket url '" << m_wsUrl << "' for building " << m_buildingInfo.mseId;
openWebSocket();
}
}
@@ -626,12 +626,12 @@ void BuildingProcess::onProcessFinished(int exitCode, QProcess::ExitStatus exitS
if (exitCode == 0 && exitStatus == QProcess::NormalExit)
return;
const char *what = exitStatus == QProcess::NormalExit ? "stopped" : "crashed";
WARNING_LOG() << "building control process for building " << m_buildingInfo.mseId
WARNING_LOG(m_logger) << "building control process for building " << m_buildingInfo.mseId
<< " " << what << " with exit code " << exitCode << " - restarting in 1 second";
if (exitCode != 0)
{
WARNING_LOG() << "stdout: " << m_proc.readAllStandardOutput();
WARNING_LOG() << "stderr: " << m_proc.readAllStandardError();
WARNING_LOG(m_logger) << "stdout: " << m_proc.readAllStandardOutput();
WARNING_LOG(m_logger) << "stderr: " << m_proc.readAllStandardError();
}
closeWebSocket();
QTimer::singleShot(1000, this, &BuildingProcess::start);
@@ -639,12 +639,12 @@ void BuildingProcess::onProcessFinished(int exitCode, QProcess::ExitStatus exitS
void BuildingProcess::onTextMessageReceived(const QString &message)
{
TRACE_LOG() << "Got message from building control process: " << message;
TRACE_LOG(m_logger) << "Got message from building control process: " << message;
BuildingControlUnit::Json::Telegrams::BaseTelegram *tel =
BuildingControlUnit::Json::Telegrams::BaseTelegram::telegramFromJson(message.toUtf8());
if (!tel)
{
WARNING_LOG() << "Can not convert '" << message << "' to a valid telegram!";
WARNING_LOG(m_logger) << "Can not convert '" << message << "' to a valid telegram!";
return;
}
if (tel->telegramId() == BuildingControlUnit::Json::Telegrams::BsmState::telegramId())
@@ -656,7 +656,7 @@ void BuildingProcess::onTextMessageReceived(const QString &message)
else if (tel->telegramId() == BuildingControlUnit::Json::Telegrams::EffectOverride::telegramId())
handleEffectOverride(static_cast<BuildingControlUnit::Json::Telegrams::EffectOverride *>(tel));
else
WARNING_LOG() << "Unhandled incoming telegram with id '" << tel->telegramId() << "'";
WARNING_LOG(m_logger) << "Unhandled incoming telegram with id '" << tel->telegramId() << "'";
delete tel;
}
@@ -692,7 +692,7 @@ void BuildingProcess::historyState(const BuildingState &state)
&& state.originatorParticipantId() == 0
&& state.contaminationStates().size() == 0)
{
DEBUG_LOG() << "setVulnerabilityState->removeHistoryStateByKey:" << state.id();
DEBUG_LOG(m_logger) << "setVulnerabilityState->removeHistoryStateByKey:" << state.id();
m_historyState.stateHistory().resize(0);
}
@@ -708,10 +708,10 @@ void BuildingProcess::historyState(const BuildingState &state)
historyStateItem.contaminationStates() = state.contaminationStates();
m_historyState.stateHistory().push_back(std::move(historyStateItem));
DEBUG_LOG() << "BuildingProcess::historyState contaminationStates:" << state;
DEBUG_LOG(m_logger) << "BuildingProcess::historyState contaminationStates:" << state;
m_historyState.mseId(state.id());
DEBUG_LOG() << "setVulnerabilityState->removeHistoryStateByKey:" << m_historyState.mseId();
DEBUG_LOG(m_logger) << "setVulnerabilityState->removeHistoryStateByKey:" << m_historyState.mseId();
m_historyState.sampleTime(QDateTime::currentMSecsSinceEpoch());
m_mainHandler->ddsHandler()->dts()->publish(m_historyState);
}
@@ -721,16 +721,16 @@ void BuildingProcess::handleHitResult(BuildingControlUnit::Json::Telegrams::HitR
const BuildingControlUnit::Json::Telegrams::HitResult::HitResultInfo &data = tel->hitResult;
BuildingState state;
DEBUG_LOG() << Q_FUNC_INFO << " data.hitOnRoomId=" << data.hitOnRoomId;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " data.hitOnRoomId=" << data.hitOnRoomId;
state.id(m_buildingInfo.mseId);
int assetId = m_mainHandler->ddsHandler()->dtcIsm()->getAssetIdFromMountingPointId(m_buildingInfo.mseId, data.sensorId);
DEBUG_LOG() << "handleHitResult assetId=" << assetId;
DEBUG_LOG(m_logger) << "handleHitResult assetId=" << assetId;
state.assetId(assetId);
InfrastructureManagement::StructureElement se;
m_mainHandler->ddsHandler()->dtcIsm()->getStructureElementInMntPointAssetByAssetId(assetId, se);
DEBUG_LOG() << "handleHitResult structureElementId=" << se.id();
DEBUG_LOG(m_logger) << "handleHitResult structureElementId=" << se.id();
state.structureElementId(se.id());
state.sampleTime(QDateTime::currentMSecsSinceEpoch());
if (data.originatorType == BuildingControlUnit::OriginatorType::DirectHit)
@@ -808,7 +808,7 @@ void BuildingProcess::handleReconnectEgcu(const QString &segment)
DEBUG_LOG() << "handleReconnectEgcu segment =" << segment;
DEBUG_LOG(m_logger) << "handleReconnectEgcu segment =" << segment;
for (const EgcuInfo &egcu : std::as_const(m_buildingInfo.egcus))
{
@@ -817,7 +817,7 @@ void BuildingProcess::handleReconnectEgcu(const QString &segment)
const auto keys = m_effectOverridesReconnect.keys();
for (const int &relayId : keys)
{
DEBUG_LOG() << "RelayId=" << relayId
DEBUG_LOG(m_logger) << "RelayId=" << relayId
<< " Override=" << m_effectOverridesReconnect.value(relayId);
if (m_effectOverridesReconnect.value(relayId) >= 0)
@@ -827,7 +827,7 @@ void BuildingProcess::handleReconnectEgcu(const QString &segment)
int structureElementIdMp = m_mainHandler->ddsHandler()->dtcIsm()->getStructueElementIdFromAssetId(egcu.assetId);
DEBUG_LOG() << "EGCU: " << egcu.assetName
DEBUG_LOG(m_logger) << "EGCU: " << egcu.assetName
<< " assetId=" << egcu.assetId
<< " hostname='" << egcu.hostname
<< "' buildingName=" << egcu.buildingName
@@ -840,9 +840,9 @@ void BuildingProcess::handleReconnectEgcu(const QString &segment)
request.structureElementId(structureElementIdMp);
request.effectId(relayId);
request.effectOverride(override);
DEBUG_LOG() << "Vor structureElementUpdateEffectOverrideRequest";
DEBUG_LOG(m_logger) << "Vor structureElementUpdateEffectOverrideRequest";
int result = m_mainHandler->ismHandler()->ftcIsm()->structureElementUpdateEffectOverrideRequest(request, this);
DEBUG_LOG() << "Nach structureElementUpdateEffectOverrideRequest result=" << result;
DEBUG_LOG(m_logger) << "Nach structureElementUpdateEffectOverrideRequest result=" << result;
}
}
break;
@@ -855,7 +855,7 @@ void BuildingProcess::handleRelayState(BuildingControlUnit::Json::Telegrams::Rel
{
RelayState state;
DEBUG_LOG() << "handleRelayState EGCU:" << tel->segment
DEBUG_LOG(m_logger) << "handleRelayState EGCU:" << tel->segment
<< " m_buildingInfo.egcus.size()=" << m_buildingInfo.egcus.size()
<< " stateTime=" << tel->stateTime
<< " offlineTime=" << tel->offlineTime;
@@ -871,7 +871,7 @@ void BuildingProcess::handleRelayState(BuildingControlUnit::Json::Telegrams::Rel
{
if (QString::compare(egcu.hostname,tel->segment, Qt::CaseInsensitive) == 0)
{
DEBUG_LOG() << "EGCU: " << egcu.assetName
DEBUG_LOG(m_logger) << "EGCU: " << egcu.assetName
<< " assetId=" << egcu.assetId
<< " hostname='" << egcu.hostname
<< "' buildingName=" << egcu.buildingName;
@@ -897,18 +897,18 @@ void BuildingProcess::handleRelayState(BuildingControlUnit::Json::Telegrams::Rel
void BuildingProcess::handleEffectOverride(BuildingControlUnit::Json::Telegrams::EffectOverride *tel)
{
DEBUG_LOG() << "BuildingProcess::handleEffectOverride"
DEBUG_LOG(m_logger) << "BuildingProcess::handleEffectOverride"
<< " tel->overrides.size=" << tel->overrides.size();
InfrastructureManagement::StructureElementUpdateEffectOverrideRequest request;
for ( int i = 0; i < m_buildingInfo.egcus.size(); i++)
{
DEBUG_LOG() << "BuildingProcess::handleEffectOverride i=" << i;
DEBUG_LOG(m_logger) << "BuildingProcess::handleEffectOverride i=" << i;
if ( m_buildingInfo.egcus[i].hostname.toLower() == tel->segment)
{
int structureElementIdMp = m_mainHandler->ddsHandler()->dtcIsm()->getStructueElementIdFromAssetId( m_buildingInfo.egcus.at(i).assetId);
DEBUG_LOG() << "BuildingProcess::handleEffectOverride i=" << i
DEBUG_LOG(m_logger) << "BuildingProcess::handleEffectOverride i=" << i
<< " mountPointId=" << m_buildingInfo.egcus.at(i).mountPointId
<< " assetId=" << m_buildingInfo.egcus.at(i).assetId
<< " structureElementId=" << m_buildingInfo.structureElementId
@@ -938,14 +938,14 @@ void BuildingProcess::handleEffectOverride(BuildingControlUnit::Json::Telegrams:
break;
}
}
DEBUG_LOG() << "Send Override Request"
DEBUG_LOG(m_logger) << "Send Override Request"
<< " structureElementId=" << request.structureElementId()
<< " effectId=" << request.effectId()
<< " effectOverride=" << request.effectOverride();
if ( request.structureElementId() > 0)
m_mainHandler->ddsHandler()->ftcIsm()->structureElementUpdateEffectOverrideRequest(request, this);
else
ERROR_LOG() << "request.structureElementId() =" << request.structureElementId() << " NOT VALID!!!";
ERROR_LOG(m_logger) << "request.structureElementId() =" << request.structureElementId() << " NOT VALID!!!";
}
}
}
@@ -1016,12 +1016,12 @@ bool BuildingProcess::writeFile(const QString &fn, const QByteArray &data)
QFile f(fn);
if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate))
{
WARNING_LOG() << "Can not open file '" << fn << "' - error: " << f.errorString();
WARNING_LOG(m_logger) << "Can not open file '" << fn << "' - error: " << f.errorString();
return false;
}
if (f.write(data) != data.size())
{
WARNING_LOG() << "Can not write data to file '" << fn << "' - error: " << f.errorString();
WARNING_LOG(m_logger) << "Can not write data to file '" << fn << "' - error: " << f.errorString();
return false;
}
return true;
@@ -1112,7 +1112,7 @@ QByteArray BuildingProcess::generateChargesData() const
auto it = chargeTypes.find(charge.chargeTypeId());
if (it == chargeTypes.end())
{
WARNING_LOG() << "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;
}
@@ -1154,7 +1154,7 @@ void BuildingProcess::openWebSocket()
this, &BuildingProcess::onWebSocketDisconnected);
connect(m_wsSocket, &QWebSocket::textMessageReceived,
this, &BuildingProcess::onTextMessageReceived);
WARNING_LOG() << "openWebSocket:" << m_wsUrl.toLocal8Bit()
WARNING_LOG(m_logger) << "openWebSocket:" << m_wsUrl.toLocal8Bit()
<< " (buildingId: " << m_buildingInfo.mseId << ") - socket: " << m_wsSocket;
m_wsSocket->open(QUrl::fromEncoded(m_wsUrl.toLocal8Bit()));
}
@@ -1163,7 +1163,7 @@ void BuildingProcess::closeWebSocket()
{
if (m_wsSocket)
{
WARNING_LOG() << "closeWebSocket (buildingId : " << m_buildingInfo.mseId << ") - socket: " << m_wsSocket
WARNING_LOG(m_logger) << "closeWebSocket (buildingId : " << m_buildingInfo.mseId << ") - socket: " << m_wsSocket
<< " localPort=" << m_wsSocket->localPort() << ", error: " << ", " << m_wsSocket->errorString();
m_wsSocket->disconnect(this);
m_wsSocket->close();
@@ -1177,7 +1177,7 @@ void BuildingProcess::onWebSocketError(QAbstractSocket::SocketError error)
{
if (!m_wsSocket)
return;
WARNING_LOG() << "Error connecting to " << m_wsSocket->peerAddress().toString() << ": " << error
WARNING_LOG(m_logger) << "Error connecting to " << m_wsSocket->peerAddress().toString() << ": " << error
<< " (buildingId: " << m_buildingInfo.mseId << ") - socket: " << m_wsSocket;
closeWebSocket();
m_wsReconnectTimer->start(1000);
@@ -1185,22 +1185,22 @@ void BuildingProcess::onWebSocketError(QAbstractSocket::SocketError error)
void BuildingProcess::onWebSocketConnected()
{
INFO_LOG() << "connected to building control process " << m_buildingInfo.mseId << " via websockets localPort="<<m_wsSocket->localPort();
INFO_LOG(m_logger) << "connected to building control process " << m_buildingInfo.mseId << " via websockets localPort="<<m_wsSocket->localPort();
QMapIterator<int, QString> i(m_effectStates);
while (i.hasNext()) {
i.next();
DEBUG_LOG() << "setEffectStates websocket send: " << i.value();
DEBUG_LOG(m_logger) << "setEffectStates websocket send: " << i.value();
qint64 sendBytesCount = m_wsSocket->sendTextMessage(i.value());
DEBUG_LOG() << "sendBytesCount= " << sendBytesCount;
DEBUG_LOG(m_logger) << "sendBytesCount= " << sendBytesCount;
}
m_wsReconnectTimer->stop();
}
void BuildingProcess::onWebSocketDisconnected()
{
WARNING_LOG() << "Websocket to " << m_wsUrl << " closed - trying to reconnect in 1 sec"
WARNING_LOG(m_logger) << "Websocket to " << m_wsUrl << " closed - trying to reconnect in 1 sec"
<< " (buildingId : " << m_buildingInfo.mseId << ") - socket: " << m_wsSocket
<< " localPort=" << m_wsSocket->localPort();
closeWebSocket();