Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rmw_publisher_wait_for_all_acked support #294

Merged
Merged
Changes from all commits
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
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 @@ -2338,6 +2338,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