Bring the validation-scope line (in-tree Jenkins CI copy, lcov coverage wiring, step-by-step release-scope README, TetraIF unit tests, the LogView runtime icon/resource fix, Dockerfile, rpmbuild and the new_docker_build.sh driver with the DEB output path) on top of the XmlPatterns branch pruned to the Release 2 scope. Conflict policy: - Out-of-scope targets/modules: keep the prune (deletion wins). - In-scope files that validation had deleted: restored from story/release-2-cleanup (the Release 2 closure, with the pruned-module guards). - In-scope sources carrying migration work: XmlPatterns versions (Qt XmlPatterns rework on QDomDocument, DDS member and logger fixes, first-build fixes). - Scope-aware CMakeLists (top level, PluginInterfaces, LtsWidgets) and .envrc: story/release-2-cleanup / ours versions.
83 lines
2.1 KiB
C++
Executable File
83 lines
2.1 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
*
|
|
* Subscriber (DDSConnector)
|
|
* Uses DTCs/DDTCs to subscribe to data
|
|
*
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#include "subscriber.h"
|
|
#include "pub_sub_base_p.h"
|
|
|
|
#include <Lts/DDS/QosProfile/DDS_DefaultQos.h>
|
|
#include <NGLLogger/INGLLogger.h>
|
|
|
|
namespace DDSConnector
|
|
{
|
|
Subscriber::Subscriber(const dds::domain::DomainParticipant &domainParticipant, const std::string &partition, bool bUseSubscriberListener)
|
|
: PubSubBase(domainParticipant, partition, "DDSConnector.Subscriber")
|
|
, m_ddsSubscriber(nullptr)
|
|
, m_subscriberListener(bUseSubscriberListener ? new DDSGeneric::SubscriberListener : nullptr)
|
|
, m_subscriberListenerBinder(nullptr)
|
|
{
|
|
Q_ASSERT(domainParticipant != nullptr);
|
|
initDDS();
|
|
}
|
|
|
|
Subscriber::~Subscriber()
|
|
{
|
|
try
|
|
{
|
|
deleteDDS();
|
|
} catch (...)
|
|
{}
|
|
}
|
|
|
|
void Subscriber::initDDS()
|
|
{
|
|
if (m_partitions.empty())
|
|
return;
|
|
|
|
|
|
if (m_logger.isDebugEnabled()) {
|
|
DEBUG_LOG(m_logger) << "Subscriber (DataReader) Qos: ";
|
|
dds::core::QosProvider qosProvider = dds::core::QosProvider::Default();
|
|
DDS::QosProfile::print(qosProvider.datareader_qos(), m_logger);
|
|
}
|
|
|
|
dds::sub::qos::SubscriberQos subscriberQos = m_domainParticipant.default_subscriber_qos();
|
|
|
|
|
|
rti::core::policy::EntityName entityName;
|
|
entityName.name(std::string("Sub ") + m_partitions.front());
|
|
subscriberQos << entityName;
|
|
|
|
DEBUG_LOG(m_logger) << "Subscribe on partition " << m_partitions.front();
|
|
|
|
m_ddsSubscriber = dds::sub::Subscriber(m_domainParticipant,
|
|
subscriberQos);
|
|
|
|
if (m_subscriberListener)
|
|
m_subscriberListenerBinder = rti::core::bind_and_manage_listener(m_ddsSubscriber,
|
|
m_subscriberListener,
|
|
DDSGeneric::SubscriberListener::mask());
|
|
|
|
updatePartitionQoS(m_ddsSubscriber);
|
|
}
|
|
|
|
void Subscriber::deleteDDS()
|
|
{
|
|
if (m_subscriberListener)
|
|
{
|
|
m_subscriberListener->prepareShutdown();
|
|
m_subscriberListener = nullptr;
|
|
}
|
|
m_subscriberListenerBinder = nullptr;
|
|
m_ddsSubscriber = nullptr;
|
|
}
|
|
|
|
}
|