Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+70
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* The ServiceHandler class handles all service related classes and writes the services state to DDS.
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2016-02-15
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
|
||||
#include "logger.h"
|
||||
#include "service_donator.h"
|
||||
#include <ServiceManagement/scm_fts.h>
|
||||
|
||||
class QTimer;
|
||||
|
||||
namespace ServiceManagement
|
||||
{
|
||||
class DdsHandler;
|
||||
class LicenceDonator;
|
||||
class Service;
|
||||
class ServiceInformation;
|
||||
class ServiceProcess;
|
||||
|
||||
class ServiceHandler final
|
||||
: public ServiceDonator
|
||||
, protected Interface::Fts::RestartServiceRequestHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ServiceHandler(const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<LicenceDonator> &licenceDonator);
|
||||
~ServiceHandler();
|
||||
|
||||
bool init();
|
||||
void addService(Service *service);
|
||||
|
||||
ServiceProcess *getProcess(int serviceId, const GroupRequest &groupData) override final;
|
||||
|
||||
void onRestartServiceRequest(const rti::core::SampleIdentity &cookie,
|
||||
const RestartServiceRequest &request) override final;
|
||||
|
||||
void stopAllServices();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void onNewServiceInfoFromProc(const ServiceInformation &info);
|
||||
void onNewServiceInfoFromDds(const Core::CurrentRunningState &data, DataModification type) override final;
|
||||
void onHeartBeatObserverTimerTimeout();
|
||||
|
||||
private: // methods
|
||||
Service *serviceFromId(int id);
|
||||
ServiceProcess *serviceProcessFromPid(qint64 pid);
|
||||
ServiceProcess *serviceProcessFromServiceProcId(int32_t id);
|
||||
|
||||
private: // attributes
|
||||
QVector<Service *> m_services;
|
||||
QTimer *m_heartBeatObserverTimer;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<LicenceDonator> m_licenceDonator;
|
||||
|
||||
int HEARTBEAT_OBSERVER_INTERVAL = 10000;
|
||||
QSet<qint64> m_unknownPidsWarned;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
} // namespace ServiceManagement
|
||||
Reference in new issue
Block a user