ROS 2 rclcpp + rcl - kilted  kilted
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 "rosidl_runtime_c/service_type_support_struct.h"
26 
27 #include "rcl/allocator.h"
28 #include "rcl/event_callback.h"
29 #include "rcl/macros.h"
30 #include "rcl/node.h"
31 #include "rcl/publisher.h"
32 #include "rcl/service_introspection.h"
33 #include "rcl/time.h"
34 #include "rcl/visibility_control.h"
35 
36 #include "rmw/types.h"
37 
40 
42 typedef struct rcl_service_s
43 {
47 
49 typedef struct rcl_service_options_s
50 {
52  rmw_qos_profile_t qos;
54 
57 
59 
65 RCL_PUBLIC
66 RCL_WARN_UNUSED
69 
71 
160 RCL_PUBLIC
161 RCL_WARN_UNUSED
162 rcl_ret_t
164  rcl_service_t * service,
165  const rcl_node_t * node,
166  const rosidl_service_type_support_t * type_support,
167  const char * service_name,
168  const rcl_service_options_t * options);
169 
171 
196 RCL_PUBLIC
197 RCL_WARN_UNUSED
198 rcl_ret_t
199 rcl_service_fini(rcl_service_t * service, rcl_node_t * node);
200 
202 
208 RCL_PUBLIC
209 RCL_WARN_UNUSED
212 
214 
258 RCL_PUBLIC
259 RCL_WARN_UNUSED
260 rcl_ret_t
262  const rcl_service_t * service,
263  rmw_service_info_t * request_header,
264  void * ros_request);
265 
267 
282 RCL_PUBLIC
283 RCL_WARN_UNUSED
284 rcl_ret_t
286  const rcl_service_t * service,
287  rmw_request_id_t * request_header,
288  void * ros_request);
289 
291 
336 RCL_PUBLIC
337 RCL_WARN_UNUSED
338 rcl_ret_t
340  const rcl_service_t * service,
341  rmw_request_id_t * response_header,
342  void * ros_response);
343 
345 
366 RCL_PUBLIC
367 RCL_WARN_UNUSED
368 const char *
370 
372 
393 RCL_PUBLIC
394 RCL_WARN_UNUSED
395 const rcl_service_options_t *
396 rcl_service_get_options(const rcl_service_t * service);
397 
399 
424 RCL_PUBLIC
425 RCL_WARN_UNUSED
426 rmw_service_t *
428 
430 
447 RCL_PUBLIC
448 bool
449 rcl_service_is_valid(const rcl_service_t * service);
450 
452 
472 RCL_PUBLIC
473 RCL_WARN_UNUSED
474 const rmw_qos_profile_t *
476 
478 
498 RCL_PUBLIC
499 RCL_WARN_UNUSED
500 const rmw_qos_profile_t *
502 
504 
526 RCL_PUBLIC
527 RCL_WARN_UNUSED
528 rcl_ret_t
530  const rcl_service_t * service,
531  rcl_event_callback_t callback,
532  const void * user_data);
533 
535 
565 RCL_PUBLIC
566 RCL_WARN_UNUSED
567 rcl_ret_t
569  rcl_service_t * service,
570  rcl_node_t * node,
571  rcl_clock_t * clock,
572  const rosidl_service_type_support_t * type_support,
573  const rcl_publisher_options_t publisher_options,
574  rcl_service_introspection_state_t introspection_state);
575 
576 #ifdef __cplusplus
577 }
578 #endif
579 
580 #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:436
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:317
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:297
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:445
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:86
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:308
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:471
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:326
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:454
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:425
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:234
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:286
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:55
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:371
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:384
Encapsulation of a time source.
Definition: time.h:138
Structure which encapsulates a ROS Node.
Definition: node.h:45
Options available for a rcl publisher.
Definition: publisher.h:44
Options available for a rcl service.
Definition: service.h:50
rmw_qos_profile_t qos
Middleware quality of service settings for the service.
Definition: service.h:52
rcl_allocator_t allocator
Custom allocator for the service, used for incidental allocations.
Definition: service.h:55
Structure which encapsulates a ROS Service.
Definition: service.h:43
rcl_service_impl_t * impl
Pointer to the service implementation.
Definition: service.h:45
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:24