Monitoring in a different way

3 posts / 0 new
Last post
Offline
Last seen: 8 years 10 months ago
Joined: 03/04/2014
Posts: 15
Monitoring in a different way

Hello, let's see if somebody can help me with this:

I'm trying to detect a participant drop (because the application stops or because of physical disconnection or etc).

Instead of using builtin topics, I'm using a common topic+liveliness qos+NOT_ALIVE_NO_WRITERS_INSTANCE_STATE.

The thing is that I can recover the instance_handle and I've been able to convert it to GUID (https://community.rti.com/forum-topic/accessing-domainparticipants-guid),

but I get a weird value when I try to parse and std::cout the 'rtps_app_id'.

I don't know whether I must get the 'rtps_app_id' from DDS_GUID_t[4] to DDS_GUID_t[7] or in a different way. In any case, I don't know how to compose the 'rtps_app_id' to be std::cout'ed in a legible way.

I'd appreciate any help with this!!

Thanks

 

Gerardo Pardo's picture
Offline
Last seen: 4 weeks 1 hour ago
Joined: 06/02/2010
Posts: 601

I am not sure I inderstood what you are doing. The InstenceHandle you get on on the SampleInfo for a sample that comes on a regular DataReader represents the Key of that data itself. Normally this will bear no relationship to the DomainParticipant that wrote it... https://community.rti.com/forum-topic/accessing-domainparticipants-guid is referring to the instance_handle that shows up in the builtin-topics where the key happens to be the BuiltinTopicKey_t and thus it is related to the GUID.

The SampleInfo's publication_handle on the oher hand refers to the DataWriter that wrote the sample. So you could use that to convert to the GUID_t of the DataWriter and the DomainParticipant.

However, I think that relying on the specific format of the InstanceHandle is not the best approach. For the builtin Topics we are currently embedding the GUID there so it will work. But the format is not specified to be like that and it may be changing in the future...

Instead I would call the DataReader's get_matched_publication_data operation to get the DDS_PublicationBuiltinTopicData and get the participant_key from that structure.

Gerardo

Offline
Last seen: 8 years 10 months ago
Joined: 03/04/2014
Posts: 15

Thanks Gerardo. 

It works perfectly :)