From efec5783d3cbc7ce8c4675354696f5f4588403e1 Mon Sep 17 00:00:00 2001 From: "Luetkebohle Ingo (CR/AEX3)" Date: Wed, 22 Apr 2020 21:26:47 +0200 Subject: [PATCH 1/3] implement with_info version of take Signed-off-by: Luetkebohle Ingo (CR/AEX3) --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index 4e149d32..181807de 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -2886,7 +2886,7 @@ static rmw_ret_t rmw_take_response_request( return RMW_RET_OK; } -extern "C" rmw_ret_t rmw_take_response( +extern "C" rmw_ret_t rmw_take_response_with_info( const rmw_client_t * client, rmw_request_id_t * request_header, void * ros_response, bool * taken) @@ -2933,7 +2933,7 @@ static void check_for_blocked_requests(CddsClient & client) } #endif -extern "C" rmw_ret_t rmw_take_request( +extern "C" rmw_ret_t rmw_take_request_with_info( const rmw_service_t * service, rmw_request_id_t * request_header, void * ros_request, bool * taken) From 4a36918252507ac56966807b401a713ea7efc073 Mon Sep 17 00:00:00 2001 From: "Luetkebohle Ingo (CR/AEX3)" Date: Wed, 22 Apr 2020 23:18:30 +0200 Subject: [PATCH 2/3] Fix function names and signatures. Signed-off-by: Luetkebohle Ingo (CR/AEX3) --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index 181807de..e10b778f 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -2856,7 +2856,7 @@ extern "C" rmw_ret_t rmw_wait( ///////////////////////////////////////////////////////////////////////////////////////// static rmw_ret_t rmw_take_response_request( - CddsCS * cs, rmw_request_id_t * request_header, + CddsCS * cs, rmw_service_info_t * request_header, void * ros_data, bool * taken, dds_time_t * source_timestamp, dds_instance_handle_t srcfilter) { @@ -2870,9 +2870,13 @@ static rmw_ret_t rmw_take_response_request( while (dds_take(cs->sub->enth, &wrap_ptr, &info, 1, 1) == 1) { if (info.valid_data) { memset(request_header, 0, sizeof(wrap.header)); - assert(sizeof(wrap.header.guid) <= sizeof(request_header->writer_guid)); - memcpy(request_header->writer_guid, &wrap.header.guid, sizeof(wrap.header.guid)); - request_header->sequence_number = wrap.header.seq; + assert(sizeof(wrap.header.guid) <= sizeof(request_header->request_id.writer_guid)); + memcpy(request_header->request_id.writer_guid, &wrap.header.guid, sizeof(wrap.header.guid)); + request_header->request_id.sequence_number = wrap.header.seq; + request_header->source_timestamp = info.source_timestamp; + if (rcutils_system_time_now(&(request_header->received_timestamp)) != RCUTILS_RET_OK) { + request_header->received_timestamp = 0; + } if (source_timestamp) { *source_timestamp = info.source_timestamp; } @@ -2886,9 +2890,9 @@ static rmw_ret_t rmw_take_response_request( return RMW_RET_OK; } -extern "C" rmw_ret_t rmw_take_response_with_info( +extern "C" rmw_ret_t rmw_take_response( const rmw_client_t * client, - rmw_request_id_t * request_header, void * ros_response, + rmw_service_info_t * request_header, void * ros_response, bool * taken) { RET_WRONG_IMPLID(client); @@ -2933,9 +2937,9 @@ static void check_for_blocked_requests(CddsClient & client) } #endif -extern "C" rmw_ret_t rmw_take_request_with_info( +extern "C" rmw_ret_t rmw_take_request( const rmw_service_t * service, - rmw_request_id_t * request_header, void * ros_request, + rmw_service_info_t * request_header, void * ros_request, bool * taken) { RET_WRONG_IMPLID(service); From 96123c37f18961c6bf2c264ca551ca2a7ce1e0d7 Mon Sep 17 00:00:00 2001 From: "Luetkebohle Ingo (CR/AEX3)" Date: Fri, 24 Apr 2020 01:03:27 +0200 Subject: [PATCH 3/3] Return 0 on received for responses as well Signed-off-by: Luetkebohle Ingo (CR/AEX3) --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index e10b778f..8c810e06 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -2874,9 +2874,8 @@ static rmw_ret_t rmw_take_response_request( memcpy(request_header->request_id.writer_guid, &wrap.header.guid, sizeof(wrap.header.guid)); request_header->request_id.sequence_number = wrap.header.seq; request_header->source_timestamp = info.source_timestamp; - if (rcutils_system_time_now(&(request_header->received_timestamp)) != RCUTILS_RET_OK) { - request_header->received_timestamp = 0; - } + // TODO(iluetkeb) replace with real received timestamp when available in cyclone + request_header->received_timestamp = 0; if (source_timestamp) { *source_timestamp = info.source_timestamp; }