Loading...
Searching...
No Matches
line-request.hpp
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> */
#ifndef __LIBGPIOD_CXX_LINE_REQUEST_HPP__
#define __LIBGPIOD_CXX_LINE_REQUEST_HPP__
#if !defined(__LIBGPIOD_GPIOD_CXX_INSIDE__)
#error "Only gpiod.hpp can be included directly."
#endif
#include <chrono>
#include <cstddef>
#include <iostream>
#include <memory>
#include "misc.hpp"
namespace gpiod {
class chip;
class edge_event;
class edge_event_buffer;
class line_config;
class line_request final
{
public:
line_request(const line_request& other) = delete;
line_request(line_request&& other) noexcept;
~line_request();
line_request& operator=(const line_request& other) = delete;
line_request& operator=(line_request&& other) noexcept;
explicit operator bool() const noexcept;
void release();
::std::string chip_name() const;
::std::size_t num_lines() const;
line::offsets offsets() const;
line::value get_value(line::offset offset);
line::values get_values(const line::offsets& offsets);
line::values get_values();
void get_values(const line::offsets& offsets, line::values& values);
void get_values(line::values& values);
line_request& set_value(line::offset offset, line::value value);
line_request& set_values(const line::value_mappings& values);
line_request& set_values(const line::offsets& offsets, const line::values& values);
line_request& set_values(const line::values& values);
line_request& reconfigure_lines(const line_config& config);
int fd() const;
bool wait_edge_events(const ::std::chrono::nanoseconds& timeout) const;
::std::size_t read_edge_events(edge_event_buffer& buffer);
::std::size_t read_edge_events(edge_event_buffer& buffer, ::std::size_t max_events);
private:
line_request();
struct impl;
::std::unique_ptr<impl> _m_priv;
friend request_builder;
};
::std::ostream& operator<<(::std::ostream& out, const line_request& request);
} /* namespace gpiod */
#endif /* __LIBGPIOD_CXX_LINE_REQUEST_HPP__ */
gpiod::chip
Represents a GPIO chip.
Definition chip.hpp:37
gpiod::edge_event_buffer
Object into which edge events are read for better performance.
Definition edge-event-buffer.hpp:33
gpiod::edge_event
Immutable object containing data about a single edge event.
Definition edge-event.hpp:29
gpiod::line_config
Contains a set of line config options used in line requests and reconfiguration.
Definition line-config.hpp:29
gpiod::line_request
Stores the context of a set of requested GPIO lines.
Definition line-request.hpp:33
gpiod::line_request::get_values
line::values get_values(const line::offsets &offsets)
Get the values of a subset of requested lines.
gpiod::line_request::~line_request
~line_request()
gpiod::line_request::release
void release()
Release the requested lines and free all associated resources.
gpiod::line_request::set_values
line_request & set_values(const line::value_mappings &values)
Set the values of a subset of requested lines.
gpiod::line_request::operator=
line_request & operator=(line_request &&other) noexcept
Move assignment operator.
gpiod::line_request::line_request
line_request(line_request &&other) noexcept
Move constructor.
gpiod::line_request::read_edge_events
::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.
gpiod::line_request::wait_edge_events
bool wait_edge_events(const ::std::chrono::nanoseconds &timeout) const
Wait for edge events on any of the lines requested with edge detection enabled.
gpiod::line_request::offsets
line::offsets offsets() const
Get the list of offsets of requested lines.
gpiod::line_request::chip_name
::std::string chip_name() const
Get the name of the chip this request was made on.
gpiod::line_request::line_request
line_request(const line_request &other)=delete
gpiod::line_request::operator=
line_request & operator=(const line_request &other)=delete
gpiod::line_request::fd
int fd() const
Get the file descriptor number associated with this line request.
gpiod::line_request::num_lines
::std::size_t num_lines() const
Get the number of requested lines.
gpiod::line_request::reconfigure_lines
line_request & reconfigure_lines(const line_config &config)
Apply new config options to requested lines.
gpiod::line_request::set_value
line_request & set_value(line::offset offset, line::value value)
Set the value of a single requested line.
gpiod::line_request::get_value
line::value get_value(line::offset offset)
Get the value of a single requested line.
misc.hpp
gpiod::line
Namespace containing various type definitions for GPIO lines.
Definition line.hpp:24
gpiod
Definition chip-info.hpp:18