Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions rclcpp/include/rclcpp/utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,14 @@ RCLCPP_PUBLIC
std::vector<const char *>
get_c_vector_string(const std::vector<std::string> & strings_in);

/// Call dds to notify about new network interfaces.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This layer shouldn't assume that the underlying middleware is a DDS.
Maybe the comment should say something like "Notify middleware to refresh available network interfaces?"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alsora good point - will change that.

/**
* \param[in] context is the default ROS context.
*/
RCLCPP_PUBLIC
void
notify_new_networks(Context::SharedPtr context);

} // namespace rclcpp

#endif // RCLCPP__UTILITIES_HPP_
12 changes: 12 additions & 0 deletions rclcpp/src/rclcpp/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "rcl/error_handling.h"
#include "rcl/rcl.h"
#include "rcl/node.h"

namespace rclcpp
{
Expand Down Expand Up @@ -227,4 +228,15 @@ get_c_vector_string(const std::vector<std::string> & strings_in)
return cstrings;
}

void
notify_new_networks(Context::SharedPtr context)
{
rcl_ret_t ret = rcl_notify_participant_dynamic_network_interface(context->get_rcl_context().get());
if (RCL_RET_OK != ret)
{
exceptions::throw_from_rcl_error(
ret, "failed to notify networks");
}
}

} // namespace rclcpp