Jump to content
OpenSplice DDS Forum
Sign in to follow this  
Christopher Thompson

No BuiltinTopicData

Recommended Posts

I'm trying to listen to the BuiltinTopicData messages but cannot get any data.  The following code works with RTI, but I get nothing with Opensplice.  Any ideas?

// One of 4 builtin topic listeners (one for each Participant, Publication, Subscription, Topic)
class topicTopicListener_t : public dds::sub::NoOpDataReaderListener<dds::topic::TopicBuiltinTopicData>
{
public:
	topicTopicListener_t ();

	/// \brief Handle data available
	/// \param dr_ DataReader containing data
	void on_data_available (dds::sub::DataReader<dds::topic::TopicBuiltinTopicData> &dr_) override;
};

// Helper function to get the existing DataReader for the builtin topics and
// connect the listener to the on_data_available callback function
template <class T>
void connectBuiltinListener (dds::domain::DomainParticipant const &dp_,
			     string const &name_,
			     dds::sub::NoOpDataReaderListener<T> *listener_)
{
	dds::sub::Subscriber builtinSubscriber = dds::sub::builtin_subscriber (dp_);
	vector<DataReader<T>> readersVector;

	dds::sub::find<DataReader<T>,
		       back_insert_iterator<vector<DataReader<T>>>> (
			       builtinSubscriber,
			       name_,
			       back_inserter<vector<DataReader<T>>> (readersVector));

	DataReader<T> dr = readersVector[0];

	dr.listener (listener_, dds::core::status::StatusMask::data_available ());
}
  
// Function that creates the listeners and initiates the connection
void builtinTopicListener_t::run ()
{
	try
	{
		connectBuiltinListener<ParticipantBuiltinTopicData> (
			m_d->dp,"DCPSParticipant", new participantTopicListener_t (this));
		connectBuiltinListener<PublicationBuiltinTopicData> (
			m_d->dp, "DCPSPublication", new publicationTopicListener_t (this));
		connectBuiltinListener<SubscriptionBuiltinTopicData> (
			m_d->dp, "DCPSSubscription", new subscriptionTopicListener_t (this));
		connectBuiltinListener<TopicBuiltinTopicData> (
			m_d->dp, "DCPSTopic", new topicTopicListener_t (this));
	}
	catch (dds::core::Exception const &e_)
	{
		cerr << "ERROR: Exception: " << e_.what () << endl;
	}
}

 

I'm using the Community edition v6.7.  My firewall is disabled.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×