Changing the type code for a dynamic data reader/writer

2 posts / 0 new
Last post
Offline
Last seen: 1 year 5 months ago
Joined: 08/03/2017
Posts: 8
Changing the type code for a dynamic data reader/writer

I have a part of my program that continuously monitors the topics on DDS. I have it able to determine when a topic comes online with a different type code than what it previously had. What I'm trying to do to deal with this is:

// Delete the existing data reader:

participant.delete_datareader((DynamicDataReader) ddrw);

// Delete the topic:

participant.delete_topic(participant.find_topic(topic, new Duration_t(1000, 0)));

// Unregister the type:

typeSupports.get(topic).unregister_type(participant, topic);

And then go and register a new typeSupport with an updated TypeCode, Create an updated topic and then create a new DataReader.

Is this the correct process or is there a better way to do this? When I try this order of cleaning up an old topic/reader/etc, I get RETCODE_ERRORs (error creating entity). I'll let you know the creation code works fine for initial startup for the topics found at the startup of the program. Since this, I believe the issue is with the cleanup/removing an old layout topic, not the creation of the replacement. Perhaps this isn't the normal way to do it and there is a way to change a DataReader type code on the fly without killing off the reader/topic/typesupport?

Organization:
Offline
Last seen: 1 year 5 months ago
Joined: 08/03/2017
Posts: 8

As a side note, I have attempted to just unregister the type code and registering a new type code while leaving the topic and datareader active. This seemed to complete without error. Would this be a proper way of doing this?