get_profile_participant_qos_from_profiles

2 posts / 0 new
Last post
Offline
Last seen: 6 years 5 days ago
Joined: 04/20/2018
Posts: 1
get_profile_participant_qos_from_profiles

Hello,

I am relatively new to DDS and hope I get some help here. I have read up many threads and help topics regarding QOS and many examples are for Linux, as I am working on a Windows machine.

I am using this function:

const char * library_name = "library";
const char * profile_name = "profile";
DDS_DomainParticipantQos participant_qos; 

DDSDomainParticipantFactory::get_instance()->get_participant_qos_from_profile(participant_qos, library, profile);       

and I will get this error of 

DDS_QosProvider_get_profile_xml_objectI:ERROR: Profile 'library:profile' not found
DDS_QosProvider_get_participant_qos_from_profile:ERROR: Profile "library:profile" not found 

I, then added the system enviroment variable:
Variable = "NDDS_QOS_PROFILES"
Value = "C:\Solution\others\dds_qoq.xml"

Thinking it was because it was unable to find the xml file, but after adding that, i am not able to execute the get_participant_qos_from_profile(), as it would lead to a crash on attemping to free the memory. I removed it and i was able to execute that function again.

Next, I saw this thread https://community.rti.com/forum-topic/participantqosdefault and decided to give it a go, where it lead to many other guides, but either I had syntax errors, or would crash.

I tried to place the directory manually by using the following

DDSDomainParticipantFactory * factory = DDSDomainParticipantFactory::get_instance();
DDS_DomainParticipantFactoryQos factoryQos;
DDS_ReturnCode_t ret_code = DDSDomainParticipantFactory::get_instance()->get_qos(factoryQos); //this line crashes
//Critical error detected c000374

const char * url_profiles[1] = { "..\\others\\dds_qos.xml" };  

factoryQos.profile.url_profile.from_array(url_profiles, 1);  
factoryQos.profile.ignore_resource_profile = DDS_BOOLEAN_TRUE;
factoryQos.profile.ignore_enviroment_profile = DDS_BOOLEAN_TRUE;

factory->set_qos(factoryQos); //this line crashes, seems like an error of attempting to do a fopen

 

I was out of options to try and the last attempt is:

factoryQos.profile.url_profile[0] - DDS_String_dup("..\\others\\dds_qos.xml");
//this line crashes
//DDS_StringSeq::operator[](...) returned nullptr.  

 

I am not sure what am i doing wrong, please point me to the correct direction.

With many thanks and regards,

Zac

irene's picture
Offline
Last seen: 2 years 4 months ago
Joined: 11/08/2017
Posts: 15

Hi Zac,

You are right about the cause of your first error: the application coud not find the profile and a possible cause could be that it was not able to find the XML file.

I recomend you do not hardcore the path to your XML in the code, this could lead tohaving to recompile the code if you need to change the location or the name of the file for some reason. 

It might be helpful if you start with the easiest way to set up your QoS XML file. Please, could you rename the file to NDDS_QOS_PROFILES.xml and move it to the working directory? If you run your application from the working directory, Connext DDS will attempt to load the QoS file named NDDS_QOS_PROFILES.xml located in this directory.

If you do that, you should configure your DomainParticipant as you did in your first attempt, by calling get_participant_qos_from_profile method.

If this fails, adding the complete error trace in a new comment in this post could be very helpful

I hope this helps,

 Irene