rcl  master
C API providing common ROS client library functionality.
service.h
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 
15 #ifndef RCL__SERVICE_H_
16 #define RCL__SERVICE_H_
17 
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #include "rosidl_runtime_c/service_type_support_struct.h"
24 
25 #include "rcl/macros.h"
26 #include "rcl/node.h"
27 #include "rcl/visibility_control.h"
28 
30 struct rcl_service_impl_t;
31 
33 typedef struct rcl_service_t
34 {
36  struct rcl_service_impl_t * impl;
38 
40 typedef struct rcl_service_options_t
41 {
45 
48 
50 
54 RCL_PUBLIC
55 RCL_WARN_UNUSED
57 rcl_get_zero_initialized_service(void);
58 
60 
149 RCL_PUBLIC
150 RCL_WARN_UNUSED
151 rcl_ret_t
152 rcl_service_init(
153  rcl_service_t * service,
154  const rcl_node_t * node,
155  const rosidl_service_type_support_t * type_support,
156  const char * service_name,
157  const rcl_service_options_t * options);
158 
160 
185 RCL_PUBLIC
186 RCL_WARN_UNUSED
187 rcl_ret_t
188 rcl_service_fini(rcl_service_t * service, rcl_node_t * node);
189 
191 
197 RCL_PUBLIC
198 RCL_WARN_UNUSED
200 rcl_service_get_default_options(void);
201 
203 
247 RCL_PUBLIC
248 RCL_WARN_UNUSED
249 rcl_ret_t
250 rcl_take_request_with_info(
251  const rcl_service_t * service,
252  rmw_service_info_t * request_header,
253  void * ros_request);
254 
256 RCL_PUBLIC
257 RCL_WARN_UNUSED
258 rcl_ret_t
259 rcl_take_request(
260  const rcl_service_t * service,
261  rmw_request_id_t * request_header,
262  void * ros_request);
263 
265 
309 RCL_PUBLIC
310 RCL_WARN_UNUSED
311 rcl_ret_t
312 rcl_send_response(
313  const rcl_service_t * service,
314  rmw_request_id_t * response_header,
315  void * ros_response);
316 
318 
339 RCL_PUBLIC
340 RCL_WARN_UNUSED
341 const char *
342 rcl_service_get_service_name(const rcl_service_t * service);
343 
345 
366 RCL_PUBLIC
367 RCL_WARN_UNUSED
368 const rcl_service_options_t *
369 rcl_service_get_options(const rcl_service_t * service);
370 
372 
397 RCL_PUBLIC
398 RCL_WARN_UNUSED
400 rcl_service_get_rmw_handle(const rcl_service_t * service);
401 
403 
420 RCL_PUBLIC
421 bool
422 rcl_service_is_valid(const rcl_service_t * service);
423 
424 #ifdef __cplusplus
425 }
426 #endif
427 
428 #endif // RCL__SERVICE_H_
rcl_node_t
Structure which encapsulates a ROS Node.
Definition: node.h:37
rcl_service_t::impl
struct rcl_service_impl_t * impl
Pointer to the service implementation.
Definition: service.h:36
rmw_service_t
rcl_service_options_t
Options available for a rcl service.
Definition: service.h:40
rcl_service_options_t::allocator
rcl_allocator_t allocator
Custom allocator for the service, used for incidental allocations.
Definition: service.h:46
rmw_service_info_t
rcl_service_options_t::qos
rmw_qos_profile_t qos
Middleware quality of service settings for the service.
Definition: service.h:43
rmw_request_id_t
rcutils_allocator_t
rmw_qos_profile_t
rcl_service_t
Structure which encapsulates a ROS Service.
Definition: service.h:33