Skip to content

Commit

Permalink
add function to call rcl
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Jakymiw <[email protected]>
  • Loading branch information
Sebastian Jakymiw committed Jan 19, 2023
1 parent 37adc03 commit 440756f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
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.
/**
* \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

0 comments on commit 440756f

Please sign in to comment.