Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* Send / Receive telegrams to/from Hla
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-09-26
|
||||
*/
|
||||
|
||||
#include "main_dispatcher.h"
|
||||
#include "main_handler_tx.h"
|
||||
#include "hla_dispatcher.h"
|
||||
#include "hla_handler_tx.h"
|
||||
#include <nglsettings/nglsettings_settings.h>
|
||||
#include <QTimer>
|
||||
|
||||
namespace ApHlaJson
|
||||
{
|
||||
MainDispatcher::MainDispatcher(TrainingAreaBase::Plugin::DataProvider *pdp,
|
||||
const std::shared_ptr<TrainingAreaBase::RecvFromTab> &recvFromTabCb,
|
||||
const std::shared_ptr<TrainingAreaBase::TxMixin> &sendToTab,
|
||||
NGL::Settings *settings)
|
||||
: m_hlaDispatcher(nullptr)
|
||||
, m_recvFromTabCb(recvFromTabCb)
|
||||
, m_sendToTab(sendToTab)
|
||||
, m_mainHandlerTx(nullptr)
|
||||
, m_pdp(pdp)
|
||||
, m_settings(settings)
|
||||
, m_logger(getLogger("MainDispatcher"))
|
||||
, m_domainId(pdp->domainId())
|
||||
, m_exerciseId(pdp->exerciseId())
|
||||
{
|
||||
INFO_LOG(m_logger) << "ApHla started, Domain Id: " << m_domainId << " ExerciseId: " << m_exerciseId;
|
||||
}
|
||||
|
||||
MainDispatcher::~MainDispatcher()
|
||||
{
|
||||
m_mainHandlerTx = nullptr;
|
||||
m_recvFromTabCb = nullptr;
|
||||
m_ddsHandler = nullptr;
|
||||
m_ppmHandler = nullptr;
|
||||
m_pdmHandler = nullptr;
|
||||
m_aesHandler = nullptr;
|
||||
delete m_hlaDispatcher;
|
||||
}
|
||||
|
||||
bool MainDispatcher::init()
|
||||
{
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(m_domainId, m_exerciseId);
|
||||
if (!m_ddsHandler->init())
|
||||
return false;
|
||||
|
||||
m_pdmHandler = std::make_shared<PdmHandler>();
|
||||
|
||||
m_pdmHandler->init(this);
|
||||
|
||||
m_ppmHandler = std::make_shared<PpmHandler>();
|
||||
|
||||
m_ppmHandler->init(this);
|
||||
|
||||
m_aesHandler = std::make_shared<AesHandler>();
|
||||
|
||||
m_aesHandler->init(this);
|
||||
|
||||
m_hlaDispatcher = new HlaDispatcher(m_pdp, m_recvFromTabCb, m_sendToTab, m_settings, m_ppmHandler, m_pdmHandler, m_aesHandler);
|
||||
m_mainHandlerTx = std::make_shared<MainHandlerTx>(std::dynamic_pointer_cast<HlaHandlerTx>(m_hlaDispatcher->sendToTab()));
|
||||
m_hlaDispatcher->init();
|
||||
|
||||
m_hlaDispatcher->connectWebsocket();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<TrainingAreaBase::SendToTab> MainDispatcher::sendToTab()
|
||||
{
|
||||
return std::static_pointer_cast<TrainingAreaBase::SendToTab>(m_mainHandlerTx);
|
||||
}
|
||||
|
||||
bool MainDispatcher::canSendData() const
|
||||
{
|
||||
return m_hlaDispatcher->canSendData();
|
||||
}
|
||||
|
||||
void MainDispatcher::exerciseChanged()
|
||||
{
|
||||
m_hlaDispatcher->exerciseChanged();
|
||||
}
|
||||
|
||||
} // namespace ApHlaJson
|
||||
Reference in new issue
Block a user