Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# DataPluginInterface
ADD_INTERFACE_LIBRARY(
DataPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/data_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
Qt5::Core
)
# GuiPluginInterface
ADD_INTERFACE_LIBRARY(
GuiPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/gui_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
Qt5::Core LtsWidgets ProjectConfig LtsAppDescriptor LtsUtilsCore
)
# projectPluginInterface
ADD_INTERFACE_LIBRARY(
ProjectPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/project_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
Qt5::Core
)
# stylePluginInterface
ADD_INTERFACE_LIBRARY(
StylePluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/style_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
Qt5::Core
)
# record_replay_plugin
ADD_INTERFACE_LIBRARY(
RecordReplayPlugin
${CMAKE_CURRENT_SOURCE_DIR}/record_replay_plugin.h
${CMAKE_CURRENT_SOURCE_DIR}/..
Qt5::Core
)
# Topic Replay Interface
ADD_INTERFACE_LIBRARY(
TopicReplayInterface
${CMAKE_CURRENT_SOURCE_DIR}/topic_replay_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
Qt5::Core
)
+53
View File
@@ -0,0 +1,53 @@
/**
* @RDE_HEADER@
* Interface for HMI plugins
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-02-29
*/
#pragma once
#include <ProjectConfig/project_defines.h>
#include <QObject>
#include <memory>
namespace NGL
{
class INGLLogger;
}
namespace LtsSession
{
class LtsSessionDataDds;
}
namespace DataPluginBase
{
// per dds session
class Interface
{
public:
Interface() = default;
virtual ~Interface() = default;
};
// per plugin
class Plugin
{
public:
Plugin() = default;
virtual ~Plugin() = default;
virtual QString pluginName() const = 0;
virtual std::shared_ptr<Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) = 0;
virtual bool availableInPartition(IDL::PartitionType partition) const = 0;
};
} // namespace DataPluginBase
Q_DECLARE_INTERFACE(DataPluginBase::Plugin, "data:")
+105
View File
@@ -0,0 +1,105 @@
/**
* @RDE_HEADER@
* Interface for HMI plugins
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-02-29
*/
#pragma once
#include <LtsWidgets/lts_base.h>
#include <ProjectConfig/project_defines.h>
#include <LtsAppDescriptor/lts_app_descriptor.h>
#include <LtsUtilsCore/lts_translatable_identifier.h>
#include <QObject>
#include <QVector>
#include <QFlags>
#include <memory>
namespace NGL
{
class INGLLogger;
}
namespace LtsWidgets
{
class LtsBackgroundWidget;
class LtsBaseLayoutWidget;
}
namespace LtsSession
{
class LtsSession;
}
namespace GuiPluginBase
{
class Interface;
class Plugin // one instance per plugin
{
public:
Plugin() = default;
virtual ~Plugin() = default;
virtual QString pluginName() = 0;
virtual std::shared_ptr<Interface> createGuiInterface(LtsSession::LtsSession *session) = 0;
virtual bool availableInPartition(IDL::PartitionType partition) const = 0;
};
// per session
class Interface
{
public:
Interface(LtsSession::LtsSession *session, NGL::INGLLogger &logger)
: m_hasInit(true)
, m_session(session)
, m_logger(logger)
, m_appId(LtsAppDescriptor::App::Login)
{}
virtual ~Interface() = default;
void setFlags(const QFlags<LtsAppDescriptor::PluginInfo::Flag> &flags) { m_flags = flags; }
const QFlags<LtsAppDescriptor::PluginInfo::Flag> &getFlags() const { return m_flags; }
void setOptions(const QStringList &options) { m_options = options; }
const QStringList &getOptions() const { return m_options; }
void setAppId(LtsAppDescriptor::App appId) { m_appId = appId; }
LtsAppDescriptor::App appId() const { return m_appId; }
virtual QVector<LtsWidgets::PluginData> getActions() { return QVector<LtsWidgets::PluginData>(); } // only override when default behaviour unwanted or insufficient (when menu items are necessary)
virtual bool fetchInterfaces() { return true; } // only override when default behaviour unwanted or insufficient (if foreign interfaces must be fetched)
virtual void clearInterfaces() {} // only override when default behaviour unwanted or insufficient (if foreign interfaces were fetched)
virtual QString menuGroup() const { return {}; }
virtual LtsUtils::LtsTranslatableIdentifier menuGroupIdentifier() const { m_hasMenuGroupIdentifier = false; return {}; }
virtual bool availableInPartition(IDL::PartitionType partition) const { Q_UNUSED(partition); return true; } // FIXME: remove !
virtual void init() { m_hasInit = false; } // called before payloads - needs to be quit with signalInitDone(); !
// NOTE: parameter 'mainBackground' is deprecated!
virtual void executePayload(LtsWidgets::LtsBackgroundWidget *mainBackground) { (void)mainBackground; } // must be overridden when executionPriority was overridden
virtual int executionPriority() const { return -1; } // only override when default behaviour unwanted or insufficient [smaller = executed sooner, 0 = first, 9999 = unpriorized - see docs!]
//virtual std::shared_ptr<ForeignDataInterface> getForeignDataInterface() = 0;
bool m_hasInit;
mutable bool m_hasMenuGroupIdentifier = true;
protected:
LtsSession::LtsSession *m_session;
NGL::INGLLogger &m_logger;
private:
QFlags<LtsAppDescriptor::PluginInfo::Flag> m_flags;
QStringList m_options;
LtsAppDescriptor::App m_appId;
//std::shared_ptr<ForeignDataInterface> m_foreignInterface;
};
} // namespace GuiPluginBase
Q_DECLARE_INTERFACE(GuiPluginBase::Plugin, "gui")
+26
View File
@@ -0,0 +1,26 @@
/**
* @RDE_HEADER@
* Interface for Project Plugins (Resources)
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2016-10-10
*/
#pragma once
#include <QObject>
namespace ProjectPlugin
{
class Plugin
{
public:
Plugin() = default;
virtual ~Plugin() = default;
};
} // namespace ProjectPlugin
Q_DECLARE_INTERFACE(ProjectPlugin::Plugin, "project")
+157
View File
@@ -0,0 +1,157 @@
/**
* @RDE_HEADER@
* Provide Record/Replay functionality for dds topics in a service
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-07-07
*/
#pragma once
#include <memory>
#include <map>
#include <QObject>
#include <QString>
#include <QHash>
namespace DDSConnector
{
class DdsConnector;
}
class NSqlQuery;
namespace RecordReplay
{
class RecordReplayPlugin
{
public:
RecordReplayPlugin() = default;
virtual ~RecordReplayPlugin() = default;
virtual QString pluginName() const = 0;
/**
* @brief initialize all data topic clients for the topics to record (for record management)
* @return true on success
*/
virtual bool initDtc(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector,
int exerciseId) = 0;
/**
* @brief initialize all data topic server for the topics to replay (for situation replay)
* @return true on success
*/
virtual bool initDts(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector,
int exerciseId,
bool bCanHandleSchemas,
NSqlQuery &query) = 0;
/**
* @brief initialize the plugin for copying data from one database to another
* @return true on success
*/
virtual bool initCopy(int exerciseId, bool bCanHandleSchemasRead, bool bCanHandleSchemasWrite) = 0;
/**
* @brief copy all recorded data from one database to another
* @param queryFrom a NSqlQuery which has a database connection to the database to read from
* @param queryToa NSqlQuery which has a database connection to the database to write to
* @param fromTime start time of the data to copy
* @param toTime end time of the data to copy
* @return true on success
*/
virtual bool copyData(NSqlQuery &queryFrom, NSqlQuery &queryTo, qint64 fromTime, qint64 toTime) = 0;
/**
* @brief get the service short name used in rec_snaphsot.svc_name)
*/
virtual QString svcShortName() const = 0;
// recording functions
/**
* @brief Read data from dds and save it to the corresponding tables
* @param query the NSqlQuery to use (speedup to not create a query on every call)
* @param minRecordSampleTime the minimum sample time seen during this call
* @return true on success (can only be false on wrong schema)
*/
virtual bool ddsTopicsToDatabase(NSqlQuery &query, QHash<QString, qint64> &minRecordSampleTimes) = 0;
// publishing functions
/**
* @brief Read all data to be able to publish all topics with the correct for the given start time
* @param query the NSqlQuery to use (speedup to not create a query on every call)
* @param startTime the timestamp for which the replay should be started
* @return true on success
*/
virtual bool setReplayStartTime(NSqlQuery &query, qint64 startTime) = 0;
/**
* @brief Read data from database and store it in internal buffers for a specific time stamp
* @param query the NSqlQuery to use (speedup to not create a query on every call)
* @param fromTime lower time for range to read (including)
* @param toTime higher time for range to read (excluding)
* @return true on success
*/
virtual bool ddsTopicsFromDatabase(NSqlQuery &query, qint64 fromTime, qint64 toTime) = 0;
/**
* @brief publish all data in the internal buffers to dds until the desired time is reached
* @param desiredTime last timestamp to publish data for
* @return true on success
*/
virtual bool publishData(qint64 desiredTime) = 0;
/**
* @brief wait for possible asnyc operations which must be finished for the given time and publish this data
* @param desiredTime last timestamp to publish data for
* @return true on success
*/
virtual bool waitForAsyncOperations(qint64 desiredTime) { Q_UNUSED(desiredTime); return true; }
/**
* @brief clear the internal buffer (filled by ddsTopicsFromDatabase()) - e.g. for a new starting point
* also remove the data from dds
*/
virtual void clearData() = 0;
// structure/functions for snapshot creation
struct RecSnapshot // see rec_db.h / RecSnapshot
{
qint64 timeStamp = 0;
std::map<int64_t, int64_t> recIdArray;
RecSnapshot() = default;
RecSnapshot(qint64 timeStamp_, const std::map<int64_t, int64_t> &recIdArray_)
: timeStamp(timeStamp_)
, recIdArray(recIdArray_)
{}
};
/**
* @brief Run through the given time range with the given interval and collect the latest database entries (id, key) for snapshot creation
* @param query the NSqlQuery to use (speedup to not create a query on every call)
* @param fromTime lower time for range to read (including)
* @param toTime higher time for range to read (excluding)
* @param interval sanpshot creation interval
* @return snapshots to create
*/
virtual std::map<QString, std::vector<RecSnapshot>> getSnapshotTimes(NSqlQuery &query,
qint64 toTime,
qint64 interval,
const QHash<QString, qint64> &minRecordedSampleTimes) = 0;
/**
* @brief Return all topics which are handled (= recorded/replayed) by this plugin
*/
virtual QVector<QString> getRecordTopicNames() const = 0;
/**
* @brief Return all record/replay tables
*/
virtual QVector<QString> getRecordTableNames() const = 0;
/**
* @brief "SELECT min(sample_time) FROM rec_<topic_name>"
* @param query the NSqlQuery to use (speedup to not create a query on every call)
* @param topicName the topic to get the minimum sample time for
* @param defaultValue the default value if no sample is found
* @return
*/
virtual qint64 getMinimumSampleTime(NSqlQuery &q, const QString &topicName, qint64 defaultValue) const = 0;
};
}
Q_DECLARE_INTERFACE(RecordReplay::RecordReplayPlugin, "special:3:recordreplay")
+29
View File
@@ -0,0 +1,29 @@
/**
* @RDE_HEADER@
* Interface for Style Plugins (Resources & Stylesheets)
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2016-10-14
*/
#pragma once
#include <QObject>
namespace StylePlugin
{
class Plugin
{
public:
Plugin() = default;
virtual ~Plugin() = default;
virtual void loadStyle(bool highDpi) = 0;
virtual void unloadStyle() = 0;
};
} // namespace StylePlugin
Q_DECLARE_INTERFACE(StylePlugin::Plugin, "style")
+148
View File
@@ -0,0 +1,148 @@
/**
* @RDE_HEADER@
* Interface for Script Editor Playback Controls
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2017-04-19
*/
#pragma once
#include <TopicEditorBase/topic_editor_utils.h>
#include <QJsonObject>
#include <QVector>
class QWidget;
namespace TopicEditorBase { class ExportNotifier; }
namespace TopicReplay
{
/**
* @brief The Interface class handles the playback of the coherent Topic in the Script Player.
*/
class Interface
{
public:
static QJsonObject timeRange(qint64 start, qint64 end)
{
return { {QStringLiteral("start"), start}, {QStringLiteral("end"), end} };
}
struct SituationReplayTime
{
int id = 0;
// topic start/end time in presentation (relative to presentation start)
qint64 topicStart_s = -1;
qint64 topicEnd_s = -1;
// absolute time of replay start/end
qint64 replayStart_ms = -1;
qint64 replayEnd_ms = -1;
double replaySpeedFactor = 1;
QJsonObject toReplayInformation() const
{
return {
{QStringLiteral("id"), id},
{QStringLiteral("timeInPresentation"), timeRange(topicStart_s * 1000, topicEnd_s * 1000)},
};
}
QJsonObject toPlaybackTime(double max) const
{
QJsonObject ret = timeRange(replayStart_ms, std::min(replayEnd_ms * replaySpeedFactor, max));
ret[QStringLiteral("replaySpeedFactor")] = replaySpeedFactor;
return ret;
}
QJsonObject toJson(double maxReplayEndMs) const
{
return {
{QStringLiteral("playbackTime"), toPlaybackTime(maxReplayEndMs)},
{QStringLiteral("replayInformation"), toReplayInformation()},
};
}
};
Interface() = default;
virtual ~Interface() = default;
/**
* @brief createWidget
* You are still the owner of the widget created by this method. You have to delete it on d_tor.
* Do not override if this is a control interface only (using playbackInit/Start/Pause only)
* @return
*/
virtual QWidget *createWidget() { return nullptr; }
// Control Ifc: (do not override one of the following if this is a widget interface only (using createWidget only))
/**
* @brief playbackInit is called when the Script Player starts the playback of the coherent topic.
* @param attributes
* @return
*/
virtual bool playbackInit(const QJsonObject &attributes) { Q_UNUSED(attributes); return true; } /*qint64 startTime, qint64 endTime, const double speed) { (void)startTime; (void)endTime; (void)speed; return false; }*/
// Override only if necessary (that is when your Topic's playback is not controlled by DDS / the Replay Management) Example: Video Playback
virtual bool playbackStart(int secondsOffset) { Q_UNUSED(secondsOffset); return true; }
virtual bool playbackPause() { return true; }
virtual bool playbackStop() { return true; }
/*
* For TakehomePackage:
* Notify about success or failure bei emitting
* emit pExportNotifier->signalExportSuccessful(const QString& strFileName);
* emit pExportNotifier->signalExportFailed();
*
* If your export is time consuming call the following signal regularly
* emit pExportNotifier->signalStillAlive();
*/
virtual void setExportPlaybackTimes(
qint64 startTimeSec, qint64 durationSec, const QVector<SituationReplayTime> &sitReplayTimes
)
{
Q_UNUSED(startTimeSec);
Q_UNUSED(durationSec);
Q_UNUSED(sitReplayTimes);
}
virtual bool exportTopic(
const QJsonObject &attributes, const QString &strFolderPath, TopicEditorBase::ExportNotifier *pExportNotifier
) = 0;
// returns a vector with additional TrackEntries to export (e.g. additional files)
virtual QVector<TopicEditorBase::TopicData> additionalTrackEntries(const QJsonObject &attributes) const
{
Q_UNUSED(attributes);
return {};
}
virtual QVector<TopicEditorBase::TopicData> additionalTrackEntries(const QJsonObject &attributes, bool &keepOriginalTopic) const
{
keepOriginalTopic = true;
return additionalTrackEntries(attributes);
}
virtual void setBasePath(const QString &basePath) { Q_UNUSED(basePath); }
};
/**
* @brief The Factory class handles one Interface at a time so that many widgets in the replay
* can be handled separately.
*/
class Factory
{
public:
virtual ~Factory() = default;
virtual Interface *createInterface(TopicEditorBase::TopicType topicType) = 0;
};
} // namespace TopicReplay