libgpiod
|
Stores the context of a set of requested GPIO lines. More...
#include <line-request.hpp>
Public Member Functions | |
line_request (const line_request &other)=delete | |
line_request (line_request &&other) noexcept | |
Move constructor. | |
~line_request () | |
line_request & | operator= (const line_request &other)=delete |
line_request & | operator= (line_request &&other) noexcept |
Move assignment operator. | |
operator bool () const noexcept | |
Check if this object is valid. | |
void | release () |
Release the requested lines and free all associated resources. | |
::std::string | chip_name () const |
Get the name of the chip this request was made on. | |
::std::size_t | num_lines () const |
Get the number of requested lines. | |
line::offsets | offsets () const |
Get the list of offsets of requested lines. | |
line::value | get_value (line::offset offset) |
Get the value of a single requested line. | |
line::values | get_values (const line::offsets &offsets) |
Get the values of a subset of requested lines. | |
line::values | get_values () |
Get the values of all requested lines. | |
void | get_values (const line::offsets &offsets, line::values &values) |
Get the values of a subset of requested lines into a vector supplied by the caller. | |
void | get_values (line::values &values) |
Get the values of all requested lines. | |
line_request & | set_value (line::offset offset, line::value value) |
Set the value of a single requested line. | |
line_request & | set_values (const line::value_mappings &values) |
Set the values of a subset of requested lines. | |
line_request & | set_values (const line::offsets &offsets, const line::values &values) |
Set the values of a subset of requested lines. | |
line_request & | set_values (const line::values &values) |
Set the values of all requested lines. | |
line_request & | reconfigure_lines (const line_config &config) |
Apply new config options to requested lines. | |
int | fd () const |
Get the file descriptor number associated with this line request. | |
bool | wait_edge_events (const ::std::chrono::nanoseconds &timeout) const |
Wait for edge events on any of the lines requested with edge detection enabled. | |
::std::size_t | read_edge_events (edge_event_buffer &buffer) |
Read a number of edge events from this request up to the maximum capacity of the buffer. | |
::std::size_t | read_edge_events (edge_event_buffer &buffer, ::std::size_t max_events) |
Read a number of edge events from this request. | |
Stores the context of a set of requested GPIO lines.
|
delete |
|
noexcept |
Move constructor.
other | Object to move. |
gpiod::line_request::~line_request | ( | ) |
::std::string gpiod::line_request::chip_name | ( | ) | const |
Get the name of the chip this request was made on.
int gpiod::line_request::fd | ( | ) | const |
Get the file descriptor number associated with this line request.
line::value gpiod::line_request::get_value | ( | line::offset | offset | ) |
Get the value of a single requested line.
offset | Offset of the line to read within the chip. |
line::values gpiod::line_request::get_values | ( | ) |
Get the values of all requested lines.
line::values gpiod::line_request::get_values | ( | const line::offsets & | offsets | ) |
Get the values of a subset of requested lines.
offsets | Vector of line offsets |
void gpiod::line_request::get_values | ( | const line::offsets & | offsets, |
line::values & | values ) |
Get the values of a subset of requested lines into a vector supplied by the caller.
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. |
void gpiod::line_request::get_values | ( | line::values & | values | ) |
Get the values of all requested lines.
values | Array in which the values will be stored. Must hold at least the number of elements returned by line_request::num_lines. |
::std::size_t gpiod::line_request::num_lines | ( | ) | const |
Get the number of requested lines.
line::offsets gpiod::line_request::offsets | ( | ) | const |
Get the list of offsets of requested lines.
|
explicitnoexcept |
Check if this object is valid.
|
delete |
|
noexcept |
Move assignment operator.
other | Object to move. |
::std::size_t gpiod::line_request::read_edge_events | ( | edge_event_buffer & | buffer | ) |
Read a number of edge events from this request up to the maximum capacity of the buffer.
buffer | Edge event buffer to read events into. |
::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.
buffer | Edge event buffer to read events into. |
max_events | Maximum number of events to read. Limited by the capacity of the buffer. |
line_request & gpiod::line_request::reconfigure_lines | ( | const line_config & | config | ) |
Apply new config options to requested lines.
config | New configuration. |
void gpiod::line_request::release | ( | ) |
Release the requested lines and free all associated resources.
line_request & gpiod::line_request::set_value | ( | line::offset | offset, |
line::value | value ) |
Set the value of a single requested line.
offset | Offset of the line to set within the chip. |
value | New line value. |
line_request & gpiod::line_request::set_values | ( | const line::offsets & | offsets, |
const line::values & | values ) |
Set the values of a subset of requested lines.
offsets | Vector containing the offsets of lines to set. |
values | Vector containing new values with indexes corresponding with those in the offsets vector. |
line_request & gpiod::line_request::set_values | ( | const line::value_mappings & | values | ) |
Set the values of a subset of requested lines.
values | Vector containing a set of offset->value mappings. |
line_request & gpiod::line_request::set_values | ( | const line::values & | values | ) |
Set the values of all requested lines.
values | Array of new line values. The size must be equal to the value returned by line_request::num_lines. |
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.
timeout | Wait time limit in nanoseconds. If set to 0, the function returns immediately. If set to a negative number, the function blocks indefinitely until an event becomes available. |