@@ -56,12 +56,36 @@ std::shared_ptr<ddspipe::core::IReader> SpyDdsParticipant::create_reader(
5656 return ddspipe::participants::DynTypesParticipant::create_reader (topic);
5757}
5858
59+ <<<<<<< HEAD
5960void SpyDdsParticipant::on_participant_discovery (
6061 fastdds::dds::DomainParticipant* participant,
6162 fastrtps::rtps::ParticipantDiscoveryInfo&& discovery_info)
6263{
6364 // If comes from this participant is not interesting
6465 if (come_from_this_participant_ (discovery_info.info .m_guid ))
66+ =======
67+ SpyDdsParticipant::SpyDdsParticipantListener::SpyDdsParticipantListener (
68+ std::shared_ptr<ddspipe::participants::ParticipantConfiguration> conf,
69+ std::shared_ptr<ddspipe::core::DiscoveryDatabase> ddb,
70+ std::shared_ptr<ddspipe::participants::InternalReader> type_object_reader,
71+ std::shared_ptr<ddspipe::participants::InternalReader> participants_reader,
72+ std::shared_ptr<ddspipe::participants::InternalReader> endpoints_reader)
73+ : ddspipe::participants::DynTypesParticipant::DynTypesRtpsListener (conf, ddb, type_object_reader)
74+ {
75+ // Set the internal readers
76+ participants_reader_ = participants_reader;
77+ endpoints_reader_ = endpoints_reader;
78+ }
79+
80+ void SpyDdsParticipant::SpyDdsParticipantListener::on_participant_discovery (
81+ fastdds::rtps::RTPSParticipant* participant,
82+ fastdds::rtps::ParticipantDiscoveryStatus reason,
83+ const fastdds::rtps::ParticipantBuiltinTopicData& info,
84+ bool & should_be_ignored)
85+ {
86+ // If comes from this participant is not interesting
87+ if (ddspipe::participants::detail::come_from_same_participant_ (info.guid , participant->getGuid ()))
88+ >>>>>>> 6a01d7d (Update Spy Listeners (#121 ))
6589 {
6690 return ;
6791 }
@@ -72,6 +96,7 @@ void SpyDdsParticipant::on_participant_discovery(
7296 info.name = std::string (discovery_info.info .m_participantName );
7397 info.guid = discovery_info.info .m_guid ;
7498
99+ <<<<<<< HEAD
75100 internal_notify_participant_discovered_ (info);
76101}
77102
@@ -81,37 +106,82 @@ void SpyDdsParticipant::on_subscriber_discovery(
81106{
82107 // If comes from this participant is not interesting
83108 if (come_from_this_participant_ (info.info .guid ()))
109+ =======
110+ ddspipe::participants::rtps::CommonParticipant::RtpsListener::on_participant_discovery (participant, reason, info,
111+ should_be_ignored);
112+
113+ internal_notify_participant_discovered_ (participant_info);
114+ }
115+
116+ void SpyDdsParticipant::SpyDdsParticipantListener::on_reader_discovery (
117+ fastdds::rtps::RTPSParticipant* participant,
118+ fastdds::rtps::ReaderDiscoveryStatus reason,
119+ const fastdds::rtps::SubscriptionBuiltinTopicData& info,
120+ bool & should_be_ignored)
121+ {
122+ // If comes from this participant is not interesting
123+ if (ddspipe::participants::detail::come_from_same_participant_ (info.guid , participant->getGuid ()))
124+ >>>>>>> 6a01d7d (Update Spy Listeners (#121 ))
84125 {
85126 return ;
86127 }
87128
129+ <<<<<<< HEAD
88130 EndpointInfo endpoint_info = ddspipe::participants::detail::create_endpoint_from_info_ (info, id ());
89131
90132 // If participant left or dropped, this notification arrives as well
91133 endpoint_info.active = !(info.status == fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS ::REMOVED_READER );
134+ =======
135+ EndpointInfo endpoint_info = ddspipe::participants::detail::create_endpoint_from_info_ (info, configuration_->id );
136+ endpoint_info.active = (reason == fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER
137+ || reason == fastdds::rtps::ReaderDiscoveryStatus::CHANGED_QOS_READER );
138+
139+ ddspipe::participants::DynTypesParticipant::DynTypesRtpsListener::on_reader_discovery (participant, reason, info,
140+ should_be_ignored);
141+ >>>>>>> 6a01d7d (Update Spy Listeners (#121 ))
92142
93143 internal_notify_endpoint_discovered_ (endpoint_info);
94144}
95145
146+ <<<<<<< HEAD
96147void SpyDdsParticipant::on_publisher_discovery (
97148 fastdds::dds::DomainParticipant* participant,
98149 fastrtps::rtps::WriterDiscoveryInfo&& info)
99150{
100151 // If comes from this participant is not interesting
101152 if (come_from_this_participant_ (info.info .guid ()))
153+ =======
154+ void SpyDdsParticipant::SpyDdsParticipantListener::on_writer_discovery (
155+ fastdds::rtps::RTPSParticipant* participant,
156+ fastdds::rtps::WriterDiscoveryStatus reason,
157+ const fastdds::rtps::PublicationBuiltinTopicData& info,
158+ bool & should_be_ignored)
159+ {
160+ // If comes from this participant is not interesting
161+ if (ddspipe::participants::detail::come_from_same_participant_ (info.guid , participant->getGuid ()))
162+ >>>>>>> 6a01d7d (Update Spy Listeners (#121 ))
102163 {
103164 return ;
104165 }
105166
167+ <<<<<<< HEAD
106168 EndpointInfo endpoint_info = ddspipe::participants::detail::create_endpoint_from_info_ (info, id ());
107169
108170 // If participant left or dropped, this notification arrives as well
109171 endpoint_info.active = !(info.status == fastrtps::rtps::WriterDiscoveryInfo::DISCOVERY_STATUS ::REMOVED_WRITER );
172+ =======
173+ EndpointInfo endpoint_info = ddspipe::participants::detail::create_endpoint_from_info_ (info, configuration_->id );
174+ endpoint_info.active = (reason == fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER
175+ || reason == fastdds::rtps::WriterDiscoveryStatus::CHANGED_QOS_WRITER );
176+
177+ ddspipe::participants::DynTypesParticipant::DynTypesRtpsListener::on_writer_discovery (participant, reason, info,
178+ should_be_ignored);
179+ >>>>>>> 6a01d7d (Update Spy Listeners (#121 ))
110180
111181 internal_notify_endpoint_discovered_ (endpoint_info);
112182}
113183
114- void SpyDdsParticipant::internal_notify_participant_discovered_ (
184+ void SpyDdsParticipant::SpyDdsParticipantListener:: internal_notify_participant_discovered_ (
115185 const ParticipantInfo& participant_discovered)
116186{
117187 // Create data containing Dynamic Type
@@ -122,7 +192,7 @@ void SpyDdsParticipant::internal_notify_participant_discovered_(
122192 participants_reader_->simulate_data_reception (std::move (data));
123193}
124194
125- void SpyDdsParticipant::internal_notify_endpoint_discovered_ (
195+ void SpyDdsParticipant::SpyDdsParticipantListener:: internal_notify_endpoint_discovered_ (
126196 const EndpointInfo& endpoint_discovered)
127197{
128198 // Create data containing Dynamic Type
@@ -133,6 +203,7 @@ void SpyDdsParticipant::internal_notify_endpoint_discovered_(
133203 endpoints_reader_->simulate_data_reception (std::move (data));
134204}
135205
206+ <<<<<<< HEAD
136207/*
137208 * NOTE: this function is required apart from come_from_same_participant_
138209 * because this participant has 2 guids, the rtps and the dds participant ones
@@ -143,6 +214,14 @@ bool SpyDdsParticipant::come_from_this_participant_(
143214 return (guid.guid_prefix () == dds_participant_->guid ().guidPrefix
144215 || guid.guid_prefix () == rtps_participant_->getGuid ().guidPrefix
145216 );
217+ =======
218+ std::unique_ptr<fastdds::rtps::RTPSParticipantListener> SpyDdsParticipant::create_listener_ ()
219+ {
220+ // We pass the configuration_ and discovery_database_ attributes from this method to avoid accessing virtual
221+ // attributes in the constructor
222+ return std::make_unique<SpyDdsParticipantListener>(configuration_, discovery_database_, type_object_reader_,
223+ participants_reader_, endpoints_reader_);
224+ >>>>>>> 6a01d7d (Update Spy Listeners (#121 ))
146225}
147226
148227} /* namespace participants */
0 commit comments