rcl  beta1
C API providing common ROS client library functionality.
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 
15 #ifndef RCL__SERVICE_H_
16 #define RCL__SERVICE_H_
17 
18 #if __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #include "rosidl_generator_c/service_type_support.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 {
35  struct rcl_service_impl_t * impl;
37 
39 typedef struct rcl_service_options_t
40 {
44 
47 
49 
57 
59 
144 rcl_ret_t
146  rcl_service_t * service,
147  const rcl_node_t * node,
148  const rosidl_service_type_support_t * type_support,
149  const char * service_name,
150  const rcl_service_options_t * options);
151 
153 
178 rcl_ret_t
179 rcl_service_fini(rcl_service_t * service, rcl_node_t * node);
180 
182 
192 
194 
238 rcl_ret_t
240  const rcl_service_t * service,
241  rmw_request_id_t * request_header,
242  void * ros_request);
243 
245 
291 rcl_ret_t
293  const rcl_service_t * service,
294  rmw_request_id_t * response_header,
295  void * ros_response);
296 
298 
321 const char *
323 
325 
348 const rcl_service_options_t *
349 rcl_service_get_options(const rcl_service_t * service);
350 
352 
381 
382 #if __cplusplus
383 }
384 #endif
385 
386 #endif // RCL__SERVICE_H_
const char * rcl_service_get_service_name(const rcl_service_t *service)
Get the topic name for the service.
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.
rmw_ret_t rcl_ret_t
Definition: types.h:20
rmw_service_t * rcl_service_get_rmw_handle(const rcl_service_t *service)
Return the rmw service handle.
struct rcl_service_impl_t * impl
Definition: service.h:35
Options available for a rcl service.
Definition: service.h:39
struct rcl_service_options_t rcl_service_options_t
Options available for a rcl service.
struct rcl_service_t rcl_service_t
Structure which encapsulates a ROS Service.
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.
#define RCL_WARN_UNUSED
Ignored return values of functions with this macro will emit a warning.
Definition: macros.h:25
#define RCL_PUBLIC
Definition: visibility_control.h:48
rcl_ret_t rcl_take_request(const rcl_service_t *service, rmw_request_id_t *request_header, void *ros_request)
Take a pending ROS request using a rcl service.
Structure which encapsulates a ROS Service.
Definition: service.h:33
rcl_ret_t rcl_service_fini(rcl_service_t *service, rcl_node_t *node)
Finalize a rcl_service_t.
const rcl_service_options_t * rcl_service_get_options(const rcl_service_t *service)
Return the rcl service options.
Encapsulation of an allocator.
Definition: allocator.h:40
rcl_allocator_t allocator
Custom allocator for the service, used for incidental allocations.
Definition: service.h:45
rcl_service_options_t rcl_service_get_default_options(void)
Return the default service options in a rcl_service_options_t.
rcl_service_t rcl_get_zero_initialized_service(void)
Return a rcl_service_t struct with members set to NULL.
rmw_qos_profile_t qos
Middleware quality of service settings for the service.
Definition: service.h:42
Structure which encapsulates a ROS Node.
Definition: node.h:37