rcl  master
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 
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/macros.h"
28 #include "rcl/node.h"
29 #include "rcl/visibility_control.h"
30 
32 struct rcl_service_impl_t;
33 
35 typedef struct rcl_service_t
36 {
38  struct rcl_service_impl_t * impl;
40 
42 typedef struct rcl_service_options_t
43 {
47 
50 
52 
58 RCL_PUBLIC
59 RCL_WARN_UNUSED
62 
64 
153 RCL_PUBLIC
154 RCL_WARN_UNUSED
155 rcl_ret_t
157  rcl_service_t * service,
158  const rcl_node_t * node,
159  const rosidl_service_type_support_t * type_support,
160  const char * service_name,
161  const rcl_service_options_t * options);
162 
164 
189 RCL_PUBLIC
190 RCL_WARN_UNUSED
191 rcl_ret_t
192 rcl_service_fini(rcl_service_t * service, rcl_node_t * node);
193 
195 
201 RCL_PUBLIC
202 RCL_WARN_UNUSED
205 
207 
251 RCL_PUBLIC
252 RCL_WARN_UNUSED
253 rcl_ret_t
255  const rcl_service_t * service,
256  rmw_service_info_t * request_header,
257  void * ros_request);
258 
260 
275 RCL_PUBLIC
276 RCL_WARN_UNUSED
277 rcl_ret_t
279  const rcl_service_t * service,
280  rmw_request_id_t * request_header,
281  void * ros_request);
282 
284 
328 RCL_PUBLIC
329 RCL_WARN_UNUSED
330 rcl_ret_t
332  const rcl_service_t * service,
333  rmw_request_id_t * response_header,
334  void * ros_response);
335 
337 
358 RCL_PUBLIC
359 RCL_WARN_UNUSED
360 const char *
362 
364 
385 RCL_PUBLIC
386 RCL_WARN_UNUSED
387 const rcl_service_options_t *
388 rcl_service_get_options(const rcl_service_t * service);
389 
391 
416 RCL_PUBLIC
417 RCL_WARN_UNUSED
420 
422 
439 RCL_PUBLIC
440 bool
441 rcl_service_is_valid(const rcl_service_t * service);
442 
443 #ifdef __cplusplus
444 }
445 #endif
446 
447 #endif // RCL__SERVICE_H_
rcl_node_t
Structure which encapsulates a ROS Node.
Definition: node.h:39
rcl_service_get_rmw_handle
rmw_service_t * rcl_service_get_rmw_handle(const rcl_service_t *service)
Return the rmw service handle.
rcl_service_t::impl
struct rcl_service_impl_t * impl
Pointer to the service implementation.
Definition: service.h:38
rmw_service_t
rcl_service_t
struct rcl_service_t rcl_service_t
Structure which encapsulates a ROS Service.
rcl_ret_t
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:23
rcl_service_options_t
Options available for a rcl service.
Definition: service.h:42
rcl_service_init
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.
rcl_service_options_t::allocator
rcl_allocator_t allocator
Custom allocator for the service, used for incidental allocations.
Definition: service.h:48
rmw_service_info_t
rcl_take_request_with_info
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.
rcl_service_options_t::qos
rmw_qos_profile_t qos
Middleware quality of service settings for the service.
Definition: service.h:45
node.h
rcl_send_response
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.
rcl_take_request
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.
rcl_service_options_t
struct rcl_service_options_t rcl_service_options_t
Options available for a rcl service.
rmw_request_id_t
rcl_service_get_options
const rcl_service_options_t * rcl_service_get_options(const rcl_service_t *service)
Return the rcl service options.
rcl_service_fini
rcl_ret_t rcl_service_fini(rcl_service_t *service, rcl_node_t *node)
Finalize a rcl_service_t.
rcutils_allocator_t
rmw_qos_profile_t
rcl_service_t
Structure which encapsulates a ROS Service.
Definition: service.h:35
rcl_service_get_service_name
const char * rcl_service_get_service_name(const rcl_service_t *service)
Get the topic name for the service.
rcl_get_zero_initialized_service
rcl_service_t rcl_get_zero_initialized_service(void)
Return a rcl_service_t struct with members set to NULL.
rcl_service_is_valid
bool rcl_service_is_valid(const rcl_service_t *service)
Check that the service is valid.
rcl_service_get_default_options
rcl_service_options_t rcl_service_get_default_options(void)
Return the default service options in a rcl_service_options_t.