libcamera/include/libcamera/internal/event_notifier.h
Kieran Bingham 27aff949fb libcamera/base: Move extended base functionality
Move the functionality for the following components to the new
base support library:

 - BoundMethod
 - EventDispatcher
 - EventDispatcherPoll
 - Log
 - Message
 - Object
 - Signal
 - Semaphore
 - Thread
 - Timer

While it would be preferable to see these split to move one component
per commit, these components are all interdependent upon each other,
which leaves us with one big change performing the move for all of them.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:08 +01:00

48 lines
903 B
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* event_notifier.h - File descriptor event notifier
*/
#ifndef __LIBCAMERA_INTERNAL_EVENT_NOTIFIER_H__
#define __LIBCAMERA_INTERNAL_EVENT_NOTIFIER_H__
#include <libcamera/base/object.h>
#include <libcamera/base/signal.h>
namespace libcamera {
class Message;
class EventNotifier : public Object
{
public:
enum Type {
Read,
Write,
Exception,
};
EventNotifier(int fd, Type type, Object *parent = nullptr);
virtual ~EventNotifier();
Type type() const { return type_; }
int fd() const { return fd_; }
bool enabled() const { return enabled_; }
void setEnabled(bool enable);
Signal<EventNotifier *> activated;
protected:
void message(Message *msg) override;
private:
int fd_;
Type type_;
bool enabled_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_INTERNAL_EVENT_NOTIFIER_H__ */