From 40fece01aac356a578abb88f4cbb7a73196925ad Mon Sep 17 00:00:00 2001 From: "M. M" Date: Thu, 6 Jun 2019 16:48:59 -0700 Subject: [PATCH] add missing qos setings in get_actual_qos() (#270) Signed-off-by: Miaofei --- rmw_opensplice_cpp/src/rmw_publisher.cpp | 40 +++++++++++++++++++----- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/rmw_opensplice_cpp/src/rmw_publisher.cpp b/rmw_opensplice_cpp/src/rmw_publisher.cpp index 115270cc..df3e3600 100644 --- a/rmw_opensplice_cpp/src/rmw_publisher.cpp +++ b/rmw_opensplice_cpp/src/rmw_publisher.cpp @@ -348,6 +348,7 @@ rmw_publisher_get_actual_qos( RMW_SET_ERROR_MSG("publisher internal dds publisher is invalid"); return RMW_RET_ERROR; } + switch (dds_qos.history.kind) { case DDS::KEEP_LAST_HISTORY_QOS: qos->history = RMW_QOS_POLICY_HISTORY_KEEP_LAST; @@ -359,6 +360,20 @@ rmw_publisher_get_actual_qos( qos->history = RMW_QOS_POLICY_HISTORY_UNKNOWN; break; } + qos->depth = static_cast(dds_qos.history.depth); + + switch (dds_qos.reliability.kind) { + case DDS::BEST_EFFORT_RELIABILITY_QOS: + qos->reliability = RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT; + break; + case DDS::RELIABLE_RELIABILITY_QOS: + qos->reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + break; + default: + qos->reliability = RMW_QOS_POLICY_RELIABILITY_UNKNOWN; + break; + } + switch (dds_qos.durability.kind) { case DDS::TRANSIENT_LOCAL_DURABILITY_QOS: qos->durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL; @@ -370,18 +385,29 @@ rmw_publisher_get_actual_qos( qos->durability = RMW_QOS_POLICY_DURABILITY_UNKNOWN; break; } - switch (dds_qos.reliability.kind) { - case DDS::BEST_EFFORT_RELIABILITY_QOS: - qos->reliability = RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT; + + qos->deadline.sec = dds_qos.deadline.period.sec; + qos->deadline.nsec = dds_qos.deadline.period.nanosec; + + qos->lifespan.sec = dds_qos.lifespan.duration.sec; + qos->lifespan.nsec = dds_qos.lifespan.duration.nanosec; + + switch (dds_qos.liveliness.kind) { + case DDS::AUTOMATIC_LIVELINESS_QOS: + qos->liveliness = RMW_QOS_POLICY_LIVELINESS_AUTOMATIC; break; - case DDS::RELIABLE_RELIABILITY_QOS: - qos->reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + case DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS: + qos->liveliness = RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE; + break; + case DDS::MANUAL_BY_TOPIC_LIVELINESS_QOS: + qos->liveliness = RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC; break; default: - qos->reliability = RMW_QOS_POLICY_RELIABILITY_UNKNOWN; + qos->liveliness = RMW_QOS_POLICY_LIVELINESS_UNKNOWN; break; } - qos->depth = static_cast(dds_qos.history.depth); + qos->liveliness_lease_duration.sec = dds_qos.liveliness.lease_duration.sec; + qos->liveliness_lease_duration.nsec = dds_qos.liveliness.lease_duration.nanosec; return RMW_RET_OK; }