libcamera/base: Move event_notifier to base
Move the event notifier, and associated header updates. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
/*
|
||||
* Copyright (C) 2019, Google Inc.
|
||||
*
|
||||
* event_notifier.h - File descriptor event notifier
|
||||
*/
|
||||
#ifndef __LIBCAMERA_BASE_EVENT_NOTIFIER_H__
|
||||
#define __LIBCAMERA_BASE_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_BASE_EVENT_NOTIFIER_H__ */
|
||||
@@ -7,6 +7,7 @@ libcamera_base_headers = files([
|
||||
'class.h',
|
||||
'event_dispatcher.h',
|
||||
'event_dispatcher_poll.h',
|
||||
'event_notifier.h',
|
||||
'file.h',
|
||||
'log.h',
|
||||
'message.h',
|
||||
|
||||
Reference in New Issue
Block a user