Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+94
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* @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/NmeaManagement/nme_notification_gui_plugin_interface.h>
|
||||
#include <Plugins/TrainingAreaBase/tab_data_plugin_interface.h>
|
||||
#include <Proxies/TrainingAreaBase/tab_dtc.h>
|
||||
#include <Proxies/TrainingAreaBase/tab_ftc.h>
|
||||
//#include <NmeaManagement/logger.h>
|
||||
#include <QTimer>
|
||||
|
||||
namespace LtsNotification
|
||||
{
|
||||
class LtsNotification;
|
||||
}
|
||||
|
||||
namespace NmeaManagement
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:nme.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 NmeaManagement::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("RadioMaster"); }
|
||||
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
|
||||
private slots:
|
||||
void onBatteryChanged(const TrainingAreaBase::BatteryInfo &dataArr, DataModification modType);
|
||||
void onShutdownStateChanged(const TrainingAreaBase::ServiceControl &data, DataModification modType);
|
||||
void onOutdatedFirstBatteryTimerTimeout();
|
||||
void onOutdatedSecondBatteryTimerTimeout();
|
||||
private:
|
||||
enum class State { //TODO:Better names, There are only five akku states
|
||||
Empty = 0,
|
||||
Twenty = 1,
|
||||
Fourty = 2,
|
||||
Sixty = 3,
|
||||
Eighty = 4,
|
||||
Full = 5,
|
||||
Unknown = 6
|
||||
};
|
||||
|
||||
void setToolTip(int firstBattery = 99, int secondBattery = 99);
|
||||
QImage renderBatteryImage(int firstBatteryState = 99, int secondBatteryState = 99);
|
||||
void updateBatteryLevel();
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Dtc> m_tabDtc;
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Ftc> m_tabFtc;
|
||||
LtsNotification::LtsNotification *m_notiBattery;
|
||||
LtsNotification::LtsNotification *m_notiOwnPosition;
|
||||
QMap<int, TrainingAreaBase::BatteryState> m_currentBatteryStateForId;
|
||||
bool m_hasConnection = true;
|
||||
QTimer *m_oudatedFirstBatteryTimer;
|
||||
QTimer *m_oudatedSecondBatteryTimer;
|
||||
|
||||
};
|
||||
|
||||
} // namespace NmeaManagement
|
||||
Reference in new issue
Block a user