libgpiod 2.1.3
info-event.hpp
1/* SPDX-License-Identifier: LGPL-2.1-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
21namespace gpiod {
22
23class chip;
24class line_info;
25
34class info_event final
35{
36public:
37
41 enum class event_type
42 {
43 LINE_REQUESTED = 1,
45 LINE_RELEASED,
47 LINE_CONFIG_CHANGED,
49 };
50
55 info_event(const info_event& other);
56
61 info_event(info_event&& other) noexcept;
62
64
71
77 info_event& operator=(info_event&& other) noexcept;
78
84
89 ::std::uint64_t timestamp_ns() const noexcept;
90
96 const line_info& get_line_info() const noexcept;
97
98private:
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__ */
Represents a GPIO chip.
Definition: chip.hpp:42
Immutable object containing data about a single line info event.
Definition: info-event.hpp:35
info_event & operator=(const info_event &other)
Copy assignment operator.
info_event(info_event &&other) noexcept
Move constructor.
event_type type() const
Type of this event.
info_event & operator=(info_event &&other) noexcept
Move assignment operator.
const line_info & get_line_info() const noexcept
Get the new line information.
info_event(const info_event &other)
Copy constructor.
event_type
Types of info events.
Definition: info-event.hpp:42
::std::uint64_t timestamp_ns() const noexcept
Timestamp of the event as returned by the kernel.
Contains an immutable snapshot of the line's state at the time when the object of this class was inst...
Definition: line-info.hpp:35