Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
add missing qos setings in get_actual_qos() (#270)
Browse files Browse the repository at this point in the history
Signed-off-by: Miaofei <[email protected]>
  • Loading branch information
mm318 authored and jacobperron committed Jun 6, 2019
1 parent a08049c commit 40fece0
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions rmw_opensplice_cpp/src/rmw_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -359,6 +360,20 @@ rmw_publisher_get_actual_qos(
qos->history = RMW_QOS_POLICY_HISTORY_UNKNOWN;
break;
}
qos->depth = static_cast<size_t>(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;
Expand All @@ -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<size_t>(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;
}
Expand Down

0 comments on commit 40fece0

Please sign in to comment.