rcl  master
C API providing common ROS client library functionality.
event.h
Go to the documentation of this file.
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 
16 
17 #ifndef RCL__EVENT_H_
18 #define RCL__EVENT_H_
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include "rcl/client.h"
26 #include "rcl/macros.h"
27 #include "rcl/publisher.h"
28 #include "rcl/service.h"
29 #include "rcl/subscription.h"
30 #include "rcl/visibility_control.h"
31 
34 {
35  RCL_PUBLISHER_OFFERED_DEADLINE_MISSED,
36  RCL_PUBLISHER_LIVELINESS_LOST,
37  RCL_PUBLISHER_OFFERED_INCOMPATIBLE_QOS,
39 
42 {
43  RCL_SUBSCRIPTION_REQUESTED_DEADLINE_MISSED,
44  RCL_SUBSCRIPTION_LIVELINESS_CHANGED,
45  RCL_SUBSCRIPTION_REQUESTED_INCOMPATIBLE_QOS,
46  RCL_SUBSCRIPTION_MESSAGE_LOST,
48 
50 typedef struct rmw_event_t rmw_event_t;
51 
53 struct rcl_event_impl_t;
54 
56 typedef struct rcl_event_t
57 {
59  struct rcl_event_impl_t * impl;
60 } rcl_event_t;
61 
63 
69 RCL_PUBLIC
70 RCL_WARN_UNUSED
73 
75 
87 RCL_PUBLIC
88 RCL_WARN_UNUSED
91  rcl_event_t * event,
92  const rcl_publisher_t * publisher,
93  const rcl_publisher_event_type_t event_type);
94 
96 
108 RCL_PUBLIC
109 RCL_WARN_UNUSED
110 rcl_ret_t
112  rcl_event_t * event,
113  const rcl_subscription_t * subscription,
114  const rcl_subscription_event_type_t event_type);
115 
116 // Take event using the event handle.
128 RCL_PUBLIC
129 RCL_WARN_UNUSED
130 rcl_ret_t
132  const rcl_event_t * event,
133  void * event_info);
134 
135 // Finalize an event.
144 RCL_PUBLIC
145 RCL_WARN_UNUSED
146 rcl_ret_t
147 rcl_event_fini(rcl_event_t * event);
148 
150 
175 RCL_PUBLIC
176 RCL_WARN_UNUSED
177 rmw_event_t *
179 
181 
198 RCL_PUBLIC
199 bool
200 rcl_event_is_valid(const rcl_event_t * event);
201 
202 #ifdef __cplusplus
203 }
204 #endif
205 
206 #endif // RCL__EVENT_H_
rcl_get_zero_initialized_event
rcl_event_t rcl_get_zero_initialized_event(void)
Return a rcl_event_t struct with members set to NULL.
rcl_subscription_event_type_t
rcl_subscription_event_type_t
Enumeration of all of the subscription events that may fire.
Definition: event.h:41
rcl_publisher_event_type_t
rcl_publisher_event_type_t
Enumeration of all of the publisher events that may fire.
Definition: event.h:33
rcl_subscription_event_init
rcl_ret_t rcl_subscription_event_init(rcl_event_t *event, const rcl_subscription_t *subscription, const rcl_subscription_event_type_t event_type)
Initialize an rcl_event_t with a subscription.
rcl_ret_t
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:23
service.h
rcl_event_fini
rcl_ret_t rcl_event_fini(rcl_event_t *event)
subscription.h
rcl_event_get_rmw_handle
rmw_event_t * rcl_event_get_rmw_handle(const rcl_event_t *event)
Return the rmw event handle.
rcl_publisher_t
Structure which encapsulates a ROS Publisher.
Definition: publisher.h:35
rcl_event_t
struct rcl_event_t rcl_event_t
Structure which encapsulates a ROS QoS event handle.
publisher.h
rcl_event_t::impl
struct rcl_event_impl_t * impl
Pointer to the event implementation.
Definition: event.h:59
rcl_subscription_t
Structure which encapsulates a ROS Subscription.
Definition: subscription.h:37
rcl_take_event
rcl_ret_t rcl_take_event(const rcl_event_t *event, void *event_info)
rmw_event_t
rcl_event_t
Structure which encapsulates a ROS QoS event handle.
Definition: event.h:56
rcl_publisher_event_init
rcl_ret_t rcl_publisher_event_init(rcl_event_t *event, const rcl_publisher_t *publisher, const rcl_publisher_event_type_t event_type)
Initialize an rcl_event_t with a publisher.
rcl_event_is_valid
bool rcl_event_is_valid(const rcl_event_t *event)
Check that the event is valid.
client.h