diff --git a/rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/get_participant.hpp b/rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/get_participant.hpp index cbd76bfbc..7f3643f37 100644 --- a/rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/get_participant.hpp +++ b/rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/get_participant.hpp @@ -34,6 +34,14 @@ RMW_FASTRTPS_CPP_PUBLIC eprosima::fastdds::dds::DomainParticipant * get_domain_participant(rmw_node_t * node); +/** + * This function returns `NULL` when either the node handle is `NULL` or when the + * node handle is from a different rmw implementation. + * + * \return rmw_ret_t non `NULL` value if successful, otherwise `NULL` + */ +rmw_ret_t rmw_notify_participant_dynamic_network_interface(rmw_context_t * context); + } // namespace rmw_fastrtps_cpp #endif // RMW_FASTRTPS_CPP__GET_PARTICIPANT_HPP_ diff --git a/rmw_fastrtps_cpp/src/rmw_node.cpp b/rmw_fastrtps_cpp/src/rmw_node.cpp index 012145a03..4d8c997d9 100644 --- a/rmw_fastrtps_cpp/src/rmw_node.cpp +++ b/rmw_fastrtps_cpp/src/rmw_node.cpp @@ -26,12 +26,14 @@ #include "rmw/ret_types.h" #include "rmw/rmw.h" +#include "rmw_fastrtps_shared_cpp/custom_participant_info.hpp" #include "rmw_fastrtps_shared_cpp/init_rmw_context_impl.hpp" #include "rmw_fastrtps_shared_cpp/rmw_common.hpp" #include "rmw_fastrtps_shared_cpp/rmw_context_impl.hpp" #include "rmw_fastrtps_cpp/identifier.hpp" #include "rmw_fastrtps_cpp/init_rmw_context_impl.hpp" +#include "rmw_fastrtps_cpp/get_participant.hpp" extern "C" { @@ -121,4 +123,30 @@ rmw_node_get_graph_guard_condition(const rmw_node_t * node) return rmw_fastrtps_shared_cpp::__rmw_node_get_graph_guard_condition( node); } + +rmw_ret_t +rmw_notify_participant_dynamic_network_interface(rmw_context_t * context) +{ + auto impl = static_cast(context->impl->participant_info); + eprosima::fastdds::dds::DomainParticipant * participant = impl->participant_; + + if (nullptr == participant) + { + return RMW_RET_ERROR; + } + + eprosima::fastdds::dds::DomainParticipantQos participant_qos; + if (participant->get_qos(participant_qos) != ReturnCode_t::RETCODE_OK) + { + return RMW_RET_ERROR; + } + + ReturnCode_t ret = participant->set_qos(participant_qos); + + if (ret != ReturnCode_t::RETCODE_OK) + { + return RMW_RET_ERROR; + } + return RMW_RET_OK; +} } // extern "C"