Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+118
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* MainHandler for TetraRadio
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-04-14
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <memory>
|
||||
#include "exm_handler.h"
|
||||
#include "ism_handler.h"
|
||||
#include "pdm_handler.h"
|
||||
#include "ppm_handler.h"
|
||||
#include "tab_db.h"
|
||||
#include "dds_handler.h"
|
||||
#include "position_handler.h"
|
||||
#include "send_to_dds.h"
|
||||
#include "recv_from_dds_aes.h"
|
||||
#include "recv_from_dds_fts.h"
|
||||
#include "send_to_tab.h"
|
||||
#include "tx_mixin.h"
|
||||
#include <ProjectDataManagement/pdm_dtc.h>
|
||||
#include "tab_plugin_interface.h"
|
||||
#include "WebSocketInterface/websocket_interface_handler.h"
|
||||
#include <ngldb/db_service_handler.h>
|
||||
|
||||
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
namespace NGLDB
|
||||
{
|
||||
template <typename DB> class DbServiceHandler;
|
||||
}
|
||||
|
||||
namespace LtsPluginManager
|
||||
{
|
||||
struct PluginInstance;
|
||||
}
|
||||
|
||||
namespace TrainingAreaBase
|
||||
{
|
||||
using DbHandler = NGLDB::DbServiceHandler<DatabaseInterface>;
|
||||
class MainHandler final : public QObject, public Plugin::DataProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MainHandler(QObject *parent = nullptr);
|
||||
~MainHandler();
|
||||
|
||||
bool init(int domainId, int exerciseId);
|
||||
|
||||
std::shared_ptr<DdsHandler> ddsHandler() const { return m_ddsHandler; }
|
||||
std::shared_ptr<DbHandler> dbHandler() const { return m_dbHandler; }
|
||||
std::shared_ptr<DatabaseInterface> db() const { return m_dbHandler->db(); }
|
||||
|
||||
std::shared_ptr<RecvFromTab> rxHandler() const { return m_rxHandler; }
|
||||
std::shared_ptr<RecvFromDdsFts> ftsHandler() const { return m_ftsHandler; }
|
||||
std::shared_ptr<SendToTab> txHandler() const { return m_txHandler; }
|
||||
std::shared_ptr<RecvFromDdsAes> aesHandler() const { return m_aesHandler; }
|
||||
std::shared_ptr<ExmHandler> exmHandler() const { return m_exmHandler; }
|
||||
std::shared_ptr<IsmHandler> ismHandler() const { return m_ismHandler; }
|
||||
std::shared_ptr<PdmHandler> pdmHandler() const { return m_pdmHandler; }
|
||||
std::shared_ptr<PpmHandler> ppmHandler() const { return m_ppmHandler; }
|
||||
std::shared_ptr<PositionHandler> posHandler() const { return m_posHandler; }
|
||||
|
||||
// Plugin::DataProvider
|
||||
int exerciseId() const override { return m_ddsHandler->ddsConnector()->getPartitionId(); }
|
||||
bool useTetraScrambling() const override;
|
||||
ProjectDataManagement::RadioGroup exerciseRadioGroup() const override;
|
||||
TetraIcd::ExerciseEnvironmentData exerciseEnvironmentData() const override;
|
||||
TetraIcd::ExerciseStateData exerciseStateData() const override;
|
||||
TetraIcd::ExerciseEquipmentAssignmentComplete exerciseEquipmentAssignment() const override;
|
||||
QVector<TetraIcd::TrainingAreaTelegram*> aesTelegrams() const override;
|
||||
QSqlDatabase databaseConnection() const override;
|
||||
QString databaseSchemaName() const override;
|
||||
int domainId() const override;
|
||||
|
||||
const std::vector<std::shared_ptr<Plugin::Interface>> &getPluginList() const { return m_interfaces; }
|
||||
|
||||
private Q_SLOTS:
|
||||
void onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType);
|
||||
void onExercise2RadioGroupChanged();
|
||||
void onConnectionState(const QString &name, bool connectionState);
|
||||
void onDirectMessage(const QByteArray &jsonMessage);
|
||||
void onPositionChanged(int equipNo, const ParticipantManagement::ParticipantPosition &pos);
|
||||
|
||||
private:
|
||||
bool loadPlugin(const LtsPluginManager::PluginInstance &pi);
|
||||
QString getErrorString(const ParticipantManagement::BiteError &error) const;
|
||||
QString getCanDeviceName(int id) const;
|
||||
QString getSubDeviceName(int id) const;
|
||||
private:
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<DbHandler> m_dbHandler;
|
||||
std::shared_ptr<RecvFromTab> m_rxHandler;
|
||||
std::shared_ptr<RecvFromDdsFts> m_ftsHandler;
|
||||
std::shared_ptr<TxMixin> m_txHandler;
|
||||
std::shared_ptr<RecvFromDdsAes> m_aesHandler;
|
||||
std::shared_ptr<IsmHandler> m_ismHandler;
|
||||
std::shared_ptr<ExmHandler> m_exmHandler;
|
||||
std::shared_ptr<PdmHandler> m_pdmHandler;
|
||||
std::shared_ptr<PpmHandler> m_ppmHandler;
|
||||
std::shared_ptr<PositionHandler> m_posHandler;
|
||||
std::vector<std::shared_ptr<Plugin::Interface>> m_interfaces;
|
||||
std::shared_ptr<WebSocketInterface::WebSocketInterfaceHandler> m_handlerWebSocket;
|
||||
|
||||
|
||||
ExerciseManagement::Exercise m_exerciseData;
|
||||
QMap<int, ProjectDataManagement::CanComponentString> m_ccsMap;
|
||||
QMap<int, ProjectDataManagement::BiteComponentText> m_bctMap;
|
||||
QMap<QString, bool> m_ifcConnectionState;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
} // namespace TrainingAreaBase
|
||||
Reference in new issue
Block a user