Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+80
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* MainHandler for AssetManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "main_handler.h"
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
#include <ngldb/db_service_handler.h>
|
||||
#include "som_db.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
namespace SoundManagement
|
||||
{
|
||||
|
||||
MainHandler::MainHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_ddsHandler(nullptr)
|
||||
, m_dbHandler(nullptr)
|
||||
, m_logger(getLogger("MainHandler"))
|
||||
{}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
{
|
||||
m_handlerSounds.reset();
|
||||
|
||||
m_ddsHandler.reset();
|
||||
m_dbHandler = nullptr;
|
||||
}
|
||||
|
||||
bool MainHandler::init(int domainId, int exerciseId)
|
||||
{
|
||||
INFO_LOG(m_logger) << "MainHandler::init";
|
||||
|
||||
// initialize database
|
||||
m_dbHandler = std::make_shared<DbHandler>();
|
||||
|
||||
if (!m_dbHandler->init(0, Settings::settings()))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation dbHandler failed.";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "Initialisation dbHandler succesful.";
|
||||
|
||||
// initialize DDS
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(domainId, exerciseId);
|
||||
if (!m_ddsHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation ddsHandler failed.";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "Initialisation ddsHandler succesful.";
|
||||
|
||||
NOTICE_LOG(m_logger) << "setNewState Core::RunningState::Starting ";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Starting);
|
||||
|
||||
// initialize handlerSounds
|
||||
m_handlerSounds = std::make_shared<HandlerSounds>(m_ddsHandler,
|
||||
m_dbHandler, this);
|
||||
|
||||
if (!m_handlerSounds->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerSounds failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
|
||||
NOTICE_LOG(m_logger) << "setNewState Core::RunningState::Running ";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace SoundManagement
|
||||
Reference in new issue
Block a user