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

@@ -44,7 +44,7 @@ AlmTests::~AlmTests()
// ------------------------------------------------------------------
bool AlmTests::init(int domainId, int testId, int operatorId)
{
INFO_LOG() << "init begin";
INFO_LOG(m_logger) << "init begin";
m_testId = testId;
m_operatorId = operatorId;
@@ -73,7 +73,7 @@ bool AlmTests::init(int domainId, int testId, int operatorId)
// ------------------------------------------------------------------
void AlmTests::startTest()
{
INFO_LOG() << "startTest m_testId=" << m_testId;
INFO_LOG(m_logger) << "startTest m_testId=" << m_testId;
if (m_testId <= 1) // Send FTC ConfigureAlarms and EEM Event
{
QTimer::singleShot(0, this, &AlmTests::tryConfigureAlarms);
@@ -102,7 +102,7 @@ void AlmTests::startTest()
// ------------------------------------------------------------------
void AlmTests::tryConfigureAlarms()
{
INFO_LOG() << "trying to send createRequest Operator Message";
INFO_LOG(m_logger) << "trying to send createRequest Operator Message";
std::vector<AlarmManagement::AlarmAction> alarms;
alarms.resize(2);
@@ -124,7 +124,7 @@ void AlmTests::tryConfigureAlarms()
if (!m_ftcAlm->configureAlarmsRequest(ConfigureAlarmsRequest(alarms, m_operatorId, participantIds, globalEvent, remove), this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
} // tryConfigureAlarms
@@ -132,7 +132,7 @@ void AlmTests::tryConfigureAlarms()
// ------------------------------------------------------------------
void AlmTests::tryCreateParticipant()
{
INFO_LOG() << "trying to create Participant index = " << m_participantIndex;
INFO_LOG(m_logger) << "trying to create Participant index = " << m_participantIndex;
ParticipantManagement::Participant participant;
switch (m_participantIndex)
{
@@ -153,10 +153,10 @@ void AlmTests::tryCreateParticipant()
participant.partyId(5);
break;
}
DEBUG_LOG() << "Publishing Participant";
DEBUG_LOG(m_logger) << "Publishing Participant";
if (!m_dtsPpm->publish(participant))
{
ERROR_LOG() << "Error publish Participant";
ERROR_LOG(m_logger) << "Error publish Participant";
failExit();
}
m_participantIndex++;
@@ -165,7 +165,7 @@ void AlmTests::tryCreateParticipant()
// ------------------------------------------------------------------
void AlmTests::tryConfigureAlarmsList()
{
INFO_LOG() << "trying to send createRequest Operator Message";
INFO_LOG(m_logger) << "trying to send createRequest Operator Message";
std::vector<AlarmManagement::AlarmAction> alarms;
alarms.resize(2);
@@ -188,7 +188,7 @@ void AlmTests::tryConfigureAlarmsList()
if (!m_ftcAlm->configureAlarmsRequest(ConfigureAlarmsRequest(alarms, m_operatorId, participantIds, globalEvent, remove), this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
} // tryConfigureAlarmsList
@@ -196,7 +196,7 @@ void AlmTests::tryConfigureAlarmsList()
// ------------------------------------------------------------------
void AlmTests::trySendEvent()
{
INFO_LOG() << "trying to send ParticipantEvent";
INFO_LOG(m_logger) << "trying to send ParticipantEvent";
ExerciseEventManagement::Event pe;
@@ -215,10 +215,10 @@ void AlmTests::trySendEvent()
QString properties = QString::fromUtf8(QJsonDocument(obj).toJson());
pe.properties(properties.toStdString());
DEBUG_LOG() << "Publishing EEM Event";
DEBUG_LOG(m_logger) << "Publishing EEM Event";
if (!m_dtsEem->publish(pe))
{
ERROR_LOG() << "Error publish EEM Event";
ERROR_LOG(m_logger) << "Error publish EEM Event";
failExit();
}
}
@@ -226,10 +226,10 @@ void AlmTests::trySendEvent()
// ------------------------------------------------------------------
void AlmTests::onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObject)
{
INFO_LOG() << "onConfigureAlarmsReply, error = " << replyObject.error();
INFO_LOG(m_logger) << "onConfigureAlarmsReply, error = " << replyObject.error();
if (replyObject.error())
{
ERROR_LOG() << "Error ConfigureAlarms - aborting";
ERROR_LOG(m_logger) << "Error ConfigureAlarms - aborting";
failExit();
}
} // onConfigureAlarmsReply
@@ -237,11 +237,11 @@ void AlmTests::onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObje
// ------------------------------------------------------------------
void AlmTests::checkAlarm()
{
INFO_LOG() << "checkAlarm";
INFO_LOG(m_logger) << "checkAlarm";
m_dtcAlm->waitForHistoricalDataNotification();
qint32 id = 0;
AlarmManagement::Notification notification = m_dtcAlm->notification(id);
INFO_LOG() << "Recived AlarmManagement::Notification: " << notification
INFO_LOG(m_logger) << "Recived AlarmManagement::Notification: " << notification
<< " testId: " << m_testId;
switch (m_testId)
@@ -249,12 +249,12 @@ void AlmTests::checkAlarm()
case 1:
case 2:
case 3:
INFO_LOG() << "ExitSuccess";
INFO_LOG(m_logger) << "ExitSuccess";
ExitSuccess();
break;
default:
// nothing
INFO_LOG() << "failExit";
INFO_LOG(m_logger) << "failExit";
failExit();
break;
}
@@ -270,7 +270,7 @@ void AlmTests::failExit()
// ------------------------------------------------------------------
void AlmTests::ExitSuccess()
{
DEBUG_LOG() << "SUCCESS";
DEBUG_LOG(m_logger) << "SUCCESS";
m_bTestsSuccessful = true;
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
} // ExitSuccess
@@ -46,6 +46,7 @@ protected Q_SLOTS:
void ExitSuccess();
protected:
NGL::INGLLogger &m_logger;
void onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObject) override final;
private:
@@ -16,14 +16,14 @@ namespace AlarmManagement
DdsHandler::DdsHandler(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector)
: m_ddsConnector(ddsConnector)
{
DEBUG_LOG() << "DdsHandler(" << m_ddsConnector->getDomainId() << ") for partition: " << m_ddsConnector->getDefaultPartition();
DEBUG_LOG(m_logger) << "DdsHandler(" << m_ddsConnector->getDomainId() << ") 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;
}
@@ -40,34 +40,34 @@ bool DdsHandler::init(const QStringList &qosFileList)
m_dtsAlm = AlarmManagement::Interface::Dts::create(m_ddsConnector);
bool bRet = m_dtsAlm->enableAll();
INFO_LOG() << "Dts initialised";
INFO_LOG(m_logger) << "Dts initialised";
m_dtcAlm = AlarmManagement::Interface::Dtc::create(m_ddsConnector);
bRet &= m_dtcAlm->enableAcknowledgeSOSInAllExercises();
INFO_LOG() << "Dts initialised";
INFO_LOG(m_logger) << "Dts initialised";
m_ftsAlm = AlarmManagement::Interface::Fts::create(m_ddsConnector);
bRet &= m_ftsAlm->enableAll();
INFO_LOG() << "Fts initialised";
INFO_LOG(m_logger) << "Fts initialised";
m_dtcEem = ExerciseEventManagement::Interface::Dtc::create(m_ddsConnector);
bRet &= m_dtcEem->enableEvent();
INFO_LOG() << "Dtc EEM initialised";
INFO_LOG(m_logger) << "Dtc EEM initialised";
m_ftcMrk = MarkerManagement::Interface::Ftc::create(m_ddsConnector);
bRet &= m_ftcMrk->enableMarkerModify();
INFO_LOG() << "Ftc MRK initialised";
INFO_LOG(m_logger) << "Ftc MRK initialised";
m_dtcPpm = ParticipantManagement::Interface::Dtc::create(m_ddsConnector);
bRet &= m_dtcPpm->enableParticipant();
INFO_LOG() << "Dtc PPM initialised";
INFO_LOG(m_logger) << "Dtc PPM initialised";
m_exmDtc = ExerciseManagement::Interface::Dtc::create(m_ddsConnector);
bRet &= m_exmDtc->enableExercise();
m_dtcTab = TrainingAreaBase::Interface::Dtc::create(m_ddsConnector);
bRet &= m_dtcTab->enableEmergencyCall();
INFO_LOG() << "Dtc TAB initialised";
INFO_LOG(m_logger) << "Dtc TAB initialised";
m_dtsEmergencyCallPublisher = std::make_shared<DDSConnector::Publisher>(m_ddsConnector->getDomainParticipant(),
@@ -77,7 +77,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
m_dtsEmergencyCallPublisher->getDdsPublisher(),
DDS::Helper::getShortTopicName(DDS::topic_type_name<AlarmManagement::AcknowledgeSOSInAllExercises>::value()));
INFO_LOG() << "Dtc TAB initialised";
INFO_LOG(m_logger) << "Dtc TAB initialised";
return bRet;
}
@@ -49,6 +49,7 @@ public:
qint64 currentPartitionTime() const;
private:
NGL::INGLLogger &m_logger;
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<Core::Interface::Dtc> m_dtcCore;
std::shared_ptr<Core::TopicLockMaster> m_topicLockMaster;
@@ -51,7 +51,7 @@ HandlerConfigureAlarms::~HandlerConfigureAlarms()
bool HandlerConfigureAlarms::init()
{
INFO_LOG() << "Start HandlerConfigureAlarms.";
INFO_LOG(m_logger) << "Start HandlerConfigureAlarms.";
auto dtcEem = m_mainHandler->dds()->dtcEem();
@@ -61,7 +61,7 @@ bool HandlerConfigureAlarms::init()
// publish data from db-table 'alm_config'
auto cb = [this](const Database::AlmConfig & data)
{
DEBUG_LOG() << "restore AlarmConfig from DB data: id=" << data.id
DEBUG_LOG(m_logger) << "restore AlarmConfig from DB data: id=" << data.id
<< " operatorId=" << data.operatorId
<< " participantId=" << data.participantId.toInt()
<< " global=" << data.global
@@ -75,7 +75,7 @@ bool HandlerConfigureAlarms::init()
};
if (!m_mainHandler->db()->select(cb))
{
ERROR_LOG() << "Error reading data from database 'alm_config'!";
ERROR_LOG(m_logger) << "Error reading data from database 'alm_config'!";
return false;
}
@@ -87,7 +87,7 @@ void HandlerConfigureAlarms::removeAlarmConfig(int operatorId,
int participantId,
int eventTypeId)
{
DEBUG_LOG() << "removeAlarmConfig m_alarms.size=" << m_alarms.size()
DEBUG_LOG(m_logger) << "removeAlarmConfig m_alarms.size=" << m_alarms.size()
<< " operatorId=" << operatorId
<< " participantId=" << participantId
<< " eventTypeId=" << eventTypeId;
@@ -97,7 +97,7 @@ void HandlerConfigureAlarms::removeAlarmConfig(int operatorId,
while (i.hasNext())
{
i.next();
DEBUG_LOG() << "key= " << i.key() << ": "
DEBUG_LOG(m_logger) << "key= " << i.key() << ": "
<< " operatorId=" << i.value().operatorId
<< " participantId=" << i.value().participantId.toInt()
<< " eventTypeId=" << i.value().eventTypeId.underlying();
@@ -106,7 +106,7 @@ void HandlerConfigureAlarms::removeAlarmConfig(int operatorId,
&& (eventTypeId == ProjectDataManagement::EventType_def::Unknown || eventTypeId == i.value().eventTypeId.underlying()))
{
const int key = i.key();
DEBUG_LOG() << "found alarm to remove: " << key << ", eventTypeId: " << eventTypeId;
DEBUG_LOG(m_logger) << "found alarm to remove: " << key << ", eventTypeId: " << eventTypeId;
m_mainHandler->db()->removeAlmConfig(key);
m_mainHandler->dds()->dtsAlm()->removeAlarmConfigByKey(key);
m_alarms.remove(key); // is ok, QMapIterator work on a copy
@@ -116,20 +116,20 @@ void HandlerConfigureAlarms::removeAlarmConfig(int operatorId,
void HandlerConfigureAlarms::removeGlobalAlarmConfig(int operatorId)
{
DEBUG_LOG() << "removeAlarmConfig m_alarms.size=" << m_alarms.size();
DEBUG_LOG(m_logger) << "removeAlarmConfig m_alarms.size=" << m_alarms.size();
// Find Key
QMapIterator<int, Database::AlmConfig> i(m_alarms);
while (i.hasNext())
{
i.next();
DEBUG_LOG() << "key= " << i.key()
DEBUG_LOG(m_logger) << "key= " << i.key()
<< " participantId=" << i.value().participantId.toInt();
if ((operatorId == i.value().operatorId)
&& (i.value().participantId.toInt()) == 0)
{
const int key = i.key();
DEBUG_LOG() << "found alarm to remove: " << key;
DEBUG_LOG(m_logger) << "found alarm to remove: " << key;
m_mainHandler->db()->removeAlmConfig(key);
m_mainHandler->dds()->dtsAlm()->removeAlarmConfigByKey(key);
m_alarms.remove(key); // is ok, QMapIterator work on a copy
@@ -141,7 +141,7 @@ void HandlerConfigureAlarms::removeGlobalAlarmConfig(int operatorId)
void HandlerConfigureAlarms::onConfigureAlarmsRequest(const rti::core::SampleIdentity &cookie,
const ConfigureAlarmsRequest &request)
{
DEBUG_LOG() << "onConfigureAlarmsRequest " << request;
DEBUG_LOG(m_logger) << "onConfigureAlarmsRequest " << request;
if (request.participantIds().size() == 0)
{
Core::FunctionReplyObject ret(0, tr_lts("dds", "Error adding ConfigureAlarms to database. There were no participants given."));
@@ -154,13 +154,13 @@ void HandlerConfigureAlarms::onConfigureAlarmsRequest(const rti::core::SampleIde
// remove only this one Alarm, not all types of the participant for operator
// in DB,
// from DDS
DEBUG_LOG() << "request.remove()";
DEBUG_LOG(m_logger) << "request.remove()";
if (request.participantIds().size() > 0 &&
request.alarms().size() > 0)
{
int participantId = request.participantIds()[0];
int eventTypeId = request.alarms()[0].eventTypeId().underlying();
DEBUG_LOG() << "removeAlarmConfig(request.operatorId()=" << request.operatorId()
DEBUG_LOG(m_logger) << "removeAlarmConfig(request.operatorId()=" << request.operatorId()
<< " participantId=" << participantId
<< " eventTypeId=" << eventTypeId;
removeAlarmConfig(request.operatorId(), participantId, eventTypeId);
@@ -171,7 +171,7 @@ void HandlerConfigureAlarms::onConfigureAlarmsRequest(const rti::core::SampleIde
// remove old configuration
for (int participantId : request.participantIds())
{
DEBUG_LOG() << "remove old configuration participantId=" << participantId;
DEBUG_LOG(m_logger) << "remove old configuration participantId=" << participantId;
removeAlarmConfig(request.operatorId(), participantId, 0);
}
if ( request.global())
@@ -181,10 +181,10 @@ void HandlerConfigureAlarms::onConfigureAlarmsRequest(const rti::core::SampleIde
for (int participantId : request.participantIds())
{
DEBUG_LOG() << "participantId: " << participantId;
DEBUG_LOG(m_logger) << "participantId: " << participantId;
for (const AlarmManagement::AlarmAction &action : request.alarms())
{
DEBUG_LOG() << "action: " << action;
DEBUG_LOG(m_logger) << "action: " << action;
AlarmManagement::AlarmConfig almConfig;
almConfig.operatorId(request.operatorId());
@@ -210,7 +210,7 @@ void HandlerConfigureAlarms::onConfigureAlarmsRequest(const rti::core::SampleIde
Core::FunctionReplyObject ret(0, tr_lts("dds", "Error adding ConfigureAlarms to database."));
m_mainHandler->dds()->ftsAlm()->configureAlarmsReply(cookie, ret);
}
DEBUG_LOG() << "m_dbAlmConfig.insert id=" << newConfig.id;
DEBUG_LOG(m_logger) << "m_dbAlmConfig.insert id=" << newConfig.id;
almConfig.id(newConfig.id);
m_alarms.insert(newConfig.id, newConfig);
@@ -224,11 +224,11 @@ void HandlerConfigureAlarms::onConfigureAlarmsRequest(const rti::core::SampleIde
//-----------------------------------------------------------------------------
void HandlerConfigureAlarms::onEventChanged(const ExerciseEventManagement::Event &eventData, DataModification modType)
{
DEBUG_LOG() << "onParticipantEventChanged participantId=" << eventData.participantId();
DEBUG_LOG(m_logger) << "onParticipantEventChanged participantId=" << eventData.participantId();
if (modType == DataModification::eRemoved ||
modType == DataModification::eModified)
return;
DEBUG_LOG() << "onParticipantEventChanged verarbeiten m_alarms.size =" << m_alarms.size();
DEBUG_LOG(m_logger) << "onParticipantEventChanged verarbeiten m_alarms.size =" << m_alarms.size();
ExerciseEventManagement::Event eventDatalocal = eventData;
@@ -248,7 +248,7 @@ void HandlerConfigureAlarms::onEventChanged(const ExerciseEventManagement::Event
for (const Database::AlmConfig &alarm : std::as_const(m_alarms))
{
{
/*DEBUG_LOG() << " alarmConfigItem.id=" << alarm.id
/*DEBUG_LOG(m_logger) << " alarmConfigItem.id=" << alarm.id
<< " alarmConfigItem.participantId=" << alarm.participantId
<< " alarmConfigItem.eventTypeId=" << alarm.eventTypeId
<< " eventDatalocal.eventTypeId()=" << eventDatalocal.eventTypeId().underlying()
@@ -272,7 +272,7 @@ void HandlerConfigureAlarms::onEventChanged(const ExerciseEventManagement::Event
bool allVulnerabilityStates = alarm.vulnerabilityState == -1;
bool vulnerabilityCheck = vulnerabilityState == alarm.vulnerabilityState;
bool globalAlarm = participantId == 0;
DEBUG_LOG() << " allVulnerabilityStates=" << allVulnerabilityStates
DEBUG_LOG(m_logger) << " allVulnerabilityStates=" << allVulnerabilityStates
<< " vulnerabilityCheck=" << vulnerabilityCheck
<< " participantId=" << participantId
<< " eventDatalocal.participantId()=" << eventDatalocal.participantId();
@@ -281,19 +281,19 @@ void HandlerConfigureAlarms::onEventChanged(const ExerciseEventManagement::Event
{
if (sentEventToOperator.contains(alarm.operatorId))
{
DEBUG_LOG() << "Event " << eventDatalocal.eventTypeId() << " already handled for Operator:" << alarm.operatorId;
DEBUG_LOG(m_logger) << "Event " << eventDatalocal.eventTypeId() << " already handled for Operator:" << alarm.operatorId;
continue;
}
sentEventToOperator += alarm.operatorId;
if (alarm.messageWindow)
{
DEBUG_LOG() << "send Window to Operator:" << alarm.operatorId;
DEBUG_LOG(m_logger) << "send Window to Operator:" << alarm.operatorId;
sendWindow(eventDatalocal, alarm);
}
if (alarm.setMarker)
{
DEBUG_LOG() << "set Marker to Operator:" << alarm.operatorId;
DEBUG_LOG(m_logger) << "set Marker to Operator:" << alarm.operatorId;
sendMarker(eventDatalocal, alarm);
}
}
@@ -359,7 +359,7 @@ void HandlerConfigureAlarms::sendMarker(const ExerciseEventManagement::Event &ev
{
int defaultOffset = 10000;
DEBUG_LOG() << "eventProperties =" << eventData.properties();
DEBUG_LOG(m_logger) << "eventProperties =" << eventData.properties();
QString contentStr;
contentStr = QStringLiteral("Equip No.: ");
@@ -376,7 +376,7 @@ void HandlerConfigureAlarms::sendMarker(const ExerciseEventManagement::Event &ev
contentStr += eventObject.value(QStringLiteral("AesName")).toString();
contentStr += QStringLiteral(")");
}
DEBUG_LOG() << "contentStr=" << contentStr;
DEBUG_LOG(m_logger) << "contentStr=" << contentStr;
const QByteArray contentArr = contentStr.toUtf8();
@@ -399,6 +399,6 @@ void HandlerConfigureAlarms::sendMarker(const ExerciseEventManagement::Event &ev
void HandlerConfigureAlarms::onMarkerModifyReply(const Core::FunctionReplyObject &replyObject)
{
Q_UNUSED(replyObject);
INFO_LOG() << "************** onMarkerCreateReply";
INFO_LOG(m_logger) << "************** onMarkerCreateReply";
} // end onMarkerCreateReply
} // namespace AlarmManagement
@@ -48,6 +48,8 @@ private Q_SLOTS:
void onEventChanged(const ExerciseEventManagement::Event &eventData, DataModification modType);
private: // methods
NGL::INGLLogger &m_logger;
void onConfigureAlarmsRequest(const rti::core::SampleIdentity &cookie,
const ConfigureAlarmsRequest &request) override;
void sendWindow(const ExerciseEventManagement::Event &eventData,
@@ -34,7 +34,7 @@ HandlerEmergencyCall::~HandlerEmergencyCall()
bool HandlerEmergencyCall::init()
{
INFO_LOG() << "Start HandlerEmergencyCall.";
INFO_LOG(m_logger) << "Start HandlerEmergencyCall.";
auto dtcTab = m_mainHandler->dds()->dtcTab();
@@ -48,7 +48,7 @@ bool HandlerEmergencyCall::init()
bool bRet = true;
auto cbEmergencyCall = [this, &bRet](const Database::AlmEmergencyCall &data)
{
WARNING_LOG()<<" ALM_EMERGENCY " << "Reading from DB AlmEmergencyCall with id = " << data.id;
WARNING_LOG(m_logger)<<" ALM_EMERGENCY " << "Reading from DB AlmEmergencyCall with id = " << data.id;
if (!this->isExerciseValidForEmergencyCall() && !data.expired)
return;
@@ -57,7 +57,7 @@ bool HandlerEmergencyCall::init()
if (ret.error())
{
delete ifs;
ERROR_LOG() << ret();
ERROR_LOG(m_logger) << ret();
bRet = false;
return;
}
@@ -67,7 +67,7 @@ bool HandlerEmergencyCall::init()
if (!m_mainHandler->db()->select(cbEmergencyCall) || !bRet)
{
ERROR_LOG() <<"Error reading data from database 'alm_emergency_call!";
ERROR_LOG(m_logger) <<"Error reading data from database 'alm_emergency_call!";
return false;
}
@@ -95,21 +95,21 @@ bool HandlerEmergencyCall::createEmergencyCallObject(const AlarmManagement::AlmE
if (ret.error())
{
delete ifs;
ERROR_LOG()<< ret();
ERROR_LOG(m_logger)<< ret();
return false;
}
WARNING_LOG()<< "Entry createEmergencyCallObject in the DB id: "<<ifs->getData().id<<" issi: "<<ifs->getData().issi<<" expired: "<<ifs->getData().expired;
WARNING_LOG(m_logger)<< "Entry createEmergencyCallObject in the DB id: "<<ifs->getData().id<<" issi: "<<ifs->getData().issi<<" expired: "<<ifs->getData().expired;
m_emergencyObjMap.insert(ifs->getId(), ifs);
return true;
}
void HandlerEmergencyCall::onEmergencyCallAcknowledgeRequest(const rti::core::SampleIdentity &cookie, const EmergencyCallAcknowledgeRequest &request)
{
WARNING_LOG() << "[onEmergencyCallAcknowledgeRequest] request: " << request;
WARNING_LOG(m_logger) << "[onEmergencyCallAcknowledgeRequest] request: " << request;
Core::FunctionReplyObject ret = emergencyCallAcknowledgeRequest(request);
if (ret.error())
WARNING_LOG()<< ret();
WARNING_LOG(m_logger)<< ret();
if (request.expired())
{
@@ -122,7 +122,7 @@ void HandlerEmergencyCall::onEmergencyCallAcknowledgeRequest(const rti::core::Sa
ackInEx.operatorId(request.operatorId());
ackInEx.comment(request.comment());
ackInEx.expired(request.expired());
WARNING_LOG() << "onEmergencyCallAcknowledgeRequest: issi: "<<ackInEx.issi();
WARNING_LOG(m_logger) << "onEmergencyCallAcknowledgeRequest: issi: "<<ackInEx.issi();
m_mainHandler->dds()->publishSOS()->write(ackInEx);
}
m_mainHandler->dds()->ftsAlm()->emergencyCallAcknowledgeReply(cookie,ret);
@@ -145,17 +145,17 @@ Core::FunctionReplyObject HandlerEmergencyCall::emergencyCallAcknowledgeRequest(
if (ifs == nullptr)
{
WARNING_LOG()<<" Couldn't acknowledge SOS with issi: " <<request.issi()<< ": already acknowledged or issi doesn't exist.";
WARNING_LOG(m_logger)<<" Couldn't acknowledge SOS with issi: " <<request.issi()<< ": already acknowledged or issi doesn't exist.";
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "already acknowledged or issi(%1) couldn't be found")).arg(request.issi());
}
if (ifs->getData().expired) // if already expired do nothing
{
WARNING_LOG() << "SOS Already expired do nothing";
WARNING_LOG(m_logger) << "SOS Already expired do nothing";
return Core::FunctionReplyObject(ifs->getData().id);
}
WARNING_LOG() << "emergencyCallAcknowledgeRequest: issi found!: "<<request.issi()<<" ifs->state: "<<ifs->getData().expired;
WARNING_LOG(m_logger) << "emergencyCallAcknowledgeRequest: issi found!: "<<request.issi()<<" ifs->state: "<<ifs->getData().expired;
Database::AlmEmergencyCall newData(ifs->getData());
newData.expired = true;
newData.issi = request.issi();
@@ -189,7 +189,7 @@ bool HandlerEmergencyCall::isNewEmergencyCall(const AlmEmergencyCall &newdata)
&& data.incomingTime == newdata.incomingTime()
&& !data.expired)
{
WARNING_LOG()<<" SOS EXISTS and not yet quit! issi: "<<data.issi<<" incomingTime: "<<data.incomingTime<<" expired: "<<data.expired;
WARNING_LOG(m_logger)<<" SOS EXISTS and not yet quit! issi: "<<data.issi<<" incomingTime: "<<data.incomingTime<<" expired: "<<data.expired;
return false;
}
}
@@ -218,7 +218,7 @@ void HandlerEmergencyCall::onEmergencyCallChanged(const TrainingAreaBase::Emerge
void HandlerEmergencyCall::onAcknowledgeSOSInExercises(const AcknowledgeSOSInAllExercises &data, DataModification modType)
{
DEBUG_LOG()<< "onAcknowledgeSOSInExercises START ";
DEBUG_LOG(m_logger)<< "onAcknowledgeSOSInExercises START ";
Q_UNUSED(modType)
EmergencyCallAcknowledgeRequest request;
@@ -232,7 +232,7 @@ void HandlerEmergencyCall::onAcknowledgeSOSInExercises(const AcknowledgeSOSInAll
request.operatorId(data.operatorId());
emergencyCallAcknowledgeRequest(request);
DEBUG_LOG()<< "onAcknowledgeEmergencyInExercises END ";
DEBUG_LOG(m_logger)<< "onAcknowledgeEmergencyInExercises END ";
}
} // namespace AlarmManagement
@@ -33,6 +33,7 @@ public:
bool init();
private:
NGL::INGLLogger &m_logger;
bool createEmergencyCallObject(const AlmEmergencyCall &data);
void onEmergencyCallAcknowledgeRequest(const rti::core::SampleIdentity &cookie,
const EmergencyCallAcknowledgeRequest &request) override final;
@@ -45,6 +46,7 @@ private slots:
void onAcknowledgeSOSInExercises(const AlarmManagement::AcknowledgeSOSInAllExercises &data, DataModification modType);
private:
NGL::INGLLogger &m_logger;
Initialization *m_mainHandler;
std::shared_ptr<HandlerConfigureAlarms> m_configAlarmHandler;
QMap<int, ObjectEmergencyCall *> m_emergencyObjMap; // Key = DangerAreaId
@@ -11,10 +11,9 @@
using namespace AlarmManagement;
HandlerParticipant::HandlerParticipant(const std::shared_ptr<DdsHandler> &ddsHandler)
: QObject()
, m_ddsHandler(ddsHandler)
{
HandlerParticipant::HandlerParticipant(const std::shared_ptr<DdsHandler> &ddsHandler) : QObject()
, m_ddsHandler(ddsHandler),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
} // end of ctor()
//-----------------------------------------------------------------------------
@@ -44,13 +43,13 @@ bool HandlerParticipant::init()
if (!dtcPpm->enableParticipant())
{
ERROR_LOG() << "Could not initialize ParticipantManagement enableParticipant data topic client";
ERROR_LOG(m_logger) << "Could not initialize ParticipantManagement enableParticipant data topic client";
return false;
}
if (!dtcPpm->enableDynamicParticipantData())
{
ERROR_LOG() << "Could not initialize ParticipantManagement enableDynamicParticipant data topic client";
ERROR_LOG(m_logger) << "Could not initialize ParticipantManagement enableDynamicParticipant data topic client";
return false;
}
@@ -66,7 +65,7 @@ bool HandlerParticipant::init()
if (participant.equipmentNumber().is_set())
{
m_partId2EquipNoMap.insert(participant.id(), participant.equipmentNumber().get());
DEBUG_LOG() << "m_partId2EquipNoMap.insert participantId=" << participant.id() << "EquimentNo=" << participant.equipmentNumber().get();
DEBUG_LOG(m_logger) << "m_partId2EquipNoMap.insert participantId=" << participant.id() << "EquimentNo=" << participant.equipmentNumber().get();
}
else
m_partId2EquipNoMap.insert(participant.id(), 0);
@@ -86,13 +85,13 @@ bool HandlerParticipant::init()
ParticipantManagement::StateInformation state = states[0];
int vulnerability = state.vulnerabilityState().underlying();
m_partId2VulnerabilityMap.insert(i.value().participantId(), vulnerability);
DEBUG_LOG() << "m_partId2EquipNoMap.insert participantId=" << i.value().participantId() << "vulnerability=" << vulnerability;
DEBUG_LOG(m_logger) << "m_partId2EquipNoMap.insert participantId=" << i.value().participantId() << "vulnerability=" << vulnerability;
}
else
m_partId2VulnerabilityMap.insert(i.value().participantId(), -1);
}
INFO_LOG() << "HandlerParticipant::init() finished. ";
INFO_LOG(m_logger) << "HandlerParticipant::init() finished. ";
return true;
} // end of init()
//-----------------------------------------------------------------------------
@@ -101,12 +100,12 @@ void HandlerParticipant::onParticipantChanged(const ParticipantManagement::Parti
{
if (modType == DataModification::eRemoved)
{
DEBUG_LOG() << "onParticipantChanged - remove: " << data.id();
DEBUG_LOG(m_logger) << "onParticipantChanged - remove: " << data.id();
m_participantHierarchy.remove(data.id());
}
else
{
DEBUG_LOG() << "onParticipantChanged:" << data;
DEBUG_LOG(m_logger) << "onParticipantChanged:" << data;
m_participantHierarchy.insert(data.id(),
AlarmManagement::HandlerParticipant::ParticipantHierarchy(data));
const int equipNo = data.equipmentNumber().is_set() ? data.equipmentNumber().get() : 0;
@@ -117,13 +116,13 @@ void HandlerParticipant::onParticipantChanged(const ParticipantManagement::Parti
void HandlerParticipant::onDynamicParticipantChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType)
{
DEBUG_LOG() << "onDynamicParticipant participantId=" << data.participantId();
DEBUG_LOG(m_logger) << "onDynamicParticipant participantId=" << data.participantId();
if (modType == DataModification::eRemoved)
{
}
else
{
INFO_LOG() << "onDynamicParticipant()"
INFO_LOG(m_logger) << "onDynamicParticipant()"
<< " participantId: " << data.participantId();
if (data.stateHistory().size() > 0)
{
@@ -131,7 +130,7 @@ void HandlerParticipant::onDynamicParticipantChanged(const ParticipantManagement
ParticipantManagement::StateInformation state = states[0];
int vulnerability = state.vulnerabilityState().underlying();
m_partId2VulnerabilityMap.insert(data.participantId(), vulnerability);
DEBUG_LOG() << "m_partId2EquipNoMap.insert participantId=" << data.participantId()
DEBUG_LOG(m_logger) << "m_partId2EquipNoMap.insert participantId=" << data.participantId()
<< " vulnerability=" << vulnerability;
}
else
@@ -178,7 +177,7 @@ QVector<int> HandlerParticipant::getRecursiveInferiorIds(const int participantId
int HandlerParticipant::participantId2EquipNo(const int participantId) const
{
int ret = m_partId2EquipNoMap.value(participantId, 0);
INFO_LOG() << "participantId2EquipNo participantId=" << participantId
INFO_LOG(m_logger) << "participantId2EquipNo participantId=" << participantId
<< " EquipmentNumber=" << ret;
return ret;
} // end of participantId2EquipNo()
@@ -186,7 +185,7 @@ int HandlerParticipant::participantId2EquipNo(const int participantId) const
int HandlerParticipant::participantId2Vulnerability(const int participantId) const
{
int ret = m_partId2VulnerabilityMap.value(participantId, 0);
INFO_LOG() << "m_partId2VulnerabilityMap participantId=" << participantId
INFO_LOG(m_logger) << "m_partId2VulnerabilityMap participantId=" << participantId
<< " Vulnerability=" << ret;
return ret;
} // end of participantId2Vulnerability()
@@ -78,6 +78,8 @@ private Q_SLOTS:
void onDynamicParticipantChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType);
private: // methoden
NGL::INGLLogger &m_logger;
QVector<AlarmManagement::HandlerParticipant::ParticipantHierarchy> getInferiorParts(int participantId) const;
private: // attributes
@@ -19,7 +19,7 @@ using namespace AlarmManagement;
Initialization::Initialization()
: m_logger(getLogger("Initialization"))
{
INFO_LOG() << "Initialization::Initialization";
INFO_LOG(m_logger) << "Initialization::Initialization";
} // end of ctor()
//-----------------------------------------------------------------------------
@@ -32,32 +32,32 @@ Initialization::~Initialization()
m_dbHandler = nullptr;
m_ddsHandler = nullptr;
INFO_LOG() << "Initialization::~Initialization";
INFO_LOG(m_logger) << "Initialization::~Initialization";
} // end of dtor()
//-----------------------------------------------------------------------------
bool Initialization::initialize(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector, const QSqlDatabase &sqlDb)
{
INFO_LOG() << "Start AlarmManagement Initialization. domainId =" << ddsConnector->getDomainId()
INFO_LOG(m_logger) << "Start AlarmManagement Initialization. domainId =" << ddsConnector->getDomainId()
<< " exerciseId=" << ddsConnector->getPartitionId();
// initialize DDS
m_ddsHandler = std::make_shared<DdsHandler>(ddsConnector);
if (!m_ddsHandler->init())
{
ERROR_LOG() << "Initialisation DdsHandler failed.";
ERROR_LOG(m_logger) << "Initialisation DdsHandler failed.";
return false;
}
INFO_LOG() << "m_ddsHandler initialized. ";
INFO_LOG(m_logger) << "m_ddsHandler initialized. ";
// initialize database
m_dbHandler = std::make_shared<DbHandler>();
if (!m_dbHandler->init(ddsConnector->getPartitionId(), sqlDb))
{
ERROR_LOG() << "Initialisation DbHandler failed.";
ERROR_LOG(m_logger) << "Initialisation DbHandler failed.";
return false;
}
INFO_LOG() << "DbHandler initialized. ";
INFO_LOG(m_logger) << "DbHandler initialized. ";
// create handlers
@@ -65,7 +65,7 @@ bool Initialization::initialize(const std::shared_ptr<DDSConnector::DdsConnector
m_handlerConfigureAlarms = std::make_shared<HandlerConfigureAlarms>(this);
m_handlerEmergencyCall = std::make_shared<HandlerEmergencyCall>(m_handlerConfigureAlarms, this);
DEBUG_LOG() << "initialize successfully finished";
DEBUG_LOG(m_logger) << "initialize successfully finished";
return true;
} // end of init()
@@ -76,20 +76,20 @@ bool Initialization::loadFromDatabase()
// initialize handlers
if (!m_handlerParticipant || !m_handlerParticipant->init())
{
ERROR_LOG() << "Can not initialize Participant handler";
ERROR_LOG(m_logger) << "Can not initialize Participant handler";
return false;
}
if (!m_handlerConfigureAlarms || !m_handlerConfigureAlarms->init())
{
ERROR_LOG() << "Can not initialize Alarm handler";
ERROR_LOG(m_logger) << "Can not initialize Alarm handler";
return false;
}
if (!m_handlerEmergencyCall || !m_handlerEmergencyCall->init())
{
ERROR_LOG() << "Can not initialize EmergencyCall handler";
ERROR_LOG(m_logger) << "Can not initialize EmergencyCall handler";
return false;
}
DEBUG_LOG() << "loadFromDatabase successfully finished";
DEBUG_LOG(m_logger) << "loadFromDatabase successfully finished";
return true;
}
@@ -45,6 +45,8 @@ public:
std::shared_ptr<HandlerParticipant> hdlParticipant() const { return m_handlerParticipant; }
private: // attributes
NGL::INGLLogger &m_logger;
std::shared_ptr<DdsHandler> m_ddsHandler;
std::shared_ptr<DbHandler> m_dbHandler; ///< Pointer to DB handler
std::shared_ptr<HandlerConfigureAlarms> m_handlerConfigureAlarms;
@@ -4,10 +4,9 @@
namespace AlarmManagement{
ObjectEmergencyCall::ObjectEmergencyCall(Initialization *mainHandler, QObject *parent)
: QObject(parent)
, m_mainHandler(mainHandler)
{
ObjectEmergencyCall::ObjectEmergencyCall(Initialization *mainHandler, QObject *parent) : QObject(parent)
, m_mainHandler(mainHandler),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
}
ObjectEmergencyCall::~ObjectEmergencyCall()
@@ -23,7 +22,7 @@ Core::FunctionReplyObject ObjectEmergencyCall::createObject(const Database::AlmE
{
if (!m_mainHandler->db()->insert(m_data))
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting Order into database."));
WARNING_LOG() << "New EmergencyCall created Id: " << m_data.id;
WARNING_LOG(m_logger) << "New EmergencyCall created Id: " << m_data.id;
}
// Publish Data via DTS
onPublishData();
@@ -40,7 +39,7 @@ Core::FunctionReplyObject ObjectEmergencyCall::updateObject(const Database::AlmE
if (!m_mainHandler->db()->update(m_data))
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Error updating EmergencyCall into database"));
DEBUG_LOG() << "Data changed for Changed Id: " << m_data.id;
DEBUG_LOG(m_logger) << "Data changed for Changed Id: " << m_data.id;
// Publish Data via DTS
onPublishData();
@@ -71,10 +70,10 @@ void ObjectEmergencyCall::onPublishData()
ddsData.operatorId(m_data.operatorId);
ddsData.comment(m_data.comment.toStdString());
INFO_LOG() << "Publish AlmEmergencyCall-data to dds (" << m_data.id << ") ...";
INFO_LOG(m_logger) << "Publish AlmEmergencyCall-data to dds (" << m_data.id << ") ...";
if (!m_mainHandler->dds()->dtsAlm()->publish(ddsData))
ERROR_LOG() << "Error publishing AlmEmergencyCall-data to dds";
ERROR_LOG(m_logger) << "Error publishing AlmEmergencyCall-data to dds";
}
}// namespace AlarmManagement
@@ -32,6 +32,7 @@ protected Q_SLOTS:
void onPublishData();
private:
NGL::INGLLogger &m_logger;
Initialization *m_mainHandler;
Database::AlmEmergencyCall m_data;
};