C# API 6.0 to 7.3 Subscriber.DATAREADER_QOS_USE_TOPIC_QOS?

3 posts / 0 new
Last post
Offline
Last seen: 2 days 12 hours ago
Joined: 12/08/2020
Posts: 4
C# API 6.0 to 7.3 Subscriber.DATAREADER_QOS_USE_TOPIC_QOS?

Hello.

I am migrating an application from DDS C# API 6.0 to 7.3. I have a call to....

         Subscriber.DATAREADER_QOS_USE_TOPIC_QOS

the return of which is passed to the subscriber.CreateDataReader function.

What is the replacement for Subscriber.DATAREADER_QOS_USE_TOPIC_QOS, in the DDS Connext C# 7.3 API?

I've looked around quiet a lot and can't find something equivalent. There is a QosProvider.GetReaderQosWithTopicName but I'm not sure that's exactly right.

Thanks, Jon

Howard's picture
Offline
Last seen: 2 days 4 hours ago
Joined: 11/29/2012
Posts: 658

There is equivalent functionality, but it takes more work.  You have to get access to the Topic's QOS and then use that to create the DataReader's QOS that is used to create the DataReader.

Use DataReaderQos.FromTopicQos(TopicQos topicQos) or the extension method ToDataReaderQos() on a TopicQos object.

https://community.rti.com/static/documentation/connext-dds/current/doc/api/connext_dds/api_csharp/classRti_1_1Dds_1_1Subscription_1_1DataReaderQos.html#a821ab3453cfd290b059ebceccae3948d

or

https://community.rti.com/static/documentation/connext-dds/current/doc/api/connext_dds/api_csharp/classRti_1_1Dds_1_1Topics_1_1TopicQos.html#a4775dc66011ac55c5c8b195eb43483c2

Example:

// Assume 'topic' is a Topic<T> object
var topicQos = topic.Qos;

// Create a DataReaderQos from the TopicQos
var readerQos = topicQos.ToDataReaderQos();

// Optionally, merge with the default DataReaderQos from the Subscriber
readerQos = subscriber.DefaultDataReaderQos.WithPoliciesFrom(readerQos);

// Create the DataReader with the combined QoS
var reader = subscriber.CreateDataReader(topic, readerQos);

 

By the way, I used the RTI Chatbot @ https://chatbot.rti.com to help compose my response.  You should try this for your questions in the future as it may provide responses faster than humans on the forum!

 

Offline
Last seen: 2 days 12 hours ago
Joined: 12/08/2020
Posts: 4

Hello

Yes, that is what I was looking for.

I didn't know abotu that chat bot. That will come in handy.

Thank you for replying, Jon