rcl  master
C API providing common ROS client library functionality.
event.h
1 // Copyright 2019 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__EVENT_H_
16 #define RCL__EVENT_H_
17 
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #include "rcl/client.h"
24 #include "rcl/macros.h"
25 #include "rcl/publisher.h"
26 #include "rcl/service.h"
27 #include "rcl/subscription.h"
28 #include "rcl/visibility_control.h"
29 
30 typedef enum rcl_publisher_event_type_t
31 {
32  RCL_PUBLISHER_OFFERED_DEADLINE_MISSED,
33  RCL_PUBLISHER_LIVELINESS_LOST,
34  RCL_PUBLISHER_OFFERED_INCOMPATIBLE_QOS,
35 } rcl_publisher_event_type_t;
36 
37 typedef enum rcl_subscription_event_type_t
38 {
39  RCL_SUBSCRIPTION_REQUESTED_DEADLINE_MISSED,
40  RCL_SUBSCRIPTION_LIVELINESS_CHANGED,
41  RCL_SUBSCRIPTION_REQUESTED_INCOMPATIBLE_QOS,
42 } rcl_subscription_event_type_t;
43 
45 typedef struct rmw_event_t rmw_event_t;
46 
48 struct rcl_event_impl_t;
49 
51 typedef struct rcl_event_t
52 {
54  struct rcl_event_impl_t * impl;
55 } rcl_event_t;
56 
58 
62 RCL_PUBLIC
63 RCL_WARN_UNUSED
65 rcl_get_zero_initialized_event(void);
66 
68 
80 RCL_PUBLIC
81 RCL_WARN_UNUSED
82 rcl_ret_t
83 rcl_publisher_event_init(
84  rcl_event_t * event,
85  const rcl_publisher_t * publisher,
86  const rcl_publisher_event_type_t event_type);
87 
89 
101 RCL_PUBLIC
102 RCL_WARN_UNUSED
103 rcl_ret_t
104 rcl_subscription_event_init(
105  rcl_event_t * event,
106  const rcl_subscription_t * subscription,
107  const rcl_subscription_event_type_t event_type);
108 
109 // Take event using the event handle.
121 RCL_PUBLIC
122 RCL_WARN_UNUSED
123 rcl_ret_t
124 rcl_take_event(
125  const rcl_event_t * event,
126  void * event_info);
127 
128 // Finalize an event.
137 RCL_PUBLIC
138 RCL_WARN_UNUSED
139 rcl_ret_t
140 rcl_event_fini(rcl_event_t * event);
141 
143 
168 RCL_PUBLIC
169 RCL_WARN_UNUSED
170 rmw_event_t *
171 rcl_event_get_rmw_handle(const rcl_event_t * event);
172 
173 #ifdef __cplusplus
174 }
175 #endif
176 
177 #endif // RCL__EVENT_H_
rcl_publisher_t
Structure which encapsulates a ROS Publisher.
Definition: publisher.h:33
rcl_event_t::impl
struct rcl_event_impl_t * impl
Pointer to the event implementation.
Definition: event.h:54
rcl_subscription_t
Structure which encapsulates a ROS Subscription.
Definition: subscription.h:35
rmw_event_t
rcl_event_t
Structure which encapsulates a ROS QoS event handle.
Definition: event.h:51