Skip to content

Commit

Permalink
add missing qos setings in get_actual_qos() (#284)
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 191a6b7 commit 015f1ee
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions rmw_fastrtps_shared_cpp/src/rmw_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,20 @@ __rmw_publisher_get_actual_qos(
qos->history = RMW_QOS_POLICY_HISTORY_UNKNOWN;
break;
}
qos->depth = static_cast<size_t>(attributes.topic.historyQos.depth);

switch (attributes.qos.m_reliability.kind) {
case eprosima::fastrtps::BEST_EFFORT_RELIABILITY_QOS:
qos->reliability = RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT;
break;
case eprosima::fastrtps::RELIABLE_RELIABILITY_QOS:
qos->reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
break;
default:
qos->reliability = RMW_QOS_POLICY_RELIABILITY_UNKNOWN;
break;
}

switch (attributes.qos.m_durability.kind) {
case eprosima::fastrtps::TRANSIENT_LOCAL_DURABILITY_QOS:
qos->durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL;
Expand All @@ -168,18 +182,29 @@ __rmw_publisher_get_actual_qos(
qos->durability = RMW_QOS_POLICY_DURABILITY_UNKNOWN;
break;
}
switch (attributes.qos.m_reliability.kind) {
case eprosima::fastrtps::BEST_EFFORT_RELIABILITY_QOS:
qos->reliability = RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT;

qos->deadline.sec = attributes.qos.m_deadline.period.seconds;
qos->deadline.nsec = attributes.qos.m_deadline.period.nanosec;

qos->lifespan.sec = attributes.qos.m_lifespan.duration.seconds;
qos->lifespan.nsec = attributes.qos.m_lifespan.duration.nanosec;

switch (attributes.qos.m_liveliness.kind) {
case eprosima::fastrtps::AUTOMATIC_LIVELINESS_QOS:
qos->liveliness = RMW_QOS_POLICY_LIVELINESS_AUTOMATIC;
break;
case eprosima::fastrtps::RELIABLE_RELIABILITY_QOS:
qos->reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
case eprosima::fastrtps::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS:
qos->liveliness = RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE;
break;
case eprosima::fastrtps::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>(attributes.topic.historyQos.depth);
qos->liveliness_lease_duration.sec = attributes.qos.m_liveliness.lease_duration.seconds;
qos->liveliness_lease_duration.nsec = attributes.qos.m_liveliness.lease_duration.nanosec;

return RMW_RET_OK;
}
Expand Down

0 comments on commit 015f1ee

Please sign in to comment.