libgpiod  2.1
line-info.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-3.0-or-later */
2 /* SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> */
3 
8 #ifndef __LIBGPIOD_CXX_LINE_INFO_HPP__
9 #define __LIBGPIOD_CXX_LINE_INFO_HPP__
10 
11 #if !defined(__LIBGPIOD_GPIOD_CXX_INSIDE__)
12 #error "Only gpiod.hpp can be included directly."
13 #endif
14 
15 #include <chrono>
16 #include <iostream>
17 #include <memory>
18 #include <string>
19 
20 namespace gpiod {
21 
22 class chip;
23 class info_event;
24 
34 class line_info final
35 {
36 public:
37 
42  line_info(const line_info& other) noexcept;
43 
48  line_info(line_info&& other) noexcept;
49 
50  ~line_info();
51 
57  line_info& operator=(const line_info& other) noexcept;
58 
64  line_info& operator=(line_info&& other) noexcept;
65 
70  line::offset offset() const noexcept;
71 
77  ::std::string name() const noexcept;
78 
87  bool used() const noexcept;
88 
95  ::std::string consumer() const noexcept;
96 
101  line::direction direction() const;
102 
107  line::edge edge_detection() const;
108 
114  line::bias bias() const;
115 
121  line::drive drive() const;
122 
127  bool active_low() const noexcept;
128 
134  bool debounced() const noexcept;
135 
141  ::std::chrono::microseconds debounce_period() const noexcept;
142 
148  line::clock event_clock() const;
149 
150 private:
151 
152  line_info();
153 
154  struct impl;
155 
156  ::std::shared_ptr<impl> _m_priv;
157 
158  friend chip;
159  friend info_event;
160 };
161 
168 ::std::ostream& operator<<(::std::ostream& out, const line_info& info);
169 
174 } /* namespace gpiod */
175 
176 #endif /* __LIBGPIOD_CXX_LINE_INFO_HPP__ */
bool active_low() const noexcept
Check if the signal of this line is inverted.
edge
Edge detection settings.
Definition: line.hpp:110
::std::string name() const noexcept
Get the GPIO line name.
bool used() const noexcept
Check if the line is currently in use.
line::drive drive() const
Read the GPIO line drive setting.
::std::chrono::microseconds debounce_period() const noexcept
Read the current debounce period in microseconds.
Immutable object containing data about a single line info event.
Definition: info-event.hpp:34
line::offset offset() const noexcept
Get the hardware offset of the line.
line_info & operator=(const line_info &other) noexcept
Copy assignment operator.
bool debounced() const noexcept
Check if this line is debounced (either by hardware or by the kernel software debouncer).
line::clock event_clock() const
Read the current event clock setting used for edge event timestamps.
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
::std::string consumer() const noexcept
Read the GPIO line consumer name.
line::edge edge_detection() const
Read the current edge detection setting of this line.
direction
Direction settings.
Definition: line.hpp:97
clock
Event clock settings.
Definition: line.hpp:155
bias
Internal bias settings.
Definition: line.hpp:125
line::bias bias() const
Read the GPIO line bias setting.
line::direction direction() const
Read the GPIO line direction setting.
Wrapper around unsigned int for representing line offsets.
Definition: line.hpp:34
drive
Drive settings.
Definition: line.hpp:142