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

@@ -42,7 +42,7 @@ IsmImportBuildings::IsmImportBuildings(QObject *parent)
// ------------------------------------------------------------------------------
bool IsmImportBuildings::init(int domainId, const QUrl &tcpDiscoveryUrl)
{
INFO_LOG() << "init begin";
INFO_LOG(m_logger) << "init begin";
// initialize DDS, always on exercise 0
m_ddsConnector.reset(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Global, 0, 0, tcpDiscoveryUrl));
@@ -50,13 +50,13 @@ bool IsmImportBuildings::init(int domainId, const QUrl &tcpDiscoveryUrl)
return false;
m_ddsConnector->initPublisherSubscriber();
DEBUG_LOG() << "create dtc";
DEBUG_LOG(m_logger) << "create dtc";
m_dtc = InfrastructureManagement::Interface::Dtc::create(m_ddsConnector);
DEBUG_LOG() << "create ftc";
DEBUG_LOG(m_logger) << "create ftc";
m_ftc = InfrastructureManagement::Interface::Ftc::create(m_ddsConnector);
DEBUG_LOG() << "init dtc & ftc";
DEBUG_LOG(m_logger) << "init dtc & ftc";
bool bRet = m_ftc->enableMainStructureElementModify() &&
m_ftc->enableMainStructureElementRemove() &&
m_ftc->enableMountingPointAssetRemove() &&
@@ -68,9 +68,9 @@ bool IsmImportBuildings::init(int domainId, const QUrl &tcpDiscoveryUrl)
m_dtc->enableMountingPointAsset() &&
m_dtc->enableMainSchedule();
DEBUG_LOG() << "init dtc, ftc end - bRet = " << bRet;
DEBUG_LOG(m_logger) << "init dtc, ftc end - bRet = " << bRet;
DEBUG_LOG() << "Domain Id = " << domainId;
DEBUG_LOG(m_logger) << "Domain Id = " << domainId;
return bRet;
}
@@ -91,7 +91,7 @@ void IsmImportBuildings::import(const QVector<ImportData> &importData)
QCoreApplication::quit();
return;
}
DEBUG_LOG() << "Trying to import " << m_importData.size() << " buildings";
DEBUG_LOG(m_logger) << "Trying to import " << m_importData.size() << " buildings";
m_curImportIdx = 0;
import(m_importData.at(m_curImportIdx));
}
@@ -146,11 +146,11 @@ void IsmImportBuildings::remove(int buildingId)
QMap<int, QVector<InfrastructureManagement::InstrumentationAsset>> assetsMapBuilding;
m_dtc->getAllAssetsPerBuilding(predicate, assetsMapBuilding);
DEBUG_LOG() << "assetsMapBuilding.size = " << assetsMapBuilding.size();
DEBUG_LOG(m_logger) << "assetsMapBuilding.size = " << assetsMapBuilding.size();
assetsMounted = (assetsMapBuilding[buildingId].size() > 0);
DEBUG_LOG() << "Building id = " << buildingId << " has assets mounted = " << assetsMounted;
DEBUG_LOG(m_logger) << "Building id = " << buildingId << " has assets mounted = " << assetsMounted;
// cfroebel 2018-11-30:
// Currently the ISM service fails to correctly remove a building when it has mounted assets (other than BCU).
@@ -159,7 +159,7 @@ void IsmImportBuildings::remove(int buildingId)
if (assetsMounted)
{
QString msg = QStringLiteral("Not possible to remove building with id %1 because there are assets mounted!").arg(buildingId);
ERROR_LOG() << msg;
ERROR_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
m_idsToBeRemoved.pop_front();
IsmImportBuildings::removeNext();
@@ -171,7 +171,7 @@ void IsmImportBuildings::remove(int buildingId)
// ------------------------------------------------------------------------------
void IsmImportBuildings::doImport()
{
INFO_LOG() << "trying to Import / Modify";
INFO_LOG(m_logger) << "trying to Import / Modify";
ParseBuildingXml buildingXml(m_currentData.xmlFileName,
m_currentData.vulFileName,
m_currentData.egcuToRoomFileName,
@@ -180,21 +180,21 @@ void IsmImportBuildings::doImport()
m_currentData.angleDegree);
if (!buildingXml.parseXml())
{
ERROR_LOG() << "Can not parse building files: " << buildingXml.lastError();
ERROR_LOG(m_logger) << "Can not parse building files: " << buildingXml.lastError();
std::cerr << "Can not parse building files name: " << m_currentData.xmlFileName
<< " error: " << buildingXml.lastError() << std::endl;
QCoreApplication::exit(1);
return;
}
INFO_LOG() << "Sending request";
INFO_LOG(m_logger) << "Sending request";
MainStructureElementModifyRequest req = buildingXml.parsedRequest();
QByteArray propertiesBa = QByteArray::fromStdString(req.properties());
QJsonParseError parserError;
const QJsonDocument doc(QJsonDocument::fromJson(propertiesBa, &parserError));
if (parserError.error != QJsonParseError::NoError)
WARNING_LOG() << "Error parsing json document: " << parserError.errorString() << " '" << propertiesBa << "'";
DEBUG_LOG() << "json to parse: " << doc.toJson();
WARNING_LOG(m_logger) << "Error parsing json document: " << parserError.errorString() << " '" << propertiesBa << "'";
DEBUG_LOG(m_logger) << "json to parse: " << doc.toJson();
QJsonObject obj(doc.object());
if (m_currentData.exerciseId > 0)
{
@@ -220,11 +220,11 @@ void IsmImportBuildings::doImport()
{
m_isInRestoringMode = true;
msg = "Building " + req.name() + " already exists. All related data is now saved.";
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
msg = "Fetching IDs of MountingPints.";
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
QVector<qint32> mountingPointIds;
for (const StructureElement &structureElement : oldMainStructureElement.elements())
@@ -235,7 +235,7 @@ void IsmImportBuildings::doImport()
}
msg = "Fetching MountingPointAssets.";
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
// get mountings of mounting points of this building
mountings = mountingsOfStructureElements(mountingPointIds);
@@ -244,7 +244,7 @@ void IsmImportBuildings::doImport()
if (!mountings.isEmpty())
{
msg = "Removing MountingPointAssets.";
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
unmountAssetsOfBuliding(oldMainStructureElement.id());
// // remove mounting point assets
@@ -256,7 +256,7 @@ void IsmImportBuildings::doImport()
}
msg = "Fetching MountingPointPlans.";
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
// get mounting points in plans of this building
auto mppsBySchedule = MountingPointPlanByScheduleOfStructureElements(mountingPointIds);
@@ -264,14 +264,14 @@ void IsmImportBuildings::doImport()
// Don't know, why these are deleted anyways...
for (auto it = mppsBySchedule.cbegin(); it != mppsBySchedule.cend(); ++it)
{
INFO_LOG() << "Removing MountingPointPlans.";
INFO_LOG(m_logger) << "Removing MountingPointPlans.";
auto copy = it.value();
for (auto &elem : copy)
elem.mountingPointState() = MountingPointState_def::Idle;
m_ftc->mountingPointPlanModifyRequest(MountingPointPlanModifyRequest(it.key(),copy), this);
}
msg = "Fetching paths of MountingPoints by name ... for later reconstruction.";
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
for (const StructureElement &structureElement : oldMainStructureElement.elements())
oldNamePaths.insert(structureElement.id(), pathWithNames(structureElement, oldMainStructureElement));
@@ -300,11 +300,11 @@ void IsmImportBuildings::doImport()
void IsmImportBuildings::doRemove(int buildingId)
{
std::string msg = "Trying to Remove building with id " + QString::number(buildingId).toStdString();
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
if (!m_ftc->mainStructureElementRemoveRequest(MainStructureElementRemoveRequest(buildingId), this))
{
ERROR_LOG() << "Error requesting remove";
ERROR_LOG(m_logger) << "Error requesting remove";
std::cerr << "Error requesting remove" << std::endl;
QCoreApplication::exit(1);
return;
@@ -402,19 +402,19 @@ StructureElement IsmImportBuildings::structureElementById(qint32 id, const MainS
void IsmImportBuildings::createNewMainStructureElement(const MainStructureElementModifyRequest &request)
{
std::string msg = "Creating new MainStructureElement.";
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
if (!m_ftc->mainStructureElementModifyRequest(request, this))
{
if (m_currentData.buildingId > 0)
ERROR_LOG() << "Error requesting update";
ERROR_LOG(m_logger) << "Error requesting update";
else
ERROR_LOG() << "Error requesting create";
ERROR_LOG(m_logger) << "Error requesting create";
std::cerr << "Error requesting update/create" << std::endl;
QCoreApplication::exit(1);
return;
}
INFO_LOG() << "Waiting for answer";
INFO_LOG(m_logger) << "Waiting for answer";
}
// ------------------------------------------------------------------------------
@@ -442,12 +442,12 @@ void IsmImportBuildings::restoreData(const MainStructureElement &oldMainStructur
newMountingPointIds.append(structureElement.id());
}
QMap<qint32, QVector<std::string> > newNamePaths;
INFO_LOG() << "Restoring mounting point data.";
INFO_LOG(m_logger) << "Restoring mounting point data.";
for (const StructureElement &structureElement : newMainStructureElement.elements())
newNamePaths.insert(structureElement.id(), pathWithNames(structureElement, oldMainStructureElement));
if (oldNamePaths.size() != newNamePaths.size())
INFO_LOG() << "old name path size: " + QString::number(oldNamePaths.size()).toStdString() + " , new name path size: " + QString::number(newNamePaths.size()).toStdString();;
INFO_LOG(m_logger) << "old name path size: " + QString::number(oldNamePaths.size()).toStdString() + " , new name path size: " + QString::number(newNamePaths.size()).toStdString();;
QMap<qint32, qint32> oldStructureElementIdToNewStructureElementId;
for (auto it = oldNamePaths.constBegin(); it != oldNamePaths.constEnd(); ++it)
@@ -484,7 +484,7 @@ void IsmImportBuildings::restoreData(const MainStructureElement &oldMainStructur
if (!mountings.isEmpty())
{
msg = "Restoring MountingPointAssets.";
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
// restore mountings
for (const MountingPointAsset &mountingPointAsset : mountings)
@@ -508,7 +508,7 @@ void IsmImportBuildings::restoreData(const MainStructureElement &oldMainStructur
return;
msg = "Restoring MountingPointPlans.";
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
// restore mounting point plans
MountingPointPlanModifyRequest createRequest;
@@ -546,7 +546,7 @@ void IsmImportBuildings::unmountAssetsOfBuliding(qint32 buildingId)
{
msg = "Waiting for socket to open";
std::cerr << msg << std::endl;
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
QThread::sleep(1);
}
@@ -563,7 +563,7 @@ void IsmImportBuildings::unmountAssetsOfBuliding(qint32 buildingId)
{
std::string msg = "Got reply: " + message.toStdString();
std::cerr << msg << std::endl;
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
hasAnswer = true;
});
@@ -573,7 +573,7 @@ void IsmImportBuildings::unmountAssetsOfBuliding(qint32 buildingId)
{
msg = "Waiting for socket to answer";
std::cerr << msg << std::endl;
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
QThread::sleep(1);
}
@@ -597,13 +597,13 @@ void IsmImportBuildings::onMainStructureElementRemoveReply(const Core::FunctionR
if (replyObject.error())
{
QString msg = QStringLiteral("Failed to remove building with id %1: %2").arg(buildingId).arg(QString::fromStdString(replyObject()));
ERROR_LOG() << msg;
ERROR_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
}
else
{
QString msg = QStringLiteral("Removed building with id %1").arg(buildingId);
INFO_LOG() << msg;
INFO_LOG(m_logger) << msg;
std::cerr << msg << std::endl;
}
@@ -618,7 +618,7 @@ void IsmImportBuildings::onMountingPointPlanModifyReply(const Core::FunctionRepl
{
if (reply.error())
{
ERROR_LOG() << reply.error();
ERROR_LOG(m_logger) << reply.error();
std::cerr << reply.error() << std::endl;
}
}
@@ -626,10 +626,10 @@ void IsmImportBuildings::onMountingPointPlanModifyReply(const Core::FunctionRepl
// ------------------------------------------------------------------
void IsmImportBuildings::onMountingPointAssetRemoveReply(const Core::FunctionReplyObject &reply)
{
ERROR_LOG() << "REMOVE REPLY";
ERROR_LOG(m_logger) << "REMOVE REPLY";
if (reply.error())
{
ERROR_LOG() << reply.error();
ERROR_LOG(m_logger) << reply.error();
std::cerr << reply.error() << std::endl;
}
}
@@ -639,7 +639,7 @@ void IsmImportBuildings::onMountingPointAssetModifyReply(const Core::FunctionRep
{
if (reply.error())
{
ERROR_LOG() << reply.error();
ERROR_LOG(m_logger) << reply.error();
std::cerr << reply.error() << std::endl;
}
}
@@ -649,7 +649,7 @@ void IsmImportBuildings::onStructureElementModifyReply(const Core::FunctionReply
{
if (reply.error())
{
ERROR_LOG() << reply.error();
ERROR_LOG(m_logger) << reply.error();
std::cerr << reply.error() << std::endl;
}
}
@@ -659,7 +659,7 @@ bool IsmImportBuildings::handleReply(const Core::FunctionReplyObject &replyObjec
{
if (replyObject.error())
{
ERROR_LOG() << "Got Reply error: " << replyObject.translated();
ERROR_LOG(m_logger) << "Got Reply error: " << replyObject.translated();
std::cerr << "Error importing building" << std::endl;
QCoreApplication::exit(1);
return false;
@@ -63,7 +63,7 @@ IsmTests::~IsmTests()
// ------------------------------------------------------------------------------
bool IsmTests::init(int domainId, int testId, int assetId, int mainStructureElementId, int structureElementId, int indexNo)
{
INFO_LOG() << "init begin";
INFO_LOG(m_logger) << "init begin";
m_testId = testId;
m_assetId = assetId;
@@ -81,30 +81,30 @@ bool IsmTests::init(int domainId, int testId, int assetId, int mainStructureElem
m_dbHandler = std::make_shared<DbHandler>();
if(!m_dbHandler->init(0, Settings::settings()))
{
ERROR_LOG() << "Initialisation dbHandler failed.";
ERROR_LOG(m_logger) << "Initialisation dbHandler failed.";
return false;
}
DEBUG_LOG() << "Initialisation dbHandler succesful.";
DEBUG_LOG(m_logger) << "Initialisation dbHandler succesful.";
m_db = m_dbHandler->db();
TRACE_LOG() << "create dtc";
TRACE_LOG(m_logger) << "create dtc";
m_dtc = InfrastructureManagement::Interface::Dtc::create(m_ddsConnector);
TRACE_LOG() << "init dtc";
TRACE_LOG(m_logger) << "init dtc";
bool bRet = m_dtc->enableAll();
TRACE_LOG() << "init dtc end - bRet = " << bRet;
TRACE_LOG(m_logger) << "init dtc end - bRet = " << bRet;
TRACE_LOG() << "create ftc";
TRACE_LOG(m_logger) << "create ftc";
m_ftc = InfrastructureManagement::Interface::Ftc::create(m_ddsConnector);
TRACE_LOG() << "init ftc";
TRACE_LOG(m_logger) << "init ftc";
bRet &= m_ftc->enableAll();
TRACE_LOG() << "init ftc end - bRet = " << bRet;
TRACE_LOG(m_logger) << "init ftc end - bRet = " << bRet;
DEBUG_LOG() << "########### Domain Id = " << domainId;
DEBUG_LOG() << "########### Test Id = " << testId;
DEBUG_LOG() << "########### Asset Id = " << assetId;
DEBUG_LOG() << "########### Main Structure Element Id = " << mainStructureElementId;
DEBUG_LOG() << "########### Structure Element Id = " << structureElementId;
DEBUG_LOG() << "########### Index No = " << indexNo;
DEBUG_LOG(m_logger) << "########### Domain Id = " << domainId;
DEBUG_LOG(m_logger) << "########### Test Id = " << testId;
DEBUG_LOG(m_logger) << "########### Asset Id = " << assetId;
DEBUG_LOG(m_logger) << "########### Main Structure Element Id = " << mainStructureElementId;
DEBUG_LOG(m_logger) << "########### Structure Element Id = " << structureElementId;
DEBUG_LOG(m_logger) << "########### Index No = " << indexNo;
return bRet;
}
@@ -112,7 +112,7 @@ bool IsmTests::init(int domainId, int testId, int assetId, int mainStructureElem
// ------------------------------------------------------------------------------
void IsmTests::startTest()
{
INFO_LOG() << "********* startTest **************";
INFO_LOG(m_logger) << "********* startTest **************";
// main structure elements
switch (m_testId)
{
@@ -179,7 +179,7 @@ void IsmTests::startTest()
failExit();
break;
}
INFO_LOG() << "********* endTest **************";
INFO_LOG(m_logger) << "********* endTest **************";
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
@@ -197,7 +197,7 @@ static void addElementToRequest(MainStructureElementModifyRequest &request,
// ------------------------------------------------------------------------------
void IsmTests::tryCreateMainStructureElement()
{
INFO_LOG() << "trying to send MainStructureElementCreateRequest";
INFO_LOG(m_logger) << "trying to send MainStructureElementCreateRequest";
MainStructureElementModifyRequest data;
@@ -443,7 +443,7 @@ void IsmTests::tryCreateMainStructureElement()
// if (!m_ftc->mainStructureElementModifyRequest(data, this))
// {
// ERROR_LOG() << "Error requesting create data (building)";
// ERROR_LOG(m_logger) << "Error requesting create data (building)";
// failExit();
// }
@@ -453,18 +453,18 @@ void IsmTests::tryCreateMainStructureElement()
// ------------------------------------------------------------------------------
void IsmTests::tryModifyMainStructureElement()
{
INFO_LOG() << "trying to send MainStructureElementModifyRequest ";
INFO_LOG(m_logger) << "trying to send MainStructureElementModifyRequest ";
m_dtc->waitForHistoricalDataMainStructureElement();
InfrastructureManagement::MainStructureElement mse = m_dtc->mainStructureElement(m_mainStructureElementId);
InfrastructureManagement::MainStructureElementModifyRequest data;
if (mse.id() == 0)
{
ERROR_LOG() << "Error requesting modify data";
ERROR_LOG(m_logger) << "Error requesting modify data";
failExit();
}
DEBUG_LOG() << "Modify MainStructureElement with id = " << mse.id();
DEBUG_LOG(m_logger) << "Modify MainStructureElement with id = " << mse.id();
// creating ModifyRequest
data.id(mse.id());
@@ -484,7 +484,7 @@ void IsmTests::tryModifyMainStructureElement()
m_replyFinished = false;
if (!m_ftc->mainStructureElementModifyRequest(data, this))
{
ERROR_LOG() << "Error requesting modify data";
ERROR_LOG(m_logger) << "Error requesting modify data";
failExit();
}
@@ -500,7 +500,7 @@ void IsmTests::tryModifyMainStructureElement()
for (size_t i = 0; i < mse.elements().size(); ++i)
{
se = mse.elements().at(i);
DEBUG_LOG() << "Updating barcode for element (" << i << ") with old barcode = " << se.barcode();
DEBUG_LOG(m_logger) << "Updating barcode for element (" << i << ") with old barcode = " << se.barcode();
se.barcode("BARCODE");
seData.elements().push_back(se);
@@ -508,7 +508,7 @@ void IsmTests::tryModifyMainStructureElement()
if (!m_ftc->structureElementModifyRequest(seData, this))
{
ERROR_LOG() << "Error requesting modify data";
ERROR_LOG(m_logger) << "Error requesting modify data";
failExit();
}
@@ -518,20 +518,20 @@ void IsmTests::tryModifyMainStructureElement()
// ------------------------------------------------------------------------------
void IsmTests::tryRemoveMainStructureElement()
{
INFO_LOG() << "trying to send MainStructureElementRemoveRequest for mse id = " << m_mainStructureElementId;
INFO_LOG(m_logger) << "trying to send MainStructureElementRemoveRequest for mse id = " << m_mainStructureElementId;
m_dtc->waitForHistoricalDataMainStructureElement();
InfrastructureManagement::MainStructureElement mse = m_dtc->mainStructureElement(m_mainStructureElementId);
if (mse.id() == 0)
{
ERROR_LOG() << "Cannot find main structure element with id = " << m_mainStructureElementId;
ERROR_LOG(m_logger) << "Cannot find main structure element with id = " << m_mainStructureElementId;
failExit();
}
if (!m_ftc->mainStructureElementRemoveRequest(MainStructureElementRemoveRequest(m_mainStructureElementId), this))
{
ERROR_LOG() << "Error requesting delete data";
ERROR_LOG(m_logger) << "Error requesting delete data";
failExit();
}
@@ -541,7 +541,7 @@ void IsmTests::tryRemoveMainStructureElement()
// ------------------------------------------------------------------------------
void IsmTests::tryCreateBridge()
{
INFO_LOG() << "trying to send MainStructureElementCreateRequest";
INFO_LOG(m_logger) << "trying to send MainStructureElementCreateRequest";
MainStructureElementModifyRequest data;
@@ -574,7 +574,7 @@ void IsmTests::tryCreateBridge()
if (!m_ftc->mainStructureElementModifyRequest(data, this))
{
ERROR_LOG() << "Error requesting create data (bridge)";
ERROR_LOG(m_logger) << "Error requesting create data (bridge)";
failExit();
}
@@ -585,18 +585,18 @@ void IsmTests::tryCreateBridge()
// ------------------------------------------------------------------------------
void IsmTests::tryChangeBridgeStatus()
{
INFO_LOG() << "trying to send MainStructureElementModifyBridgeStatusRequest ";
INFO_LOG(m_logger) << "trying to send MainStructureElementModifyBridgeStatusRequest ";
m_dtc->waitForHistoricalDataMainStructureElement();
InfrastructureManagement::MainStructureElement mse = m_dtc->mainStructureElement(m_mainStructureElementId);
InfrastructureManagement::MainStructureElementModifyBridgeStatusRequest data;
if (mse.id() == 0)
{
ERROR_LOG() << "Error requesting modify data";
ERROR_LOG(m_logger) << "Error requesting modify data";
failExit();
}
DEBUG_LOG() << "Modify MainStructureElement with id = " << mse.id();
DEBUG_LOG(m_logger) << "Modify MainStructureElement with id = " << mse.id();
// creating ModifyRequest
data.id(mse.id());
@@ -608,7 +608,7 @@ void IsmTests::tryChangeBridgeStatus()
m_replyFinished = false;
if (!m_ftc->mainStructureElementModifyBridgeStatusRequest(data, this))
{
ERROR_LOG() << "Error requesting modify bridge status";
ERROR_LOG(m_logger) << "Error requesting modify bridge status";
failExit();
}
@@ -622,7 +622,7 @@ void IsmTests::tryChangeBridgeStatus()
// ------------------------------------------------------------------------------
void IsmTests::tryCreateAsset()
{
INFO_LOG() << "trying to send AssetCreateRequest";
INFO_LOG(m_logger) << "trying to send AssetCreateRequest";
InstrumentationAssetModifyRequest data;
@@ -633,7 +633,7 @@ void IsmTests::tryCreateAsset()
if (!m_ftc->instrumentationAssetModifyRequest(data, this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
@@ -646,7 +646,7 @@ void IsmTests::tryCreateAsset()
if (!m_ftc->instrumentationAssetModifyRequest(data, this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
@@ -659,7 +659,7 @@ void IsmTests::tryCreateAsset()
if (!m_ftc->instrumentationAssetModifyRequest(data, this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
@@ -672,7 +672,7 @@ void IsmTests::tryCreateAsset()
if (!m_ftc->instrumentationAssetModifyRequest(data, this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
@@ -683,21 +683,21 @@ void IsmTests::tryCreateAsset()
// ------------------------------------------------------------------------------
void IsmTests::tryModifyAsset()
{
INFO_LOG() << "trying to send asset modify request ";
INFO_LOG(m_logger) << "trying to send asset modify request ";
DEBUG_LOG() << "m_assetId = " << m_assetId;
DEBUG_LOG(m_logger) << "m_assetId = " << m_assetId;
m_dtc->waitForHistoricalDataInstrumentationAsset();
const InfrastructureManagement::InstrumentationAsset &ast = m_dtc->instrumentationAsset(m_assetId);
// const InfrastructureManagement::InstrumentationAsset &ast1 = m_dtc->instrumentationAssets()[m_assetId];
InfrastructureManagement::InstrumentationAssetModifyRequest data;
DEBUG_LOG() << "ast.id() = " << ast.id();
// DEBUG_LOG() << "ast1.id() = " << ast1.id();
DEBUG_LOG(m_logger) << "ast.id() = " << ast.id();
// DEBUG_LOG(m_logger) << "ast1.id() = " << ast1.id();
if (ast.id() == 0)
{
ERROR_LOG() << "Cannot find Asset Id = " << m_assetId;
ERROR_LOG(m_logger) << "Cannot find Asset Id = " << m_assetId;
failExit();
}
else
@@ -714,7 +714,7 @@ void IsmTests::tryModifyAsset()
if (!m_ftc->instrumentationAssetModifyRequest(InstrumentationAssetModifyRequest(data), this))
{
ERROR_LOG() << "Error requesting modify data";
ERROR_LOG(m_logger) << "Error requesting modify data";
failExit();
}
@@ -725,20 +725,20 @@ void IsmTests::tryModifyAsset()
// ------------------------------------------------------------------------------
void IsmTests::tryRemoveAsset()
{
INFO_LOG() << "trying to send AssetRemoveRequest for id = " << m_assetId;
INFO_LOG(m_logger) << "trying to send AssetRemoveRequest for id = " << m_assetId;
m_dtc->waitForHistoricalDataInstrumentationAsset();
const InfrastructureManagement::InstrumentationAsset &ast = m_dtc->instrumentationAsset(m_assetId);
if (ast.id() == 0)
{
ERROR_LOG() << "Cannot find Asset Id = " << m_assetId;
ERROR_LOG(m_logger) << "Cannot find Asset Id = " << m_assetId;
failExit();
}
if (!m_ftc->instrumentationAssetRemoveRequest(InstrumentationAssetRemoveRequest(m_assetId), this))
{
ERROR_LOG() << "Error requesting delete data";
ERROR_LOG(m_logger) << "Error requesting delete data";
failExit();
}
QTest::qWait(1000);
@@ -747,21 +747,21 @@ void IsmTests::tryRemoveAsset()
// ------------------------------------------------------------------------------
void IsmTests::tryUnmountAsset()
{
INFO_LOG() << "trying to send asset state modify request ";
INFO_LOG(m_logger) << "trying to send asset state modify request ";
DEBUG_LOG() << "m_assetId = " << m_assetId;
DEBUG_LOG(m_logger) << "m_assetId = " << m_assetId;
m_dtc->waitForHistoricalDataInstrumentationAsset();
const InfrastructureManagement::InstrumentationAsset &ast = m_dtc->instrumentationAsset(m_assetId);
// const InfrastructureManagement::InstrumentationAsset &ast1 = m_dtc->instrumentationAssets()[m_assetId];
InfrastructureManagement::InstrumentationAssetSetStateRequest data;
DEBUG_LOG() << "ast.id() = " << ast.id();
// DEBUG_LOG() << "ast1.id() = " << ast1.id();
DEBUG_LOG(m_logger) << "ast.id() = " << ast.id();
// DEBUG_LOG(m_logger) << "ast1.id() = " << ast1.id();
if (ast.id() == 0)
{
ERROR_LOG() << "Cannot find Asset Id = " << m_assetId;
ERROR_LOG(m_logger) << "Cannot find Asset Id = " << m_assetId;
failExit();
}
else
@@ -771,7 +771,7 @@ void IsmTests::tryUnmountAsset()
if (!m_ftc->instrumentationAssetSetStateRequest(InstrumentationAssetSetStateRequest(data), this))
{
ERROR_LOG() << "Error requesting set asset state";
ERROR_LOG(m_logger) << "Error requesting set asset state";
failExit();
}
@@ -783,7 +783,7 @@ void IsmTests::tryUnmountAsset()
// ------------------------------------------------------------------------------
void IsmTests::tryCreateMountingPointAsset()
{
INFO_LOG() << "trying to send AssetCreateRequest";
INFO_LOG(m_logger) << "trying to send AssetCreateRequest";
MountingPointAssetModifyRequest data;
@@ -793,7 +793,7 @@ void IsmTests::tryCreateMountingPointAsset()
if (!m_ftc->mountingPointAssetModifyRequest(data, this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
@@ -803,20 +803,20 @@ void IsmTests::tryCreateMountingPointAsset()
// ------------------------------------------------------------------------------
void IsmTests::tryRemoveMountingPointAsset()
{
INFO_LOG() << "trying to send MountingPointAssetRemoveRequest ";
INFO_LOG(m_logger) << "trying to send MountingPointAssetRemoveRequest ";
m_dtc->waitForHistoricalDataMountingPointAsset();
if (!m_dtc->getMountingPointAssetId(m_structureElementId, m_assetId, m_mountingPointAssetId))
{
ERROR_LOG() << "Cannot find requested mounting point asset";
ERROR_LOG(m_logger) << "Cannot find requested mounting point asset";
failExit();
}
DEBUG_LOG() << "MountingPointAsset Id = " << m_mountingPointAssetId;
DEBUG_LOG(m_logger) << "MountingPointAsset Id = " << m_mountingPointAssetId;
if (!m_ftc->mountingPointAssetRemoveRequest(MountingPointAssetRemoveRequest(m_mountingPointAssetId), this))
{
ERROR_LOG() << "Error requesting delete data";
ERROR_LOG(m_logger) << "Error requesting delete data";
failExit();
}
@@ -827,7 +827,7 @@ void IsmTests::tryRemoveMountingPointAsset()
// ------------------------------------------------------------------------------
void IsmTests::tryCreateMainSchedule()
{
INFO_LOG() << "trying to send MainScheduleCreateRequest";
INFO_LOG(m_logger) << "trying to send MainScheduleCreateRequest";
MainScheduleModifyRequest data0, data1, data2;
@@ -842,7 +842,7 @@ void IsmTests::tryCreateMainSchedule()
if (!m_ftc->mainScheduleModifyRequest(data1, this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
@@ -859,7 +859,7 @@ void IsmTests::tryCreateMainSchedule()
if (!m_ftc->mainScheduleModifyRequest(data2, this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
@@ -875,7 +875,7 @@ void IsmTests::tryCreateMainSchedule()
if (!m_ftc->mainScheduleModifyRequest(data0, this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
@@ -885,16 +885,16 @@ void IsmTests::tryCreateMainSchedule()
// ------------------------------------------------------------------------------
void IsmTests::tryModifyMainSchedule()
{
INFO_LOG() << "trying to send mounting point schedule modify request ";
INFO_LOG(m_logger) << "trying to send mounting point schedule modify request ";
m_dtc->waitForHistoricalDataMainSchedule();
// using m_assetId as main schedule id
InfrastructureManagement::MainSchedule ast = m_dtc->mainSchedule(m_assetId);
InfrastructureManagement::MainScheduleModifyRequest data;
DEBUG_LOG() << "m_assetId = " << m_assetId;
DEBUG_LOG(m_logger) << "m_assetId = " << m_assetId;
DEBUG_LOG() << "ast.id() = " << ast.id();
DEBUG_LOG(m_logger) << "ast.id() = " << ast.id();
// creating ModifyRequest
if (ast.id() > 0)
@@ -913,13 +913,13 @@ void IsmTests::tryModifyMainSchedule()
if (!m_ftc->mainScheduleModifyRequest(MainScheduleModifyRequest(data), this))
{
ERROR_LOG() << "Error requesting modify data";
ERROR_LOG(m_logger) << "Error requesting modify data";
failExit();
}
}
else
{
ERROR_LOG() << "Cannot find main schedule id = " << m_assetId;
ERROR_LOG(m_logger) << "Cannot find main schedule id = " << m_assetId;
failExit();
}
QTest::qWait(1000);
@@ -928,16 +928,16 @@ void IsmTests::tryModifyMainSchedule()
// ------------------------------------------------------------------------------
void IsmTests::tryChangeStatusSchedule()
{
INFO_LOG() << "trying to send mounting point schedule modify request ";
INFO_LOG(m_logger) << "trying to send mounting point schedule modify request ";
m_dtc->waitForHistoricalDataMainSchedule();
// using m_assetId as main schedule id
InfrastructureManagement::MainSchedule ast = m_dtc->mainSchedule(m_assetId);
InfrastructureManagement::MainScheduleModifyRequest data;
DEBUG_LOG() << "m_assetId = " << m_assetId;
DEBUG_LOG(m_logger) << "m_assetId = " << m_assetId;
DEBUG_LOG() << "ast.id() = " << ast.id();
DEBUG_LOG(m_logger) << "ast.id() = " << ast.id();
// creating ModifyRequest
if (ast.id() > 0)
@@ -974,13 +974,13 @@ void IsmTests::tryChangeStatusSchedule()
if (!m_ftc->mainScheduleModifyRequest(MainScheduleModifyRequest(data), this))
{
ERROR_LOG() << "Error requesting modify data";
ERROR_LOG(m_logger) << "Error requesting modify data";
failExit();
}
}
else
{
ERROR_LOG() << "Cannot find main schedule id = " << m_assetId;
ERROR_LOG(m_logger) << "Cannot find main schedule id = " << m_assetId;
failExit();
}
QTest::qWait(1000);
@@ -989,20 +989,20 @@ void IsmTests::tryChangeStatusSchedule()
// ------------------------------------------------------------------------------
void IsmTests::tryRemoveMainSchedule()
{
INFO_LOG() << "trying to send MainScheduleRemoveRequest for id = " << m_assetId;
INFO_LOG(m_logger) << "trying to send MainScheduleRemoveRequest for id = " << m_assetId;
m_dtc->waitForHistoricalDataMainSchedule();
InfrastructureManagement::MainSchedule ast = m_dtc->mainSchedule(m_assetId);
if (ast.id() == 0)
{
ERROR_LOG() << "Cannot find main schedule id = " << m_assetId;
ERROR_LOG(m_logger) << "Cannot find main schedule id = " << m_assetId;
failExit();
}
if (!m_ftc->mainScheduleRemoveRequest(MainScheduleRemoveRequest(m_assetId), this))
{
ERROR_LOG() << "Error requesting delete data";
ERROR_LOG(m_logger) << "Error requesting delete data";
failExit();
}
QTest::qWait(1000);
@@ -1011,20 +1011,20 @@ void IsmTests::tryRemoveMainSchedule()
// ------------------------------------------------------------------------------
void IsmTests::tryCopySchedule()
{
INFO_LOG() << "trying to copy schedule";
INFO_LOG(m_logger) << "trying to copy schedule";
m_dtc->waitForHistoricalDataMainSchedule();
// using m_assetId as main schedule id
InfrastructureManagement::MainSchedule ms = m_dtc->mainSchedule(m_assetId);
DEBUG_LOG() << "scheduleId = " << m_assetId;
DEBUG_LOG() << "ms.id() = " << ms.id();
DEBUG_LOG(m_logger) << "scheduleId = " << m_assetId;
DEBUG_LOG(m_logger) << "ms.id() = " << ms.id();
int newId = m_db->copySchedule(ms.id());
if (newId <= 0)
{
ERROR_LOG() << "Error copy schedule, code = " << newId;
ERROR_LOG(m_logger) << "Error copy schedule, code = " << newId;
failExit();
}
@@ -1034,26 +1034,26 @@ void IsmTests::tryCopySchedule()
// ------------------------------------------------------------------------------
void IsmTests::checkSchedule()
{
ERROR_LOG() << "check instrumentation plan";
ERROR_LOG(m_logger) << "check instrumentation plan";
m_dtc->waitForHistoricalDataMainSchedule();
// using m_assetId as main schedule id
InfrastructureManagement::MainSchedule ms = m_dtc->mainSchedule(m_assetId);
DEBUG_LOG() << "scheduleId = " << m_assetId;
DEBUG_LOG() << "ms.id() = " << ms.id();
DEBUG_LOG(m_logger) << "scheduleId = " << m_assetId;
DEBUG_LOG(m_logger) << "ms.id() = " << ms.id();
QList<MountingPointPlan> diff;
bool ok = m_dtc->getScheduleDifferences(m_assetId, diff);
if (ok)
ERROR_LOG() << "Instrumentation plan complete!";
ERROR_LOG(m_logger) << "Instrumentation plan complete!";
else
{
ERROR_LOG() << "Instrumentation plan not complete !!!";
ERROR_LOG(m_logger) << "Instrumentation plan not complete !!!";
for (const MountingPointPlan &mpp : std::as_const(diff))
ERROR_LOG() << "Diff - # mpp.structureElementId() = " << mpp.structureElementId();
ERROR_LOG(m_logger) << "Diff - # mpp.structureElementId() = " << mpp.structureElementId();
}
QTest::qWait(1000);
@@ -1064,7 +1064,7 @@ void IsmTests::checkSchedule()
// ------------------------------------------------------------------------------
void IsmTests::tryCreateMountingPointPlan()
{
INFO_LOG() << "trying to send MountingPointPlanCreateRequest";
INFO_LOG(m_logger) << "trying to send MountingPointPlanCreateRequest";
MountingPointPlanModifyRequest data;
@@ -1074,7 +1074,7 @@ void IsmTests::tryCreateMountingPointPlan()
if (!m_ftc->mountingPointPlanModifyRequest(data, this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
@@ -1086,7 +1086,7 @@ void IsmTests::tryCreateMountingPointPlan()
if (!m_ftc->mountingPointPlanModifyRequest(data, this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
@@ -1098,7 +1098,7 @@ void IsmTests::tryCreateMountingPointPlan()
// ------------------------------------------------------------------------------
void IsmTests::onError(const QString &reason)
{
ERROR_LOG() << "Got Reply error: " << reason;
ERROR_LOG(m_logger) << "Got Reply error: " << reason;
failExit();
}
@@ -1110,7 +1110,7 @@ void IsmTests::onCreateReply(const Core::FunctionReplyObject &replyObject)
onError(replyObject.translated());
return;
}
INFO_LOG() << "Got createReply with id " << replyObject.id()
INFO_LOG(m_logger) << "Got createReply with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
@@ -1124,7 +1124,7 @@ void IsmTests::onModifyReply(const Core::FunctionReplyObject &replyObject)
onError(replyObject.translated());
return;
}
INFO_LOG() << "Got modifyRequest with id " << replyObject.id()
INFO_LOG(m_logger) << "Got modifyRequest with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
@@ -1137,7 +1137,7 @@ void IsmTests::onRemoveReply(const Core::FunctionReplyObject &replyObject)
onError(replyObject.translated());
return;
}
INFO_LOG() << "Got removeReply with id " << replyObject.id()
INFO_LOG(m_logger) << "Got removeReply with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
@@ -1145,7 +1145,7 @@ void IsmTests::onRemoveReply(const Core::FunctionReplyObject &replyObject)
// ------------------------------------------------------------------------------
void IsmTests::failExit()
{
ERROR_LOG() << "FAIL EXIT !";
ERROR_LOG(m_logger) << "FAIL EXIT !";
m_bTestsSuccessful = false;
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
@@ -37,34 +37,34 @@ bool WebSocketInterfaceHandler::init()
{
cleanup();
DEBUG_LOG() << "... ok";
DEBUG_LOG(m_logger) << "... ok";
DEBUG_LOG() << "Initialising DataManager";
DEBUG_LOG(m_logger) << "Initialising DataManager";
m_dataManager = new DataManager(m_mainHandler);
if (!m_dataManager->init())
{
ERROR_LOG() << "Failed to initialise DataManager";
ERROR_LOG(m_logger) << "Failed to initialise DataManager";
return false;
}
DEBUG_LOG() << "... ok";
DEBUG_LOG(m_logger) << "... ok";
m_messageFactory = new Messages::ClientMessageFactory(m_dataManager);
m_webSocketServer = new LtsWebSocket::LtsWebSocketServer(m_messageFactory, this);
DEBUG_LOG() << "Setting Message Delay to " << Settings::messageDelay();
DEBUG_LOG(m_logger) << "Setting Message Delay to " << Settings::messageDelay();
m_webSocketServer->setMessageDelay(Settings::messageDelay());
DEBUG_LOG() << "Initialising LtsWebSocketServer";
DEBUG_LOG(m_logger) << "Initialising LtsWebSocketServer";
if (!m_webSocketServer->init(QStringLiteral("ISM"),
NGL::Connections::port(NGL::Connections::eConnection::ISM_WEBSOCKET)))
{
ERROR_LOG() << "Failed to initialise LtsWebSocketServer";
ERROR_LOG(m_logger) << "Failed to initialise LtsWebSocketServer";
return false;
}
DEBUG_LOG() << "... ok";
DEBUG_LOG(m_logger) << "... ok";
DEBUG_LOG() << "Connection signals and slots";
DEBUG_LOG(m_logger) << "Connection signals and slots";
return true;
}
@@ -21,6 +21,7 @@ class Base : public QObject
{
Q_OBJECT
protected:
NGL::INGLLogger &m_logger;
explicit Base(MainHandler *mainHandler, NGL::INGLLogger &logger);
virtual ~Base();
@@ -17,14 +17,14 @@ namespace InfrastructureManagement
DdsHandler::DdsHandler(int domainId)
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Any))
{
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
}
bool DdsHandler::init(const QStringList &qosFileList)
{
if (!m_ddsConnector->init(qosFileList))
{
ERROR_LOG() << "Error initializing dds connections - aborting";
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
return false;
}
@@ -43,15 +43,15 @@ bool DdsHandler::init(const QStringList &qosFileList)
try
{
bRet = m_ddsFts->enableAll();
INFO_LOG() << "Fts initialised";
INFO_LOG(m_logger) << "Fts initialised";
// erst FTS funktioniert komischer Weise nicht (seit MainStructureElementModifyRequest
// von MainStructureElement abgeleitet ist ... rti/dds - Bug?
bRet &= m_ddsDts->enableAll();
INFO_LOG() << "Dts initialised";
INFO_LOG(m_logger) << "Dts initialised";
}
catch (const dds::core::Exception &e)
{
ERROR_LOG() << "Exception: " << e.what();
ERROR_LOG(m_logger) << "Exception: " << e.what();
m_pacemaker->setNewState(Core::RunningState::StoppedError);
return false;
}
@@ -50,6 +50,7 @@ public:
}
private:
NGL::INGLLogger &m_logger;
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<Core::Pacemaker> m_pacemaker;
std::shared_ptr<Core::TopicLockMaster> m_topicLockMaster;
@@ -48,14 +48,14 @@ MainHandler::~MainHandler()
//-------------------------------------------------------------------------------------------------------------
bool MainHandler::init(int domainId)
{
INFO_LOG() << "--- Start InfrastructureManagement MainHandler.";
INFO_LOG(m_logger) << "--- Start InfrastructureManagement MainHandler.";
// initialize DDS
// for InfrastructureManagement => exerciseId = partitionId
m_ddsHandler = std::make_shared<DdsHandler>(domainId);
if (!m_ddsHandler->init())
{
ERROR_LOG() << "Initialisation DdsHandler failed.";
ERROR_LOG(m_logger) << "Initialisation DdsHandler failed.";
if (m_ddsHandler->pacemaker())
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
return false;
@@ -66,7 +66,7 @@ bool MainHandler::init(int domainId)
m_dbHandler = std::make_shared<DbHandler>();
if (!m_dbHandler->init(0, Settings::settings()))
{
ERROR_LOG() << "Initialisation DbHandler failed.";
ERROR_LOG(m_logger) << "Initialisation DbHandler failed.";
pm->setNewState(Core::RunningState::StoppedError);
return false;
}
@@ -79,7 +79,7 @@ bool MainHandler::init(int domainId)
m_handlerMainStructureElement = std::make_shared<HandlerMainStructureElement>(this);
if (!m_handlerMainStructureElement->init())
{
ERROR_LOG() << "Initialisation HandlerMainStructureElement failed.";
ERROR_LOG(m_logger) << "Initialisation HandlerMainStructureElement failed.";
pm->setNewState(Core::RunningState::StoppedError);
return false;
}
@@ -89,7 +89,7 @@ bool MainHandler::init(int domainId)
m_handlerInstrumentationAsset = std::make_shared<HandlerInstrumentationAsset>(this);
if (!m_handlerInstrumentationAsset->init())
{
ERROR_LOG() << "Initialisation HandlerInstrumentationAsset failed.";
ERROR_LOG(m_logger) << "Initialisation HandlerInstrumentationAsset failed.";
pm->setNewState(Core::RunningState::StartingError);
return false;
}
@@ -98,7 +98,7 @@ bool MainHandler::init(int domainId)
m_handlerMountingPointAsset = std::make_shared<HandlerMountingPointAsset>(this);
if (!m_handlerMountingPointAsset->init())
{
ERROR_LOG() << "Initialisation HandlerMountingPointAsset failed.";
ERROR_LOG(m_logger) << "Initialisation HandlerMountingPointAsset failed.";
pm->setNewState(Core::RunningState::StartingError);
return false;
}
@@ -108,7 +108,7 @@ bool MainHandler::init(int domainId)
m_handlerEffectArea = std::make_shared<HandlerEffectArea>(this);
if (!m_handlerEffectArea->init())
{
ERROR_LOG() << "Initialisation HandlerEffectArea failed.";
ERROR_LOG(m_logger) << "Initialisation HandlerEffectArea failed.";
pm->setNewState(Core::RunningState::StartingError);
return false;
}
@@ -117,7 +117,7 @@ bool MainHandler::init(int domainId)
m_handlerSpecialArea = std::make_shared<HandlerSpecialArea>(this);
if (!m_handlerSpecialArea->init())
{
ERROR_LOG() << "Initialisation HandlerSpecialArea failed.";
ERROR_LOG(m_logger) << "Initialisation HandlerSpecialArea failed.";
pm->setNewState(Core::RunningState::StartingError);
return false;
}
@@ -126,7 +126,7 @@ bool MainHandler::init(int domainId)
m_handlerMainSchedule = std::make_shared<HandlerMainSchedule>(this);
if (!m_handlerMainSchedule->init())
{
ERROR_LOG() << "Initialisation HandlerMainSchedule failed.";
ERROR_LOG(m_logger) << "Initialisation HandlerMainSchedule failed.";
pm->setNewState(Core::RunningState::StartingError);
return false;
}
@@ -141,12 +141,12 @@ bool MainHandler::init(int domainId)
m_handlerWebSocketInterface = std::make_shared<WebSocketInterfaceHandler>(this);
if (!m_handlerWebSocketInterface->init())
{
ERROR_LOG() << "Initialisation WebSocketInterface failed.";
ERROR_LOG(m_logger) << "Initialisation WebSocketInterface failed.";
pm->setNewState(Core::RunningState::StartingError);
return false;
}
INFO_LOG() << "ISM MainHandler initialized.";
INFO_LOG(m_logger) << "ISM MainHandler initialized.";
pm->setNewState(Core::RunningState::Running);
pm->addPort(m_handlerWebSocketInterface->webSocketPort(), Core::PortType::WebSocketServer);
@@ -74,6 +74,8 @@ public:
int exerciseId() const;
private: // attributes
NGL::INGLLogger &m_logger;
std::shared_ptr<DbHandler> m_dbHandler;
std::shared_ptr<DdsHandler> m_ddsHandler;
std::shared_ptr<HandlerMainStructureElement> m_handlerMainStructureElement;
@@ -60,12 +60,12 @@ ParseBuildingXml::ParseBuildingXml(const QString &xmlFilename,
, m_geoPosition(geoPosition)
, m_rotationAngleDegree(rotationAngleDegree)
{
DEBUG_LOG() << "m_soundAreaFilename=" << m_soundAreaFilename;
DEBUG_LOG(m_logger) << "m_soundAreaFilename=" << m_soundAreaFilename;
}
QJsonObject ParseBuildingXml::egcusToJson() const
{
DEBUG_LOG() << "egcusToJson";
DEBUG_LOG(m_logger) << "egcusToJson";
if (m_egcus.isEmpty())
return QJsonObject();
@@ -90,7 +90,7 @@ QJsonObject ParseBuildingXml::egcusToJson() const
QJsonObject ParseBuildingXml::soundAreaToJson() const
{
DEBUG_LOG() << "soundAreaToJson";
DEBUG_LOG(m_logger) << "soundAreaToJson";
QJsonObject soundArea;
QJsonObject json;
QJsonObject jsonEgcu;
@@ -117,7 +117,7 @@ QJsonObject ParseBuildingXml::soundAreaToJson() const
//-------------------------------------------------------------------------------------------------------------
bool ParseBuildingXml::parseXml()
{
DEBUG_LOG() << "parseXml";
DEBUG_LOG(m_logger) << "parseXml";
m_request = MainStructureElementModifyRequest();
m_request.properties("{}");
m_lastError.clear();
@@ -141,7 +141,7 @@ bool ParseBuildingXml::parseXml()
// catch (const std::exception &ex)
// {
// m_lastError = QString::fromUtf8(ex.what());
// WARNING_LOG() << "Error importing building: " << ex.what();
// WARNING_LOG(m_logger) << "Error importing building: " << ex.what();
// m_request = MainStructureElementModifyRequest();
// return false;
// }
@@ -151,17 +151,17 @@ bool ParseBuildingXml::parseXml()
parseXmlEgcus();
QJsonObject egcus = egcusToJson();
properties[QStringLiteral("egcusToRooms")] = egcus[QStringLiteral("egcusToRooms")];
DEBUG_LOG() << "parseXml vor isEmpty";
DEBUG_LOG(m_logger) << "parseXml vor isEmpty";
if (!m_soundAreaFilename.isEmpty())
{
DEBUG_LOG() << "parseXml vor parseXmlSoundArea";
DEBUG_LOG(m_logger) << "parseXml vor parseXmlSoundArea";
parseXmlSoundArea();
properties[QStringLiteral("soundArea")] = soundAreaToJson();
}
m_request.properties(QJsonDocument(properties).toJson(QJsonDocument::Compact).toStdString());
DEBUG_LOG() << "Finished import for file " << m_xmlFilename;
DEBUG_LOG(m_logger) << "Finished import for file " << m_xmlFilename;
return bRet;
}
@@ -170,24 +170,24 @@ ParseBuildingXml::Egcu ParseBuildingXml::parseEgcu(const QDomElement &domEgcu)
{
ParseBuildingXml::Egcu ret;
INFO_LOG() << "parseEgcu Egcu: = " << domEgcu.tagName();
INFO_LOG(m_logger) << "parseEgcu Egcu: = " << domEgcu.tagName();
QDomElement mountpoint = domEgcu.firstChildElement(QStringLiteral("Mountpoint"));
INFO_LOG() << "Mountpoint=" << mountpoint.tagName();
INFO_LOG(m_logger) << "Mountpoint=" << mountpoint.tagName();
QDomElement mountpointSubId = mountpoint.firstChildElement(QStringLiteral("SubId"));
INFO_LOG() << "Mountpoint=" << mountpointSubId.tagName()
INFO_LOG(m_logger) << "Mountpoint=" << mountpointSubId.tagName()
<< " SubId = " << mountpointSubId.attribute(QStringLiteral("SubId"))
<< " text= " << mountpointSubId.text();
ret.mountpointEgcu = mountpointSubId.text().toInt();
QDomElement rooms = domEgcu.firstChildElement(QStringLiteral("Rooms"));
INFO_LOG() << "Rooms=" << rooms.tagName()
INFO_LOG(m_logger) << "Rooms=" << rooms.tagName()
<< " SubId = " << rooms.attribute(QStringLiteral("SubId"))
<< " text = " << rooms.text();
QDomElement room = rooms.firstChildElement(QStringLiteral("SubId"));
for (; !room.isNull(); room = room.nextSiblingElement(room.tagName()))
{
INFO_LOG() << "Room=" << room.tagName()
INFO_LOG(m_logger) << "Room=" << room.tagName()
<< " SubId = " << room.attribute(QStringLiteral("SubId"))
<< " text = " << room.text();
ret.rooms.append(room.text().toInt());
@@ -203,27 +203,27 @@ bool ParseBuildingXml::parseXmlEgcus()
try
{
//parseXmlInternal();
INFO_LOG() << "parseXmlEgcus " << m_egcuToRoomFilename;
INFO_LOG(m_logger) << "parseXmlEgcus " << m_egcuToRoomFilename;
if (!m_egcuToRoomFilename.isEmpty())
{
INFO_LOG() << "openXml";
INFO_LOG(m_logger) << "openXml";
QDomDocument doc = openXml(m_egcuToRoomFilename);
if (!doc.isNull())
{
// Evaluate xml file and modify properties in m_request
QDomElement root = doc.documentElement();
INFO_LOG() << "root.tagName()=" << root.tagName();
INFO_LOG(m_logger) << "root.tagName()=" << root.tagName();
if (root.tagName() != QStringLiteral("EgcusToRooms"))
{
WARNING_LOG() << "The file is not EgcusToRooms";
WARNING_LOG(m_logger) << "The file is not EgcusToRooms";
return false;
}
QDomElement domEgcu = root.firstChildElement(QStringLiteral("Egcu"));
if (domEgcu.isNull())
INFO_LOG() << "Keine EGCU's";
INFO_LOG(m_logger) << "Keine EGCU's";
for (; !domEgcu.isNull(); domEgcu = domEgcu.nextSiblingElement(domEgcu.tagName()))
{
INFO_LOG() << "parseEgcus=" << domEgcu.tagName()
INFO_LOG(m_logger) << "parseEgcus=" << domEgcu.tagName()
<< " text=" << domEgcu.text()
<< " Name=" << domEgcu.attribute(QStringLiteral("Name"));
const Egcu egcu = parseEgcu(domEgcu);
@@ -236,7 +236,7 @@ bool ParseBuildingXml::parseXmlEgcus()
catch (const std::exception &ex)
{
m_lastError = QString::fromUtf8(ex.what());
WARNING_LOG() << "Error importing building: wrong XML-File EgcuToRooms: " << ex.what();
WARNING_LOG(m_logger) << "Error importing building: wrong XML-File EgcuToRooms: " << ex.what();
bRet = false;
}
@@ -253,34 +253,34 @@ bool ParseBuildingXml::parseXmlSoundArea()
try
{
//parseXmlInternal();
INFO_LOG() << "parseXmlSoundArea " << m_soundAreaFilename;
INFO_LOG(m_logger) << "parseXmlSoundArea " << m_soundAreaFilename;
if (!m_soundAreaFilename.isEmpty())
{
INFO_LOG() << "openXml";
INFO_LOG(m_logger) << "openXml";
QDomDocument doc = openXml(m_soundAreaFilename);
if (!doc.isNull())
{
// Evaluate xml file and modify properties in m_request
QDomElement root = doc.documentElement();
INFO_LOG() << "root.tagName()=" << root.tagName();
INFO_LOG(m_logger) << "root.tagName()=" << root.tagName();
if (root.tagName() != QStringLiteral("SoundArea"))
{
WARNING_LOG() << "The file is not SoundArea";
WARNING_LOG(m_logger) << "The file is not SoundArea";
return false;
}
INFO_LOG() << "parseSoundArea SoundArea: = " << root.tagName();
INFO_LOG(m_logger) << "parseSoundArea SoundArea: = " << root.tagName();
// Id
m_soundArea.id = root.firstChildElement(QStringLiteral("Id")).text().toInt();
INFO_LOG() << "Id=" << m_soundArea.id;
INFO_LOG(m_logger) << "Id=" << m_soundArea.id;
// Geometry
QDomElement geometry = root.firstChildElement(QStringLiteral("Geometry"));
QDomElement point = geometry.firstChildElement(QStringLiteral("Point"));
for (; !point.isNull(); point = point.nextSiblingElement(point.tagName()))
{
INFO_LOG() << "Point=" << point.tagName()
INFO_LOG(m_logger) << "Point=" << point.tagName()
<< " lat = " << point.firstChildElement(QStringLiteral("lat")).text().toDouble()
<< " lon = " << point.firstChildElement(QStringLiteral("lon")).text().toDouble();
geoPosition.lat(point.firstChildElement(QStringLiteral("lat")).text().toDouble());
@@ -290,7 +290,7 @@ bool ParseBuildingXml::parseXmlSoundArea()
// MainEgcuMountpoint
m_soundArea.mainEgcuMountpoint = root.firstChildElement(QStringLiteral("MainEgcuMountpoint")).text().toInt();
DEBUG_LOG() << "MainEgcuMountpoint Id=" << m_soundArea.mainEgcuMountpoint;
DEBUG_LOG(m_logger) << "MainEgcuMountpoint Id=" << m_soundArea.mainEgcuMountpoint;
// MountpointsEgcu
QDomElement egcuMountpoints = root.firstChildElement(QStringLiteral("EgcuMountpoints"));
@@ -298,7 +298,7 @@ bool ParseBuildingXml::parseXmlSoundArea()
for (; !id.isNull(); id = id.nextSiblingElement(id.tagName()))
{
int mountpointEgcu = id.text().toInt();
DEBUG_LOG() << "mountpointEgcu=" << mountpointEgcu;
DEBUG_LOG(m_logger) << "mountpointEgcu=" << mountpointEgcu;
m_soundArea.egcuMountpoints.push_back(mountpointEgcu);
}
}
@@ -308,7 +308,7 @@ bool ParseBuildingXml::parseXmlSoundArea()
catch (const std::exception &ex)
{
m_lastError = QString::fromUtf8(ex.what());
WARNING_LOG() << "Error importing building: wrong XML-File EgcuToRooms: " << ex.what();
WARNING_LOG(m_logger) << "Error importing building: wrong XML-File EgcuToRooms: " << ex.what();
bRet = false;
}
@@ -367,16 +367,16 @@ QVector<ParseBuildingXml::BuildingMetaInfo> ParseBuildingXml::parseMetaXml(const
info.filename = streifElem.attribute(QLatin1String("Name"));
if (info.filename.isEmpty())
{
WARNING_LOG() << "Empty filename (building)!";
WARNING_LOG(m_logger) << "Empty filename (building)!";
continue;
}
info.rotationAngleDegree = orientationElem.attribute(QLatin1String("Angle")).toDouble(); // correct rotation?
INFO_LOG() << "Found Building angle: " << info.rotationAngleDegree;
INFO_LOG(m_logger) << "Found Building angle: " << info.rotationAngleDegree;
info.geoPosition = positionFromElement<Core::GeoPosition>(posElem);
INFO_LOG() << "Found Building position: (" << info.geoPosition.lon() << ", ("
INFO_LOG(m_logger) << "Found Building position: (" << info.geoPosition.lon() << ", ("
<< info.geoPosition.lat() << ", ("
<< info.geoPosition.z() << ")";
@@ -397,14 +397,14 @@ void ParseBuildingXml::parseXmlInternal()
const QDomElement headerElem = getChildElement(rootElem, QStringLiteral("Header"));
const QDomElement baseGroupElem = getChildElement(headerElem, QStringLiteral("Group"));
DEBUG_LOG() << "Start import for file " << m_xmlFilename;
DEBUG_LOG(m_logger) << "Start import for file " << m_xmlFilename;
m_request.angle(m_rotationAngleDegree);
m_request.geoPosition(m_geoPosition);
m_request.modelId(getInteger(getChildElement(baseGroupElem, QStringLiteral("ModelId")), QStringLiteral("Id")));
m_request.name(getChildElement(baseGroupElem, QStringLiteral("Name")).text().toStdString());
m_request.description(m_request.name());
INFO_LOG() << "Importing building with name: " << m_request.name();
INFO_LOG(m_logger) << "Importing building with name: " << m_request.name();
InfrastructureManagement::StructureElement seBuilding;
seBuilding.name(m_request.name());
@@ -483,15 +483,15 @@ void ParseBuildingXml::importExternalReferences(const QDomElement &parent,
// we don't care about BCU Mounting positions inside xml file - we create our own
if (se.mountingPointTypeId() == MountingPointType::BuildingControlUnit)
{
INFO_LOG() << "Ignoring xml-internal BuildingControl mounting point - not needed";
INFO_LOG(m_logger) << "Ignoring xml-internal BuildingControl mounting point - not needed";
continue;
}
if (se.mountingPointTypeId() == MountingPointType::Unknown)
{
INFO_LOG() << "Ignoring unknown mounting point type with subId " << se.mountingPointId();
INFO_LOG(m_logger) << "Ignoring unknown mounting point type with subId " << se.mountingPointId();
continue;
}
INFO_LOG() << "importExternalReferences: " << se.displayName() << ", parentIdx = " << parentIdx;
INFO_LOG(m_logger) << "importExternalReferences: " << se.displayName() << ", parentIdx = " << parentIdx;
addElementToRequest(se, parentIdx);
}
}
@@ -507,7 +507,7 @@ void ParseBuildingXml::importFloors(const QDomElement &parent,
if (!nameElement.text().startsWith(QLatin1String("floor_"), Qt::CaseInsensitive))
continue;
INFO_LOG() << "importFloors: " << nameElement.text() << ", parentIdx = " << parentIdx;
INFO_LOG(m_logger) << "importFloors: " << nameElement.text() << ", parentIdx = " << parentIdx;
StructureElement se;
se.name(nameElement.text().simplified().toStdString());
@@ -518,12 +518,12 @@ void ParseBuildingXml::importFloors(const QDomElement &parent,
// read base height from xml comment
const QDomElement commentElement = getChildElement(floorElem, QStringLiteral("Comment"), false);
DEBUG_LOG() << "Comment = " << commentElement.text();
DEBUG_LOG(m_logger) << "Comment = " << commentElement.text();
const QStringList comm = commentElement.text().split(QLatin1Char('='));
double baseHeight = 0.00;
if (comm.at(0) == QStringLiteral("base_height"))
baseHeight = comm.at(1).toDouble();
DEBUG_LOG() << "base_height = " << baseHeight;
DEBUG_LOG(m_logger) << "base_height = " << baseHeight;
se.relPosition().offsetZ(baseHeight);
addElementToRequest(se, parentIdx);
@@ -552,7 +552,7 @@ void ParseBuildingXml::importRooms(const QDomElement &parent,
// displayed room names are too long
roomName.replace(QStringLiteral("SW_room"), QStringLiteral("R"));
INFO_LOG() << "importRooms: " << roomName << ", parentIdx = " << parentIdx;
INFO_LOG(m_logger) << "importRooms: " << roomName << ", parentIdx = " << parentIdx;
se.displayName(roomName.toStdString());
se.mountingPointId(subId);
@@ -567,7 +567,7 @@ void ParseBuildingXml::importRooms(const QDomElement &parent,
addElementToRequest(se, parentIdx);
const int curIdx = m_request.elements().size() - 1;
importExternalReferences(subRoomElem, curIdx);
DEBUG_LOG() << "Room=" << se.name()
DEBUG_LOG(m_logger) << "Room=" << se.name()
<< " Id=" << se.id()
<< " mountingPointId=" << se.mountingPointId();
}
@@ -55,6 +55,7 @@ public:
QVector<BuildingMetaInfo> parseMetaXml(const QString &metaXml) const;
const MainStructureElementModifyRequest &parsedRequest() const { return m_request; }
private:
NGL::INGLLogger &m_logger;
QDomDocument openXml(const QString &fileName) const;
void parseXmlInternal();
Egcu parseEgcu(const QDomElement &domEgcu);
@@ -79,6 +80,7 @@ private:
QDomElement getChildElement(const T &parent, const QString &childTag, bool bThrow = true) const;
int getInteger(const QDomElement &element, const QString &attribute) const;
private:
NGL::INGLLogger &m_logger;
QString m_xmlFilename;
QString m_vulnerabilityFilename;
QString m_egcuToRoomFilename;
@@ -27,7 +27,7 @@ void ScheduleStatusBase::onEntry(QEvent *event)
{
QState::onEntry(event);
DEBUG_LOG() << "Schedule " << scheduleId() << ": onEntry Base: write ScheduleStatus: " << m_scheduleStatus;
DEBUG_LOG(m_logger) << "Schedule " << scheduleId() << ": onEntry Base: write ScheduleStatus: " << m_scheduleStatus;
// write ScheduleStatus to db
m_schedule->setScheduleStatus(m_scheduleStatus);
}
@@ -44,7 +44,7 @@ Creation::Creation(ObjectMainSchedule *objSchedule)
void Creation::onEntry(QEvent *event)
{
DEBUG_LOG() << "Schedule " << scheduleId() << ": onEntry Creation ";
DEBUG_LOG(m_logger) << "Schedule " << scheduleId() << ": onEntry Creation ";
ScheduleStatusBase::onEntry(event);
}
@@ -60,7 +60,7 @@ Activation::Activation(ObjectMainSchedule *objSchedule)
void Activation::onEntry(QEvent *event)
{
DEBUG_LOG() << "Schedule " << scheduleId() << ": onEntry Activation: write ScheduleStatus:Activated";
DEBUG_LOG(m_logger) << "Schedule " << scheduleId() << ": onEntry Activation: write ScheduleStatus:Activated";
ScheduleStatusBase::onEntry(event);
}
@@ -71,7 +71,7 @@ Expiration::Expiration(ObjectMainSchedule *objSchedule)
void Expiration::onEntry(QEvent *event)
{
DEBUG_LOG() << "Schedule " << scheduleId() << ": onEntry Expiration ";
DEBUG_LOG(m_logger) << "Schedule " << scheduleId() << ": onEntry Expiration ";
ScheduleStatusBase::onEntry(event);
}
@@ -22,12 +22,14 @@ namespace InfrastructureManagement
InfrastructureManagement::ScheduleStatus scheduleStatus() const { return m_scheduleStatus; }
protected:
NGL::INGLLogger &m_logger;
ScheduleStatusBase(const QString &objectName, const ScheduleStatus &scheduleStatus, ObjectMainSchedule* objSchedule);
void onEntry(QEvent *event);
int scheduleId() const { return m_schedule ? m_schedule->getId() : -1; }
protected:
NGL::INGLLogger &m_logger;
ObjectMainSchedule *m_schedule;
private:
const InfrastructureManagement::ScheduleStatus m_scheduleStatus;
@@ -46,6 +48,7 @@ namespace InfrastructureManagement
public:
explicit Creation(ObjectMainSchedule *objSchedule);
protected:
NGL::INGLLogger &m_logger;
void onEntry(QEvent *event);
};
@@ -62,6 +65,7 @@ namespace InfrastructureManagement
public:
explicit Activation(ObjectMainSchedule *objSchedule);
protected:
NGL::INGLLogger &m_logger;
void onEntry(QEvent *event);
};
@@ -71,6 +75,7 @@ namespace InfrastructureManagement
public:
explicit Expiration(ObjectMainSchedule *objSchedule);
protected:
NGL::INGLLogger &m_logger;
void onEntry(QEvent *event);
};
@@ -30,11 +30,11 @@ namespace InfrastructureManagement
bool ScheduleStatusManager::triggerSwitchState(InfrastructureManagement::ScheduleStatus state)
{
INFO_LOG() << "Schedule " << scheduleId() << ": Trying to switch to state " << toString(state);
INFO_LOG(m_logger) << "Schedule " << scheduleId() << ": Trying to switch to state " << toString(state);
std::function<void()> f = m_stateSignals.value(state);
if (f)
{
//DEBUG_LOG() << "function: emit signal";
//DEBUG_LOG(m_logger) << "function: emit signal";
emit f();
}
return (f != nullptr);
@@ -78,13 +78,13 @@ namespace InfrastructureManagement
void ScheduleStatusManager::setStateInternal(InfrastructureManagement::ScheduleStatus state)
{
INFO_LOG() << "Schedule " << scheduleId() << ": In setStateInternal: new state " << toString(state);
INFO_LOG(m_logger) << "Schedule " << scheduleId() << ": In setStateInternal: new state " << toString(state);
if(m_ScheduleStatus == state)
return;
m_ScheduleStatus = state;
INFO_LOG() << "Schedule " << scheduleId() << ": Changed schedule state to " << toString(state);
INFO_LOG(m_logger) << "Schedule " << scheduleId() << ": Changed schedule state to " << toString(state);
}
int ScheduleStatusManager::scheduleId() const
@@ -45,6 +45,8 @@ namespace InfrastructureManagement
void stateFalse();
private:
NGL::INGLLogger &m_logger;
void setStateInternal(InfrastructureManagement::ScheduleStatus state);
int scheduleId() const;
@@ -76,12 +76,12 @@ ScheduleStatusMachine::ScheduleStatusMachine(ObjectMainSchedule* objSchedule, QO
//States zur StateMachine hinzufügen
for (ScheduleStatusBase *state : std::as_const(m_ScheduleStatuses))
{
DEBUG_LOG() << "Schedule " << scheduleId() << ": state: " << state->scheduleStatus();
DEBUG_LOG(m_logger) << "Schedule " << scheduleId() << ": state: " << state->scheduleStatus();
m_stateMachine->addState(state);
connect(state, &ScheduleStatusBase::entered, this, &ScheduleStatusMachine::onEnteredState);
}
DEBUG_LOG() << "Schedule " << scheduleId() << ": Constructor ScheduleStatusMachine: size m_ScheduleStatuses = " << m_ScheduleStatuses.size();
DEBUG_LOG(m_logger) << "Schedule " << scheduleId() << ": Constructor ScheduleStatusMachine: size m_ScheduleStatuses = " << m_ScheduleStatuses.size();
}
ScheduleStatusMachine::~ScheduleStatusMachine()
@@ -96,11 +96,11 @@ bool ScheduleStatusMachine::init()
if (m_stateMachine->isRunning())
return false;
DEBUG_LOG() << "Schedule " << scheduleId() << ": Init ScheduleStatusMachine ";
DEBUG_LOG(m_logger) << "Schedule " << scheduleId() << ": Init ScheduleStatusMachine ";
// initialise current ScheduleStatus
ScheduleStatusBase *currentScheduleStatus = getStateFromId(m_schedule->scheduleStatus());
DEBUG_LOG() << "Schedule " << scheduleId() << ": State = "
DEBUG_LOG(m_logger) << "Schedule " << scheduleId() << ": State = "
<< ScheduleStatusManager::toString(m_schedule->scheduleStatus());
m_stateMachine->setInitialState(currentScheduleStatus);
@@ -108,7 +108,7 @@ bool ScheduleStatusMachine::init()
m_stateManager->setInitial(m_schedule->scheduleStatus());
DEBUG_LOG() << "Schedule " << scheduleId() << ": ==> Done Init ScheduleStatusMachine ";
DEBUG_LOG(m_logger) << "Schedule " << scheduleId() << ": ==> Done Init ScheduleStatusMachine ";
return true;
}
@@ -125,13 +125,13 @@ bool ScheduleStatusMachine::switchToState(ScheduleStatus newScheduleStatus)
void ScheduleStatusMachine::onEnteredState()
{
DEBUG_LOG() << "Schedule " << scheduleId() << ": ScheduleStatusMachine - onEnteredState";
DEBUG_LOG(m_logger) << "Schedule " << scheduleId() << ": ScheduleStatusMachine - onEnteredState";
ScheduleStatusBase *s = qobject_cast<ScheduleStatusBase*>(sender());
if (!s)
return;
DEBUG_LOG() << "Schedule " << scheduleId() << ": ScheduleStatusBase : " << s->scheduleStatus();
DEBUG_LOG(m_logger) << "Schedule " << scheduleId() << ": ScheduleStatusBase : " << s->scheduleStatus();
m_stateManager->setCurrent(s->scheduleStatus());
@@ -45,6 +45,8 @@ namespace InfrastructureManagement
void onEnteredState();
private:
NGL::INGLLogger &m_logger;
ScheduleStatusBase *getStateFromId(InfrastructureManagement::ScheduleStatus ScheduleStatus);
int scheduleId() const;