Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* MainHandler for HighLevelArchitecture
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2017-04-07
|
||||
*/
|
||||
|
||||
#include "main_handler.h"
|
||||
#include "ngs_handler.h"
|
||||
#include "web_socket_interface.h"
|
||||
#include "Common/identifierstruct.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QTimer>
|
||||
#include <Common/settings.h>
|
||||
#include <Common/logger.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace HighLevelArchitecture
|
||||
{
|
||||
|
||||
MainHandler::MainHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_exerciseId(0)
|
||||
, m_logger(getLogger("MainHandler"))
|
||||
{}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
{
|
||||
m_ngsHandler = nullptr;
|
||||
m_wsInterface = nullptr;
|
||||
}
|
||||
|
||||
bool MainHandler::init(int exerciseId)
|
||||
{
|
||||
NOTICE_LOG(m_logger) << LOGFUNCTION << ", exerciseId=" << exerciseId;
|
||||
|
||||
m_exerciseId = 5; // exerciseId;
|
||||
IdentifierStruct::setOwnSiteId(exerciseId);
|
||||
|
||||
//
|
||||
// NgsHandler
|
||||
//
|
||||
|
||||
/*
|
||||
if (!m_ngsHandler)
|
||||
{
|
||||
m_ngsHandler = std::make_shared<NgsHandler>();
|
||||
// connect(m_ngsHandler.get(), &NgsHandler::ngsHandlerReady,
|
||||
// m_wsHandler.get(), &WebSocketHandler::sendHlaConnectionState, Qt::UniqueConnection);
|
||||
if (!m_ngsHandler->init())
|
||||
{
|
||||
m_ngsHandler = nullptr;
|
||||
ERROR_LOG(m_logger) << "Could not init ngs - stopping application";
|
||||
QCoreApplication::quit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// WsInterface
|
||||
//
|
||||
if (!m_wsInterface)
|
||||
{
|
||||
// requests from ws will be sent to ngsHandler:
|
||||
m_wsInterface = std::make_shared<WsInterface>(m_ngsHandler, this);
|
||||
int port = 23456;
|
||||
if (!m_wsInterface->init(port))
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION
|
||||
<< " WsInterface::init failed on port: " << port;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MainHandler::isConnectedToHla() const
|
||||
{
|
||||
return m_ngsHandler && m_ngsHandler->isConnectedToHla();
|
||||
}
|
||||
|
||||
|
||||
} // namespace HighLevelArchitecture
|
||||
Reference in new issue
Block a user