libcamera  v0.0.0+100-debian/0_git20200629+e7aa92a-8-9-g77f5237c-dirty (2021-05-05T16:20:29+01:00)
Supporting cameras in Linux since 2019
event_notifier.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /*
3  * Copyright (C) 2019, Google Inc.
4  *
5  * event_notifier.h - File descriptor event notifier
6  */
7 #ifndef __LIBCAMERA_INTERNAL_EVENT_NOTIFIER_H__
8 #define __LIBCAMERA_INTERNAL_EVENT_NOTIFIER_H__
9 
10 #include <libcamera/object.h>
11 #include <libcamera/signal.h>
12 
13 namespace libcamera {
14 
15 class Message;
16 
17 class EventNotifier : public Object
18 {
19 public:
20  enum Type {
24  };
25 
26  EventNotifier(int fd, Type type, Object *parent = nullptr);
27  virtual ~EventNotifier();
28 
29  Type type() const { return type_; }
30  int fd() const { return fd_; }
31 
32  bool enabled() const { return enabled_; }
33  void setEnabled(bool enable);
34 
36 
37 protected:
38  void message(Message *msg) override;
39 
40 private:
41  int fd_;
42  Type type_;
43  bool enabled_;
44 };
45 
46 } /* namespace libcamera */
47 
48 #endif /* __LIBCAMERA_INTERNAL_EVENT_NOTIFIER_H__ */
Type type() const
Retrieve the type of the event being monitored.
Definition: event_notifier.h:29
Type
Definition: event_notifier.h:20
void setEnabled(bool enable)
Enable or disable the notifier.
Definition: event_notifier.cpp:105
Top-level libcamera namespace.
Definition: bound_method.h:15
Signal & slot implementation.
A message that can be posted to a Thread.
Definition: message.h:21
int fd() const
Retrieve the file descriptor being monitored.
Definition: event_notifier.h:30
Signal< EventNotifier * > activated
Signal emitted when the event occurs.
Definition: event_notifier.h:35
Definition: event_notifier.h:22
Base object to support automatic signal disconnection.
Object * parent() const
Retrieve the object&#39;s parent.
Definition: object.h:47
Generic signal and slot communication mechanism.
Definition: object.h:20
Notify of activity on a file descriptor.
Definition: event_notifier.h:17
Definition: event_notifier.h:21
bool enabled() const
Retrieve the notifier state.
Definition: event_notifier.h:32
Definition: event_notifier.h:23
EventNotifier(int fd, Type type, Object *parent=nullptr)
Construct an event notifier with a file descriptor and event type.
Definition: event_notifier.cpp:66
Base object to support automatic signal disconnection.
Definition: object.h:24
void message(Message *msg) override
Message handler for the object.
Definition: event_notifier.cpp:128