Adds q2 repos to migrate
This commit is contained in:
1 parent
ad1f62c4ee
commit
17f1c61c9e
991 files changed
+178451
No files matched your search
@@ -0,0 +1,125 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "PrtCnvThreadStarter.hpp"
|
||||
#include "PrtCnvCentralThread.hpp"
|
||||
#include "PrtCnvRadioThread.hpp"
|
||||
#include "PrtCnvDbThread.hpp"
|
||||
#include "PrtCnvTelegramLogThread.hpp"
|
||||
#include "PrtCnvInjectionThread.hpp"
|
||||
#include "PrtCnvRadioTrafficThread.hpp"
|
||||
#include "PrtCnvApplication.hpp"
|
||||
|
||||
namespace PrtCnv
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
PrtCnvThreadStarter::PrtCnvThreadStarter(const PrtCnv::PrtCnvApplication::E_ThreadId a_id,
|
||||
const QString &configFileName,
|
||||
PrtCnv::PrtCnvApplication* a_mainApp)
|
||||
: m_Thread(nullptr)
|
||||
, m_Application(a_mainApp)
|
||||
, m_Id(a_id)
|
||||
, m_settings(new NGL::Settings(configFileName))
|
||||
, m_logger(getLogger("PrtCnvThreadStarter"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Using Config file '" << configFileName << "'";
|
||||
}
|
||||
|
||||
|
||||
PrtCnvThreadStarter::~PrtCnvThreadStarter()
|
||||
{
|
||||
delete m_settings;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void PrtCnvThreadStarter::run()
|
||||
{
|
||||
INFO_LOG(m_logger) << "Entering event loop for thread " << this << ", id: " << m_Id;
|
||||
|
||||
switch (m_Id)
|
||||
{
|
||||
case PrtCnvApplication::e_Central:
|
||||
m_Thread = new PrtCnvCentralThread(this);
|
||||
break;
|
||||
|
||||
case PrtCnvApplication::e_Radio:
|
||||
m_Thread = new PrtCnvRadioThread(m_Application->exerciseId(), this);
|
||||
break;
|
||||
|
||||
case PrtCnvApplication::e_Db:
|
||||
m_Thread = new PrtCnvDbThread(m_Application->databaseDriver(),
|
||||
m_Application->databaseHostName(),
|
||||
m_Application->databaseName(),
|
||||
m_Application->databaseSchemaName(),
|
||||
m_Application->databaseUserName(),
|
||||
m_Application->databasePassword(),
|
||||
this);
|
||||
break;
|
||||
|
||||
case PrtCnvApplication::e_Log:
|
||||
m_Thread = new PrtCnvTelegramLogThread(this);
|
||||
break;
|
||||
|
||||
case PrtCnvApplication::e_Injection:
|
||||
m_Thread = new PrtCnvInjectionThread(this);
|
||||
break;
|
||||
|
||||
case PrtCnvApplication::e_RadioTraffic:
|
||||
m_Thread = new PrtCnvRadioTrafficThread(this);
|
||||
break;
|
||||
|
||||
case PrtCnvApplication::e_ThreadIdMax:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!m_Thread)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Unknown threadId: " << m_Id;
|
||||
return;
|
||||
}
|
||||
|
||||
while (!m_Application)
|
||||
sleep(1);
|
||||
|
||||
m_Application->waitForCreate(m_Id);
|
||||
m_Thread->create(m_settings);
|
||||
m_Application->waitForInit(m_Id);
|
||||
m_Thread->init();
|
||||
m_Application->waitForStart(m_Id);
|
||||
m_Thread->start();
|
||||
m_Application->waitForExec(m_Id);
|
||||
|
||||
exec();
|
||||
|
||||
INFO_LOG(m_logger) << "Leaving event loop for thread " << this << ", id: " << m_Id;
|
||||
delete m_Thread;
|
||||
m_Thread = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PrtCnvThread *PrtCnvThreadStarter::getOtherThread(PrtCnvApplication::E_ThreadId a_threadId) const
|
||||
{
|
||||
return m_Application->getThreadStarter(a_threadId)->m_Thread;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user