Program Listing for File timer.h
↰ Return to documentation for file (include/rcl/timer.h
)
// Copyright 2015 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef RCL__TIMER_H_
#define RCL__TIMER_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdbool.h>
#include "rcl/allocator.h"
#include "rcl/context.h"
#include "rcl/event_callback.h"
#include "rcl/guard_condition.h"
#include "rcl/macros.h"
#include "rcl/time.h"
#include "rcl/types.h"
#include "rcutils/logging_macros.h"
#include "rmw/rmw.h"
typedef struct rcl_timer_impl_s rcl_timer_impl_t;
typedef struct rcl_timer_s
{
rcl_timer_impl_t * impl;
} rcl_timer_t;
typedef struct rcl_timer_on_reset_callback_data_s
{
rcl_event_callback_t on_reset_callback;
const void * user_data;
size_t reset_counter;
} rcl_timer_on_reset_callback_data_t;
typedef struct rcl_timer_call_info_s
{
rcl_time_point_value_t expected_call_time;
rcl_time_point_value_t actual_call_time;
} rcl_timer_call_info_t;
typedef void (* rcl_timer_callback_t)(rcl_timer_t *, int64_t);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_timer_t
rcl_get_zero_initialized_timer(void);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_init2(
rcl_timer_t * timer,
rcl_clock_t * clock,
rcl_context_t * context,
int64_t period,
const rcl_timer_callback_t callback,
rcl_allocator_t allocator,
bool autostart);
RCL_PUBLIC
RCUTILS_DEPRECATED_WITH_MSG("Call rcl_timer_init2 instead")
rcl_ret_t
rcl_timer_init(
rcl_timer_t * timer,
rcl_clock_t * clock,
rcl_context_t * context,
int64_t period,
const rcl_timer_callback_t callback,
rcl_allocator_t allocator);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_fini(rcl_timer_t * timer);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_call(rcl_timer_t * timer);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_call_with_info(rcl_timer_t * timer, rcl_timer_call_info_t * call_info);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_clock(const rcl_timer_t * timer, rcl_clock_t ** clock);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_is_ready(const rcl_timer_t * timer, bool * is_ready);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_get_time_until_next_call(const rcl_timer_t * timer, int64_t * time_until_next_call);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_get_next_call_time(const rcl_timer_t * timer, int64_t * next_call_time);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_get_time_since_last_call(const rcl_timer_t * timer, int64_t * time_since_last_call);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_get_period(const rcl_timer_t * timer, int64_t * period);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_exchange_period(const rcl_timer_t * timer, int64_t new_period, int64_t * old_period);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_timer_callback_t
rcl_timer_get_callback(const rcl_timer_t * timer);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_timer_callback_t
rcl_timer_exchange_callback(rcl_timer_t * timer, const rcl_timer_callback_t new_callback);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_cancel(rcl_timer_t * timer);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_is_canceled(const rcl_timer_t * timer, bool * is_canceled);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_reset(rcl_timer_t * timer);
RCL_PUBLIC
RCL_WARN_UNUSED
const rcl_allocator_t *
rcl_timer_get_allocator(const rcl_timer_t * timer);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_guard_condition_t *
rcl_timer_get_guard_condition(const rcl_timer_t * timer);
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_timer_set_on_reset_callback(
const rcl_timer_t * timer,
rcl_event_callback_t on_reset_callback,
const void * user_data);
#ifdef __cplusplus
}
#endif
#endif // RCL__TIMER_H_