85 lines
2.1 KiB
C++
85 lines
2.1 KiB
C++
|
|
|
|
#pragma once
|
|
|
|
#include "svccoreclient_export.h"
|
|
|
|
#include <QtCore/QObject>
|
|
#include <QtCore/QThread>
|
|
|
|
// Forward declarations for moc compatibility (moc doesn't see BUILD_RTI guards)
|
|
namespace Core { enum class RunningState; enum class PortType; }
|
|
#if !BUILD_RTI
|
|
// Only needed when the generated core_dts_types.h (which defines this as an
|
|
// alias template instantiation) is not available.
|
|
namespace DTS { class CurrentRunningStateImpl; }
|
|
#endif
|
|
|
|
#if BUILD_RTI
|
|
#include <Core/core_dts_types.h>
|
|
#endif
|
|
|
|
namespace DDSConnector
|
|
{
|
|
class DdsConnector;
|
|
}
|
|
class QTimer;
|
|
|
|
namespace NGL
|
|
{
|
|
class INGLLogger;
|
|
}
|
|
|
|
namespace Core
|
|
{
|
|
class CORE_CLIENT_EXPORT Pacemaker final : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
#if BUILD_RTI
|
|
explicit Pacemaker(const std::shared_ptr<DDSConnector::DdsConnector>& ddsConnector) : Pacemaker(ddsConnector.get())
|
|
{
|
|
}
|
|
|
|
explicit Pacemaker(DDSConnector::DdsConnector* ddsConnector);
|
|
#else
|
|
explicit Pacemaker(void* /*ddsConnector*/) {}
|
|
explicit Pacemaker() {}
|
|
#endif
|
|
~Pacemaker();
|
|
|
|
#if BUILD_RTI
|
|
void startTimer();
|
|
#endif
|
|
|
|
public Q_SLOTS:
|
|
#if BUILD_RTI
|
|
void setNewState(Core::RunningState newState, const QString& errorString = QString());
|
|
void addPort(unsigned short number, Core::PortType portType, const QString& properties = QStringLiteral(""));
|
|
|
|
void publishState();
|
|
#endif
|
|
|
|
private:
|
|
#if BUILD_RTI
|
|
NGL::INGLLogger& m_logger;
|
|
void init(DDSConnector::DdsConnector* ddsConnector);
|
|
void setNewStateInternal(Core::RunningState newState, const QString& errorString = QString());
|
|
void addPortInternal(unsigned short number, Core::PortType portType,
|
|
const QString& properties = QStringLiteral(""));
|
|
|
|
::Core::CurrentRunningState m_state;
|
|
DTS::CurrentRunningStateImpl* m_dtsCurrentRunningState = nullptr;
|
|
#else
|
|
void* m_reserved1 = nullptr;
|
|
void* m_reserved2 = nullptr;
|
|
void* m_reserved3 = nullptr;
|
|
void* m_reserved4 = nullptr;
|
|
void* m_reserved5 = nullptr;
|
|
#endif
|
|
static constexpr const int m_publishTimerDelay = 3000;
|
|
QTimer* m_publishTimer = nullptr;
|
|
QThread* m_paceThread = nullptr;
|
|
};
|
|
} // namespace Core
|