Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+58
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Initialisation for Subscriber
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "initialisation.h"
|
||||
#include "subscriber.h"
|
||||
|
||||
#include <DDS/DDSConnector/publisher.h>
|
||||
|
||||
namespace DdsView
|
||||
{
|
||||
|
||||
Initialisation::Initialisation(const dds::domain::DomainParticipant &dp,
|
||||
int domainId, IDL::PartitionType partitionType,
|
||||
int exerciseId, TelegramModel *tm)
|
||||
: DDSConnector::DdsConnector(domainId, partitionType, exerciseId)
|
||||
, m_logger(DdsView::getLogger("Initialisation"))
|
||||
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Initialisation for partition: " << getDefaultPartition();
|
||||
initDDS(dp, tm);
|
||||
}
|
||||
|
||||
void Initialisation::initDDS(const dds::domain::DomainParticipant &dp, TelegramModel *tm)
|
||||
{
|
||||
DDSConnector::DdsConnector::init();
|
||||
|
||||
// Initialisation Subscriber
|
||||
setSubscriber(new DdsView::Subscriber(dp, getDefaultPartition(), tm));
|
||||
|
||||
// Initialisation Publisher
|
||||
// Note (!): The publisher has its own domainParticipant
|
||||
setPublisher(new DDSConnector::Publisher(dds::domain::DomainParticipant(getDomainId()), getDefaultPartition()));
|
||||
|
||||
if (getPublisher()->getDomainParticipant() == nullptr)
|
||||
return;
|
||||
|
||||
// Enable DomainParticipant
|
||||
// Default-QoS Configuration for enabled => false (using Qos from DefaultParticipant)
|
||||
dds::domain::DomainParticipant &pubDp = const_cast<dds::domain::DomainParticipant &>(getPublisher()->getDomainParticipant());
|
||||
pubDp->enable();
|
||||
}
|
||||
|
||||
bool Initialisation::initDDTCs(const QVector<DDSGeneric::TopicDescription> &vDro)
|
||||
{
|
||||
DdsView::Subscriber *sub = dynamic_cast<DdsView::Subscriber *>(getSubscriber());
|
||||
return sub ? sub->initDDTCs(vDro) : false;
|
||||
}
|
||||
|
||||
bool Initialisation::publish(const dds::core::xtypes::DynamicData &data, const std::string &topicName)
|
||||
{
|
||||
return getPublisher() ? getPublisher()->write(data, topicName) : false;
|
||||
}
|
||||
|
||||
} // Namespace DdsView
|
||||
Reference in new issue
Block a user