From 167e703af3ca464537b24033b6ed65909ce42b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Dom=C3=ADnguez=20L=C3=B3pez?= <116071334+Mario-DL@users.noreply.github.com> Date: Wed, 4 Jun 2025 11:42:35 +0200 Subject: [PATCH] Retrieve `HistoryQoS` in discovery when available (#829) Signed-off-by: Mario Dominguez (cherry picked from commit e78f3f43ed8d61fe2f101174b5d0852cc28e8bcc) --- .../include/rmw_fastrtps_shared_cpp/qos.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp index 76edddad50..aa1c0f4841 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp @@ -175,6 +175,23 @@ rtps_qos_to_rmw_qos( break; } qos->liveliness_lease_duration = dds_duration_to_rmw(rtps_qos.liveliness.lease_duration); + + if (rtps_qos.history.has_value()) { + switch (rtps_qos.history->kind) { + case eprosima::fastdds::dds::KEEP_LAST_HISTORY_QOS: + qos->history = RMW_QOS_POLICY_HISTORY_KEEP_LAST; + break; + case eprosima::fastdds::dds::KEEP_ALL_HISTORY_QOS: + qos->history = RMW_QOS_POLICY_HISTORY_KEEP_ALL; + break; + default: + qos->history = RMW_QOS_POLICY_HISTORY_UNKNOWN; + break; + } + qos->depth = static_cast(rtps_qos.history->depth); + } else { + qos->history = RMW_QOS_POLICY_HISTORY_UNKNOWN; + } } extern template RMW_FASTRTPS_SHARED_CPP_PUBLIC