95 lines
2.4 KiB
C++
Executable File
95 lines
2.4 KiB
C++
Executable File
/**
|
|
* DdsHandler for DDS
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hanna E. Rathje, SLSE, 2015-09-02
|
|
*/
|
|
|
|
#include "dds_handler.h"
|
|
#include <Core/pacemaker.h>
|
|
|
|
namespace EffectShowClient
|
|
{
|
|
|
|
DdsHandler::DdsHandler(int domainId, int exerciseId)
|
|
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Any, exerciseId))
|
|
, m_exerciseId(exerciseId)
|
|
, m_logger(getLogger("DdsHandler"))
|
|
{
|
|
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
|
}
|
|
|
|
|
|
bool DdsHandler::init(const QStringList &qosFileList)
|
|
{
|
|
if (!m_ddsConnector->init(qosFileList))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
|
return false;
|
|
}
|
|
|
|
// default initialize Publisher and Subscriber
|
|
m_ddsConnector->initPublisherSubscriber();
|
|
|
|
m_dtcCore = Core::Interface::Dtc::create(m_ddsConnector);
|
|
bool bRet = m_dtcCore->enablePartitionTime();
|
|
|
|
// Pacemaker
|
|
m_pacemaker = std::make_shared<Core::Pacemaker>(m_ddsConnector);
|
|
|
|
m_ddsDts = EffectShowClient::Interface::Dts::create(m_ddsConnector);
|
|
m_ddsFts = EffectShowClient::Interface::Fts::create(m_ddsConnector);
|
|
|
|
bRet &= m_ddsDts->enableAll();
|
|
INFO_LOG(m_logger) << "Dts initialised";
|
|
|
|
bRet &= m_ddsFts->enableAll();
|
|
INFO_LOG(m_logger) << "Fts initialised";
|
|
|
|
if (!bRet)
|
|
return false;
|
|
|
|
// Subscripe for Training Area Base
|
|
m_dtcTab = TrainingAreaBase::Interface::Dtc::create(m_ddsConnector);
|
|
|
|
if (!m_dtcTab->enableFireSmokeMarkerData())
|
|
{
|
|
ERROR_LOG(m_logger) << "Error initializing TrainingAreaBase DTC";
|
|
return false;
|
|
}
|
|
m_ftcTab = TrainingAreaBase::Interface::Ftc::create(m_ddsConnector);
|
|
if (!m_ftcTab->enableSendFireSmokeMarkerData())
|
|
{
|
|
ERROR_LOG(m_logger) << "Error initializing TrainingAreaBase FTC";
|
|
return false;
|
|
}
|
|
|
|
// Subscripe for NOM
|
|
m_ftcNom = NotificationManagement::Interface::Ftc::create(m_ddsConnector);
|
|
if (!m_ftcNom->enableCreateNotification())
|
|
{
|
|
ERROR_LOG(m_logger) << "Error initializing NotificationManagement FTC";
|
|
return false;
|
|
}
|
|
|
|
// Subscripe for ASM
|
|
m_dtcAsm = AssetManagement::Interface::Dtc::create(m_ddsConnector);
|
|
|
|
if (!m_dtcAsm->enableAsset())
|
|
{
|
|
ERROR_LOG(m_logger) << "Error initializing AssetManagement DTC";
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
qint64 DdsHandler::currentPartitionTime() const
|
|
{
|
|
return m_dtcCore->partitionTime().timeStamp();
|
|
}
|
|
|
|
|
|
} // Namespace EffectShowClient
|