102 lines
4.7 KiB
C++
Executable File
102 lines
4.7 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* HMI Plugin for ExerciseManangement - Exercise Overview Dialog
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Mike Wille, SLSE, 2016-03-30
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "scm_dialog_group.h"
|
|
|
|
#include <ServiceManagement/scm_ftc.h>
|
|
#include <ServiceManagement/scm_dtc.h>
|
|
#include <ExerciseManagement/exm_dtc.h>
|
|
#include <ServiceManagement/logger.h>
|
|
#include <LtsWidgets/lts_dialog.h>
|
|
#include <LtsUtilsGuiDds/request_helper.h>
|
|
|
|
|
|
namespace Ui
|
|
{
|
|
class ServiceManagementDialog;
|
|
}
|
|
|
|
namespace ServiceManagement
|
|
{
|
|
//class ExerciseManagementDialogModel;
|
|
// --------------------------------------------------------
|
|
// ExerciseManagementDialog
|
|
// --------------------------------------------------------
|
|
class ServiceManagementDialog : public LtsWidgets::LtsDialog
|
|
, protected ServiceManagement::Interface::Ftc::RestartServiceReplyHandler
|
|
, protected ServiceManagement::Interface::Ftc::RestartGroupReplyHandler
|
|
, protected ServiceManagement::Interface::Ftc::StartGroupReplyHandler
|
|
, protected ServiceManagement::Interface::Ftc::StopGroupReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ServiceManagementDialog(QWidget *parent = nullptr);
|
|
~ServiceManagementDialog();
|
|
|
|
bool init(const std::shared_ptr<Interface::Dtc> &dtc,
|
|
const std::shared_ptr<Interface::Ftc> &ftc,
|
|
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &dtcExm);
|
|
|
|
virtual void onRestartServiceReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
|
virtual void onRestartGroupReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
|
virtual void onStartGroupReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
|
virtual void onStopGroupReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
|
|
|
// TODO: raus, String soll gepublished werden
|
|
static QString groupEnumToGroupName(const Core::ServiceGroupType &type)
|
|
{
|
|
QMap<QString, Core::ServiceGroupType_def::type> groupNameMapping;
|
|
groupNameMapping.insert(QLatin1String("Master"), Core::ServiceGroupType_def::Master);
|
|
groupNameMapping.insert(QLatin1String("Core"), Core::ServiceGroupType_def::Core);
|
|
groupNameMapping.insert(QLatin1String("ExercisePreparation"), Core::ServiceGroupType_def::ExercisePreparation);
|
|
groupNameMapping.insert(QLatin1String("ExerciseExecution"), Core::ServiceGroupType_def::ExerciseExecution);
|
|
groupNameMapping.insert(QLatin1String("ExercisePaused"), Core::ServiceGroupType_def::ExercisePaused);
|
|
groupNameMapping.insert(QLatin1String("ExerciseAfterActionReview"), Core::ServiceGroupType_def::ExerciseAfterActionReview);
|
|
groupNameMapping.insert(QLatin1String("Playback"), Core::ServiceGroupType_def::Playback);
|
|
|
|
return groupNameMapping.key(type.underlying());
|
|
}
|
|
|
|
private:
|
|
void retranslate() override;
|
|
|
|
static QString craftBaseName(const QString &server, const QString &exercise) { return server + QLatin1Char('.') + exercise + QLatin1Char('.'); }
|
|
|
|
GroupWidget *addGroup(const Core::ServiceGroupType &groupType, int server, int exercise, int32_t replayPartitionId,
|
|
const QString &groupName, long long timestamp, const QVector<int> &servicesList);
|
|
void addService(const ServiceInformation &svc);
|
|
|
|
LtsUtils::RequestHelper *m_requestHelper;
|
|
|
|
public:
|
|
static QString craftGroupName(int server, int exercise, const QString &groupName) { return craftBaseName(QString::number(server), QString::number(exercise)) + groupName; }
|
|
static QString craftServiceName(int server, int exercise, const QString &groupName, int serviceId) { return craftGroupName(server, exercise, groupName) + QLatin1Char('.') + QString::number(serviceId); }
|
|
static QString craftWildcardedServiceName(int serviceId) { return craftBaseName(QLatin1String("*"), QLatin1String("*")) + QString::number(serviceId); }
|
|
|
|
Ui::ServiceManagementDialog *m_ui;
|
|
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_dtcExm;
|
|
std::shared_ptr<ServiceManagement::Interface::Dtc> m_dtc;
|
|
std::shared_ptr<ServiceManagement::Interface::Ftc> m_ftc;
|
|
|
|
LOGGER_T m_logger;
|
|
|
|
private slots:
|
|
void slotRestartService(int serviceID);
|
|
void slotRestartGroup(const Core::ServiceGroupType &groupType, int exercise, int server, int32_t replayPartitionId);
|
|
void slotStartGroup(const Core::ServiceGroupType &groupType, int exercise, int server, int32_t replayPartitionId);
|
|
void slotStopGroup(const Core::ServiceGroupType &groupType, int exercise, int server, int32_t replayPartitionId);
|
|
|
|
void slotGroupInformationChanged(ServiceManagement::GroupInformation, DataModification);
|
|
void slotServiceInformationChanged(ServiceManagement::ServiceInformation, DataModification);
|
|
};
|
|
}
|