Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
@@ -78,7 +78,7 @@ void Pacemaker::init(DDSConnector::DdsConnector *ddsConnector)
|
||||
m_dtsCurrentRunningState = ddsConnector->createDTS<DTS::CurrentRunningStateImpl>();
|
||||
if (!m_dtsCurrentRunningState)
|
||||
{
|
||||
WARNING_LOG() << "Can not initialize DTS::CurrentRunningState!";
|
||||
WARNING_LOG(m_logger) << "Can not initialize DTS::CurrentRunningState!";
|
||||
return;
|
||||
}
|
||||
m_state.pid(QCoreApplication::applicationPid());
|
||||
|
||||
@@ -41,10 +41,12 @@ public Q_SLOTS:
|
||||
void publishState();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void init(DDSConnector::DdsConnector *ddsConnector);
|
||||
void setNewStateInternal(Core::RunningState newState, const QString &errorString = QString());
|
||||
void addPortInternal(unsigned short number, Core::PortType portType, const QString &properties = QStringLiteral(""));
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
static constexpr const int m_publishTimerDelay = 3000;
|
||||
|
||||
CurrentRunningState m_state;
|
||||
|
||||
@@ -33,7 +33,7 @@ DdsConnector::DdsConnector(int domainId,
|
||||
.getNGLLogger("Common.DDSConnector"))
|
||||
{
|
||||
initInternal();
|
||||
DEBUG_LOG() << "DdsConnector ctor: " << m_domainId << "," << m_partitionId << ","<< m_exerciseId << "," << static_cast<int>(m_defaultPartitionType);
|
||||
DEBUG_LOG(m_logger) << "DdsConnector ctor: " << m_domainId << "," << m_partitionId << ","<< m_exerciseId << "," << static_cast<int>(m_defaultPartitionType);
|
||||
}
|
||||
|
||||
DdsConnector::DdsConnector(int domainId,
|
||||
@@ -108,7 +108,7 @@ bool DdsConnector::init(const QStringList &qosFileList)
|
||||
|
||||
QUrl DdsConnector::getTcpConnectionUrl() const
|
||||
{
|
||||
DEBUG_LOG() << this << " gettcpConnectionUrl: " << m_tcpConnectionUrl.toString();
|
||||
DEBUG_LOG(m_logger) << this << " gettcpConnectionUrl: " << m_tcpConnectionUrl.toString();
|
||||
return m_tcpConnectionUrl;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ std::string DdsConnector::getPartitionString(IDL::PartitionType pt, int partitio
|
||||
}
|
||||
|
||||
NGL::INGLLogger &m_logger = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Common.DDSConnector");
|
||||
ERROR_LOG() << "Invalid partition type: " << static_cast<int>(pt);
|
||||
ERROR_LOG(m_logger) << "Invalid partition type: " << static_cast<int>(pt);
|
||||
return std::string();
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ void DdsConnector::setDomainParticipant(const dds::domain::DomainParticipant &pa
|
||||
}
|
||||
catch (const dds::core::Exception &ex)
|
||||
{
|
||||
WARNING_LOG() << "Could not enable DomainParticipant: " << ex.what();
|
||||
WARNING_LOG(m_logger) << "Could not enable DomainParticipant: " << ex.what();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -213,7 +213,7 @@ void DdsConnector::setPublisher(Publisher *publisher)
|
||||
{
|
||||
if (m_publisher && publisher != m_publisher)
|
||||
{
|
||||
WARNING_LOG() << "Trying to set publisher but there is already a publisher set - overwriting!";
|
||||
WARNING_LOG(m_logger) << "Trying to set publisher but there is already a publisher set - overwriting!";
|
||||
delete m_publisher;
|
||||
}
|
||||
m_publisher = publisher;
|
||||
@@ -232,7 +232,7 @@ void DdsConnector::setSubscriber(Subscriber *subscriber)
|
||||
{
|
||||
if (m_subscriber && subscriber != m_subscriber)
|
||||
{
|
||||
WARNING_LOG() << "Trying to set subscriber but there is already a subscriber set - overwriting!";
|
||||
WARNING_LOG(m_logger) << "Trying to set subscriber but there is already a subscriber set - overwriting!";
|
||||
delete m_subscriber;
|
||||
}
|
||||
m_subscriber = subscriber;
|
||||
@@ -257,13 +257,13 @@ void DdsConnector::initInternal()
|
||||
m_defaultPartitionType == IDL::PartitionType::AllExercises)
|
||||
m_partitionId = -1;
|
||||
if (m_defaultPartitionType == IDL::PartitionType::Exercise && m_partitionId < 0)
|
||||
WARNING_LOG() << "Want to subscribe to an exercise, but no exercise Id is given!";
|
||||
WARNING_LOG(m_logger) << "Want to subscribe to an exercise, but no exercise Id is given!";
|
||||
if (m_defaultPartitionType == IDL::PartitionType::Global)
|
||||
{
|
||||
m_partitionId = 0;
|
||||
m_exerciseId = 0;
|
||||
}
|
||||
INFO_LOG() << "DDSConnector(" << m_domainId << ") for partition: " << m_partitionId
|
||||
INFO_LOG(m_logger) << "DDSConnector(" << m_domainId << ") for partition: " << m_partitionId
|
||||
<< " with partition type " << static_cast<int>(m_defaultPartitionType);
|
||||
|
||||
|
||||
|
||||
@@ -182,9 +182,11 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void initInternal();
|
||||
void createWaitSetHandler();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
int m_domainId;
|
||||
IDL::PartitionType m_defaultPartitionType;
|
||||
int m_partitionId;
|
||||
@@ -207,6 +209,7 @@ public:
|
||||
: m_coherentSet(connector->getDdsPublisher())
|
||||
{}
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
dds::pub::CoherentSet m_coherentSet;
|
||||
};
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace DDSConnector
|
||||
class DDSCONNECTOR_EXPORT PubSubBase
|
||||
{
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
PubSubBase(const dds::domain::DomainParticipant &domainParticipant,
|
||||
const std::string &partition,
|
||||
const char *loggerName);
|
||||
|
||||
@@ -81,12 +81,12 @@ public:
|
||||
{
|
||||
if (m_subscriberCallback)
|
||||
{
|
||||
WARNING_LOG() << "Can not set subscriber callback - already set ...";
|
||||
WARNING_LOG(m_logger) << "Can not set subscriber callback - already set ...";
|
||||
return false;
|
||||
}
|
||||
if (!m_subscriberListener)
|
||||
{
|
||||
WARNING_LOG() << "Can not set subscriber callback - no subscriber listener ...";
|
||||
WARNING_LOG(m_logger) << "Can not set subscriber callback - no subscriber listener ...";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
|
||||
if (!m_dataReaderObject)
|
||||
{
|
||||
WARNING_LOG() << "Can not set subscriber callback - no data reader object ...";
|
||||
WARNING_LOG(m_logger) << "Can not set subscriber callback - no data reader object ...";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ protected:
|
||||
Q_UNUSED(topicType);
|
||||
if (m_writerState.testAndSetRelaxed(1, 0))
|
||||
{
|
||||
DEBUG_LOG() << "Recreate Reader for topic " << topicName
|
||||
DEBUG_LOG(m_logger) << "Recreate Reader for topic " << topicName
|
||||
<< ", type name " << DDS::topic_type_name<TopicTypeRead>::value();
|
||||
if (m_subscriberListener)
|
||||
m_subscriberListener->removeCallback(m_dataReaderObject->getDataReader(), this);
|
||||
@@ -202,7 +202,7 @@ protected:
|
||||
m_subscriberListener->addCallback(m_dataReaderObject->getDataReader(), this);
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "IN droDataAvailable(), topic name: " << topicName
|
||||
DEBUG_LOG(m_logger) << "IN droDataAvailable(), topic name: " << topicName
|
||||
<< ", type name " << DDS::topic_type_name<TopicTypeRead>::value()
|
||||
<< ", this: " << this
|
||||
<< ", m_dataReaderObject: " << m_dataReaderObject
|
||||
@@ -235,7 +235,7 @@ protected:
|
||||
{
|
||||
if (!droInitOk)
|
||||
{
|
||||
ERROR_LOG() << "Error initializing DRO for type " << DDS::topic_type_name<TopicTypeRead>::value();
|
||||
ERROR_LOG(m_logger) << "Error initializing DRO for type " << DDS::topic_type_name<TopicTypeRead>::value();
|
||||
delete m_dataReaderObject;
|
||||
m_dataReaderObject = nullptr;
|
||||
return false;
|
||||
@@ -243,13 +243,13 @@ protected:
|
||||
|
||||
if (m_subscriberListener)
|
||||
{
|
||||
DEBUG_LOG() << "subscriberListener exists, adding type "
|
||||
DEBUG_LOG(m_logger) << "subscriberListener exists, adding type "
|
||||
<< DDS::topic_type_name<TopicTypeRead>::value();
|
||||
m_subscriberListener->addCallback(m_dataReaderObject->getDataReader(), this);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG() << "Cannot add DTC to subscriberListener callback - type: "
|
||||
DEBUG_LOG(m_logger) << "Cannot add DTC to subscriberListener callback - type: "
|
||||
<< DDS::topic_type_name<TopicTypeRead>::value();
|
||||
}
|
||||
m_dataReaderObject->setHaveSubscriberCallback(m_subscriberListener != nullptr);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace DTS
|
||||
bool write(const TopicType &data,
|
||||
const dds::core::optional<dds::sub::SampleInfo> &si = dds::core::optional<dds::sub::SampleInfo>()) override final
|
||||
{
|
||||
DEBUG_LOG() << "IN write ("
|
||||
DEBUG_LOG(m_logger) << "IN write ("
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< ")";
|
||||
|
||||
@@ -45,11 +45,11 @@ namespace DTS
|
||||
|
||||
if (!m_dataWriterObject->write(data, si))
|
||||
{
|
||||
ERROR_LOG() << "Error writing for "
|
||||
ERROR_LOG(m_logger) << "Error writing for "
|
||||
<< DDS::topic_type_name<TopicType>::value();
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "TopicData ("
|
||||
DEBUG_LOG(m_logger) << "TopicData ("
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< ") written";
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace DTS
|
||||
|
||||
bool remove(const TopicType &data, bool errorMsgIfNotExists = true) override final
|
||||
{
|
||||
DEBUG_LOG() << "IN remove ("
|
||||
DEBUG_LOG(m_logger) << "IN remove ("
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< ")";
|
||||
|
||||
@@ -68,11 +68,11 @@ namespace DTS
|
||||
if (!m_dataWriterObject->remove(data, errorMsgIfNotExists))
|
||||
{
|
||||
if (errorMsgIfNotExists)
|
||||
ERROR_LOG() << "Error removing for "
|
||||
ERROR_LOG(m_logger) << "Error removing for "
|
||||
<< DDS::topic_type_name<TopicType>::value();
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "TopicData ("
|
||||
DEBUG_LOG(m_logger) << "TopicData ("
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< ") removed";
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
#include <QThread>
|
||||
|
||||
|
||||
DataTopicTests::DataTopicTests()
|
||||
: m_domainParticipantPub(nullptr)
|
||||
DataTopicTests::DataTopicTests() : m_domainParticipantPub(nullptr)
|
||||
, m_domainParticipantSub(nullptr)
|
||||
, m_domainId(0)
|
||||
, m_partitionId(1)
|
||||
@@ -26,12 +25,12 @@ DataTopicTests::DataTopicTests()
|
||||
, m_subscriberListener(nullptr)
|
||||
, m_dtcTestPart(nullptr)
|
||||
, m_mainThreadId(QThread::currentThreadId())
|
||||
.getNGLLogger("UnitTests.DataTopicTests"))
|
||||
{
|
||||
.getNGLLogger("UnitTests.DataTopicTests")),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
if (!DDS::QosProfile::setDefault())
|
||||
ERROR_LOG() << "Error setting default QoS from xml-file ";
|
||||
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
|
||||
|
||||
DEBUG_LOG() << "Main thread ID is " << m_mainThreadId;
|
||||
DEBUG_LOG(m_logger) << "Main thread ID is " << m_mainThreadId;
|
||||
}
|
||||
|
||||
DataTopicTests::~DataTopicTests()
|
||||
@@ -65,7 +64,7 @@ bool DataTopicTests::initPublisher()
|
||||
partitionQos.name( { partition.toStdString() } );
|
||||
publisherQos << partitionQos;
|
||||
|
||||
DEBUG_LOG() << "Publish on partition " << partition;
|
||||
DEBUG_LOG(m_logger) << "Publish on partition " << partition;
|
||||
|
||||
m_ddsPublisher = dds::pub::Publisher(m_domainParticipantPub, publisherQos);
|
||||
m_testPart = new DTS::TestParticipantImpl(m_domainParticipantPub, m_ddsPublisher);
|
||||
@@ -75,8 +74,8 @@ bool DataTopicTests::initPublisher()
|
||||
|
||||
bool DataTopicTests::write(const DdsUnitTests::TestParticipant &data)
|
||||
{
|
||||
INFO_LOG() << "Publish topic TestParticipant ";
|
||||
DEBUG_LOG() << "ParticipantId: " << data.location().participantId()
|
||||
INFO_LOG(m_logger) << "Publish topic TestParticipant ";
|
||||
DEBUG_LOG(m_logger) << "ParticipantId: " << data.location().participantId()
|
||||
<< ", equipNo = " << data.location().equipNo();
|
||||
|
||||
return m_testPart->write(data);
|
||||
@@ -88,7 +87,7 @@ bool DataTopicTests::write(const DdsUnitTests::TestParticipant &data)
|
||||
|
||||
bool DataTopicTests::initSubscriber()
|
||||
{
|
||||
DEBUG_LOG() << "Initialisation DDS (Subscriber/Reader)";
|
||||
DEBUG_LOG(m_logger) << "Initialisation DDS (Subscriber/Reader)";
|
||||
|
||||
m_domainParticipantSub =
|
||||
dds::domain::DomainParticipant(m_domainId,
|
||||
@@ -108,7 +107,7 @@ bool DataTopicTests::initSubscriber()
|
||||
partitionQos.name( partitions );
|
||||
subscriberQos << partitionQos;
|
||||
|
||||
DEBUG_LOG() << "Initialise DTC::SubscriberListener";
|
||||
DEBUG_LOG(m_logger) << "Initialise DTC::SubscriberListener";
|
||||
m_subscriberListener = new DDSGeneric::SubscriberListener();
|
||||
m_ddsSubscriber = dds::sub::Subscriber(m_domainParticipantSub,
|
||||
subscriberQos,
|
||||
@@ -142,10 +141,10 @@ void DataTopicTests::deleteSubscriber()
|
||||
|
||||
void DataTopicTests::processData(const DdsUnitTests::TestParticipant &instance, const dds::sub::SampleInfo &si)
|
||||
{
|
||||
INFO_LOG() << "process data in topic TestParticipant, Sampleinfo: " << si.source_timestamp().sec();
|
||||
INFO_LOG(m_logger) << "process data in topic TestParticipant, Sampleinfo: " << si.source_timestamp().sec();
|
||||
|
||||
DEBUG_LOG() << "participantId: " << instance.location().participantId();
|
||||
DEBUG_LOG() << "equipNo: " << instance.location().equipNo();
|
||||
DEBUG_LOG(m_logger) << "participantId: " << instance.location().participantId();
|
||||
DEBUG_LOG(m_logger) << "equipNo: " << instance.location().equipNo();
|
||||
|
||||
m_receivedParticipantData = instance;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void processData(const DdsUnitTests::TestParticipant &instance, const dds::sub::SampleInfo &si);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
@@ -33,7 +33,7 @@ DataTopicTestsMain::DataTopicTestsMain()
|
||||
|
||||
void DataTopicTestsMain::initTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: initTestCase";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: initTestCase";
|
||||
|
||||
m_dtTest = new DataTopicTests();
|
||||
QVERIFY2(m_dtTest, "Initialisation of DataTopicTest failed");
|
||||
@@ -46,20 +46,20 @@ void DataTopicTestsMain::initTestCase()
|
||||
|
||||
void DataTopicTestsMain::publishTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: publish TestParticipant";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: publish TestParticipant";
|
||||
|
||||
m_sentParticipantData.location().participantId(100);
|
||||
m_sentParticipantData.location().equipNo(1010);
|
||||
m_sentParticipantData.testId(100);
|
||||
QVERIFY2(m_dtTest->write(m_sentParticipantData), "Publishing Topic TestParticipant failed");
|
||||
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: publish ready";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: publish ready";
|
||||
}
|
||||
|
||||
|
||||
void DataTopicTestsMain::subscribeTestCase()
|
||||
{
|
||||
DEBUG_LOG() << "IN subscribeTestCase";
|
||||
DEBUG_LOG(m_logger) << "IN subscribeTestCase";
|
||||
|
||||
QTRY_COMPARE(m_participantDataArrivedSpy->count(), 1);
|
||||
|
||||
@@ -95,7 +95,7 @@ void DataTopicTestsMain::deleteDataReaderTestCase()
|
||||
|
||||
void DataTopicTestsMain::cleanupTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: cleanupTestCase";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: cleanupTestCase";
|
||||
delete m_dtTest; m_dtTest = nullptr;
|
||||
delete m_participantDataArrivedSpy; m_participantDataArrivedSpy = nullptr;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ private Q_SLOTS:
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
private:
|
||||
DdsUnitTests::TestParticipant m_sentParticipantData;
|
||||
QSignalSpy *m_participantDataArrivedSpy = nullptr;
|
||||
|
||||
@@ -27,10 +27,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
FunctionTopicTests::FunctionTopicTests()
|
||||
: m_mainThreadId(QThread::currentThreadId())
|
||||
.getNGLLogger("UnitTests.FunctionTopicTests"))
|
||||
{
|
||||
FunctionTopicTests::FunctionTopicTests() : m_mainThreadId(QThread::currentThreadId())
|
||||
.getNGLLogger("UnitTests.FunctionTopicTests")),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
qRegisterMetaType<DdsUnitTests::FunctionReply>("DdsUnitTests::FunctionReply");
|
||||
qRegisterMetaType<DdsUnitTests::FunctionReplyWithState>("DdsUnitTests::FunctionReplyWithState");
|
||||
}
|
||||
@@ -38,7 +37,7 @@ FunctionTopicTests::FunctionTopicTests()
|
||||
|
||||
void FunctionTopicTests::initTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"FunctionTopicTests: initTestCase";
|
||||
DEBUG_LOG(m_logger) <<"FunctionTopicTests: initTestCase";
|
||||
|
||||
const int domainId = 0;
|
||||
|
||||
@@ -97,7 +96,7 @@ void FunctionTopicTests::requestWithState()
|
||||
QSignalSpy spyRequest(this, &FunctionTopicTests::functionTopicRequestFinished);
|
||||
QSignalSpy spyReply(this, &FunctionTopicTests::functionTopicReply);
|
||||
|
||||
DEBUG_LOG() <<"FunctionTopicTests: request";
|
||||
DEBUG_LOG(m_logger) <<"FunctionTopicTests: request";
|
||||
|
||||
|
||||
DdsUnitTests::FunctionRequestWithState data;
|
||||
@@ -125,7 +124,7 @@ void FunctionTopicTests::requestTestCase2()
|
||||
QSignalSpy spyRequest(this, &FunctionTopicTests::functionTopicRequestFinished);
|
||||
QSignalSpy spyReply(this, &FunctionTopicTests::functionTopicReply);
|
||||
|
||||
DEBUG_LOG() <<"FunctionTopicTests: request";
|
||||
DEBUG_LOG(m_logger) <<"FunctionTopicTests: request";
|
||||
|
||||
|
||||
DdsUnitTests::FunctionRequest data;
|
||||
@@ -149,7 +148,7 @@ void FunctionTopicTests::requestTestCase2()
|
||||
|
||||
void FunctionTopicTests::cleanupTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"FunctionTopicTests: cleanupTestCase";
|
||||
DEBUG_LOG(m_logger) <<"FunctionTopicTests: cleanupTestCase";
|
||||
|
||||
m_fts = nullptr;
|
||||
m_ftc = nullptr;
|
||||
@@ -165,7 +164,7 @@ void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity
|
||||
{
|
||||
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
|
||||
|
||||
INFO_LOG() << "Got function topic request (with status member)";
|
||||
INFO_LOG(m_logger) << "Got function topic request (with status member)";
|
||||
m_requestTopicWithState = request;
|
||||
QCOMPARE(m_requestTopicWithState.id(), 1);
|
||||
QCOMPARE(m_requestTopicWithState.info().get(), std::string("Test request"));
|
||||
@@ -173,7 +172,7 @@ void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity
|
||||
|
||||
DdsUnitTests::FunctionReplyWithState reply;
|
||||
|
||||
DEBUG_LOG() << "Send sample with status REPLY_COMPLETED";
|
||||
DEBUG_LOG(m_logger) << "Send sample with status REPLY_COMPLETED";
|
||||
reply.id(1);
|
||||
reply.errorString("Hello");
|
||||
reply.replyState(Core::FtReplyState::Completed);
|
||||
@@ -191,7 +190,7 @@ void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity
|
||||
{
|
||||
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
|
||||
|
||||
INFO_LOG() << "Got function topic request (without status member)";
|
||||
INFO_LOG(m_logger) << "Got function topic request (without status member)";
|
||||
|
||||
m_requestTopic = request;
|
||||
|
||||
@@ -214,7 +213,7 @@ void FunctionTopicTests::slotRequestedData(const DdsUnitTests::FunctionTopicTest
|
||||
Q_UNUSED(seqNo);
|
||||
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
|
||||
|
||||
INFO_LOG() << "Got reply from FTS: " << reply.replyState();
|
||||
INFO_LOG(m_logger) << "Got reply from FTS: " << reply.replyState();
|
||||
|
||||
m_replyTopicWithState = reply;
|
||||
|
||||
|
||||
@@ -48,9 +48,11 @@ protected Q_SLOTS:
|
||||
const DdsUnitTests::FunctionRequestWithState &request);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void requestWithState();
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::unique_ptr<FTS::FunctionTopicTest> m_fts;
|
||||
std::unique_ptr<FTS::FunctionTopicTestWithState> m_ftsWS;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ GenericDataTests::GenericDataTests()
|
||||
|
||||
void GenericDataTests::initTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"GenericDataTests: initTestCase";
|
||||
DEBUG_LOG(m_logger) <<"GenericDataTests: initTestCase";
|
||||
|
||||
m_init = new Initialisation();
|
||||
|
||||
@@ -81,7 +81,7 @@ void GenericDataTests::initDWTestCase()
|
||||
|
||||
void GenericDataTests::dataWriterTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"GenericDataTests: dataWriter";
|
||||
DEBUG_LOG(m_logger) <<"GenericDataTests: dataWriter";
|
||||
|
||||
|
||||
DdsUnitTests::SpatialData data;
|
||||
@@ -125,7 +125,7 @@ void GenericDataTests::dataWriterTestCase()
|
||||
|
||||
void GenericDataTests::dataReaderTestCase()
|
||||
{
|
||||
DEBUG_LOG() << "GenericDataTests: dataReader";
|
||||
DEBUG_LOG(m_logger) << "GenericDataTests: dataReader";
|
||||
|
||||
|
||||
QTRY_COMPARE(m_spatialData.equipNo(), 999);
|
||||
@@ -136,7 +136,7 @@ void GenericDataTests::dataReaderTestCase()
|
||||
|
||||
bool bSeenUnreadSamples = false;
|
||||
dds::sub::LoanedSamples<DdsUnitTests::TestParticipant> vecTp = m_dataReader->readAlive(bSeenUnreadSamples);
|
||||
INFO_LOG() <<"vecTp size: " << vecTp.length();
|
||||
INFO_LOG(m_logger) <<"vecTp size: " << vecTp.length();
|
||||
QCOMPARE(vecTp.length(), static_cast<decltype(vecTp.length())>(5));
|
||||
QCOMPARE(vecTp[0].data().id(), 10000);
|
||||
QCOMPARE(vecTp[1].data().id(), 11000);
|
||||
@@ -145,7 +145,7 @@ void GenericDataTests::dataReaderTestCase()
|
||||
QCOMPARE(vecTp[4].data().id(), 11111);
|
||||
|
||||
dds::sub::LoanedSamples<DdsUnitTests::TestParticipant> vecTpLoaned = m_dataReader->takeAlive(bSeenUnreadSamples);
|
||||
INFO_LOG() <<"vecTpLoaned size: " << vecTp.length();
|
||||
INFO_LOG(m_logger) <<"vecTpLoaned size: " << vecTp.length();
|
||||
QCOMPARE(vecTpLoaned.length(), static_cast<decltype(vecTpLoaned.length())>(5));
|
||||
QCOMPARE(vecTpLoaned[0].data().id(), 10000);
|
||||
QCOMPARE(vecTpLoaned[1].data().id(), 11000);
|
||||
@@ -177,7 +177,7 @@ void GenericDataTests::deleteDataReaderTestCase()
|
||||
|
||||
void GenericDataTests::cleanupTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"GenericDataTests: cleanupTestCase";
|
||||
DEBUG_LOG(m_logger) <<"GenericDataTests: cleanupTestCase";
|
||||
if (m_dataReader)
|
||||
{
|
||||
m_init->getSubscriberListener()->removeCallback(m_dataReader->getDataReader(), this);
|
||||
@@ -198,21 +198,21 @@ void GenericDataTests::cleanupTestCase()
|
||||
|
||||
void GenericDataTests::processData(const DdsUnitTests::SpatialData &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG() << "SpatialData: equipNo = " << data.equipNo() << " modType: " << modType;
|
||||
DEBUG_LOG(m_logger) << "SpatialData: equipNo = " << data.equipNo() << " modType: " << modType;
|
||||
m_spatialData = data;
|
||||
}
|
||||
|
||||
void GenericDataTests::processData(const DdsUnitTests::TestParticipant &data, const dds::sub::SampleInfo &si)
|
||||
{
|
||||
Q_UNUSED(si);
|
||||
DEBUG_LOG() << "TestParticipant: equipNo = " << data.location().equipNo();
|
||||
DEBUG_LOG(m_logger) << "TestParticipant: equipNo = " << data.location().equipNo();
|
||||
m_testPart = data;
|
||||
}
|
||||
|
||||
void GenericDataTests::droDataAvailable(const std::string &topicType, const std::string &topicName)
|
||||
{
|
||||
Q_UNUSED(topicName)
|
||||
DEBUG_LOG() << "IN droDataAvailable: type = " << topicType;
|
||||
DEBUG_LOG(m_logger) << "IN droDataAvailable: type = " << topicType;
|
||||
if (topicType == "DdsUnitTests::TestParticipant")
|
||||
{
|
||||
m_init->getSubscriberListener()->enableCallback(m_dataReader->getDataReader(), this);
|
||||
|
||||
@@ -34,6 +34,7 @@ private Q_SLOTS:
|
||||
void cleanupTestCase();
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void droDataAvailable(const std::string &topicType, const std::string &topicName) override;
|
||||
void noWriterAnymore(const std::string &topicType, const std::string &topicName) override
|
||||
{
|
||||
|
||||
@@ -8,18 +8,17 @@
|
||||
#include <Lts/Common/ProjectConfig/project_defines.h>
|
||||
|
||||
|
||||
Initialisation::Initialisation()
|
||||
: m_domainParticipant(nullptr)
|
||||
Initialisation::Initialisation() : m_domainParticipant(nullptr)
|
||||
, m_domainParticipantSub(nullptr)
|
||||
, m_domainId(0)
|
||||
, m_exerciseId(-1)
|
||||
, m_ddsPublisher(nullptr)
|
||||
, m_ddsSubscriber(nullptr)
|
||||
, m_subListener(new DDSGeneric::SubscriberListener)
|
||||
.getNGLLogger("UnitTests.Initialisation"))
|
||||
{
|
||||
.getNGLLogger("UnitTests.Initialisation")),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
if (!DDS::QosProfile::setDefault())
|
||||
ERROR_LOG() << "Error setting default QoS from xml-file ";
|
||||
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +51,7 @@ bool Initialisation::initDDS(int domainId, int exerciseId, PubSub pubsub)
|
||||
{
|
||||
dds::pub::qos::PublisherQos publisherQos = m_domainParticipant.default_publisher_qos();
|
||||
|
||||
DEBUG_LOG() << "Publish on partition " << IDL::exercisePartition(exerciseId);
|
||||
DEBUG_LOG(m_logger) << "Publish on partition " << IDL::exercisePartition(exerciseId);
|
||||
|
||||
|
||||
dds::core::policy::Partition partitionQos;
|
||||
@@ -74,7 +73,7 @@ bool Initialisation::initDDS(int domainId, int exerciseId, PubSub pubsub)
|
||||
|
||||
dds::sub::qos::SubscriberQos subscriberQos = domainPart.default_subscriber_qos();
|
||||
|
||||
DEBUG_LOG() << "Subsribing on partition " << IDL::exercisePartition(exerciseId);
|
||||
DEBUG_LOG(m_logger) << "Subsribing on partition " << IDL::exercisePartition(exerciseId);
|
||||
|
||||
|
||||
dds::core::policy::Partition partitionQos;
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
DDSGeneric::SubscriberListener *getSubscriberListener() { return m_subListener; }
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
dds::domain::DomainParticipant m_domainParticipant;
|
||||
dds::domain::DomainParticipant m_domainParticipantSub;
|
||||
int m_domainId;
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
DDS::QosProfile::print(m_requesterParams.datareader_qos(), m_logger);
|
||||
DDS::QosProfile::print(m_requesterParams.datawriter_qos(), m_logger);
|
||||
|
||||
DEBUG_LOG() << "=> Static request using request/reply topic names: "
|
||||
DEBUG_LOG(m_logger) << "=> Static request using request/reply topic names: "
|
||||
<< TopicNameHelper::requestTopicName()
|
||||
<< ", reply: "
|
||||
<< TopicNameHelper::replyTopicName();
|
||||
@@ -395,13 +395,13 @@ private:
|
||||
bool inProgress = true;
|
||||
while (inProgress && isRun())
|
||||
{
|
||||
DEBUG_LOG() << "Waiting for reply ";
|
||||
DEBUG_LOG(m_logger) << "Waiting for reply ";
|
||||
|
||||
connext::Sample<ReplyTopic> reply;
|
||||
|
||||
if (!requester.receive_reply(reply, MAX_WAIT))
|
||||
{
|
||||
WARNING_LOG() << "Timed out waiting for reply";
|
||||
WARNING_LOG(m_logger) << "Timed out waiting for reply";
|
||||
sendError(request, 3);
|
||||
return;
|
||||
}
|
||||
@@ -412,14 +412,14 @@ private:
|
||||
if (request.sample.info().identity() != reply.info()->related_original_publication_virtual_sample_identity())
|
||||
{
|
||||
|
||||
INFO_LOG() << "#receiveReply - outdated. sample id: " << connext::DebugInfo::toReadable(request.sample.info().identity())
|
||||
INFO_LOG(m_logger) << "#receiveReply - outdated. sample id: " << connext::DebugInfo::toReadable(request.sample.info().identity())
|
||||
<< ", virutal sample id: " << connext::DebugInfo::toReadable(reply.info()->related_original_publication_virtual_sample_identity());
|
||||
continue;
|
||||
}
|
||||
inProgress = isInProgress(reply);
|
||||
if (request.replySlot.isValid())
|
||||
{
|
||||
INFO_LOG() << "#receiveReply for " << TopicNameHelper::replyTopicTypeName();
|
||||
INFO_LOG(m_logger) << "#receiveReply for " << TopicNameHelper::replyTopicTypeName();
|
||||
|
||||
request.replySlot.invoke(m_objToInform, Qt::QueuedConnection,
|
||||
QArgument<ReplyTopic>(TopicNameHelper::replyTopicTypeName(), reply.data()),
|
||||
@@ -428,13 +428,13 @@ private:
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING_LOG() << "reply slot doesn't exist for " << dds::topic::topic_type_name<ReplyTopic>::value();
|
||||
WARNING_LOG(m_logger) << "reply slot doesn't exist for " << dds::topic::topic_type_name<ReplyTopic>::value();
|
||||
}
|
||||
if (!inProgress)
|
||||
return;
|
||||
}
|
||||
else
|
||||
WARNING_LOG() << "No valid data available ";
|
||||
WARNING_LOG(m_logger) << "No valid data available ";
|
||||
|
||||
|
||||
|
||||
@@ -457,7 +457,7 @@ private:
|
||||
|
||||
if (!requester.receive_reply(reply, MAX_WAIT))
|
||||
{
|
||||
WARNING_LOG() << "Timeout while waiting for reply!";
|
||||
WARNING_LOG(m_logger) << "Timeout while waiting for reply!";
|
||||
throw std::runtime_error("Timeout while waiting for reply!");
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ private:
|
||||
|
||||
if (!reply.info().valid())
|
||||
{
|
||||
WARNING_LOG() << "No valid data available!";
|
||||
WARNING_LOG(m_logger) << "No valid data available!";
|
||||
|
||||
throw std::runtime_error("No valid data available!");
|
||||
}
|
||||
@@ -473,7 +473,7 @@ private:
|
||||
if (request.sample.info().identity() != reply.info()->related_original_publication_virtual_sample_identity())
|
||||
{
|
||||
|
||||
INFO_LOG() << "#receiveReply - outdated. sample id: " << connext::DebugInfo::toReadable(request.sample.info().identity())
|
||||
INFO_LOG(m_logger) << "#receiveReply - outdated. sample id: " << connext::DebugInfo::toReadable(request.sample.info().identity())
|
||||
<< ", virutal sample id: " << connext::DebugInfo::toReadable(reply.info()->related_original_publication_virtual_sample_identity());
|
||||
continue;
|
||||
}
|
||||
@@ -481,10 +481,10 @@ private:
|
||||
Q_ASSERT(!isInProgress(reply));
|
||||
if (isInProgress(reply))
|
||||
{
|
||||
ERROR_LOG() << "Used ModernRequest for a request with FtReplyState! Your data will most likely be imcomplete!";
|
||||
ERROR_LOG(m_logger) << "Used ModernRequest for a request with FtReplyState! Your data will most likely be imcomplete!";
|
||||
}
|
||||
|
||||
INFO_LOG() << "#receiveReply for " << TopicNameHelper::replyTopicTypeName();
|
||||
INFO_LOG(m_logger) << "#receiveReply for " << TopicNameHelper::replyTopicTypeName();
|
||||
|
||||
request.promise.set_value(reply.data());
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ public:
|
||||
|
||||
m_contentFilteredTopic->filter(dds::topic::Filter(filterContent.data()));
|
||||
}
|
||||
DEBUG_LOG() << "content filter for topic "
|
||||
DEBUG_LOG(m_logger) << "content filter for topic "
|
||||
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
|
||||
<< " - related_sample_identity should be: "
|
||||
<< writerGuid;
|
||||
@@ -349,7 +349,7 @@ public:
|
||||
m_dataWriter->write(request.data(), request.info());
|
||||
|
||||
const rti::core::SampleIdentity currentSampleIdentity = request.info().identity();
|
||||
DEBUG_LOG() << "send_request for topic "
|
||||
DEBUG_LOG(m_logger) << "send_request for topic "
|
||||
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
|
||||
<< ", m_currentSampleIdentity: "
|
||||
<< DebugInfo::toReadable(currentSampleIdentity);
|
||||
@@ -369,12 +369,12 @@ public:
|
||||
|
||||
if (m_dataReader->take(reply.data(), reply.info()) && reply.info().valid())
|
||||
{
|
||||
DEBUG_LOG() << "receive_reply for topic "
|
||||
DEBUG_LOG(m_logger) << "receive_reply for topic "
|
||||
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
|
||||
<< ", SampleIdentity - original publication virtual: "
|
||||
<< DebugInfo::toReadable(reply.info()->original_publication_virtual_sample_identity());
|
||||
|
||||
DEBUG_LOG() << "receive_reply for topic "
|
||||
DEBUG_LOG(m_logger) << "receive_reply for topic "
|
||||
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
|
||||
<< ", SampleIdentity - related original: "
|
||||
<< DebugInfo::toReadable(reply.info()->related_original_publication_virtual_sample_identity());
|
||||
@@ -387,7 +387,7 @@ public:
|
||||
dds::core::cond::WaitSet::ConditionSeq activeConditionsSeq = waitset.wait(duration);
|
||||
if (activeConditionsSeq.empty())
|
||||
{
|
||||
ERROR_LOG() << "Bailing out!";
|
||||
ERROR_LOG(m_logger) << "Bailing out!";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -398,7 +398,7 @@ public:
|
||||
if (!m_curInstanceHandle.is_nil())
|
||||
{
|
||||
|
||||
DEBUG_LOG() << "Keyed topic - disposing instance: "
|
||||
DEBUG_LOG(m_logger) << "Keyed topic - disposing instance: "
|
||||
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name();
|
||||
m_dataWriter.dispose_instance(m_curInstanceHandle);
|
||||
}
|
||||
@@ -448,7 +448,7 @@ public:
|
||||
const rti::core::SampleIdentity &identity,
|
||||
bool bLastSample = true)
|
||||
{
|
||||
DEBUG_LOG() << "send_reply for topic "
|
||||
DEBUG_LOG(m_logger) << "send_reply for topic "
|
||||
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
|
||||
<< ", sampleIdentity: " << DebugInfo::toReadable(identity);
|
||||
|
||||
@@ -459,7 +459,7 @@ public:
|
||||
sf |= rti::core::SampleFlag::intermediate_reply_sequence();
|
||||
reply.info().flag(sf);
|
||||
reply.info().related_sample_identity(identity);
|
||||
DEBUG_LOG() << "send_reply for topic "
|
||||
DEBUG_LOG(m_logger) << "send_reply for topic "
|
||||
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
|
||||
<< ", related sampleIdentity: " << DebugInfo::toReadable(reply.info().related_sample_identity());
|
||||
|
||||
@@ -473,7 +473,7 @@ public:
|
||||
|
||||
if (request.info().valid())
|
||||
{
|
||||
DEBUG_LOG() << "receive_request for topic "
|
||||
DEBUG_LOG(m_logger) << "receive_request for topic "
|
||||
<< ReplyRequestBase<REQUEST, REPLY>::m_requestTopic.name()
|
||||
<< ", sampleIdentity publication_virtual_sample_identity: "
|
||||
<< DebugInfo::toReadable(request.info()->publication_virtual_sample_identity())
|
||||
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
{
|
||||
if (m_subscriberCallback)
|
||||
{
|
||||
WARNING_LOG() << "Can not set subscriber callback - already set ...";
|
||||
WARNING_LOG(m_logger) << "Can not set subscriber callback - already set ...";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
|
||||
bool sendReply(const rti::core::SampleIdentity &requestIdentity, const QVector<ReplyTopic> &replyData) override final
|
||||
{
|
||||
DEBUG_LOG() << TopicNameHelper::requestTopicName() << " - IN sendReply";
|
||||
DEBUG_LOG(m_logger) << TopicNameHelper::requestTopicName() << " - IN sendReply";
|
||||
|
||||
for(int i = 0; i < replyData.size(); ++i)
|
||||
{
|
||||
@@ -184,7 +184,7 @@ protected:
|
||||
|
||||
void processRequest(const connext::Sample<RequestTopic> &request)
|
||||
{
|
||||
DEBUG_LOG() << TopicNameHelper::requestTopicName() << " - processRequest: "
|
||||
DEBUG_LOG(m_logger) << TopicNameHelper::requestTopicName() << " - processRequest: "
|
||||
<< connext::DebugInfo::toReadable(request.identity());
|
||||
|
||||
qint64 age = qAbs(qint64(request.info().source_timestamp().to_secs()) - time(nullptr));
|
||||
@@ -203,7 +203,7 @@ protected:
|
||||
s.append("...");
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "received a request for topic "
|
||||
DEBUG_LOG(m_logger) << "received a request for topic "
|
||||
<< TopicNameHelper::requestTopicName()
|
||||
<< " but it was outdated - ignoring. "
|
||||
<< " local time: " << (time(nullptr) - 10) << "[s], source timestamp: "
|
||||
@@ -226,7 +226,7 @@ protected:
|
||||
|
||||
void processRequests() override
|
||||
{
|
||||
DEBUG_LOG() << TopicNameHelper::requestTopicName() << " - processRequests";
|
||||
DEBUG_LOG(m_logger) << TopicNameHelper::requestTopicName() << " - processRequests";
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -235,21 +235,21 @@ protected:
|
||||
std::lock_guard<std::mutex> l(m_requestMutex);
|
||||
if (m_requests.empty())
|
||||
{
|
||||
DEBUG_LOG() << "No more requests";
|
||||
DEBUG_LOG(m_logger) << "No more requests";
|
||||
return;
|
||||
}
|
||||
DEBUG_LOG() << TopicNameHelper::requestTopicName() << " - read one request for ";
|
||||
DEBUG_LOG(m_logger) << TopicNameHelper::requestTopicName() << " - read one request for ";
|
||||
request = m_requests.front();
|
||||
m_requests.pop();
|
||||
}
|
||||
if (!request.info().valid())
|
||||
{
|
||||
WARNING_LOG() << TopicNameHelper::requestTopicName() << " - No valid data";
|
||||
WARNING_LOG(m_logger) << TopicNameHelper::requestTopicName() << " - No valid data";
|
||||
continue;
|
||||
}
|
||||
processRequest(request);
|
||||
}
|
||||
DEBUG_LOG() << TopicNameHelper::requestTopicName() << " - processRequests finished";
|
||||
DEBUG_LOG(m_logger) << TopicNameHelper::requestTopicName() << " - processRequests finished";
|
||||
}
|
||||
|
||||
bool enqueueRequests() override
|
||||
|
||||
@@ -53,19 +53,19 @@ public:
|
||||
const std::string &specialTopicName,
|
||||
const StructType &structType)
|
||||
{
|
||||
DEBUG_LOG() << "IN DynamicDataReader::create ("
|
||||
DEBUG_LOG(m_logger) << "IN DynamicDataReader::create ("
|
||||
<< m_structType->name()
|
||||
<< ")";
|
||||
|
||||
if (domainParticipant == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "DomainParticipant does not exist ";
|
||||
ERROR_LOG(m_logger) << "DomainParticipant does not exist ";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_ddsTopic != nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Type '"
|
||||
ERROR_LOG(m_logger) << "Type '"
|
||||
<< m_structType->name()
|
||||
<< "' already created";
|
||||
return false;
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
DDS::Helper::getShortTopicName(m_structType->name()) :
|
||||
specialTopicName;
|
||||
|
||||
DEBUG_LOG() << "Creating topic " << topicName << " with type: "
|
||||
DEBUG_LOG(m_logger) << "Creating topic " << topicName << " with type: "
|
||||
<< m_structType->name();
|
||||
|
||||
m_ddsTopic = dds::topic::find<dds::topic::Topic<DynamicData>>(domainParticipant, topicName);
|
||||
@@ -97,16 +97,16 @@ public:
|
||||
m_ddsTopic = dds::topic::Topic<DynamicData>(domainParticipant, topicName, structType);
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "m_ddsTopic created: " << m_ddsTopic.name();
|
||||
DEBUG_LOG(m_logger) << "m_ddsTopic created: " << m_ddsTopic.name();
|
||||
|
||||
if (m_logger.isDebugEnabled())
|
||||
{
|
||||
dds::sub::qos::SubscriberQos subscriberQoS = ddsSubscriber.qos();
|
||||
dds::core::policy::Partition partition = subscriberQoS.policy<dds::core::policy::Partition>();
|
||||
dds::core::StringSeq parititionNames = partition.name();
|
||||
DEBUG_LOG() << "Subscribing partitions: " << parititionNames.size();
|
||||
DEBUG_LOG(m_logger) << "Subscribing partitions: " << parititionNames.size();
|
||||
for (const std::string &name : parititionNames)
|
||||
DEBUG_LOG() << "SubscriberQoS: partition name = " << name;
|
||||
DEBUG_LOG(m_logger) << "SubscriberQoS: partition name = " << name;
|
||||
}
|
||||
|
||||
dds::sub::qos::DataReaderQos dataReaderQos = ddsSubscriber.default_datareader_qos();
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
|
||||
if (m_dataReader == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Creating dataReader for '" << topicName << "' with type: '"
|
||||
ERROR_LOG(m_logger) << "Creating dataReader for '" << topicName << "' with type: '"
|
||||
<< m_structType->name()
|
||||
<< "' failed";
|
||||
return false;
|
||||
@@ -138,11 +138,11 @@ public:
|
||||
}
|
||||
catch (const dds::core::Exception &ex)
|
||||
{
|
||||
ERROR_LOG() << ex.what();
|
||||
ERROR_LOG(m_logger) << ex.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "dataReader created ("
|
||||
DEBUG_LOG(m_logger) << "dataReader created ("
|
||||
<< m_structType->name()
|
||||
<< ")";
|
||||
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
bool hasSamples() const
|
||||
{
|
||||
qint64 sampleSize = m_dataReader->datareader_cache_status().sample_count();
|
||||
DEBUG_LOG() << "sampleSize = " << sampleSize;
|
||||
DEBUG_LOG(m_logger) << "sampleSize = " << sampleSize;
|
||||
return sampleSize > 0;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
{
|
||||
dds::sub::LoanedSamples<DynamicData> samples =
|
||||
m_dataReader.select().state(dds::sub::status::InstanceState::alive()).read();
|
||||
TRACE_LOG() << "readAlive for " << DDS::topic_type_name<TopicType>::value()
|
||||
TRACE_LOG(m_logger) << "readAlive for " << DDS::topic_type_name<TopicType>::value()
|
||||
<< ", count: " << samples.length()
|
||||
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
|
||||
|
||||
@@ -175,7 +175,7 @@ public:
|
||||
{
|
||||
dds::sub::LoanedSamples<DynamicData> samples =
|
||||
m_dataReader.select().state(dds::sub::status::InstanceState::alive()).take();
|
||||
TRACE_LOG() << "takeAlive for " << DDS::topic_type_name<TopicType>::value()
|
||||
TRACE_LOG(m_logger) << "takeAlive for " << DDS::topic_type_name<TopicType>::value()
|
||||
<< ", count: " << samples.length()
|
||||
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
|
||||
|
||||
@@ -187,7 +187,7 @@ public:
|
||||
{
|
||||
dds::sub::LoanedSamples<DynamicData> samples =
|
||||
m_dataReader.select().state(dds::sub::status::InstanceState::not_alive_disposed()).take();
|
||||
TRACE_LOG() << "takeDisposed for " << DDS::topic_type_name<TopicType>::value()
|
||||
TRACE_LOG(m_logger) << "takeDisposed for " << DDS::topic_type_name<TopicType>::value()
|
||||
<< ", count: " << samples.length()
|
||||
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
|
||||
return samples;
|
||||
@@ -196,18 +196,18 @@ public:
|
||||
template<typename C>
|
||||
bool read(C callbackFunc)
|
||||
{
|
||||
DEBUG_LOG() << "IN read ("
|
||||
DEBUG_LOG(m_logger) << "IN read ("
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< "), this: " << this << ", instance handle " << m_dataReader.instance_handle();
|
||||
|
||||
if (m_dataReader == nullptr || m_ddsTopic == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "No dataReader initialised ";
|
||||
ERROR_LOG(m_logger) << "No dataReader initialised ";
|
||||
return false;
|
||||
}
|
||||
if (!isValid(callbackFunc))
|
||||
{
|
||||
ERROR_LOG() << "No subscriber set for "
|
||||
ERROR_LOG(m_logger) << "No subscriber set for "
|
||||
<< DDS::topic_type_name<TopicType>::value();
|
||||
return false;
|
||||
}
|
||||
@@ -216,7 +216,7 @@ public:
|
||||
|
||||
dds::sub::LoanedSamples<DynamicData> samples = m_dataReader.select().state(dds::sub::status::DataState::new_data()).read();
|
||||
|
||||
DEBUG_LOG() << "got " << samples.length() + m_newSamplesDuringRead.size() << " samples from reader for "
|
||||
DEBUG_LOG(m_logger) << "got " << samples.length() + m_newSamplesDuringRead.size() << " samples from reader for "
|
||||
<< DDS::topic_type_name<TopicType>::value();
|
||||
|
||||
for (const auto &sample : samples)
|
||||
@@ -297,7 +297,7 @@ private:
|
||||
if (samples.length() == 0)
|
||||
return false;
|
||||
|
||||
DEBUG_LOG() << "got " << samples.length() << " disposed instances from reader for "
|
||||
DEBUG_LOG(m_logger) << "got " << samples.length() << " disposed instances from reader for "
|
||||
<< m_ddsTopic.name();
|
||||
|
||||
for (const auto &sample : samples)
|
||||
|
||||
@@ -47,19 +47,19 @@ public:
|
||||
const std::string &topicName = DDS::Helper::getShortTopicName(DDS::topic_type_name<TopicType>::value()),
|
||||
bool bCreateDataReader = true)
|
||||
{
|
||||
DEBUG_LOG() << "IN GenericDataReader::create ("
|
||||
DEBUG_LOG(m_logger) << "IN GenericDataReader::create ("
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< "), this: " << this;
|
||||
|
||||
if (domainParticipant == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "DomainParticipant does not exist ";
|
||||
ERROR_LOG(m_logger) << "DomainParticipant does not exist ";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_ddsTopic != nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Type '"
|
||||
ERROR_LOG(m_logger) << "Type '"
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< "' already created";
|
||||
return false;
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
|
||||
try
|
||||
{
|
||||
DEBUG_LOG() << "Creating read topic " << topicName << " with type: "
|
||||
DEBUG_LOG(m_logger) << "Creating read topic " << topicName << " with type: "
|
||||
<< DDS::topic_type_name<TopicType>::value();
|
||||
|
||||
m_ddsTopic = dds::topic::find<DataTopic>(domainParticipant, topicName);
|
||||
@@ -79,9 +79,9 @@ public:
|
||||
dds::sub::qos::SubscriberQos subscriberQoS = ddsSubscriber.qos();
|
||||
dds::core::policy::Partition partition = subscriberQoS.policy<dds::core::policy::Partition>();
|
||||
dds::core::StringSeq parititionNames = partition.name();
|
||||
DEBUG_LOG() << "Subscribing partitions: " << parititionNames.size();
|
||||
DEBUG_LOG(m_logger) << "Subscribing partitions: " << parititionNames.size();
|
||||
for (const std::string &name : parititionNames)
|
||||
DEBUG_LOG() << " partition name = " << name;
|
||||
DEBUG_LOG(m_logger) << " partition name = " << name;
|
||||
}
|
||||
|
||||
if (bCreateDataReader)
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
m_dataReader = DataReader(ddsSubscriber, m_ddsTopic, drQos);
|
||||
if (m_dataReader == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Creating dataReader for '" << topicName << "' with type: '"
|
||||
ERROR_LOG(m_logger) << "Creating dataReader for '" << topicName << "' with type: '"
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< "' failed";
|
||||
return false;
|
||||
@@ -99,11 +99,11 @@ public:
|
||||
}
|
||||
catch (const dds::core::Exception &ex)
|
||||
{
|
||||
ERROR_LOG() << ex.what();
|
||||
ERROR_LOG(m_logger) << ex.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "dataReader created ("
|
||||
DEBUG_LOG(m_logger) << "dataReader created ("
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< ")";
|
||||
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
bool hasSamples() const
|
||||
{
|
||||
qint64 sampleSize = m_dataReader->datareader_cache_status().sample_count();
|
||||
DEBUG_LOG() << "sampleSize = " << sampleSize;
|
||||
DEBUG_LOG(m_logger) << "sampleSize = " << sampleSize;
|
||||
return sampleSize > 0;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
{
|
||||
dds::sub::LoanedSamples<TopicTypeRead> samples =
|
||||
m_dataReader.select().state(dds::sub::status::InstanceState::alive()).read();
|
||||
TRACE_LOG() << "readAlive for " << DDS::topic_type_name<TopicType>::value()
|
||||
TRACE_LOG(m_logger) << "readAlive for " << DDS::topic_type_name<TopicType>::value()
|
||||
<< ", count: " << samples.length()
|
||||
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
|
||||
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
{
|
||||
dds::sub::LoanedSamples<TopicTypeRead> samples =
|
||||
m_dataReader.select().state(dds::sub::status::InstanceState::alive()).take();
|
||||
TRACE_LOG() << "takeAlive for " << DDS::topic_type_name<TopicType>::value()
|
||||
TRACE_LOG(m_logger) << "takeAlive for " << DDS::topic_type_name<TopicType>::value()
|
||||
<< ", count: " << samples.length()
|
||||
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
|
||||
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
{
|
||||
dds::sub::LoanedSamples<TopicTypeRead> samples =
|
||||
m_dataReader.select().state(dds::sub::status::InstanceState::not_alive_disposed()).take();
|
||||
TRACE_LOG() << "takeDisposed for " << DDS::topic_type_name<TopicType>::value()
|
||||
TRACE_LOG(m_logger) << "takeDisposed for " << DDS::topic_type_name<TopicType>::value()
|
||||
<< ", count: " << samples.length()
|
||||
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
|
||||
return samples;
|
||||
@@ -159,18 +159,18 @@ public:
|
||||
template<typename C>
|
||||
bool read(C callbackFunc)
|
||||
{
|
||||
DEBUG_LOG() << "IN read ("
|
||||
DEBUG_LOG(m_logger) << "IN read ("
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< "), this: " << this << ", instance handle " << m_dataReader.instance_handle();
|
||||
|
||||
if (m_dataReader == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "No dataReader initialised ";
|
||||
ERROR_LOG(m_logger) << "No dataReader initialised ";
|
||||
return false;
|
||||
}
|
||||
if (!isValid(callbackFunc))
|
||||
{
|
||||
ERROR_LOG() << "No subscriber set for "
|
||||
ERROR_LOG(m_logger) << "No subscriber set for "
|
||||
<< DDS::topic_type_name<TopicType>::value();
|
||||
return false;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "got " << samples.size() + m_newSamplesDuringRead.size() << " samples from reader for "
|
||||
DEBUG_LOG(m_logger) << "got " << samples.size() + m_newSamplesDuringRead.size() << " samples from reader for "
|
||||
<< DDS::topic_type_name<TopicType>::value();
|
||||
|
||||
for (const SampleStruct &ss : samples)
|
||||
@@ -265,7 +265,7 @@ private:
|
||||
if (samples.length() == 0)
|
||||
return false;
|
||||
|
||||
DEBUG_LOG() << "got " << samples.length() << " disposed instances from reader for "
|
||||
DEBUG_LOG(m_logger) << "got " << samples.length() << " disposed instances from reader for "
|
||||
<< DDS::topic_type_name<TopicType>::value();
|
||||
|
||||
for (const auto &sample : samples)
|
||||
|
||||
@@ -32,19 +32,19 @@ public:
|
||||
const dds::pub::Publisher &ddsPublisher,
|
||||
const std::string &topicName = DDS::Helper::getShortTopicName(DDS::topic_type_name<TopicType>::value()))
|
||||
{
|
||||
DEBUG_LOG() << "IN GenericDataWriter::create ("
|
||||
DEBUG_LOG(m_logger) << "IN GenericDataWriter::create ("
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< ")";
|
||||
|
||||
if (participant == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Participant not available, aborting. ";
|
||||
ERROR_LOG(m_logger) << "Participant not available, aborting. ";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_ddsTopic != nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Type '"
|
||||
ERROR_LOG(m_logger) << "Type '"
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< "' already created";
|
||||
return false;
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
try {
|
||||
|
||||
DEBUG_LOG() << "Creating write topic " << topicName << " with type: "
|
||||
DEBUG_LOG(m_logger) << "Creating write topic " << topicName << " with type: "
|
||||
<< DDS::topic_type_name<TopicType>::value();
|
||||
|
||||
m_ddsTopic = dds::topic::find<DataTopic>(participant, topicName);
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
|
||||
if (m_dataWriter == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Initialisation of "
|
||||
ERROR_LOG(m_logger) << "Initialisation of "
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< " failed ";
|
||||
return false;
|
||||
@@ -74,11 +74,11 @@ public:
|
||||
}
|
||||
catch ( const dds::core::Exception &ex )
|
||||
{
|
||||
ERROR_LOG() << ex.what();
|
||||
ERROR_LOG(m_logger) << ex.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "dataWriter created ("
|
||||
DEBUG_LOG(m_logger) << "dataWriter created ("
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< ")";
|
||||
|
||||
@@ -88,12 +88,12 @@ public:
|
||||
bool write(const TopicType &data,
|
||||
const dds::core::optional<dds::sub::SampleInfo> &si = dds::core::optional<dds::sub::SampleInfo>())
|
||||
{
|
||||
DEBUG_LOG() << "IN write ("
|
||||
DEBUG_LOG(m_logger) << "IN write ("
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< ") ";
|
||||
|
||||
if (m_dataWriter == nullptr) {
|
||||
ERROR_LOG() << "No dataWriter initialised ";
|
||||
ERROR_LOG(m_logger) << "No dataWriter initialised ";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -112,18 +112,18 @@ public:
|
||||
|
||||
bool remove(const TopicType &data, bool errorMsgIfNotExists = true)
|
||||
{
|
||||
DEBUG_LOG() << "IN remove ("
|
||||
DEBUG_LOG(m_logger) << "IN remove ("
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< ") ";
|
||||
|
||||
if (m_dataWriter == nullptr) {
|
||||
ERROR_LOG() << "No dataWriter initialised ";
|
||||
ERROR_LOG(m_logger) << "No dataWriter initialised ";
|
||||
return false;
|
||||
}
|
||||
const dds::core::InstanceHandle ih = m_dataWriter.lookup_instance(data);
|
||||
if (ih.is_nil()) {
|
||||
if (errorMsgIfNotExists)
|
||||
ERROR_LOG() << "Could not find instance for topic "
|
||||
ERROR_LOG(m_logger) << "Could not find instance for topic "
|
||||
<< DDS::topic_type_name<TopicType>::value()
|
||||
<< " for unregistering!";
|
||||
return false;
|
||||
|
||||
@@ -13,7 +13,7 @@ SubscriberListener::SubscriberListener()
|
||||
, m_logger(DDS::getLogger("SubscriberListener", DDS::DataType::DATA_TOPIC_CLIENT))
|
||||
{
|
||||
qRegisterMetaType<std::string>("std::string");
|
||||
DEBUG_LOG() << "SubscriberListener initialized, this " << this;
|
||||
DEBUG_LOG(m_logger) << "SubscriberListener initialized, this " << this;
|
||||
}
|
||||
|
||||
void SubscriberListener::addCallback(const std::string &topicName,
|
||||
@@ -21,7 +21,7 @@ void SubscriberListener::addCallback(const std::string &topicName,
|
||||
const dds::sub::AnyDataReader &dataReader,
|
||||
SubscriberListenerCallback *cb)
|
||||
{
|
||||
DEBUG_LOG() << "addSubscriberCallback for " << topicName << ", type " << topicTypeName
|
||||
DEBUG_LOG(m_logger) << "addSubscriberCallback for " << topicName << ", type " << topicTypeName
|
||||
<< ", cb " << cb << ", this " << this;
|
||||
QWriteLocker l(&m_accessLock);
|
||||
if (m_bPrepareForShutdown)
|
||||
@@ -34,7 +34,7 @@ void SubscriberListener::removeCallback(const std::string &topicName,
|
||||
const dds::sub::AnyDataReader &dataReader,
|
||||
SubscriberListenerCallback *cb)
|
||||
{
|
||||
DEBUG_LOG() << "IN removeSubscriberCallback for " << topicName << ", type " << topicTypeName
|
||||
DEBUG_LOG(m_logger) << "IN removeSubscriberCallback for " << topicName << ", type " << topicTypeName
|
||||
<< ", cb " << cb << ", this " << this;
|
||||
QWriteLocker l(&m_accessLock);
|
||||
m_droCallbacks.remove(std::make_pair(topicName, topicTypeName), fillData(dataReader, cb));
|
||||
@@ -68,7 +68,7 @@ void SubscriberListener::enaDisaCallback(const std::string &topicName,
|
||||
}
|
||||
|
||||
if (!bFound)
|
||||
WARNING_LOG() << "Can not " << (bEnable ? "enable" : "disable")
|
||||
WARNING_LOG(m_logger) << "Can not " << (bEnable ? "enable" : "disable")
|
||||
<< " callback for " << topicName << ", type " << topicTypeName
|
||||
<< ", cb " << cb << ", this " << this << " - not found!";
|
||||
}
|
||||
@@ -91,7 +91,7 @@ void SubscriberListener::on_data_available(dds::sub::AnyDataReader &reader)
|
||||
QReadLocker l(&m_accessLock);
|
||||
if (m_droCallbacks.isEmpty() || m_bPrepareForShutdown)
|
||||
return;
|
||||
DEBUG_LOG() << "Data available for " << topicName << ", type " << topicTypeName << ", this " << this;
|
||||
DEBUG_LOG(m_logger) << "Data available for " << topicName << ", type " << topicTypeName << ", this " << this;
|
||||
QMultiMap<std::pair<std::string, std::string>, cbData>::iterator cbIt = m_droCallbacks.find(key);
|
||||
const QMultiMap<std::pair<std::string, std::string>, cbData>::iterator cbEnd = m_droCallbacks.end();
|
||||
for( ; cbIt != cbEnd && cbIt.key() == key; ++cbIt)
|
||||
@@ -122,7 +122,7 @@ void SubscriberListener::on_liveliness_changed(dds::sub::AnyDataReader &reader,
|
||||
const std::string &topicName = reader.topic_name();
|
||||
const std::string &topicTypeName = reader.type_name();
|
||||
|
||||
DEBUG_LOG() << "on_liveliness_changed: " << livelinessStatus.alive_count()
|
||||
DEBUG_LOG(m_logger) << "on_liveliness_changed: " << livelinessStatus.alive_count()
|
||||
<< ", " << livelinessStatus.not_alive_count()
|
||||
<< ", " << livelinessStatus.alive_count_change()
|
||||
<< ", " << livelinessStatus.not_alive_count_change()
|
||||
@@ -154,7 +154,7 @@ void SubscriberListener::on_liveliness_changed(dds::sub::AnyDataReader &reader,
|
||||
|
||||
if (bNoWritersAnymore)
|
||||
{
|
||||
DEBUG_LOG() << "bNoWritersAnymore for " << topicName << ", type " << topicTypeName;
|
||||
DEBUG_LOG(m_logger) << "bNoWritersAnymore for " << topicName << ", type " << topicTypeName;
|
||||
data.cb->noWriterAnymore(topicTypeName, topicName);
|
||||
}
|
||||
else if (bNewWriters)
|
||||
@@ -164,7 +164,7 @@ void SubscriberListener::on_liveliness_changed(dds::sub::AnyDataReader &reader,
|
||||
continue;
|
||||
if (data.methodToCall.isValid())
|
||||
{
|
||||
DEBUG_LOG() << "methodcall is valid for " << topicName << ", type " << topicTypeName;
|
||||
DEBUG_LOG(m_logger) << "methodcall is valid for " << topicName << ", type " << topicTypeName;
|
||||
data.methodToCall.invoke(data.cb, Qt::QueuedConnection,
|
||||
Q_ARG(std::string, topicTypeName),
|
||||
Q_ARG(std::string, topicName));
|
||||
|
||||
@@ -71,6 +71,7 @@ public:
|
||||
void prepareShutdown();
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void addCallback(const std::string &topicName,
|
||||
const std::string &topicTypeName,
|
||||
const dds::sub::AnyDataReader &dataReader,
|
||||
|
||||
@@ -24,7 +24,7 @@ WaitSetHandler::~WaitSetHandler()
|
||||
|
||||
bool WaitSetHandler::attachWaitSet(const dds::core::cond::Condition &cond, CallbackInterface *cb)
|
||||
{
|
||||
DEBUG_LOG() << "AttachWaitSet with callback " << cb;
|
||||
DEBUG_LOG(m_logger) << "AttachWaitSet with callback " << cb;
|
||||
|
||||
WaitSetData wsd(cond, cb);
|
||||
|
||||
@@ -33,7 +33,7 @@ bool WaitSetHandler::attachWaitSet(const dds::core::cond::Condition &cond, Callb
|
||||
auto it = m_waitSetData.find(wsd.condition->native_condition());
|
||||
if (it != m_waitSetData.end())
|
||||
{
|
||||
WARNING_LOG() << "Waitset " << cb << " already registered";
|
||||
WARNING_LOG(m_logger) << "Waitset " << cb << " already registered";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ bool WaitSetHandler::attachWaitSet(const dds::core::cond::Condition &cond, Callb
|
||||
|
||||
bool WaitSetHandler::detachWaitSet(const dds::core::cond::Condition &cond, CallbackInterface *cb)
|
||||
{
|
||||
DEBUG_LOG() << "DetachWaitSet with callback " << cb;
|
||||
DEBUG_LOG(m_logger) << "DetachWaitSet with callback " << cb;
|
||||
|
||||
WaitSetData wsd(cond, cb);
|
||||
|
||||
@@ -56,7 +56,7 @@ bool WaitSetHandler::detachWaitSet(const dds::core::cond::Condition &cond, Callb
|
||||
auto it = m_waitSetData.find(wsd.condition->native_condition());
|
||||
if (it == m_waitSetData.end())
|
||||
{
|
||||
WARNING_LOG() << "Waitset for " << cb << " not registered";
|
||||
WARNING_LOG(m_logger) << "Waitset for " << cb << " not registered";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ bool WaitSetHandler::detachWaitSet(const dds::core::cond::Condition &cond, Callb
|
||||
|
||||
bool WaitSetHandler::enableWaitSet(const dds::core::cond::Condition &cond, CallbackInterface *cb)
|
||||
{
|
||||
DEBUG_LOG() << "EnableWaitSet with callback " << cb;
|
||||
DEBUG_LOG(m_logger) << "EnableWaitSet with callback " << cb;
|
||||
|
||||
WaitSetData wsd(cond, cb);
|
||||
|
||||
@@ -75,7 +75,7 @@ bool WaitSetHandler::enableWaitSet(const dds::core::cond::Condition &cond, Callb
|
||||
auto it = m_waitSetData.find(wsd.condition->native_condition());
|
||||
if (it == m_waitSetData.end())
|
||||
{
|
||||
ERROR_LOG() << "Could not find WaitSetData - cannot enable waitSet for " << cb;
|
||||
ERROR_LOG(m_logger) << "Could not find WaitSetData - cannot enable waitSet for " << cb;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ bool WaitSetHandler::enableWaitSet(const dds::core::cond::Condition &cond, Callb
|
||||
|
||||
bool WaitSetHandler::disableWaitSet(const dds::core::cond::Condition &cond, CallbackInterface *cb)
|
||||
{
|
||||
DEBUG_LOG() << "DisableWaitSet with callback " << cb;
|
||||
DEBUG_LOG(m_logger) << "DisableWaitSet with callback " << cb;
|
||||
|
||||
WaitSetData wsd(cond, cb);
|
||||
|
||||
@@ -96,7 +96,7 @@ bool WaitSetHandler::disableWaitSet(const dds::core::cond::Condition &cond, Call
|
||||
auto it = m_waitSetData.find(wsd.condition->native_condition());
|
||||
if (it == m_waitSetData.end())
|
||||
{
|
||||
ERROR_LOG() << "Could not find WaitSetData - cannot disable waitSet for " << cb;
|
||||
ERROR_LOG(m_logger) << "Could not find WaitSetData - cannot disable waitSet for " << cb;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ void WaitSetHandler::waitSetTask()
|
||||
WaitSetData &wsd = it->second;
|
||||
if (wsd.enabled)
|
||||
{
|
||||
DEBUG_LOG() << "Condition triggered for " << wsd.callback;
|
||||
DEBUG_LOG(m_logger) << "Condition triggered for " << wsd.callback;
|
||||
wsd.callback->dataAvailable();
|
||||
}
|
||||
++it;
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
int attachedConditionCount() const;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
struct WaitSetData final
|
||||
{
|
||||
dds::core::cond::Condition condition;
|
||||
@@ -52,9 +53,11 @@ private:
|
||||
{}
|
||||
};
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void waitSetTask();
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
dds::core::cond::WaitSet m_waitSet;
|
||||
dds::core::cond::GuardCondition m_abortCondition;
|
||||
std::future<void> m_task;
|
||||
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
|
||||
void writeSamples() override
|
||||
{
|
||||
TRACE_LOG() << "Writing samples for " << DDS::topic_type_name<TOPIC>::value()
|
||||
TRACE_LOG(m_logger) << "Writing samples for " << DDS::topic_type_name<TOPIC>::value()
|
||||
<< ", sample count: " << m_loanedSamples.length();
|
||||
rti::pub::WriteParams writeParams;
|
||||
for (const auto &sample : m_loanedSamples)
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
|
||||
|
||||
|
||||
TRACE_LOG() << "identity: " << DebugInfo::toReadable(writeParams.identity())
|
||||
TRACE_LOG(m_logger) << "identity: " << DebugInfo::toReadable(writeParams.identity())
|
||||
<< ", related_sample_identity: " << DebugInfo::toReadable(writeParams.related_sample_identity());
|
||||
|
||||
const auto &state = sample.info().state();
|
||||
@@ -159,20 +159,20 @@ public:
|
||||
}
|
||||
else if (instanceState == dds::sub::status::InstanceState::not_alive_disposed())
|
||||
{
|
||||
TRACE_LOG() << " - is disposed";
|
||||
TRACE_LOG(m_logger) << " - is disposed";
|
||||
m_dataWriter->dispose_instance(writeParams);
|
||||
}
|
||||
else if (instanceState == dds::sub::status::InstanceState::not_alive_no_writers())
|
||||
{
|
||||
TRACE_LOG() << " - is unregistered";
|
||||
TRACE_LOG(m_logger) << " - is unregistered";
|
||||
m_dataWriter->unregister_instance(writeParams);
|
||||
}
|
||||
else
|
||||
WARNING_LOG() << "Unknown instance state: " << instanceState;
|
||||
WARNING_LOG(m_logger) << "Unknown instance state: " << instanceState;
|
||||
}
|
||||
catch (const dds::core::Exception &ex)
|
||||
{
|
||||
ERROR_LOG() << "writeSamples exception: " << ex.what();
|
||||
ERROR_LOG(m_logger) << "writeSamples exception: " << ex.what();
|
||||
}
|
||||
}
|
||||
m_dataWriter->flush();
|
||||
@@ -207,7 +207,7 @@ public:
|
||||
{
|
||||
if (!m_dwt)
|
||||
return false;
|
||||
DEBUG_LOG() << "Creating DataWriter for domain " << dpOut.domain_id();
|
||||
DEBUG_LOG(m_logger) << "Creating DataWriter for domain " << dpOut.domain_id();
|
||||
m_dataWriter = dds::pub::DataWriter<T>(pubOut,
|
||||
getTopic<T>(dpOut, m_topicName),
|
||||
DDS::QosProfile::dataWriterDefault(m_topicType));
|
||||
@@ -222,7 +222,7 @@ public:
|
||||
{
|
||||
|
||||
|
||||
TRACE_LOG() << "Data available for " << DDS::topic_type_name<T>::value();
|
||||
TRACE_LOG(m_logger) << "Data available for " << DDS::topic_type_name<T>::value();
|
||||
auto ws = new SampleWriter<T>(reader.take(), m_dataWriter, m_topicType == DDS::QosProfile::TopicType::FunctionTopic, m_logger);
|
||||
m_dwt->enqueue(ws);
|
||||
}
|
||||
@@ -275,14 +275,14 @@ protected:
|
||||
const dds::domain::DomainParticipant &dpOut,
|
||||
const dds::pub::Publisher &pubOut) override
|
||||
{
|
||||
DEBUG_LOG() << "Initializing TopicDispatcher " << "(" << this << ")";
|
||||
DEBUG_LOG(m_logger) << "Initializing TopicDispatcher " << "(" << this << ")";
|
||||
if (m_dataReader != nullptr)
|
||||
return false;
|
||||
|
||||
m_dataReader = dds::sub::DataReader<TOPIC>(subIn,
|
||||
getTopic<TOPIC>(dpIn, m_topicName),
|
||||
DDS::QosProfile::dataReaderDefault(m_topicType));
|
||||
DEBUG_LOG() << "Creating DataReader for domain " << dpIn.domain_id() << ", ptr: " << m_dataReader.delegate().get();
|
||||
DEBUG_LOG(m_logger) << "Creating DataReader for domain " << dpIn.domain_id() << ", ptr: " << m_dataReader.delegate().get();
|
||||
|
||||
m_dtl.reset(new DataTopicListener<TOPIC>(dwt, m_topicName, m_topicType, m_logger));
|
||||
|
||||
@@ -294,10 +294,10 @@ protected:
|
||||
|
||||
void shutdown() override
|
||||
{
|
||||
DEBUG_LOG() << "Cleaning up TopicDispatcher " << "(" << this << ")";
|
||||
DEBUG_LOG(m_logger) << "Cleaning up TopicDispatcher " << "(" << this << ")";
|
||||
if (m_dataReader != nullptr)
|
||||
{
|
||||
DEBUG_LOG() << "shutting down DataReader: " << m_dataReader.delegate().get();
|
||||
DEBUG_LOG(m_logger) << "shutting down DataReader: " << m_dataReader.delegate().get();
|
||||
m_dataReader.listener(nullptr, dds::core::status::StatusMask::none());
|
||||
try
|
||||
{
|
||||
@@ -305,7 +305,7 @@ protected:
|
||||
}
|
||||
catch (const dds::core::Exception &ex)
|
||||
{
|
||||
ERROR_LOG() << "topic close ex: " << ex.what();
|
||||
ERROR_LOG(m_logger) << "topic close ex: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user