Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
# Created by Dassow Philipp, SLST, 2017-09-19
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(Gui)
|
||||
ADD_SUBDIRECTORY(Data)
|
||||
|
||||
#
|
||||
# Gui Pairing Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(TabGuiNotificationPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tab_notification_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../
|
||||
GuiPluginInterface
|
||||
)
|
||||
|
||||
|
||||
#
|
||||
# Data Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(TabDataPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tab_data_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
DataPluginInterface
|
||||
svcTabCommon
|
||||
)
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
# Created by Dassow Philipp, SLST, 2017-09-19
|
||||
#
|
||||
|
||||
#
|
||||
# Data Plugin
|
||||
#
|
||||
NGL_ADD_LIBRARY(WS TabDataPlugin MODULE tab_data_plugin.cpp tab_data_plugin.h)
|
||||
NGL_TARGET_LINK_LIBRARIES(TabDataPlugin
|
||||
Qt5::Core
|
||||
TabDataPluginInterface
|
||||
svcTabClient
|
||||
NGLLogger
|
||||
LtsSessionDataDds
|
||||
)
|
||||
NGL_INSTALL_TARGET(TabDataPlugin)
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for TrainingAreaBase
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLST, 2017-09-19
|
||||
*/
|
||||
|
||||
|
||||
#include "tab_data_plugin.h"
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <Proxies/TrainingAreaBase/tab_dtc.h>
|
||||
#include <Proxies/TrainingAreaBase/tab_ftc.h>
|
||||
|
||||
namespace TrainingAreaBase
|
||||
{
|
||||
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
|
||||
{
|
||||
// non-default use-case - only one topic needed
|
||||
std::shared_ptr<Interface::Dtc> dtc = Interface::Dtc::create(session->ddsConnector());
|
||||
std::shared_ptr<Interface::Ftc> ftc = Interface::Ftc::create(session->ddsConnector());
|
||||
dtc->enableConnections();
|
||||
return std::make_shared<DataInterfaceImpl>(dtc , ftc);
|
||||
}
|
||||
|
||||
|
||||
DataInterfaceImpl::DataInterfaceImpl(const std::shared_ptr<TrainingAreaBase::Interface::Dtc> &dtc, const std::shared_ptr<TrainingAreaBase::Interface::Ftc> &ftc)
|
||||
: DataInterface()
|
||||
, m_dtc(dtc)
|
||||
, m_ftc(ftc)
|
||||
{}
|
||||
|
||||
|
||||
} // namespace TrainingAreaBase
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for TrainingAreaBase
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLST, 2017-09-19
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <Plugins/TrainingAreaBase/tab_data_plugin_interface.h>
|
||||
|
||||
|
||||
namespace TrainingAreaBase
|
||||
{
|
||||
|
||||
class DataPlugin final : public QObject, public DataPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "data:3:tab")
|
||||
Q_INTERFACES(DataPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataPlugin() = default;
|
||||
~DataPlugin() = default;
|
||||
|
||||
QString pluginName() const override { return QStringLiteral("TrainingAreaBase"); }
|
||||
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::Global;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class DataInterfaceImpl final : public DataInterface
|
||||
{
|
||||
public:
|
||||
explicit DataInterfaceImpl(const std::shared_ptr<TrainingAreaBase::Interface::Dtc> &dtc, const std::shared_ptr<TrainingAreaBase::Interface::Ftc> &ftc);
|
||||
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Dtc> getDtc() override { return m_dtc; }
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Ftc> getFtc() override { return m_ftc; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Ftc> m_ftc;
|
||||
};
|
||||
|
||||
} // namespace TrainingAreaBase
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
# Created by Dassow Philipp, SLST, 2017-09-19
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(Notification)
|
||||
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
# Created by Dassow Philipp, SLST, 2017-09-19
|
||||
#
|
||||
|
||||
SET (tab_info_gui_SRCS
|
||||
tab_notification_gui_plugin.h
|
||||
tab_notification_gui_plugin.cpp
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS TabNotificationGuiPlugin MODULE ${tab_info_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(TabNotificationGuiPlugin
|
||||
LtsSession
|
||||
LtsNotification
|
||||
TabGuiNotificationPluginInterface
|
||||
TabDataPluginInterface
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(TabNotificationGuiPlugin)
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Notifcation plugin for TAB connection states
|
||||
* $Id: tab_notification_gui_plugin.cpp 65000 2025-08-08 05:22:36Z fritsche_h $
|
||||
* $HeadURL: svn://192.168.133.21/TDS/branches/product/release_candidates/guez/3dws_rc/Lts/Plugins/TrainingAreaBase/Gui/Notification/tab_notification_gui_plugin.cpp $
|
||||
* $Author: fritsche_h $
|
||||
* Created by Philipp Dassow, SLST, 2017-09-19
|
||||
*/
|
||||
|
||||
|
||||
#include "tab_notification_gui_plugin.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsNotification/lts_notification.h>
|
||||
#include <QCoreApplication>
|
||||
#include <TrainingAreaBase/logger.h>
|
||||
|
||||
namespace TrainingAreaBase
|
||||
{
|
||||
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("Notification"))
|
||||
, m_dtc(nullptr)
|
||||
, m_noti(nullptr)
|
||||
{}
|
||||
|
||||
InterfaceImpl::~InterfaceImpl()
|
||||
{
|
||||
delete m_noti;
|
||||
}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.createInstant = LtsWidgets::CreateInstantType::CreateInstantAndDiscardAction;
|
||||
plData.directFunc = [this](const LtsWidgets::PluginData &)
|
||||
{
|
||||
if (m_noti != nullptr)
|
||||
return;
|
||||
|
||||
m_noti = m_session->createNotification(QStringLiteral("TabConnections"));
|
||||
setDefaultToolTip();
|
||||
|
||||
connect(m_dtc.get(), &TrainingAreaBase::Interface::Dtc::connectionsChanged, this, &InterfaceImpl::onConnections);
|
||||
|
||||
auto cb = [this](const Connections &data) { onConnections(data, DataModification::eAdded); };
|
||||
m_dtc->waitForHistoricalDataConnections(3000);
|
||||
m_dtc->connectionss(cb);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
if (!m_session->getDtc<TrainingAreaBase::DataInterface>(m_dtc))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_dtc = nullptr;
|
||||
}
|
||||
|
||||
void InterfaceImpl::onConnections(const Connections &data, DataModification modType)
|
||||
{
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
{
|
||||
QStringList sl;
|
||||
sl.reserve(data.connections().size());
|
||||
|
||||
bool allConnected = true;
|
||||
InterfaceImpl::State state = InterfaceImpl::State::Red;
|
||||
|
||||
if (data.connections().size() == 0)
|
||||
allConnected = false;
|
||||
else
|
||||
{
|
||||
for (auto it = data.connections().begin(); it != data.connections().end(); ++it)
|
||||
{
|
||||
const TrainingAreaBase::ConnectionState &connection = *it;
|
||||
const QString name = QCoreApplication::translate("dds", connection.name().c_str());
|
||||
if (connection.state())
|
||||
{
|
||||
state = InterfaceImpl::State::Yellow;
|
||||
sl += tr("%1 connected").arg(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
allConnected = false;
|
||||
sl += tr("%1 disconnected").arg(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allConnected)
|
||||
state = InterfaceImpl::State::Green;
|
||||
|
||||
if (sl.size())
|
||||
{
|
||||
setIcon(state);
|
||||
m_noti->setToolTip(sl.join(QLatin1Char('\n')));
|
||||
}
|
||||
else
|
||||
setDefaultToolTip();
|
||||
break;
|
||||
}
|
||||
case DataModification::eRemoved:
|
||||
setDefaultToolTip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void InterfaceImpl::setDefaultToolTip()
|
||||
{
|
||||
m_noti->setToolTip(tr("Exercise has no data connections"));
|
||||
setIcon(InterfaceImpl::State::Red);
|
||||
}
|
||||
|
||||
void InterfaceImpl::setIcon(InterfaceImpl::State state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case InterfaceImpl::State::Green:
|
||||
m_noti->setIcon(QIcon(QStringLiteral("icon:/network-wireless-green.svg")));
|
||||
break;
|
||||
case InterfaceImpl::State::Yellow:
|
||||
m_noti->setIcon(QIcon(QStringLiteral("icon:/network-wireless-yellow.svg")));
|
||||
break;
|
||||
case InterfaceImpl::State::Red:
|
||||
m_noti->setIcon(QIcon(QStringLiteral("icon:/network-wireless-red.svg")));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace TrainingAreaBase
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Notifcation plugin for TAB connection states
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLST, 2017-09-19
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/TrainingAreaBase/tab_data_plugin_interface.h>
|
||||
#include <Plugins/TrainingAreaBase/tab_notification_gui_plugin_interface.h>
|
||||
#include <Proxies/TrainingAreaBase/tab_dtc.h>
|
||||
|
||||
namespace LtsNotification
|
||||
{
|
||||
class LtsNotification;
|
||||
}
|
||||
|
||||
namespace TrainingAreaBase
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:tab.notification")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return ForeignGuiInterface::pluginName(); }
|
||||
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 TrainingAreaBase::ForeignGuiInterface, public GuiPluginBase::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
~InterfaceImpl();
|
||||
|
||||
QString pluginName() { return ForeignGuiInterface::pluginName(); }
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
QString menuGroup() const override { return tr("Training Area Base"); }
|
||||
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
|
||||
public slots:
|
||||
void onConnections(const TrainingAreaBase::Connections &data, DataModification modType);
|
||||
|
||||
private:
|
||||
enum class State {
|
||||
Green = 0,
|
||||
Yellow = 1,
|
||||
Red = 2
|
||||
};
|
||||
|
||||
void setDefaultToolTip();
|
||||
void setIcon(State state);
|
||||
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Dtc> m_dtc;
|
||||
LtsNotification::LtsNotification *m_noti;
|
||||
};
|
||||
|
||||
} // namespace TrainingAreaBase
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for TrainingAreaBase (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLST, 2017-09-19
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
|
||||
namespace TrainingAreaBase
|
||||
{
|
||||
namespace Interface
|
||||
{
|
||||
class Dtc;
|
||||
class Ftc;
|
||||
}
|
||||
}
|
||||
|
||||
namespace TrainingAreaBase
|
||||
{
|
||||
/**
|
||||
* @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<TrainingAreaBase::Interface::Dtc> getDtc() = 0;
|
||||
virtual std::shared_ptr<TrainingAreaBase::Interface::Ftc> getFtc() = 0;
|
||||
};
|
||||
|
||||
} // namespace TrainingAreaBase
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* @RDE_HEADER@
|
||||
*
|
||||
* Notifcation plugin for TAB connection states
|
||||
*
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Dassow Philipp, SLST, 2017-09-19
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
class QObject;
|
||||
|
||||
namespace TrainingAreaBase
|
||||
{
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
|
||||
static QString pluginName() { return QStringLiteral("TrainingAreaBaseNotificationGuiPlugin"); }
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user