Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+28
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Patric Karwat, SLSE, 2016-07-19
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(Data)
|
||||
ADD_SUBDIRECTORY(Gui)
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(SrmGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/srm_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
GuiPluginInterface
|
||||
)
|
||||
|
||||
#
|
||||
# Data Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(SrmDataPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/srm_data_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
DataPluginInterface
|
||||
svcSrmCommon
|
||||
)
|
||||
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Mike Wille, SLSE, 2016-09-06
|
||||
#
|
||||
|
||||
#
|
||||
# Data Plugin
|
||||
#
|
||||
NGL_ADD_LIBRARY(WS SrmDataPlugin MODULE srm_data_plugin.cpp srm_data_plugin.h)
|
||||
NGL_TARGET_LINK_LIBRARIES(SrmDataPlugin
|
||||
Qt5::Core
|
||||
Qt5::Network
|
||||
ddsconnector
|
||||
SrmDataPluginInterface
|
||||
svcCoreClient
|
||||
NGLLogger
|
||||
LtsSessionDataDds
|
||||
LtsUtilsGuiDds
|
||||
LtsUtilsCoreHeaderOnly # await
|
||||
)
|
||||
NGL_INSTALL_TARGET(SrmDataPlugin)
|
||||
@@ -0,0 +1,539 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for SituationReplayManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-19
|
||||
*/
|
||||
|
||||
#include "srm_data_plugin.h"
|
||||
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
#include <SituationReplayManagement/srm_ftc.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <DDS/QosProfile/DDS_DefaultQos.h>
|
||||
#include <DDS/Core/core_dts_types.h>
|
||||
#include <DDS/DTS/generic_dts_impl.h>
|
||||
#include <SituationReplayManagement/logger.h>
|
||||
#include <LtsUtilsCore/await.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QPointer>
|
||||
#include <QProcess>
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace SituationReplayManagement
|
||||
{
|
||||
|
||||
class ReplayHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ReplayHandler()
|
||||
: m_logger(getLogger("ReplayHandler"))
|
||||
{}
|
||||
|
||||
~ReplayHandler()
|
||||
{
|
||||
try
|
||||
{
|
||||
replayPartitionRemoveRequest(nullptr, 0, 0, 0);
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
}
|
||||
|
||||
void addSession(ForeignInterfaceImpl *fi, int partitionId)
|
||||
{
|
||||
// next 4 lines: comment please
|
||||
m_references += fi;
|
||||
for (const auto &info : qAsConst(m_replayPartitions))
|
||||
{
|
||||
fi->write(info);
|
||||
}
|
||||
|
||||
// take ownership of 'own' replays
|
||||
for (auto it = m_replayPartitions.begin(); it != m_replayPartitions.end(); ++it)
|
||||
{
|
||||
ReplayPartitionEx &rp = it.value();
|
||||
|
||||
if (rp.fi != nullptr)
|
||||
continue;
|
||||
|
||||
if (rp.id() == partitionId)
|
||||
rp.fi = fi;
|
||||
}
|
||||
}
|
||||
|
||||
void removeSession(ForeignInterfaceImpl *fi, bool wait = true) noexcept(false)
|
||||
{
|
||||
m_references -= fi;
|
||||
for (const auto &info : qAsConst(m_replayPartitions))
|
||||
fi->remove(info);
|
||||
|
||||
replayPartitionRemoveRequest(fi, 0, 0, 0, wait);
|
||||
}
|
||||
|
||||
|
||||
int replayPartitionCreateRequest(int domainId, int domainIdReplay, const QUrl &tcpConnectionUrl,
|
||||
int exerciseId, int workstationId, int operatorId, Core::ReplayType replayType, bool wait = true) noexcept(false)
|
||||
{
|
||||
|
||||
// clarification need for: domainId, partitionId, replayId, idToUse... : same or different?
|
||||
// 'idToUse will become replayPartitionId'
|
||||
// assume: replayId == partitionId == replayPartitionId == idToUse
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START"
|
||||
<< ", domainId = " << domainId
|
||||
<< ", domainIdReplay = " << domainIdReplay
|
||||
<< ", tcpConnectionUrl = " << tcpConnectionUrl.toDisplayString()
|
||||
<< ", exerciseId = " << exerciseId
|
||||
<< ", workstationId = " << workstationId
|
||||
<< ", operatorId = " << operatorId
|
||||
<< ", replayType = " << replayType
|
||||
<< ", wait = " << wait;
|
||||
|
||||
// find free replay id
|
||||
QSet<int> keys;
|
||||
for (auto it = m_replayPartitions.constBegin(); it != m_replayPartitions.constEnd(); ++it)
|
||||
keys += it.key();
|
||||
|
||||
int idToUse = -1;
|
||||
for (int i = 1; i < 20; ++i) // why 20??
|
||||
{
|
||||
if (keys.contains(i))
|
||||
continue;
|
||||
idToUse = i;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " idToUse = " << idToUse;
|
||||
|
||||
|
||||
// found a valid one
|
||||
if (idToUse > 0)
|
||||
{
|
||||
ReplayPartitionEx repl;
|
||||
repl.proc = new QProcess(this);
|
||||
QProcess *proc = repl.proc;
|
||||
|
||||
connect(repl.proc, &QProcess::errorOccurred,
|
||||
this, [this, idToUse](const QProcess::ProcessError &error)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "QProcess::ProcessError occured: "
|
||||
<< ", idToUse = " << idToUse;
|
||||
qCritical() << "QProcess::ProcessError: " << error;
|
||||
} );
|
||||
|
||||
connect(repl.proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
this, [this, proc, idToUse]() { processFinished(proc, idToUse); } );
|
||||
|
||||
connect(proc, &QProcess::readyReadStandardError, this, [this, idToUse, proc]()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "REPLAY #" << idToUse << " [!]: " << QString::fromUtf8(proc->readAllStandardError());
|
||||
});
|
||||
connect(proc, &QProcess::readyReadStandardOutput, this, [this, idToUse, proc]()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "REPLAY #" << idToUse << " [ ]: " << QString::fromUtf8(proc->readAllStandardOutput());
|
||||
});
|
||||
|
||||
repl.fi = nullptr;
|
||||
repl.id(idToUse);
|
||||
repl.name((QStringLiteral("srp_%1").arg(idToUse)).toStdString());
|
||||
repl.exerciseId(exerciseId);
|
||||
repl.workstationId(workstationId);
|
||||
repl.operatorId(operatorId);
|
||||
repl.replayType(replayType);
|
||||
repl.domainId(domainIdReplay);
|
||||
repl.proc->setProgram(QCoreApplication::applicationDirPath() + QStringLiteral("/svcSituationReplay"));
|
||||
QString input = QString::number(domainId) + QLatin1Char(',') + QString::number(exerciseId);
|
||||
if (!tcpConnectionUrl.isEmpty())
|
||||
input += QLatin1Char(',') + tcpConnectionUrl.toString();
|
||||
|
||||
QString output = QString::number(repl.domainId()) + QLatin1Char(',') + QString::number(repl.id());
|
||||
|
||||
repl.proc->setArguments({QStringLiteral("--input"), input,
|
||||
QStringLiteral("--output"), output,
|
||||
QStringLiteral("-e"), QString::number(exerciseId)});
|
||||
|
||||
m_replayPartitions.insert(idToUse, repl);
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " repl.proc->start()...";
|
||||
repl.proc->start();
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " repl.proc->start()...DONE";
|
||||
|
||||
if (wait)
|
||||
{
|
||||
|
||||
//#define APPROACH_AWAIT_BY_MIKE
|
||||
#ifdef APPROACH_AWAIT_BY_MIKE
|
||||
try
|
||||
{
|
||||
connect(repl.proc, &QProcess::started, this, [this]() {
|
||||
NOTICE_LOG(m_logger) << " SRM: Got signal 'QProcess::started'";
|
||||
});
|
||||
connect(repl.proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this](int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
NOTICE_LOG(m_logger) << " SRM: Got signal 'QProcess::finished'"
|
||||
<< ", exitCode = " << exitCode
|
||||
<< ", exitStatus = " << exitStatus;
|
||||
});
|
||||
|
||||
NOTICE_LOG(m_logger) << " LtsUtils::awaitWithCancelationSignal ... ";
|
||||
LtsUtils::awaitWithCancelationSignal(repl.proc,
|
||||
&QProcess::started,
|
||||
repl.proc,
|
||||
QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
60 * 1000); // 1 min
|
||||
NOTICE_LOG(m_logger) << " LtsUtils::awaitWithCancelationSignal ... DONE";
|
||||
|
||||
processStarted(proc, idToUse);
|
||||
DEBUG_LOG(m_logger) << "Replay started: " << idToUse;
|
||||
return idToUse; // <-- return
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
auto error(repl.proc->errorString());
|
||||
throw std::runtime_error(QStringLiteral("Replay failed to start! %1").arg(error.isEmpty() ? QString::fromUtf8(ex.what()) : error).toStdString().c_str());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
fprintf(stderr, "awaitWithCancelationSignal has thrown an error ...\n");
|
||||
} // catch
|
||||
|
||||
#else // APPROACH_AWAIT_BY_MIKE
|
||||
// rebuild by former version... hopefully it works:
|
||||
|
||||
const bool bIsStartedSuccessfully = repl.proc->waitForStarted(7500); // Qt docu: Returns true if the process was started successfully;
|
||||
if (bIsStartedSuccessfully)
|
||||
{
|
||||
processStarted(proc, idToUse);
|
||||
DEBUG_LOG(m_logger) << "Replay started: " << idToUse;
|
||||
return idToUse; // <-- return
|
||||
}
|
||||
else
|
||||
{
|
||||
// cleanup:
|
||||
idToUse = -1;
|
||||
wait = false;
|
||||
if (repl.proc)
|
||||
repl.proc->deleteLater(); // repl.proc is a QPointer
|
||||
// repl.proc = nullptr; // repl.proc is a QPointer
|
||||
// useless with idToUse == -1 !!??!!
|
||||
m_replayPartitions[idToUse].proc = nullptr; // TODO: don't use operator[] !
|
||||
}
|
||||
#endif // APPROACH_AWAIT_BY_MIKE
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
connect(repl.proc, &QProcess::started,
|
||||
this, [this, proc, idToUse]() { processStarted(proc, idToUse); } );
|
||||
}
|
||||
} // if (idToUse > 0)
|
||||
|
||||
// didn't find a valid one!
|
||||
|
||||
if (wait)
|
||||
{
|
||||
throw std::runtime_error("Failed to create replay!");
|
||||
}
|
||||
|
||||
return idToUse;
|
||||
}
|
||||
|
||||
void processFinished(QProcess *proc, int replayId)
|
||||
{
|
||||
auto it = m_replayPartitions.find(replayId);
|
||||
if (it == m_replayPartitions.end())
|
||||
return;
|
||||
|
||||
if (proc->exitCode() != 0 || proc->exitStatus() != QProcess::NormalExit)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "SituationReplay process exited with error: " << proc->exitCode()
|
||||
<< ", status: " << proc->exitStatus()
|
||||
<< ", stdout: " << proc->readAllStandardOutput()
|
||||
<< ", stderr: " << proc->readAllStandardError();
|
||||
}
|
||||
|
||||
const auto &rp = it.value();
|
||||
for (auto ptr : qAsConst(m_references))
|
||||
ptr->remove(rp);
|
||||
|
||||
proc->deleteLater();
|
||||
m_replayPartitions.erase(it);
|
||||
}
|
||||
|
||||
void processStarted(QProcess *proc, int replayId)
|
||||
{
|
||||
Q_UNUSED(proc);
|
||||
auto it = m_replayPartitions.find(replayId);
|
||||
if (it == m_replayPartitions.end())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Got a processStarted signal from a process for replay " << replayId
|
||||
<< " but found not corresponding entry in m_replayPartitions";
|
||||
return;
|
||||
}
|
||||
|
||||
const ReplayPartitionEx &rp = it.value();
|
||||
for (ForeignInterfaceImpl* ptr : qAsConst(m_references))
|
||||
ptr->write(rp);
|
||||
}
|
||||
|
||||
void replayPartitionRemoveRequest(ForeignInterfaceImpl *fi, int partitionId, int workstationId, int operatorId, bool wait = true) noexcept(false)
|
||||
{
|
||||
bool bFoundOne = false;
|
||||
int idToReturn = partitionId;
|
||||
if (idToReturn == 0)
|
||||
idToReturn = workstationId;
|
||||
if (idToReturn == 0)
|
||||
idToReturn = operatorId;
|
||||
|
||||
auto it = m_replayPartitions.begin();
|
||||
while (it != m_replayPartitions.end())
|
||||
{
|
||||
const ReplayPartitionEx &rp = it.value();
|
||||
if ((partitionId != 0 && rp.id() != partitionId) ||
|
||||
(workstationId != 0 && rp.workstationId() != workstationId) ||
|
||||
(operatorId != 0 && rp.operatorId() != operatorId) ||
|
||||
(fi != nullptr && rp.fi != fi))
|
||||
{
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rp.proc)
|
||||
{
|
||||
rp.proc->disconnect(this);
|
||||
if (rp.proc->state() == QProcess::NotRunning)
|
||||
{
|
||||
delete rp.proc;
|
||||
}
|
||||
else
|
||||
{
|
||||
rp.proc->terminate();
|
||||
|
||||
|
||||
QPointer<QProcess> proc = rp.proc;
|
||||
auto cb = [this, proc]()
|
||||
{
|
||||
if (!proc)
|
||||
return;
|
||||
if (proc->state() != QProcess::NotRunning)
|
||||
proc->kill();
|
||||
const auto err(proc->readAllStandardError());
|
||||
if (!err.isEmpty())
|
||||
WARNING_LOG(m_logger) << "stderr: " << err;
|
||||
delete proc;
|
||||
};
|
||||
|
||||
|
||||
if (wait)
|
||||
{
|
||||
try
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Waiting for replay to process to shutdown... Replay id: " << rp.id();
|
||||
LtsUtils::awaitTimeout(10000, rp.proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), true);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Timeout waiting for the replay process to quit gracefully - killing the process! Replay id: " << rp.id();
|
||||
cb();
|
||||
}
|
||||
}
|
||||
else // dont wait
|
||||
{
|
||||
QTimer::singleShot(10000, rp.proc, cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto *ptr : qAsConst(m_references))
|
||||
ptr->remove(rp);
|
||||
|
||||
it = m_replayPartitions.erase(it);
|
||||
bFoundOne = true;
|
||||
}
|
||||
|
||||
// workstationId / operatorId are wildcard operations which may find nothing which is ok
|
||||
if (partitionId == 0)
|
||||
bFoundOne = true;
|
||||
|
||||
if (!bFoundOne && wait)
|
||||
{
|
||||
throw std::runtime_error("Requested remove replay for a replay that doesn't exist!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<DDSConnector::DdsConnector> getDdsConnector(const std::shared_ptr<DDSConnector::DdsConnector> &sessionConnector)
|
||||
{
|
||||
if (m_ddsConnector)
|
||||
return m_ddsConnector;
|
||||
|
||||
if (sessionConnector->getTcpConnectionUrl().isEmpty())
|
||||
{
|
||||
m_ddsConnector = sessionConnector;
|
||||
return sessionConnector;
|
||||
}
|
||||
|
||||
int domainId = 1; // ok since we are using ShmUdpLocalhost
|
||||
m_ddsConnector.reset(new DDSConnector::DdsConnector(domainId,
|
||||
IDL::PartitionType::Exercise,
|
||||
sessionConnector->getPartitionId(),
|
||||
sessionConnector->getPartitionId(),
|
||||
DDS::QosProfile::ConnectionType::ShmUdp));
|
||||
m_ddsConnector->initPublisherSubscriber();
|
||||
|
||||
return m_ddsConnector;
|
||||
}
|
||||
|
||||
std::shared_ptr<Core::Interface::Dtc> dtc(const std::shared_ptr<DDSConnector::DdsConnector> &sessionConnector)
|
||||
{
|
||||
if (m_dtc)
|
||||
return m_dtc;
|
||||
auto ddsConnector = getDdsConnector(sessionConnector);
|
||||
m_dtc = Core::Interface::Dtc::create(ddsConnector);
|
||||
m_dtc->enableReplayPartition();
|
||||
return m_dtc;
|
||||
}
|
||||
|
||||
std::shared_ptr<DTS::ReplayPartition> dtsReplay(const std::shared_ptr<DDSConnector::DdsConnector> &sessionConnector)
|
||||
{
|
||||
if (m_replayPartion)
|
||||
return m_replayPartion;
|
||||
auto ddsConnector = getDdsConnector(sessionConnector);
|
||||
m_replayPartion.reset(ddsConnector->createDTS<DTS::ReplayPartitionImpl>());
|
||||
return m_replayPartion;
|
||||
}
|
||||
|
||||
private:
|
||||
struct ReplayPartitionEx : public Core::ReplayPartition
|
||||
{
|
||||
QPointer<QProcess> proc; // = nullptr;
|
||||
ForeignInterfaceImpl *fi = nullptr;
|
||||
};
|
||||
|
||||
QMap<int, ReplayPartitionEx> m_replayPartitions; // idToUse - ReplayPartitionEx
|
||||
QSet<ForeignInterfaceImpl*> m_references;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<Core::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<DTS::ReplayPartition> m_replayPartion;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
|
||||
DataPlugin::DataPlugin()
|
||||
: m_replayHandler(std::make_shared<ReplayHandler>())
|
||||
{}
|
||||
|
||||
DataPlugin::~DataPlugin()
|
||||
{}
|
||||
|
||||
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
|
||||
{
|
||||
std::shared_ptr<Core::Interface::Dtc> dtc = m_replayHandler->dtc(session->ddsConnector());
|
||||
return std::make_shared<DataInterfaceImpl>(m_replayHandler, session, dtc);
|
||||
}
|
||||
|
||||
DataInterfaceImpl::DataInterfaceImpl(const std::shared_ptr<ReplayHandler> &replayHandler,
|
||||
LtsSession::LtsSessionDataDds *session,
|
||||
const std::shared_ptr<Core::Interface::Dtc> &dtc)
|
||||
: DataInterface()
|
||||
, m_dtc(dtc)
|
||||
, m_foreignInterface(std::make_shared<ForeignInterfaceImpl>(replayHandler, session))
|
||||
{
|
||||
}
|
||||
|
||||
ForeignInterfaceImpl::ForeignInterfaceImpl(const std::shared_ptr<ReplayHandler> &replayHandler,
|
||||
LtsSession::LtsSessionDataDds *session)
|
||||
: m_replayHandler(replayHandler)
|
||||
, m_session(session)
|
||||
, m_logger(getLogger("ForeignInterfaceImpl"))
|
||||
{
|
||||
if (m_session->partitionType() == IDL::PartitionType::Exercise ||
|
||||
m_session->partitionType() == IDL::PartitionType::Replay)
|
||||
m_replayHandler->addSession(this, session->partitionId());
|
||||
}
|
||||
|
||||
ForeignInterfaceImpl::~ForeignInterfaceImpl()
|
||||
{
|
||||
m_replayHandler->removeSession(this, false /* dont' wait for replay service to quit */);
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::removeReplayPartitionsWorkstation(const int workstationId) noexcept(false)
|
||||
{
|
||||
if (!m_session)
|
||||
{
|
||||
throw std::runtime_error("No session available.");
|
||||
}
|
||||
m_replayHandler->replayPartitionRemoveRequest(nullptr, 0, workstationId, 0);
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::removeReplayPartitionsOperator(const int operatorId) noexcept(false)
|
||||
{
|
||||
if (!m_session)
|
||||
{
|
||||
throw std::runtime_error("No session available.");
|
||||
}
|
||||
m_replayHandler->replayPartitionRemoveRequest(nullptr, 0, 0, operatorId);
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::replayPartitionRemoveRequest(int partitionId, int workstationId, int operatorId) noexcept(false)
|
||||
{
|
||||
if (!m_session)
|
||||
{
|
||||
throw std::runtime_error("No session available.");
|
||||
}
|
||||
m_replayHandler->replayPartitionRemoveRequest(nullptr, partitionId, workstationId, operatorId);
|
||||
}
|
||||
|
||||
int ForeignInterfaceImpl::replayPartitionCreateRequest(int exerciseId, int workstationId, int operatorId, Core::ReplayType replayType) noexcept(false)
|
||||
{
|
||||
if (!m_session)
|
||||
{
|
||||
throw std::runtime_error("No session available.");
|
||||
}
|
||||
|
||||
int domainId = m_session->domainId();
|
||||
if (m_session->isReplayPartition())
|
||||
{
|
||||
/* starting a replay partition from a replay partition would normally inc the
|
||||
* domainId to the already inc'd domainId - dec the already inc'd domain id
|
||||
* to keep the same domainId for every replay partition */
|
||||
if (domainId == 1)
|
||||
domainId= 199;
|
||||
else
|
||||
domainId--;
|
||||
}
|
||||
int domainIdReplay = (domainId % 200) + 1; // mod aka "if (domainId > 200) domainId = 0;" - domainIds can never be > 199
|
||||
|
||||
|
||||
return m_replayHandler->replayPartitionCreateRequest(domainId, domainIdReplay,
|
||||
m_session->tcpConnectionUrl(),
|
||||
exerciseId, workstationId, operatorId, replayType);
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::write(const Core::ReplayPartition &repl)
|
||||
{
|
||||
if (!m_session)
|
||||
return;
|
||||
m_replayHandler->dtsReplay(m_session->ddsConnector())->write(repl);
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::remove(const Core::ReplayPartition &repl)
|
||||
{
|
||||
if (!m_session)
|
||||
return;
|
||||
m_replayHandler->dtsReplay(m_session->ddsConnector())->remove(repl);
|
||||
}
|
||||
|
||||
} // namespace SituationReplayManagement
|
||||
|
||||
#include "srm_data_plugin.moc"
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for SituationReplayManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-19
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/SituationReplayManagement/srm_data_plugin_interface.h>
|
||||
#include <Core/core_dts_types.h>
|
||||
#include <SituationReplayManagement/logger.h>
|
||||
|
||||
#include <QPointer>
|
||||
#include <QSet>
|
||||
|
||||
class QProcess;
|
||||
namespace SituationReplayManagement
|
||||
{
|
||||
class ReplayHandler;
|
||||
class DataPlugin final : public QObject, public DataPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "data:3:srm")
|
||||
Q_INTERFACES(DataPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataPlugin();
|
||||
~DataPlugin();
|
||||
|
||||
QString pluginName() const override { return QStringLiteral("SituationReplayManagement"); }
|
||||
std::shared_ptr<DataPluginBase::Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Exercise ||
|
||||
partition == IDL::PartitionType::Replay ||
|
||||
partition == IDL::PartitionType::Global; // due to Logout/clear Replay session
|
||||
}
|
||||
|
||||
std::shared_ptr<ReplayHandler> m_replayHandler;
|
||||
};
|
||||
|
||||
|
||||
class DataInterfaceImpl final : public DataInterface
|
||||
{
|
||||
public:
|
||||
explicit DataInterfaceImpl(const std::shared_ptr<ReplayHandler> &replayHandler,
|
||||
LtsSession::LtsSessionDataDds *session,
|
||||
const std::shared_ptr<Core::Interface::Dtc> &dtc);
|
||||
|
||||
std::shared_ptr<Core::Interface::Dtc> getDtc() override { return m_dtc; }
|
||||
std::shared_ptr<ForeignDataInterface> getForeignDataInterface() override { return m_foreignInterface; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<Core::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<ForeignDataInterface> m_foreignInterface;
|
||||
};
|
||||
|
||||
|
||||
class ForeignInterfaceImpl final : public ForeignDataInterface
|
||||
{
|
||||
public:
|
||||
ForeignInterfaceImpl(const std::shared_ptr<ReplayHandler> &replayHandler,
|
||||
LtsSession::LtsSessionDataDds *session);
|
||||
~ForeignInterfaceImpl();
|
||||
|
||||
// ForeignInterface
|
||||
void removeReplayPartitionsWorkstation(const int workstationId) noexcept(false) override;
|
||||
void removeReplayPartitionsOperator(const int operatorId) noexcept(false) override;
|
||||
void replayPartitionRemoveRequest(int partitionId, int workstationId, int operatorId) noexcept(false) override;
|
||||
int replayPartitionCreateRequest(int exerciseId, int workstationId, int operatorId, Core::ReplayType replayType) noexcept(false) override;
|
||||
|
||||
private:
|
||||
void write(const Core::ReplayPartition &repl);
|
||||
void remove(const Core::ReplayPartition &repl);
|
||||
|
||||
private:
|
||||
std::shared_ptr<ReplayHandler> m_replayHandler;
|
||||
QPointer<LtsSession::LtsSessionDataDds> m_session;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
friend class ReplayHandler;
|
||||
};
|
||||
|
||||
} // namespace SituationReplayManagement
|
||||
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Patric Karwat, SLSE, 2016-07-19
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(ReplayManagement)
|
||||
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Patric Karwat, SLSE, 2016-07-19
|
||||
#
|
||||
|
||||
SET(replay_gui_SRCS
|
||||
replay_management_gui_plugin.h
|
||||
replay_management_gui_plugin.cpp
|
||||
replay_dialog.h
|
||||
replay_dialog.cpp
|
||||
replay_dialog_model.h
|
||||
replay_dialog_model.cpp
|
||||
|
||||
CustomView/srm_replay.h
|
||||
CustomView/srm_replay.cpp
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(replay_gui_SRCS
|
||||
replay_dialog.ui
|
||||
CustomView/srm_replay.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS SrmReplayManagementGuiPlugin MODULE ${replay_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(SrmReplayManagementGuiPlugin
|
||||
NGLLogger
|
||||
LtsPrinting
|
||||
SrmGuiPluginInterface
|
||||
SrmDataPluginInterface
|
||||
FltAesGuiPluginInterface
|
||||
ddscore
|
||||
svcCoreClient
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsSession
|
||||
LtsSessionData
|
||||
LtsDataView
|
||||
LtsUtilsGuiDds
|
||||
LtsAppManager # for windows tablet replay hack
|
||||
LtsUtilsCore
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(SrmReplayManagementGuiPlugin)
|
||||
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* CustomView for SRM Replay
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, SLSE, 2016-04-08
|
||||
*/
|
||||
|
||||
#include "srm_replay.h"
|
||||
#include "ui_srm_replay.h"
|
||||
|
||||
#include "replay_dialog_model.h"
|
||||
|
||||
namespace SituationReplayManagement
|
||||
{
|
||||
CustomViewReplay::CustomViewReplay(QWidget *parent)
|
||||
: AbstractDisplayWidget(parent)
|
||||
, m_ui(new Ui::CustomViewReplay)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
CustomViewReplay::~CustomViewReplay()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool CustomViewReplay::init(const QModelIndex &idx)
|
||||
{
|
||||
if (!idx.isValid())
|
||||
return false;
|
||||
|
||||
m_ui->lbName->setText(rowData(idx, SituationReplayManagement::ReplayPartitionDialogModel::Name).toString());
|
||||
m_ui->lbExercise->setText(rowData(idx, SituationReplayManagement::ReplayPartitionDialogModel::Exercise).toString());
|
||||
m_ui->lbWorkstationId->setText(rowData(idx, SituationReplayManagement::ReplayPartitionDialogModel::WorkstationId).toString());
|
||||
return true;
|
||||
}
|
||||
} // namespace SituationReplayManagement
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* CustomView for SRM Replay
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, SLSE, 2016-04-08
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Viewer/LtsDataView/abstract_display_widget.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CustomViewReplay;
|
||||
}
|
||||
|
||||
namespace SituationReplayManagement
|
||||
{
|
||||
class CustomViewReplay final : public LtsDataView::AbstractDisplayWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CustomViewReplay(QWidget *parent = nullptr);
|
||||
~CustomViewReplay();
|
||||
bool init(const QModelIndex &idx) override;
|
||||
|
||||
private:
|
||||
Ui::CustomViewReplay* m_ui;
|
||||
|
||||
};
|
||||
} // namespace SituationReplayManagement
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CustomViewReplay</class>
|
||||
<widget class="QWidget" name="CustomViewReplay">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>70</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbName">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbExercise">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Exercise</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Workstation:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbWorkstationId">
|
||||
<property name="text">
|
||||
<string notr="true">WorkstationId</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for SituationReplayManagement - Replay Partition Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-19
|
||||
*/
|
||||
|
||||
|
||||
#include "replay_dialog.h"
|
||||
#include "ui_replay_dialog.h"
|
||||
#include "replay_dialog_model.h"
|
||||
#include "CustomView/srm_replay.h"
|
||||
|
||||
#include <LtsWidgets/lts_message_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsSession/lts_session_manager.h>
|
||||
|
||||
#include <QModelIndexList>
|
||||
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace SituationReplayManagement
|
||||
{
|
||||
//---------------------------------
|
||||
// SituationReplayManagementDialog
|
||||
//---------------------------------
|
||||
SituationReplayManagementDialog::SituationReplayManagementDialog(LtsSession::LtsSession *session, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_session(session)
|
||||
, m_model(nullptr)
|
||||
, m_ui(new Ui::SituationReplayManagementDialog)
|
||||
, m_srmForeign(nullptr)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(getLogger("SituationReplayManagementDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add,
|
||||
this, &SituationReplayManagementDialog::onAddReplayPartition);
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove,
|
||||
this, &SituationReplayManagementDialog::onRemoveReplayPartition);
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print,
|
||||
this, &SituationReplayManagementDialog::onPrint);
|
||||
|
||||
m_buttonBox->setText(LtsWidgets::DialogButton::Yes, tr("Start Replay"));
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Yes, // renamed to "Start"
|
||||
this, &SituationReplayManagementDialog::slotStartReplay);
|
||||
|
||||
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Replay_Management"));
|
||||
}
|
||||
|
||||
|
||||
SituationReplayManagementDialog::~SituationReplayManagementDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void SituationReplayManagementDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Replay Management"));
|
||||
}
|
||||
|
||||
void SituationReplayManagementDialog::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
|
||||
void SituationReplayManagementDialog::slotStartReplay()
|
||||
{
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
const Core::ReplayPartition rp = m_model->getRowData(idx.row());
|
||||
|
||||
int replayPartition = rp.id();
|
||||
|
||||
if (replayPartition < 1)
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this, tr("This Replay Partition is not valid!"), tr("Cannot start Replay"));
|
||||
return;
|
||||
}
|
||||
|
||||
const LtsSession::DdsConnectionParams connParams(rp);
|
||||
m_session->getSessionManager()->createSession(connParams, true, false /* no payloads! */);
|
||||
}
|
||||
|
||||
|
||||
bool SituationReplayManagementDialog::init(const std::shared_ptr<Core::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<SituationReplayManagement::ForeignDataInterface> &srmForeign)
|
||||
{
|
||||
m_srmForeign = srmForeign;
|
||||
m_model = new ReplayPartitionDialogModel(this);
|
||||
m_model->initModel(m_session->exerciseId(), dtc);
|
||||
m_ui->widget->setModel(m_model, [this]() { return new CustomViewReplay(this); });
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &SituationReplayManagementDialog::enaDisa);
|
||||
|
||||
enaDisa();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void SituationReplayManagementDialog::enaDisa()
|
||||
{
|
||||
QModelIndexList selectedRows = m_ui->widget->selectedRows();
|
||||
const int cntSelectedRows = selectedRows.size();
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, (cntSelectedRows > 0));
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Yes, (cntSelectedRows == 1));
|
||||
}
|
||||
|
||||
|
||||
void SituationReplayManagementDialog::onAddReplayPartition()
|
||||
{
|
||||
if (!m_session)
|
||||
return;
|
||||
|
||||
const int partitionId = m_session->partitionId();
|
||||
try
|
||||
{
|
||||
m_srmForeign->replayPartitionCreateRequest(partitionId,
|
||||
LtsSessionData::LtsSessionData::getInstance()->getWorkstationId(),
|
||||
LtsSessionData::LtsSessionData::getInstance()->getOperatorId(),
|
||||
Core::ReplayType::SituationData);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("Failed to create replay partition!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SituationReplayManagementDialog::onRemoveReplayPartition()
|
||||
{
|
||||
QVector<QPair<int, int> > toDelete;
|
||||
QModelIndexList selectedRows = m_ui->widget->selectedRows();
|
||||
|
||||
for (auto i = selectedRows.constBegin(); i != selectedRows.constEnd(); ++i)
|
||||
{
|
||||
const Core::ReplayPartition &rp = m_model->getRowData((*i).row());
|
||||
int id = rp.id();
|
||||
int wsId = rp.workstationId();
|
||||
|
||||
if (id < 1 || wsId < 1) // invalid!
|
||||
continue;
|
||||
|
||||
QPair<int, int> p(id, wsId);
|
||||
|
||||
toDelete.append(p);
|
||||
}
|
||||
|
||||
for (auto i = toDelete.constBegin(); i != toDelete.constEnd(); ++i)
|
||||
{
|
||||
QPair<int, int> p = *i;
|
||||
|
||||
try
|
||||
{
|
||||
m_srmForeign->replayPartitionRemoveRequest(p.first, p.second, 0);
|
||||
} // no more remove on error
|
||||
catch(...)
|
||||
{
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("Failed to remove replay partition!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SituationReplayManagementDialog::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView() );
|
||||
}
|
||||
} // namespace SituationReplayManagement
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SituationReplayManagement - Marker Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Services/SituationReplayManagement/srm_ftc.h>
|
||||
#include <Plugins/SituationReplayManagement/srm_data_plugin_interface.h>
|
||||
#include <Services/SituationReplayManagement/logger.h>
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class SituationReplayManagementDialog;
|
||||
}
|
||||
|
||||
namespace SituationReplayManagement
|
||||
{
|
||||
class ReplayPartitionDialogModel;
|
||||
// --------------------------------------------------------
|
||||
// SituationReplayManagementDialog
|
||||
// --------------------------------------------------------
|
||||
class SituationReplayManagementDialog : public LtsWidgets::LtsDialog
|
||||
, protected Interface::Ftc::ReplayPartitionCreateReplyHandler
|
||||
, protected Interface::Ftc::ReplayPartitionRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SituationReplayManagementDialog(LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
||||
~SituationReplayManagementDialog();
|
||||
|
||||
bool init(const std::shared_ptr<Core::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<SituationReplayManagement::ForeignDataInterface> &srmForeign);
|
||||
|
||||
void onReplayPartitionCreateReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onReplayPartitionRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
private slots:
|
||||
void enaDisa();
|
||||
void onAddReplayPartition();
|
||||
void onRemoveReplayPartition();
|
||||
void onPrint();
|
||||
void slotStartReplay();
|
||||
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
LtsSession::LtsSession *m_session;
|
||||
ReplayPartitionDialogModel *m_model;
|
||||
Ui::SituationReplayManagementDialog *m_ui;
|
||||
std::shared_ptr<SituationReplayManagement::ForeignDataInterface> m_srmForeign;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SituationReplayManagementDialog</class>
|
||||
<widget class="QWidget" name="SituationReplayManagementDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>435</width>
|
||||
<height>268</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="LtsDataView::LtsDataView" name="widget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for SituationReplayManagement - Replay Partition Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-19
|
||||
*/
|
||||
#include "replay_dialog_model.h"
|
||||
|
||||
namespace SituationReplayManagement
|
||||
{
|
||||
ReplayPartitionDialogModel::ReplayPartitionDialogModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<Core::ReplayPartition>({tr("Id"),
|
||||
tr("Name"),
|
||||
tr("Exercise"),
|
||||
tr("Workstation"),
|
||||
tr("Connection")},
|
||||
parent)
|
||||
, m_partitionid(-1)
|
||||
, m_dtc(nullptr)
|
||||
, m_logger(getLogger("ReplayPartitionDialogModel"))
|
||||
{}
|
||||
|
||||
ReplayPartitionDialogModel::~ReplayPartitionDialogModel()
|
||||
{}
|
||||
|
||||
bool ReplayPartitionDialogModel::initModel(int partitionId,
|
||||
const std::shared_ptr<Core::Interface::Dtc> &dtc)
|
||||
{
|
||||
m_dtc = dtc;
|
||||
m_partitionid = partitionId;
|
||||
|
||||
connect(m_dtc.get(), &Core::Interface::Dtc::replayPartitionChanged,
|
||||
this, &ReplayPartitionDialogModel::onDataChanged);
|
||||
m_dtc->replayPartitions([this](const Core::ReplayPartition &partition) { insertRow(partition); });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariant ReplayPartitionDialogModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const Core::ReplayPartition &partition = m_vecData.at(index.row());
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return partition.id();
|
||||
case Name:
|
||||
return QString::fromStdString(partition.name());
|
||||
case Exercise:
|
||||
return partition.exerciseId(); // TODO: get name from pdm
|
||||
case WorkstationId:
|
||||
return partition.workstationId();
|
||||
case ConnectionString:
|
||||
{
|
||||
if (partition.tcpConnectionUrl().size() == 0)
|
||||
return QString::number(partition.domainId());
|
||||
return QString(QString::fromUtf8(partition.tcpConnectionUrl().c_str()) +
|
||||
QStringLiteral(" - ") +
|
||||
QString::number(partition.domainId()));
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
bool ReplayPartitionDialogModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
//#warning PATRIC!!
|
||||
// int partitionId = m_vecData.at(r).id();
|
||||
// int workstationId = m_vecData.at(r).workstationId();
|
||||
// // TODO: make async / wait dialog
|
||||
// m_ftc->replayPartitionRemoveRequest(ReplayPartitionRemoveRequest(partitionId, workstationId), this);
|
||||
return LtsAbstractTableModel::removeRows(row, count, parent);
|
||||
}
|
||||
} // namespace SituationReplayManagement
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for SituationReplayManagement - Replay Partition Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-19
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <SituationReplayManagement/srm_dtc.h>
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
#include <SituationReplayManagement/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
|
||||
namespace SituationReplayManagement
|
||||
{
|
||||
// --------------------------------------------------------
|
||||
// ReplayPartitionDialogModel
|
||||
// --------------------------------------------------------
|
||||
class ReplayPartitionDialogModel final : public LtsWidgets::LtsAbstractTableModel<Core::ReplayPartition>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id,
|
||||
Name,
|
||||
Exercise,
|
||||
WorkstationId,
|
||||
ConnectionString
|
||||
};
|
||||
|
||||
explicit ReplayPartitionDialogModel(QObject *parent = nullptr);
|
||||
~ReplayPartitionDialogModel();
|
||||
|
||||
bool initModel(int partitionId,
|
||||
const std::shared_ptr<Core::Interface::Dtc> &dtc);
|
||||
|
||||
QVariant data(const QModelIndex &, int) const override final;
|
||||
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override final;
|
||||
|
||||
protected:
|
||||
bool isFiltered(const Core::ReplayPartition &data, DataModification modType) const override
|
||||
{
|
||||
if (data.exerciseId() != m_partitionid)
|
||||
return true;
|
||||
return LtsWidgets::LtsAbstractTableModel<Core::ReplayPartition>::isFiltered(data, modType);
|
||||
}
|
||||
private:
|
||||
int m_partitionid;
|
||||
std::shared_ptr<Core::Interface::Dtc> m_dtc;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
Executable
+292
@@ -0,0 +1,292 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for SituationReplayManagement - Replay Management
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwar, SLSE, 2016-07-19
|
||||
*/
|
||||
|
||||
#include "replay_management_gui_plugin.h"
|
||||
#include "replay_dialog.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsSession/lts_session_manager.h>
|
||||
#include <LtsUtilsCore/await.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsWidgets/lts_global_wait_dialog.h>
|
||||
#include <LtsWidgets/lts_wait_dialog.h>
|
||||
#include <LtsAppManager/lts_app_manager.h>
|
||||
|
||||
#include <FilterManagement/flt_data_plugin_aes_display_filter.h>
|
||||
#include <FilterManagement/flt_symbol_appearance_settings.h>
|
||||
#include <Services/SituationReplayManagement/srm_operator_rights.h>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace SituationReplayManagement
|
||||
{
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Srm.ReplayManagement"))
|
||||
, m_requestHelper(nullptr)
|
||||
{}
|
||||
|
||||
InterfaceImpl::~InterfaceImpl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
if (!m_session->getDtc<DataInterface>(m_coreDtc))
|
||||
return false;
|
||||
if (!m_session->getForeignDataInterface<DataInterface>(m_sitRepIfc))
|
||||
return false;
|
||||
|
||||
if (!m_session->getForeignGuiInterface<FilterManagement::ForeignFltParticipantGuiInterface>(m_fltParticipantIfc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getForeignGuiInterface for Filter Management Participant Gui failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_session->getForeignGuiInterface<FilterManagement::ForeignAesGuiInterface>(m_fltAesIfc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getForeignGuiInterface for Filter Management Aes Gui failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_session->getFtc<FilterManagement::DataInterface>(m_fltFtc))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getFtc for FilterManagement::Interface failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_coreDtc = nullptr;
|
||||
m_sitRepIfc = nullptr;
|
||||
m_fltParticipantIfc = nullptr;
|
||||
m_fltAesIfc = nullptr;
|
||||
}
|
||||
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("ShowReplayManagementAction")) == QVariant(true))
|
||||
#endif
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.layoutArea = LtsWidgets::LayoutArea::eDialogTab;
|
||||
plData.menuText = tr("Replay Management");
|
||||
plData.identifier = QLatin1String("ReplayManagement");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:playback_situation.svg"));
|
||||
plData.operatorRight = OperatorRights::ReplayManagement;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eAfterAction;
|
||||
|
||||
plData.createWidgetFunc = [this](QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new SituationReplayManagementDialog(m_session, parent),
|
||||
m_coreDtc, m_sitRepIfc);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Situation Playback");
|
||||
plData.identifier = QLatin1String("ReplayManagementStart");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:playback_situation_start.svg"));
|
||||
plData.operatorRight = OperatorRights::ReplayManagement;
|
||||
|
||||
if (m_session->partitionType() == IDL::PartitionType::Exercise)
|
||||
{
|
||||
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eAfterAction;
|
||||
plData.directFunc = [this](const LtsWidgets::PluginData &)
|
||||
{
|
||||
return startReplay();
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
// Zusaetzlich auch in 'Apps' aufschalten
|
||||
//????? wie kann man das auch in 'Apps' anzeigen die keinen exercisePart haben ?? z.B. RessourcenManagement, Timeline
|
||||
plData.menuGroup = tr("Apps");
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eSpecial;
|
||||
plData.directFunc = [this](const LtsWidgets::PluginData &)
|
||||
{
|
||||
return startReplay();
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString InterfaceImpl::menuGroup() const
|
||||
{
|
||||
return tr("Playbacks");
|
||||
}
|
||||
|
||||
void InterfaceImpl::startReplay() // blocks!
|
||||
{
|
||||
std::unique_ptr<LtsWidgets::LtsWaitDialog> _(new LtsWidgets::LtsWaitDialog(tr("Waiting for Situation Replay app")));
|
||||
|
||||
int replayId;
|
||||
try
|
||||
{
|
||||
replayId = m_sitRepIfc->replayPartitionCreateRequest(m_session->partitionId(),
|
||||
LtsSessionData::LtsSessionData::getInstance()->getWorkstationId(),
|
||||
LtsSessionData::LtsSessionData::getInstance()->getOperatorId(),
|
||||
Core::ReplayType::SituationData);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
new LtsWidgets::LtsMessageDialogNew(m_session->baseLayout(), tr("Failed to start replay partition for replay!"));
|
||||
return;
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
Core::ReplayPartition rp;
|
||||
for (int i = 0; i < 40; i++)
|
||||
{
|
||||
rp = m_coreDtc->replayPartition(replayId);
|
||||
|
||||
if (rp.id() == replayId)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
try{
|
||||
LtsUtils::awaitTimeout(250);
|
||||
}catch(...){}
|
||||
}
|
||||
|
||||
auto rmPartFn = [this, replayId]()
|
||||
{
|
||||
try
|
||||
{
|
||||
m_sitRepIfc->replayPartitionRemoveRequest(replayId, LtsSessionData::LtsSessionData::getInstance()->getWorkstationId(),
|
||||
LtsSessionData::LtsSessionData::getInstance()->getOperatorId()); // NOTE: unfortunately waits...
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "[timeout] Failed to remove failed-to-start replay. domainId: " << m_session->domainId()
|
||||
<< " - replay id: " << replayId
|
||||
<< " - url " << m_session->tcpConnectionUrl().toString();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if (!found)
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayout(), tr("Error trying to create a replay session"));
|
||||
WARNING_LOG(m_logger) << "[timeout] Error while trying to create a replay session: domainId: " << m_session->domainId()
|
||||
<< " - replay partition does not exist - replay id: " << replayId
|
||||
<< " - url " << m_session->tcpConnectionUrl().toString();
|
||||
rmPartFn();
|
||||
return;
|
||||
}
|
||||
|
||||
startReplayApp(rp); // calls done() on global wait dlg
|
||||
}
|
||||
|
||||
void InterfaceImpl::startReplayApp(const Core::ReplayPartition &data)
|
||||
{
|
||||
m_aesTransfered = false;
|
||||
m_symbolAppearanceTransfered = false;
|
||||
m_data = data;
|
||||
|
||||
// could we supply the operator-specific default settings???
|
||||
// available vi opm plugin (OperatorManagement -> defaultFilterPresetId)???
|
||||
|
||||
if (!transferFilter(data))
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " transferFilter failed.";
|
||||
|
||||
|
||||
// to avoid race conditions, continued in 'startReplayAppInternal', called by
|
||||
// onAesFilterUpdateReply / onSymbolAppearanceUpdateReply
|
||||
}
|
||||
|
||||
void InterfaceImpl::startReplayAppInternal()
|
||||
{
|
||||
const LtsSession::DdsConnectionParams connParams(m_data);
|
||||
// what's the difference?
|
||||
// LtsAppManager::LtsAppManager::getInstance()->createApp(static_cast<int>(LtsSession::LtsSession::App::Situation), connParams);
|
||||
m_session->getSessionManager()->createSession(connParams, true, false /* no payloads! */);
|
||||
}
|
||||
|
||||
|
||||
bool InterfaceImpl::transferFilter(const Core::ReplayPartition &data)
|
||||
{
|
||||
if (m_requestHelper == nullptr)
|
||||
m_requestHelper = new LtsUtils::RequestHelper(this);
|
||||
|
||||
// copy last filter from current session to replay:
|
||||
const int operatorId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
|
||||
const QString context = m_session->workspaceId();
|
||||
const QString replayContext = QStringLiteral("replay_%1").arg(data.id());
|
||||
|
||||
// AES:
|
||||
auto fOrig = m_fltAesIfc->aesFilterForOperator(operatorId, context);
|
||||
auto fReplay = m_fltAesIfc->aesFilterForOperator(operatorId, replayContext); // AesDisplayFilter
|
||||
fReplay->setFilterFromData(fOrig->filterToData());
|
||||
|
||||
auto cb1 = [this, fReplay]()
|
||||
{
|
||||
return m_fltFtc->aesFilterUpdateRequest(fReplay->filterToData(), this);
|
||||
};
|
||||
m_requestHelper->addRequest(cb1);
|
||||
|
||||
|
||||
// SymbolAppearance:
|
||||
auto sOrig = m_fltParticipantIfc->symbolAppearanceForOperator(operatorId, context);
|
||||
auto sReplay = m_fltParticipantIfc->symbolAppearanceForOperator(operatorId, replayContext);
|
||||
sReplay->setSettings(sOrig->settings(), FilterManagement::SymbolAppearanceSettings::Part::All);
|
||||
|
||||
auto cb2 = [this, sReplay]()
|
||||
{
|
||||
return m_fltFtc->symbolAppearanceUpdateRequest(sReplay->settingsToData(), this);
|
||||
};
|
||||
m_requestHelper->addRequest(cb2);
|
||||
|
||||
return m_requestHelper->startRequests();
|
||||
}
|
||||
|
||||
void InterfaceImpl::onAesFilterUpdateReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
|
||||
// the last replay should trigger startReplayAppInternal to continue, but
|
||||
// give flt some time publish data (race condition)
|
||||
m_aesTransfered = true;
|
||||
if (m_aesTransfered && m_symbolAppearanceTransfered)
|
||||
QTimer::singleShot(2000, this, &InterfaceImpl::startReplayAppInternal);
|
||||
}
|
||||
|
||||
void InterfaceImpl::onSymbolAppearanceUpdateReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
|
||||
// the last replay should trigger startReplayAppInternal to continue, but
|
||||
// give flt some time publish data (race condition)
|
||||
m_symbolAppearanceTransfered = true;
|
||||
if (m_aesTransfered && m_symbolAppearanceTransfered)
|
||||
QTimer::singleShot(2000, this, &InterfaceImpl::startReplayAppInternal);
|
||||
}
|
||||
|
||||
} // namespace SituationReplayManagement
|
||||
Executable
+91
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
*@RDE_HEADER@
|
||||
* Gui Plugin for SituationReplayManagement - Replay Management
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-19
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/SituationReplayManagement/srm_data_plugin_interface.h>
|
||||
#include <Plugins/SituationReplayManagement/srm_gui_plugin_interface.h>
|
||||
#include <Plugins/FilterManagement/flt_participant_plugin_interface.h>
|
||||
#include <Plugins/FilterManagement/flt_aes_plugin_interface.h>
|
||||
#include <Plugins/FilterManagement/flt_data_plugin_interface.h>
|
||||
#include <Services/SituationReplayManagement/logger.h>
|
||||
|
||||
namespace SituationReplayManagement
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:srm")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("SituationReplayManagement"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Global;
|
||||
}
|
||||
};
|
||||
|
||||
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface
|
||||
, protected SituationReplayManagement::Interface::Ftc::ReplayPartitionCreateReplyHandler
|
||||
, private FilterManagement::Interface::Ftc::AesFilterUpdateReplyHandler
|
||||
, private FilterManagement::Interface::Ftc::SymbolAppearanceUpdateReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
~InterfaceImpl();
|
||||
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
QString menuGroup() const override;
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Global;
|
||||
}
|
||||
|
||||
private:
|
||||
void startReplay();
|
||||
void startReplayApp(const Core::ReplayPartition &data);
|
||||
void startReplayAppInternal();
|
||||
|
||||
private:
|
||||
void onReplayPartitionCreateReply(const Core::FunctionReplyObject &reply) override { m_requestHelper->requestReply(reply); }
|
||||
void onAesFilterUpdateReply(const Core::FunctionReplyObject &replyObject) override;
|
||||
void onSymbolAppearanceUpdateReply(const Core::FunctionReplyObject &replyObject) override;
|
||||
|
||||
bool transferFilter(const Core::ReplayPartition &data);
|
||||
|
||||
private:
|
||||
std::shared_ptr<Core::Interface::Dtc> m_coreDtc;
|
||||
std::shared_ptr<SituationReplayManagement::ForeignDataInterface> m_sitRepIfc;
|
||||
|
||||
std::shared_ptr<FilterManagement::ForeignFltParticipantGuiInterface> m_fltParticipantIfc;
|
||||
std::shared_ptr<FilterManagement::ForeignAesGuiInterface> m_fltAesIfc;
|
||||
std::shared_ptr<FilterManagement::Interface::Ftc> m_fltFtc;
|
||||
|
||||
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
int m_replayPartitionId;
|
||||
|
||||
bool m_aesTransfered = false;
|
||||
bool m_symbolAppearanceTransfered = false;
|
||||
Core::ReplayPartition m_data;
|
||||
};
|
||||
|
||||
} // namespace SituationReplayManagement
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin Interface for SituationReplayManagement (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <SituationReplayManagement/srm_ftc.h>
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
|
||||
namespace Core
|
||||
{
|
||||
class ReplayPartition;
|
||||
namespace Interface
|
||||
{
|
||||
class Dtc;
|
||||
}
|
||||
}
|
||||
|
||||
namespace SituationReplayManagement
|
||||
{
|
||||
class ForeignDataInterface;
|
||||
/**
|
||||
* @brief The DataInterface class provides the Topics Clients only for the GUI Plugins
|
||||
*/
|
||||
class DataInterface : public DataPluginBase::Interface
|
||||
{
|
||||
public:
|
||||
using DataPluginBase::Interface::Interface;
|
||||
|
||||
virtual std::shared_ptr<Core::Interface::Dtc> getDtc() = 0;
|
||||
virtual std::shared_ptr<ForeignDataInterface> getForeignDataInterface() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The ForeignInterface class provides methods and signals for foreign plugins, that need
|
||||
* access to the data of this DataPlugin
|
||||
*/
|
||||
class ForeignDataInterface
|
||||
{
|
||||
public:
|
||||
ForeignDataInterface() = default;
|
||||
virtual ~ForeignDataInterface() = default;
|
||||
|
||||
virtual void removeReplayPartitionsWorkstation(const int workstationId) noexcept(false) = 0;
|
||||
virtual void removeReplayPartitionsOperator(const int operatorId) noexcept(false) = 0;
|
||||
virtual void replayPartitionRemoveRequest(int partitionId, int workstationId, int operatorId) noexcept(false) = 0;
|
||||
virtual int replayPartitionCreateRequest(int exerciseId, int workstationId, int operatorId, Core::ReplayType replayType) noexcept(false) = 0;
|
||||
};
|
||||
|
||||
} //namespace SituationReplayManagement
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for SituationReplayManagement (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-19
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace SituationReplayManagement
|
||||
{
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
};
|
||||
|
||||
} // namespace SituationReplayManagement
|
||||
Reference in new issue
Block a user