From 079b5cc1336627ce53c2145dffd3d4e7b0e83a9f Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Mon, 19 Feb 2024 08:50:10 -0500 Subject: [PATCH] Implement rmw_get_gid_for_client. Signed-off-by: Chris Lalancette --- rmw_zenoh_cpp/src/rmw_zenoh.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rmw_zenoh_cpp/src/rmw_zenoh.cpp b/rmw_zenoh_cpp/src/rmw_zenoh.cpp index a2863270..7a6df086 100644 --- a/rmw_zenoh_cpp/src/rmw_zenoh.cpp +++ b/rmw_zenoh_cpp/src/rmw_zenoh.cpp @@ -3542,9 +3542,15 @@ rmw_get_gid_for_publisher(const rmw_publisher_t * publisher, rmw_gid_t * gid) rmw_ret_t rmw_get_gid_for_client(const rmw_client_t * client, rmw_gid_t * gid) { - static_cast(client); - static_cast(gid); - return RMW_RET_UNSUPPORTED; + RMW_CHECK_ARGUMENT_FOR_NULL(client, RMW_RET_INVALID_ARGUMENT); + RMW_CHECK_ARGUMENT_FOR_NULL(gid, RMW_RET_INVALID_ARGUMENT); + + rmw_client_data_t * client_data = static_cast(client->data); + + gid->implementation_identifier = rmw_zenoh_identifier; + memcpy(gid->data, client_data->client_guid, RMW_GID_STORAGE_SIZE); + + return RMW_RET_OK; } //==============================================================================