summaryrefslogtreecommitdiff
path: root/include/libcamera/base
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-06-25 02:06:55 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-06-25 16:11:10 +0100
commitf9ee72430735f749fb7d8fd4a8fe01ca88dc1f88 (patch)
tree3de5662a1ad584c4e69449fe8b00cdfedae8399c /include/libcamera/base
parentb304bc013ef8022131ef0a146f20c6bad7ac45d5 (diff)
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>
Diffstat (limited to 'include/libcamera/base')
-rw-r--r--include/libcamera/base/event_notifier.h48
-rw-r--r--include/libcamera/base/meson.build1
2 files changed, 49 insertions, 0 deletions
diff --git a/include/libcamera/base/event_notifier.h b/include/libcamera/base/event_notifier.h
new file mode 100644
index 00000000..5aa2784a
--- /dev/null
+++ b/include/libcamera/base/event_notifier.h
@@ -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__ */
diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build
index 6fc6c138..83c664af 100644
--- a/include/libcamera/base/meson.build
+++ b/include/libcamera/base/meson.build
@@ -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',