Stores the context of a set of requested GPIO lines.
More...
#include <line-request.hpp>
Stores the context of a set of requested GPIO lines.
Definition at line 37 of file line-request.hpp.
◆ line_request()
Move constructor.
- Parameters
-
◆ fd()
int gpiod::line_request::fd |
( |
| ) |
const |
Get the file descriptor number associated with this line request.
- Returns
- File descriptor number.
◆ get_value()
Get the value of a single requested line.
- Parameters
-
offset | Offset of the line to read within the chip. |
- Returns
- Current line value.
◆ get_values() [1/4]
Get the values of all requested lines.
- Returns
- List of read values.
◆ get_values() [2/4]
Get the values of a subset of requested lines.
- Parameters
-
offsets | Vector of line offsets |
- Returns
- Vector of lines values with indexes of values corresponding to those of the offsets.
◆ get_values() [3/4]
Get the values of a subset of requested lines into a vector supplied by the caller.
- Parameters
-
offsets | Vector of line offsets. |
values | Vector for storing the values. Its size must be at least that of the offsets vector. The indexes of read values will correspond with those in the offsets vector. |
◆ get_values() [4/4]
void gpiod::line_request::get_values |
( |
line::values & |
values | ) |
|
Get the values of all requested lines.
- Parameters
-
values | Array in which the values will be stored. Must hold at least the number of elements returned by line_request::num_lines. |
◆ num_lines()
::std::size_t gpiod::line_request::num_lines |
( |
| ) |
const |
Get the number of requested lines.
- Returns
- Number of lines in this request.
◆ offsets()
Get the list of offsets of requested lines.
- Returns
- List of hardware offsets of the lines in this request.
◆ operator bool()
gpiod::line_request::operator bool |
( |
| ) |
const |
|
explicitnoexcept |
Check if this object is valid.
- Returns
- True if this object's methods can be used, false otherwise. False usually means the request was released. If the user calls any of the methods of this class on an object for which this operator returned false, a logic_error will be thrown.
◆ operator=()
Move assignment operator.
- Parameters
-
- Returns
- Reference to self.
◆ read_edge_events() [1/2]
Read a number of edge events from this request up to the maximum capacity of the buffer.
- Parameters
-
buffer | Edge event buffer to read events into. |
- Returns
- Number of events read.
◆ read_edge_events() [2/2]
::std::size_t gpiod::line_request::read_edge_events |
( |
edge_event_buffer & |
buffer, |
|
|
::std::size_t |
max_events |
|
) |
| |
Read a number of edge events from this request.
- Parameters
-
buffer | Edge event buffer to read events into. |
max_events | Maximum number of events to read. Limited by the capacity of the buffer. |
- Returns
- Number of events read.
◆ reconfigure_lines()
Apply new config options to requested lines.
- Parameters
-
- Returns
- Reference to self.
◆ release()
void gpiod::line_request::release |
( |
| ) |
|
Release the GPIO chip and free all associated resources.
- Note
- The object can still be used after this method is called but using any of the mutators will result in throwing a logic_error exception.
◆ set_value()
Set the value of a single requested line.
- Parameters
-
offset | Offset of the line to set within the chip. |
value | New line value. |
- Returns
- Reference to self.
◆ set_values() [1/3]
Set the values of a subset of requested lines.
- Parameters
-
offsets | Vector containing the offsets of lines to set. |
values | Vector containing new values with indexes corresponding with those in the offsets vector. |
- Returns
- Reference to self.
◆ set_values() [2/3]
Set the values of a subset of requested lines.
- Parameters
-
values | Vector containing a set of offset->value mappings. |
- Returns
- Reference to self.
◆ set_values() [3/3]
Set the values of all requested lines.
- Parameters
-
- Returns
- Reference to self.
◆ wait_edge_events()
bool gpiod::line_request::wait_edge_events |
( |
const ::std::chrono::nanoseconds & |
timeout | ) |
const |
Wait for edge events on any of the lines requested with edge detection enabled.
- Parameters
-
timeout | Wait time limit in nanoseconds. |
- Returns
- True if at least one event is ready to be read. False if the wait timed out.
The documentation for this class was generated from the following file: