diff --git a/micro_ros_agent/include/agent/graph_manager/graph_manager.hpp b/micro_ros_agent/include/agent/graph_manager/graph_manager.hpp index 4365909..c113a96 100644 --- a/micro_ros_agent/include/agent/graph_manager/graph_manager.hpp +++ b/micro_ros_agent/include/agent/graph_manager/graph_manager.hpp @@ -111,6 +111,12 @@ class GraphManager const eprosima::fastdds::dds::DomainParticipant* participant, bool from_microros = true); + /** + * @brief Getter for the graph cache. + * @return Reference to inner graph cache + */ + rmw_dds_common::GraphCache& get_graph_cache() { return graphCache_; } + /** * @brief Adds a DDS datawriter to the graph tree. * @param datawriter_guid rtps::GUID_t of the datawriter to be added. diff --git a/micro_ros_agent/src/agent/graph_manager/graph_manager.cpp b/micro_ros_agent/src/agent/graph_manager/graph_manager.cpp index 2a85a91..69b8f93 100644 --- a/micro_ros_agent/src/agent/graph_manager/graph_manager.cpp +++ b/micro_ros_agent/src/agent/graph_manager/graph_manager.cpp @@ -597,7 +597,7 @@ GraphManager::ParticipantListener::ParticipantListener( } void GraphManager::ParticipantListener::on_participant_discovery( - eprosima::fastdds::dds::DomainParticipant* participant, + eprosima::fastdds::dds::DomainParticipant* /* participant */, eprosima::fastrtps::rtps::ParticipantDiscoveryInfo&& info) { switch (info.status) @@ -614,13 +614,15 @@ void GraphManager::ParticipantListener::on_participant_discovery( const std::string enclave = std::string(name_found->second.begin(), name_found->second.end()); - graphManager_from_->add_participant(participant, false, enclave); + const rmw_gid_t gid = rmw_fastrtps_shared_cpp::create_rmw_gid("rmw_fastrtps_cpp", info.info.m_guid); + graphManager_from_->get_graph_cache().add_participant(gid, enclave); break; } case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT: case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT: { - graphManager_from_->remove_participant(participant, false); + const rmw_gid_t gid = rmw_fastrtps_shared_cpp::create_rmw_gid("rmw_fastrtps_cpp", info.info.m_guid); + graphManager_from_->get_graph_cache().remove_participant(gid); break; } default: