Skip to content

Commit

Permalink
Add rmw_publisher_wait_for_all_acked support
Browse files Browse the repository at this point in the history
Signed-off-by: Barry Xu <barry.xu@sony.com>
  • Loading branch information
Barry-Xu-2018 committed Mar 31, 2021
1 parent 56734ee commit fc27236
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions rmw_cyclonedds_cpp/src/rmw_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2158,6 +2158,39 @@ rmw_ret_t rmw_publisher_assert_liveliness(const rmw_publisher_t * publisher)
return RMW_RET_OK;
}

rmw_ret_t rmw_publisher_wait_for_all_acked(
const rmw_publisher_t * publisher,
rmw_time_t wait_timeout)
{
RMW_CHECK_ARGUMENT_FOR_NULL(publisher, RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_TYPE_IDENTIFIERS_MATCH(
publisher,
publisher->implementation_identifier,
eclipse_cyclonedds_identifier,
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);

auto pub = static_cast<CddsPublisher *>(publisher->data);
if (pub == nullptr) {
RMW_SET_ERROR_MSG("The publisher is not a valid publisher.");
return RMW_RET_INVALID_ARGUMENT;
}

dds_duration_t timeout = rmw_duration_to_dds(wait_timeout);
switch (dds_wait_for_acks(pub->enth, timeout)) {
case DDS_RETCODE_OK:
return RMW_RET_OK;
case DDS_RETCODE_BAD_PARAMETER:
RMW_SET_ERROR_MSG("The publisher is not a valid publisher.");
return RMW_RET_INVALID_ARGUMENT;
case DDS_RETCODE_TIMEOUT:
return RMW_RET_TIMEOUT;
case DDS_RETCODE_UNSUPPORTED:
return RMW_RET_UNSUPPORTED;
default:
return RMW_RET_ERROR;
}
}

rmw_ret_t rmw_publisher_get_actual_qos(const rmw_publisher_t * publisher, rmw_qos_profile_t * qos)
{
RMW_CHECK_ARGUMENT_FOR_NULL(publisher, RMW_RET_INVALID_ARGUMENT);
Expand Down

0 comments on commit fc27236

Please sign in to comment.