summaryrefslogtreecommitdiff
path: root/test/file-descriptor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/file-descriptor.cpp')
0 files changed, 0 insertions, 0 deletions
'>50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2019, Google Inc.
 *
 * event_dispatcher.cpp - Event dispatcher
 */

#include <libcamera/base/event_dispatcher.h>
#include <libcamera/base/log.h>

/**
 * \file base/event_dispatcher.h
 */

namespace libcamera {

LOG_DEFINE_CATEGORY(Event)

/**
 * \class EventDispatcher
 * \brief Interface to manage the libcamera events and timers
 *
 * The EventDispatcher class allows the integration of the application event
 * loop with libcamera by abstracting how events and timers are managed and
 * processed.
 *
 * To listen to events, libcamera creates EventNotifier instances and registers
 * them with the dispatcher with registerEventNotifier(). The event notifier
 * \ref EventNotifier::activated signal is then emitted by the dispatcher
 * whenever the event is detected.
 *
 * To set timers, libcamera creates Timer instances and registers them with the
 * dispatcher with registerTimer(). The timer \ref Timer::timeout signal is then
 * emitted by the dispatcher when the timer times out.
 */

EventDispatcher::~EventDispatcher()
{
}

/**
 * \fn EventDispatcher::registerEventNotifier()
 * \brief Register an event notifier
 * \param[in] notifier The event notifier to register
 *
 * Once the \a notifier is registered with the dispatcher, the dispatcher will
 * emit the notifier \ref EventNotifier::activated signal whenever a
 * corresponding event is detected on the notifier's file descriptor. The event
 * is monitored until the notifier is unregistered with
 * unregisterEventNotifier().
 *
 * Registering multiple notifiers for the same file descriptor and event type is
 * not allowed and results in undefined behaviour.
 */

/**
 * \fn EventDispatcher::unregisterEventNotifier()
 * \brief Unregister an event notifier
 * \param[in] notifier The event notifier to unregister
 *
 * After this function returns the \a notifier is guaranteed not to emit the
 * \ref EventNotifier::activated signal.
 *
 * If the notifier isn't registered, this function performs no operation.
 */

/**
 * \fn EventDispatcher::registerTimer()
 * \brief Register a timer
 * \param[in] timer The timer to register
 *
 * Once the \a timer is registered with the dispatcher, the dispatcher will emit
 * the timer \ref Timer::timeout signal when the timer times out. The timer can
 * be unregistered with unregisterTimer() before it times out, in which case the
 * signal will not be emitted.
 *
 * When the \a timer times out, it is automatically unregistered by the
 * dispatcher and can be registered back as early as from the \ref Timer::timeout
 * signal handlers.
 *
 * Registering the same timer multiple times is not allowed and results in
 * undefined behaviour.
 */

/**
 * \fn EventDispatcher::unregisterTimer()
 * \brief Unregister a timer
 * \param[in] timer The timer to unregister
 *
 * After this function returns the \a timer is guaranteed not to emit the
 * \ref Timer::timeout signal.
 *
 * If the timer isn't registered, this function performs no operation.
 */