Skip to content

Commit 488c302

Browse files
author
Sebastian Jakymiw
committed
add network notify function
1 parent 4b84feb commit 488c302

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/get_participant.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ RMW_FASTRTPS_CPP_PUBLIC
3434
eprosima::fastdds::dds::DomainParticipant *
3535
get_domain_participant(rmw_node_t * node);
3636

37+
/**
38+
* This function returns `NULL` when either the node handle is `NULL` or when the
39+
* node handle is from a different rmw implementation.
40+
*
41+
* \return rmw_ret_t non `NULL` value if successful, otherwise `NULL`
42+
*/
43+
rmw_ret_t rmw_notify_participant_dynamic_network_interface(rmw_context_t * context);
44+
3745
} // namespace rmw_fastrtps_cpp
3846

3947
#endif // RMW_FASTRTPS_CPP__GET_PARTICIPANT_HPP_

rmw_fastrtps_cpp/src/rmw_node.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
#include "rmw/ret_types.h"
2727
#include "rmw/rmw.h"
2828

29+
#include "rmw_fastrtps_shared_cpp/custom_participant_info.hpp"
2930
#include "rmw_fastrtps_shared_cpp/init_rmw_context_impl.hpp"
3031
#include "rmw_fastrtps_shared_cpp/rmw_common.hpp"
3132
#include "rmw_fastrtps_shared_cpp/rmw_context_impl.hpp"
3233

3334
#include "rmw_fastrtps_cpp/identifier.hpp"
3435
#include "rmw_fastrtps_cpp/init_rmw_context_impl.hpp"
36+
#include "rmw_fastrtps_cpp/get_participant.hpp"
3537

3638
extern "C"
3739
{
@@ -121,4 +123,30 @@ rmw_node_get_graph_guard_condition(const rmw_node_t * node)
121123
return rmw_fastrtps_shared_cpp::__rmw_node_get_graph_guard_condition(
122124
node);
123125
}
126+
127+
rmw_ret_t
128+
rmw_notify_participant_dynamic_network_interface(rmw_context_t * context)
129+
{
130+
auto impl = static_cast<CustomParticipantInfo *>(context->impl->participant_info);
131+
eprosima::fastdds::dds::DomainParticipant * participant = impl->participant_;
132+
133+
if (nullptr == participant)
134+
{
135+
return RMW_RET_ERROR;
136+
}
137+
138+
eprosima::fastdds::dds::DomainParticipantQos participant_qos;
139+
if (participant->get_qos(participant_qos) != ReturnCode_t::RETCODE_OK)
140+
{
141+
return RMW_RET_ERROR;
142+
}
143+
144+
ReturnCode_t ret = participant->set_qos(participant_qos);
145+
146+
if (ret != ReturnCode_t::RETCODE_OK)
147+
{
148+
return RMW_RET_ERROR;
149+
}
150+
return RMW_RET_OK;
151+
}
124152
} // extern "C"

0 commit comments

Comments
 (0)