Loading...
Searching...
No Matches
request-builder.hpp
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> */
#ifndef __LIBGPIOD_CXX_REQUEST_BUILDER_HPP__
#define __LIBGPIOD_CXX_REQUEST_BUILDER_HPP__
#if !defined(__LIBGPIOD_GPIOD_CXX_INSIDE__)
#error "Only gpiod.hpp can be included directly."
#endif
#include <memory>
#include <ostream>
namespace gpiod {
class chip;
class line_config;
class line_request;
class request_config;
class request_builder final
{
public:
request_builder(const request_builder& other) = delete;
request_builder(request_builder&& other) noexcept;
~request_builder();
request_builder& operator=(const request_builder& other) = delete;
request_builder& operator=(request_builder&& other) noexcept;
request_builder& set_request_config(request_config& req_cfg);
const request_config& get_request_config() const noexcept;
request_builder& set_consumer(const ::std::string& consumer) noexcept;
request_builder& set_event_buffer_size(::std::size_t event_buffer_size) noexcept;
request_builder& set_line_config(line_config &line_cfg);
const line_config& get_line_config() const noexcept;
request_builder& add_line_settings(line::offset offset, const line_settings& settings);
request_builder& add_line_settings(const line::offsets& offsets, const line_settings& settings);
request_builder& set_output_values(const line::values& values);
line_request do_request();
private:
struct impl;
request_builder(chip& chip);
::std::unique_ptr<impl> _m_priv;
friend chip;
friend ::std::ostream& operator<<(::std::ostream& out, const request_builder& builder);
};
::std::ostream& operator<<(::std::ostream& out, const request_builder& builder);
} /* namespace gpiod */
#endif /* __LIBGPIOD_CXX_REQUEST_BUILDER_HPP__ */
gpiod::chip
Represents a GPIO chip.
Definition chip.hpp:37
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_settings
Stores GPIO line settings.
Definition line-settings.hpp:28
gpiod::request_builder
Intermediate object storing the configuration for a line request.
Definition request-builder.hpp:29
gpiod::request_builder::set_event_buffer_size
request_builder & set_event_buffer_size(::std::size_t event_buffer_size) noexcept
Set the event buffer size in the request config stored by this object.
gpiod::request_builder::operator=
request_builder & operator=(const request_builder &other)=delete
gpiod::request_builder::set_line_config
request_builder & set_line_config(line_config &line_cfg)
Set the line config for this request.
gpiod::request_builder::~request_builder
~request_builder()
gpiod::request_builder::operator=
request_builder & operator=(request_builder &&other) noexcept
Move assignment operator.
gpiod::request_builder::get_request_config
const request_config & get_request_config() const noexcept
Get the current request config.
gpiod::request_builder::add_line_settings
request_builder & add_line_settings(line::offset offset, const line_settings &settings)
Add line settings to the line config stored by this object for a single offset.
gpiod::request_builder::get_line_config
const line_config & get_line_config() const noexcept
Get the current line config.
gpiod::request_builder::set_consumer
request_builder & set_consumer(const ::std::string &consumer) noexcept
Set consumer in the request config stored by this object.
gpiod::request_builder::do_request
line_request do_request()
Make the line request.
gpiod::request_builder::request_builder
request_builder(request_builder &&other) noexcept
Move constructor.
gpiod::request_builder::request_builder
request_builder(const request_builder &other)=delete
gpiod::request_builder::set_output_values
request_builder & set_output_values(const line::values &values)
Set output values for a number of lines in the line config stored by this object.
gpiod::request_builder::set_request_config
request_builder & set_request_config(request_config &req_cfg)
Set the request config for the request.
gpiod::request_config
Stores a set of options passed to the kernel when making a line request.
Definition request-config.hpp:31
gpiod::line
Namespace containing various type definitions for GPIO lines.
Definition line.hpp:24
gpiod
Definition chip-info.hpp:18