libgpiod
Loading...
Searching...
No Matches
line-info.hpp
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-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
20namespace gpiod {
21
22class chip;
23class info_event;
24
29class line_info final
30{
31public:
32
37 line_info(const line_info& other) noexcept;
38
43 line_info(line_info&& other) noexcept;
44
46
52 line_info& operator=(const line_info& other) noexcept;
53
59 line_info& operator=(line_info&& other) noexcept;
60
65 line::offset offset() const noexcept;
66
72 ::std::string name() const noexcept;
73
82 bool used() const noexcept;
83
90 ::std::string consumer() const noexcept;
91
96 line::direction direction() const;
97
102 line::edge edge_detection() const;
103
109 line::bias bias() const;
110
116 line::drive drive() const;
117
122 bool active_low() const noexcept;
123
129 bool debounced() const noexcept;
130
136 ::std::chrono::microseconds debounce_period() const noexcept;
137
143 line::clock event_clock() const;
144
145private:
146
147 line_info();
148
149 struct impl;
150
151 ::std::shared_ptr<impl> _m_priv;
152
153 friend chip;
154 friend info_event;
155};
156
163::std::ostream& operator<<(::std::ostream& out, const line_info& info);
164
165} /* namespace gpiod */
166
167#endif /* __LIBGPIOD_CXX_LINE_INFO_HPP__ */
Represents a GPIO chip.
Definition chip.hpp:37
Immutable object containing data about a single line info event.
Definition info-event.hpp:30
Wrapper around unsigned int for representing line offsets.
Definition line.hpp:30
Contains an immutable snapshot of the line's state at the time when the object of this class was inst...
Definition line-info.hpp:30
line_info(const line_info &other) noexcept
Copy constructor.
line::clock event_clock() const
Read the current event clock setting used for edge event timestamps.
bool debounced() const noexcept
Check if this line is debounced (either by hardware or by the kernel software debouncer).
line::drive drive() const
Read the GPIO line drive setting.
line_info & operator=(line_info &&other) noexcept
Move assignment operator.
line::offset offset() const noexcept
Get the hardware offset of the line.
line::direction direction() const
Read the GPIO line direction setting.
::std::chrono::microseconds debounce_period() const noexcept
Read the current debounce period in microseconds.
line::edge edge_detection() const
Read the current edge detection setting of this line.
::std::string consumer() const noexcept
Read the GPIO line consumer name.
line_info & operator=(const line_info &other) noexcept
Copy assignment operator.
::std::string name() const noexcept
Get the GPIO line name.
bool active_low() const noexcept
Check if the signal of this line is inverted.
line::bias bias() const
Read the GPIO line bias setting.
bool used() const noexcept
Check if the line is currently in use.
line_info(line_info &&other) noexcept
Move constructor.
Definition chip-info.hpp:18