/** * situation replay objects * $Id$ * $HeadURL$ * $Author$ * Created by Hanna E. Rathje, SLSE, 2016-01-13 */ #pragma once #include #include #include "dds_handler.h" #include "db_reader.h" #include // Generated #include namespace SituationReplay { class DatabaseInterface; class DbReader; class ObjectSituationReplay : public QObject { Q_OBJECT public: explicit ObjectSituationReplay(const std::shared_ptr &ddsHandler, const std::shared_ptr &db, const std::shared_ptr &dbReader, int exerciseId); ~ObjectSituationReplay(); Core::FunctionReplyObject createObject(const Database::SrpSituationReplay &data); Core::FunctionReplyObject removeObject(); qint32 getId() const { return m_data.id; } qint32 getExerciseId() const { return m_exerciseId; } qint32 getReplayPartitionId() const { return m_data.replayPartitionId; } qint64 currentReplayTime() const { return m_currentReplayTime; } SrpState srpState() const { return m_data.srpStateId; } double pace() const { return m_data.pace; } bool setPace(double newPace); // Used by SrpStateManager (only internal) bool setSrpData(const Database::SrpSituationReplay &newData); // Used by Client Core::FunctionReplyObject switchToState(SrpState newSrpState); bool isRunning() const; bool isStopped() const; bool start(); bool pause(); bool resume(); bool stop(); protected Q_SLOTS: void onPublishReplayInformation(); void onPublishReplayTime(); void onReplayTimerTimeout(); private: bool checkPublishData(); Q_SIGNALS: // for thp void replayTimeChanged(qint64 currentReplayTime); void started(qint64 currentReplayTime); void paused(); void resumed(qint64 currentReplayTime); void stopped(); private: std::shared_ptr m_ddsInterface; std::shared_ptr m_db; std::shared_ptr m_dbReader; Database::SrpSituationReplay m_data; int m_exerciseId; QTimer *m_replayTimer; qint64 m_currentReplayTime; NGL::INGLLogger &m_logger; }; }