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

Implement rmw_publisher_assert_liveliness #235

Merged
merged 1 commit into from
Jul 2, 2024
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
18 changes: 16 additions & 2 deletions rmw_zenoh_cpp/src/rmw_zenoh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1166,8 +1166,21 @@ rmw_get_serialized_message_size(
rmw_ret_t
rmw_publisher_assert_liveliness(const rmw_publisher_t * publisher)
{
static_cast<void>(publisher);
return RMW_RET_UNSUPPORTED;
RMW_CHECK_FOR_NULL_WITH_MSG(
publisher, "publisher handle is null",
return RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_FOR_NULL_WITH_MSG(
publisher->data, "publisher data is null",
return RMW_RET_INVALID_ARGUMENT);
rmw_zenoh_cpp::rmw_publisher_data_t * pub_data =
static_cast<rmw_zenoh_cpp::rmw_publisher_data_t *>(publisher->data);
RMW_CHECK_ARGUMENT_FOR_NULL(pub_data, RMW_RET_INVALID_ARGUMENT);

if (!zc_liveliness_token_check(&pub_data->token)) {
return RMW_RET_ERROR;
}

return RMW_RET_OK;
}

//==============================================================================
Expand Down Expand Up @@ -3798,6 +3811,7 @@ rmw_get_gid_for_publisher(const rmw_publisher_t * publisher, rmw_gid_t * gid)

rmw_zenoh_cpp::rmw_publisher_data_t * pub_data =
static_cast<rmw_zenoh_cpp::rmw_publisher_data_t *>(publisher->data);
RMW_CHECK_ARGUMENT_FOR_NULL(pub_data, RMW_RET_INVALID_ARGUMENT);

gid->implementation_identifier = rmw_zenoh_cpp::rmw_zenoh_identifier;
memcpy(gid->data, pub_data->pub_gid, RMW_GID_STORAGE_SIZE);
Expand Down