diff --git a/rmw/include/rmw/qos_profiles.h b/rmw/include/rmw/qos_profiles.h new file mode 100644 index 000000000..1ed94236a --- /dev/null +++ b/rmw/include/rmw/qos_profiles.h @@ -0,0 +1,64 @@ +// Copyright 2015 Open Source Robotics Foundation, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef ROS_MIDDLEWARE_INTERFACE_ROS_MIDDLEWARE_INTERFACE_QOS_PROFILES_H_ +#define ROS_MIDDLEWARE_INTERFACE_ROS_MIDDLEWARE_INTERFACE_QOS_PROFILES_H_ + +#if __cplusplus +extern "C" +{ +#endif + +#include "types.h" + +const static rmw_qos_profile_t rmw_qos_profile_sensor_data = +{ + RMW_QOS_POLICY_KEEP_LAST_HISTORY, + 5, + RMW_QOS_POLICY_BEST_EFFORT +}; + +const static rmw_qos_profile_t rmw_qos_profile_parameters = +{ + RMW_QOS_POLICY_KEEP_LAST_HISTORY, + 1000, + RMW_QOS_POLICY_RELIABLE +}; + +const static rmw_qos_profile_t rmw_qos_profile_default = +{ + RMW_QOS_POLICY_KEEP_ALL_HISTORY, + 10, + RMW_QOS_POLICY_RELIABLE +}; + +const static rmw_qos_profile_t rmw_qos_profile_services_default = +{ + RMW_QOS_POLICY_KEEP_ALL_HISTORY, + 10, + RMW_QOS_POLICY_RELIABLE +}; + +const static rmw_qos_profile_t rmw_qos_profile_parameter_events = +{ + RMW_QOS_POLICY_KEEP_ALL_HISTORY, + 1000, + RMW_QOS_POLICY_RELIABLE +}; + +#if __cplusplus +} +#endif + +#endif /* ROS_MIDDLEWARE_INTERFACE_ROS_MIDDLEWARE_INTERFACE_QOS_PROFILES_H_ */ diff --git a/rmw/include/rmw/rmw.h b/rmw/include/rmw/rmw.h index 35797bfaa..402b1fd69 100644 --- a/rmw/include/rmw/rmw.h +++ b/rmw/include/rmw/rmw.h @@ -33,6 +33,7 @@ extern "C" #include #include +#include "qos_profiles.h" #include "types.h" #include "visibility_control.h" @@ -63,7 +64,7 @@ rmw_create_publisher( const rmw_node_t * node, const rosidl_message_type_support_t * type_support, const char * topic_name, - size_t queue_size); + const rmw_qos_profile_t & qos_policies = rmw_qos_profile_default); RMW_PUBLIC RMW_WARN_UNUSED @@ -82,8 +83,8 @@ rmw_create_subscription( const rmw_node_t * node, const rosidl_message_type_support_t * type_support, const char * topic_name, - size_t queue_size, - bool ignore_local_publications); + const rmw_qos_profile_t & qos_policies = rmw_qos_profile_default, + bool ignore_local_publications = false); RMW_PUBLIC RMW_WARN_UNUSED diff --git a/rmw/include/rmw/types.h b/rmw/include/rmw/types.h index fb0df068f..43ba84698 100644 --- a/rmw/include/rmw/types.h +++ b/rmw/include/rmw/types.h @@ -102,6 +102,25 @@ typedef struct RMW_PUBLIC_TYPE rmw_time_t uint64_t nsec; } rmw_time_t; +enum RMW_PUBLIC_TYPE rmw_qos_reliability_policy_t +{ + RMW_QOS_POLICY_RELIABLE, + RMW_QOS_POLICY_BEST_EFFORT +}; + +enum RMW_PUBLIC_TYPE rmw_qos_history_policy_t +{ + RMW_QOS_POLICY_KEEP_LAST_HISTORY, + RMW_QOS_POLICY_KEEP_ALL_HISTORY +}; + +typedef struct RMW_PUBLIC_TYPE rmw_qos_profile_t +{ + enum rmw_qos_history_policy_t history; + size_t depth; + enum rmw_qos_reliability_policy_t reliability; +} rmw_qos_profile_t; + #if __cplusplus } #endif