89 lines
2.3 KiB
C++
Executable File
89 lines
2.3 KiB
C++
Executable File
/**
|
|
* situation replay objects
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hanna E. Rathje, SLSE, 2016-01-13
|
|
*/
|
|
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QTimer>
|
|
#include "dds_handler.h"
|
|
#include "db_reader.h"
|
|
#include <DDS/Core/function_reply_object.h>
|
|
|
|
// Generated
|
|
#include <SituationReplay/srp_db.h>
|
|
|
|
namespace SituationReplay
|
|
{
|
|
class DatabaseInterface;
|
|
class DbReader;
|
|
|
|
class ObjectSituationReplay : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit ObjectSituationReplay(const std::shared_ptr<DdsHandler> &ddsHandler,
|
|
const std::shared_ptr<DatabaseInterface> &db,
|
|
const std::shared_ptr<DbReader> &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<DdsHandler> m_ddsInterface;
|
|
std::shared_ptr<DatabaseInterface> m_db;
|
|
std::shared_ptr<DbReader> m_dbReader;
|
|
Database::SrpSituationReplay m_data;
|
|
int m_exerciseId;
|
|
QTimer *m_replayTimer;
|
|
qint64 m_currentReplayTime;
|
|
|
|
NGL::INGLLogger &m_logger;
|
|
|
|
};
|
|
}
|