libgpiod  2.1
info-event.hpp
1 /* SPDX-License-Identifier: LGPL-3.0-or-later */
2 /* SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> */
3 
8 #ifndef __LIBGPIOD_CXX_INFO_EVENT_HPP__
9 #define __LIBGPIOD_CXX_INFO_EVENT_HPP__
10 
11 #if !defined(__LIBGPIOD_GPIOD_CXX_INSIDE__)
12 #error "Only gpiod.hpp can be included directly."
13 #endif
14 
15 #include <cstdint>
16 #include <iostream>
17 #include <memory>
18 
19 #include "timestamp.hpp"
20 
21 namespace gpiod {
22 
23 class chip;
24 class line_info;
25 
34 class info_event final
35 {
36 public:
37 
41  enum class event_type
42  {
43  LINE_REQUESTED = 1,
49  };
50 
55  info_event(const info_event& other);
56 
61  info_event(info_event&& other) noexcept;
62 
63  ~info_event();
64 
70  info_event& operator=(const info_event& other);
71 
77  info_event& operator=(info_event&& other) noexcept;
78 
83  event_type type() const;
84 
89  ::std::uint64_t timestamp_ns() const noexcept;
90 
96  const line_info& get_line_info() const noexcept;
97 
98 private:
99 
100  info_event();
101 
102  struct impl;
103 
104  ::std::shared_ptr<impl> _m_priv;
105 
106  friend chip;
107 };
108 
115 ::std::ostream& operator<<(::std::ostream& out, const info_event& event);
116 
121 } /* namespace gpiod */
122 
123 #endif /* __LIBGPIOD_CXX_INFO_EVENT_HPP__ */
event_type
Types of info events.
Definition: info-event.hpp:41
event_type type() const
Type of this event.
Previously requested line has been released.
Immutable object containing data about a single line info event.
Definition: info-event.hpp:34
::std::uint64_t timestamp_ns() const noexcept
Timestamp of the event as returned by the kernel.
Represents a GPIO chip.
Definition: chip.hpp:41
Contains an immutable snapshot of the line's state at the time when the object of this class was inst...
Definition: line-info.hpp:34
const line_info & get_line_info() const noexcept
Get the new line information.