How to use 'USER_QOS_PROFILES.xml' in my DDS?

6 posts / 0 new
Last post
Offline
Last seen: 8 years 3 months ago
Joined: 11/25/2015
Posts: 14
How to use 'USER_QOS_PROFILES.xml' in my DDS?

Hi.

I hope to use 'USER_QOS_PROFILES.xml' in my TestType DDS Application, but it is hard to adjust in my DDS.

I've already read libraries and documents, but there was no clear answer what I really want to know.

Let me summarize my questions,

1. How can I adjust 'USER_QOS_PROFILES.xml' in my test application? (I want to change qos' through xml file)

2. What should be added in test application code? Please answer me clearly and detail.

 

Thank you.

Organization:
Offline
Last seen: 8 years 1 month ago
Joined: 01/09/2016
Posts: 8

From my small experience, the 'USER_QOS_PROFILES.xml' file should be in the directory from which you call the application, NOT from where the application actually is. Only then your application will load the xml file to override any default values. Hope this helps.

Offline
Last seen: 8 years 3 months ago
Joined: 11/25/2015
Posts: 14

Thanks for your comment.

I put xml file into real directory that contains application code.

What you mean that I should put this file in the release directory?

And, Should I change some codes to use USER_QOS_PROFILES?

I use only 'DDS_<entity>_DEFAULT_QOS'.

 

Thanks for your response.

Offline
Last seen: 8 years 1 month ago
Joined: 01/09/2016
Posts: 8

For me, I used the example code that is generated from the 'rtiddsgen' command.

You don't need to change your code in order to use the 'USER_QOS_PROFILES.xml' file. Just edit it, then run your application.

Remember: the USER_QOS_PROFILES.xml file must be in the directory of which you are executing the application (from command line). So if you are in directory X, and you are executing the application that is in path X\someDirectory\applicationDirectory, then the XML file should be in direcory X, NOT in 'applicationDirecytory'.

Hope it makes sense.

Offline
Last seen: 8 years 3 months ago
Joined: 11/25/2015
Posts: 14

Here is my clear question.

I made application with idl file (shapetype that is given from rti connext dds) and ran application with USER_QOS_PROFILES.xml 

I didn't move xml file after application had made. (It is in directory that original idl file was in before I made application with it)

Because I want to look some changes, I wrote some code in the ShapeType_Publisher.cxx

>> Here is an example.

/* To customize data writer QoS, use
the configuration file USER_QOS_PROFILES.xml */
writer = publisher->create_datawriter(
topic, DDS_DATAWRITER_QOS_DEFAULT, NULL /* listener */,
DDS_STATUS_MASK_NONE);
if (writer == NULL) {
printf("create_datawriter error\n");
publisher_shutdown(participant);
return -1;
}

if (DDS_DATAWRITER_QOS_DEFAULT.reliability.kind == DDS_RELIABLE_RELIABILITY_QOS)
{
printf("reliable\n");
}
else
{
printf("best effort\n");
}

 

Before I modified some codes in ShapeType_Publisher.cxx, I had made some changes in USER_QOS_PROFILES.xml like this.

<datawriter_qos>
<publication_name>
<name>ShapeTypeDataWriter</name>
</publication_name>
<reliability>
<kind>BEST_EFFORT_RELIABILITY_QOS</kind>
</reliability>
</datawriter_qos>

As you look, I added some xml codes under the datawriter_qos category.

Before I added this, there was only <publication_name> subcategory in the <datawriter_qos> category.

 

Then, I guess the console application would print "best-effort", but it printed on;y "reliable".

It never changed datawriter_qos.

 

This is my summarized quesitons.

1. If I changed USER_QOS_PROFILES.xml, Does it work in publication.cxx file?

2. I just put xml file in the code directory, not in debug or release directory, Was it right?

3. 

if (DDS_DATAWRITER_QOS_DEFAULT.reliability.kind == DDS_RELIABLE_RELIABILITY_QOS) {printf("reliable\n");} >> Is it right test code?

 

help me please.

gianpiero's picture
Offline
Last seen: 3 months 4 days ago
Joined: 06/02/2010
Posts: 177

Hello there,

I think the right things to do, would be to get the writer qos after you create it. And then to print it. Basically use the following test code instead of yours:

{
    DDS_DataWriterQos qos;
    writer->get_qos(qos);
    if (qos.reliability.kind == DDS_RELIABLE_RELIABILITY_QOS) {
        printf("Reliable\n");
    } else {
        printf("Best Effort\n");
    }
} 

 

Let me know if that works!

Best,
  Gianpiero