Files
2026-08-13 18:33:10 +02:00

62 lines
1.5 KiB
C++
Executable File

/**
* DdsHandler for ServiceManagement
* $Id$
* $HeadURL$
* $Author$
* Created by Hannes Baeuerle, SLSE, 2016-02-15
*/
#include "dds_handler.h"
#include "scm_dts.h"
#include "scm_fts.h"
namespace ServiceManagement
{
DdsHandler::DdsHandler(int domainId)
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Any))
, 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_ddsConnector->enableBatchedWriter(false);
m_ddsDts = ServiceManagement::Interface::Dts::create(m_ddsConnector);
bool bRet = m_ddsDts->enableAll();
INFO_LOG(m_logger) << "initialized Dts";
m_ddsFts = ServiceManagement::Interface::Fts::create(m_ddsConnector);
bRet &= m_ddsFts->enableAll();
INFO_LOG(m_logger) << "initialized Fts";
return bRet;
}
std::shared_ptr<ServiceManagement::Interface::Dts> ServiceManagement::DdsHandler::dts() const
{
return m_ddsDts;
}
std::shared_ptr<ServiceManagement::Interface::Fts> ServiceManagement::DdsHandler::fts() const
{
return m_ddsFts;
}
std::shared_ptr<DDSConnector::DdsConnector> DdsHandler::connector() const
{
return m_ddsConnector;
}
} // namespace ServiceManagement