ROS 2 rclcpp + rcl - rolling  rolling-e7363f10
ROS 2 C++ Client Library with ROS Client Library
service.h
Go to the documentation of this file.
1 // Copyright 2016 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
16 
17 #ifndef RCL__SERVICE_H_
18 #define RCL__SERVICE_H_
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include <stdbool.h>
26 
27 #include "rosidl_runtime_c/service_type_support_struct.h"
28 
29 #include "rcl/allocator.h"
30 #include "rcl/event_callback.h"
31 #include "rcl/macros.h"
32 #include "rcl/node.h"
33 #include "rcl/publisher.h"
34 #include "rcl/service_introspection.h"
35 #include "rcl/time.h"
36 #include "rcl/types.h"
37 #include "rcl/visibility_control.h"
38 
39 #include "rmw/types.h"
40 
43 
45 typedef struct rcl_service_s
46 {
50 
52 typedef struct rcl_service_options_s
53 {
55  rmw_qos_profile_t qos;
57 
60 
62 
68 RCL_PUBLIC
69 RCL_WARN_UNUSED
72 
74 
163 RCL_PUBLIC
164 RCL_WARN_UNUSED
165 rcl_ret_t
167  rcl_service_t * service,
168  const rcl_node_t * node,
169  const rosidl_service_type_support_t * type_support,
170  const char * service_name,
171  const rcl_service_options_t * options);
172 
174 
199 RCL_PUBLIC
200 RCL_WARN_UNUSED
201 rcl_ret_t
202 rcl_service_fini(rcl_service_t * service, rcl_node_t * node);
203 
205 
211 RCL_PUBLIC
212 RCL_WARN_UNUSED
215 
217 
261 RCL_PUBLIC
262 RCL_WARN_UNUSED
263 rcl_ret_t
265  const rcl_service_t * service,
266  rmw_service_info_t * request_header,
267  void * ros_request);
268 
270 
285 RCL_PUBLIC
286 RCL_WARN_UNUSED
287 rcl_ret_t
289  const rcl_service_t * service,
290  rmw_request_id_t * request_header,
291  void * ros_request);
292 
294 
339 RCL_PUBLIC
340 RCL_WARN_UNUSED
341 rcl_ret_t
343  const rcl_service_t * service,
344  rmw_request_id_t * response_header,
345  void * ros_response);
346 
348 
369 RCL_PUBLIC
370 RCL_WARN_UNUSED
371 const char *
373 
375 
396 RCL_PUBLIC
397 RCL_WARN_UNUSED
398 const rcl_service_options_t *
399 rcl_service_get_options(const rcl_service_t * service);
400 
402 
427 RCL_PUBLIC
428 RCL_WARN_UNUSED
429 rmw_service_t *
431 
433 
450 RCL_PUBLIC
451 bool
452 rcl_service_is_valid(const rcl_service_t * service);
453 
455 
475 RCL_PUBLIC
476 RCL_WARN_UNUSED
477 const rmw_qos_profile_t *
479 
481 
501 RCL_PUBLIC
502 RCL_WARN_UNUSED
503 const rmw_qos_profile_t *
505 
507 
540 RCL_PUBLIC
541 RCL_WARN_UNUSED
542 rcl_ret_t
544  const rcl_service_t * service,
545  rcl_event_callback_t callback,
546  const void * user_data);
547 
549 
579 RCL_PUBLIC
580 RCL_WARN_UNUSED
581 rcl_ret_t
583  rcl_service_t * service,
584  rcl_node_t * node,
585  rcl_clock_t * clock,
586  const rosidl_service_type_support_t * type_support,
587  const rcl_publisher_options_t publisher_options,
588  rcl_service_introspection_state_t introspection_state);
589 
590 #ifdef __cplusplus
591 }
592 #endif
593 
594 #endif // RCL__SERVICE_H_
rcutils_allocator_t rcl_allocator_t
Encapsulation of an allocator.
Definition: allocator.h:31
RCL_PUBLIC RCL_WARN_UNUSED const rmw_qos_profile_t * rcl_service_request_subscription_get_actual_qos(const rcl_service_t *service)
Get the actual qos settings of the service's request subscription.
Definition: service.c:432
RCL_PUBLIC RCL_WARN_UNUSED rmw_service_t * rcl_service_get_rmw_handle(const rcl_service_t *service)
Return the rmw service handle.
Definition: service.c:313
RCL_PUBLIC RCL_WARN_UNUSED const char * rcl_service_get_service_name(const rcl_service_t *service)
Get the topic name for the service.
Definition: service.c:293
RCL_PUBLIC RCL_WARN_UNUSED const rmw_qos_profile_t * rcl_service_response_publisher_get_actual_qos(const rcl_service_t *service)
Get the actual qos settings of the service's response publisher.
Definition: service.c:441
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_service_init(rcl_service_t *service, const rcl_node_t *node, const rosidl_service_type_support_t *type_support, const char *service_name, const rcl_service_options_t *options)
Initialize a rcl service.
Definition: service.c:81
RCL_PUBLIC RCL_WARN_UNUSED const rcl_service_options_t * rcl_service_get_options(const rcl_service_t *service)
Return the rcl service options.
Definition: service.c:304
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_service_configure_service_introspection(rcl_service_t *service, rcl_node_t *node, rcl_clock_t *clock, const rosidl_service_type_support_t *type_support, const rcl_publisher_options_t publisher_options, rcl_service_introspection_state_t introspection_state)
Configure service introspection features for the service.
Definition: service.c:467
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_take_request_with_info(const rcl_service_t *service, rmw_service_info_t *request_header, void *ros_request)
Take a pending ROS request using a rcl service.
Definition: service.c:322
struct rcl_service_s rcl_service_t
Structure which encapsulates a ROS Service.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_service_set_on_new_request_callback(const rcl_service_t *service, rcl_event_callback_t callback, const void *user_data)
Set the on new request callback function for the service.
Definition: service.c:450
struct rcl_service_options_s rcl_service_options_t
Options available for a rcl service.
RCL_PUBLIC bool rcl_service_is_valid(const rcl_service_t *service)
Check that the service is valid.
Definition: service.c:421
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_service_fini(rcl_service_t *service, rcl_node_t *node)
Finalize a rcl_service_t.
Definition: service.c:230
RCL_PUBLIC RCL_WARN_UNUSED rcl_service_options_t rcl_service_get_default_options(void)
Return the default service options in a rcl_service_options_t.
Definition: service.c:282
RCL_PUBLIC RCL_WARN_UNUSED rcl_service_t rcl_get_zero_initialized_service(void)
Return a rcl_service_t struct with members set to NULL.
Definition: service.c:50
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_take_request(const rcl_service_t *service, rmw_request_id_t *request_header, void *ros_request)
Backwards compatibility function to take a pending ROS request using a rcl service.
Definition: service.c:367
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_send_response(const rcl_service_t *service, rmw_request_id_t *response_header, void *ros_response)
Send a ROS response to a client using a service.
Definition: service.c:380
Encapsulation of a time source.
Definition: time.h:141
Structure which encapsulates a ROS Node.
Definition: node.h:49
Options available for a rcl publisher.
Definition: publisher.h:51
Options available for a rcl service.
Definition: service.h:53
rmw_qos_profile_t qos
Middleware quality of service settings for the service.
Definition: service.h:55
rcl_allocator_t allocator
Custom allocator for the service, used for incidental allocations.
Definition: service.h:58
Structure which encapsulates a ROS Service.
Definition: service.h:46
rcl_service_impl_t * impl
Pointer to the service implementation.
Definition: service.h:48
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:25