61 lines
1.6 KiB
C++
Executable File
61 lines
1.6 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Handler for the WebSocket Interface
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hannes Fritsche, SLSE, 2017-09-07
|
|
*/
|
|
#include "ws_bite_interface_handler.h"
|
|
|
|
#include "Connection/connection_handler.h"
|
|
#include "Messages/message_handler.h"
|
|
#include "Messages/message_transmitter.h"
|
|
#include "dds_handler.h"
|
|
#include "bite_data_manager.h"
|
|
|
|
namespace WarehouseGuez
|
|
{
|
|
namespace WsBiteInterface
|
|
{
|
|
|
|
WsBiteInterfaceHandler::WsBiteInterfaceHandler(DataManager *dataManager)
|
|
: m_dataManager(dataManager)
|
|
, m_connectionHandler(nullptr)
|
|
, m_messageHandler(nullptr)
|
|
, m_logger(getLogger("WsBiteInterfaceHandler"))
|
|
{
|
|
Q_ASSERT(dataManager);
|
|
}
|
|
|
|
WsBiteInterfaceHandler::~WsBiteInterfaceHandler()
|
|
{
|
|
delete m_connectionHandler;
|
|
delete m_messageHandler;
|
|
}
|
|
|
|
bool WsBiteInterfaceHandler::init()
|
|
{
|
|
Q_ASSERT(!m_connectionHandler);
|
|
|
|
m_connectionHandler = new Connection::ConnectionHandler;
|
|
if (!m_connectionHandler->init())
|
|
{
|
|
ERROR_LOG(m_logger) << "Failed to initialise ConnectionHandler";
|
|
return false;
|
|
}
|
|
|
|
m_messageHandler = new Messages::MessageHandler(m_dataManager);
|
|
|
|
QObject::connect(m_connectionHandler, &Connection::ConnectionHandler::clientDisconnected, m_dataManager, &DataManager::onClientDisconnect);
|
|
|
|
//QObject::connect(m_connectionHandler, &Connection::ConnectionHandler::lastConnectionClosed, m_dataManager, &ExerciseManager::stopPositionsUpdate);
|
|
QObject::connect(m_connectionHandler, &Connection::ConnectionHandler::newTextMessageFromClient, m_messageHandler, &Messages::MessageHandler::onNewTextMessage);
|
|
|
|
return true;
|
|
}
|
|
|
|
} // namespace WsBiteInterface
|
|
|
|
} // namespace CombatNetRadio
|