92 lines
2.6 KiB
C++
Executable File
92 lines
2.6 KiB
C++
Executable File
/**
|
|
* Handler for table-io message data request
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by hjl, SLSE, 2016-10-12
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <QObject>
|
|
#include "dds_handler.h"
|
|
#include "logger.h"
|
|
#include <alm_db.h>
|
|
|
|
#include <AlarmManagement/alm_fts.h>
|
|
#include <AlarmManagement/alm_ftc.h>
|
|
#include <AlarmManagement/alm_dtc.h>
|
|
#include <AlarmManagement/alm_dts.h>
|
|
|
|
#include <ExerciseEventManagement/eem_dtc.h>
|
|
#include <MarkerManagement/mrk_ftc.h>
|
|
#include <handler_participant.h>
|
|
|
|
namespace AlarmManagement
|
|
{
|
|
class Initialization;
|
|
|
|
class HandlerConfigureAlarms final
|
|
: public QObject
|
|
, protected Interface::Fts::ConfigureAlarmsRequestHandler
|
|
, protected MarkerManagement::Interface::Ftc::MarkerModifyReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit HandlerConfigureAlarms(Initialization *mainHandler);
|
|
|
|
~HandlerConfigureAlarms();
|
|
|
|
bool init();
|
|
|
|
void onMarkerModifyReply(const Core::FunctionReplyObject &replyObject) override final;
|
|
void incrementWindowIndex() { m_windowIndex++; }
|
|
int getWindowIndex() const { return m_windowIndex; }
|
|
|
|
|
|
private Q_SLOTS:
|
|
void onEventChanged(const ExerciseEventManagement::Event &eventData, DataModification modType);
|
|
|
|
private: // methods
|
|
void onConfigureAlarmsRequest(const rti::core::SampleIdentity &cookie,
|
|
const ConfigureAlarmsRequest &request) override;
|
|
void sendWindow(const ExerciseEventManagement::Event &eventData,
|
|
const Database::AlmConfig &config);
|
|
void sendMarker(const ExerciseEventManagement::Event &eventData,
|
|
const Database::AlmConfig &config);
|
|
static QJsonObject getEventProperties(const ExerciseEventManagement::Event &eventData);
|
|
|
|
void removeAlarmConfig(int operatorId, int participantId, int eventTypeId);
|
|
void removeGlobalAlarmConfig(int operatorId);
|
|
|
|
private: // attributes
|
|
Initialization *m_mainHandler;
|
|
|
|
struct AlarmKey
|
|
{
|
|
int operatorId = 0;
|
|
int participantId = 0;
|
|
AlarmKey() = default;
|
|
explicit AlarmKey(const Database::AlmConfig &db)
|
|
: operatorId(db.operatorId)
|
|
, participantId(db.participantId.isNull() ? 0 : db.participantId.toInt())
|
|
{}
|
|
explicit AlarmKey(int operatorId_, int participantId_)
|
|
: operatorId(operatorId_)
|
|
, participantId(participantId_)
|
|
{}
|
|
|
|
bool operator<(const AlarmKey &o) const
|
|
{
|
|
if (operatorId != o.operatorId)
|
|
return operatorId < o.operatorId;
|
|
return participantId < o.participantId;
|
|
}
|
|
};
|
|
QMap<int, Database::AlmConfig> m_alarms; // Key = almConfig.id
|
|
|
|
NGL::INGLLogger &m_logger;
|
|
int m_windowIndex;
|
|
};
|
|
} // namespace AlarmManagement
|