8 #ifndef __LIBGPIOD_GPIOD_CXX_HPP__ 9 #define __LIBGPIOD_GPIOD_CXX_HPP__ 105 GPIOD_API ::std::string
name(
void)
const;
111 GPIOD_API ::std::string
label(
void)
const;
171 GPIOD_API operator bool(
void)
const noexcept;
198 chip(::gpiod_chip* chip);
200 void throw_if_noref(
void)
const;
202 ::std::shared_ptr<::gpiod_chip> _m_chip;
266 GPIOD_API line(
const line& other) =
default;
297 GPIOD_API unsigned int offset(
void)
const;
303 GPIOD_API ::std::string
name(
void)
const;
310 GPIOD_API ::std::string consumer(
void)
const;
316 GPIOD_API int direction(
void)
const noexcept;
322 GPIOD_API int active_state(
void)
const noexcept;
335 GPIOD_API bool is_open_drain(
void)
const;
341 GPIOD_API bool is_open_source(
void)
const;
379 GPIOD_API bool event_wait(const ::std::chrono::nanoseconds& timeout)
const;
426 GPIOD_API operator bool(
void)
const noexcept;
457 line(::gpiod_line* line,
const chip& owner);
459 void throw_if_null(
void)
const;
461 ::gpiod_line* _m_line;
526 GPIOD_API line_bulk(
const line_bulk& other) =
default;
532 GPIOD_API line_bulk(line_bulk&& other) =
default;
580 GPIOD_API unsigned int size(
void)
const noexcept;
586 GPIOD_API bool empty(
void)
const noexcept;
600 const std::vector<int> default_vals = std::vector<int>())
const;
612 GPIOD_API ::std::vector<int> get_values(
void)
const;
619 GPIOD_API void set_values(const ::std::vector<int>& values)
const;
628 GPIOD_API line_bulk event_wait(const ::std::chrono::nanoseconds& timeout)
const;
634 GPIOD_API operator bool(
void)
const noexcept;
726 iterator(const ::std::vector<line>::iterator& it);
728 ::std::vector<line>::iterator _m_iter;
747 void throw_if_empty(
void)
const;
750 ::std::vector<line> _m_bulk;
856 ::std::shared_ptr<::gpiod_chip_iter> _m_iter;
898 GPIOD_API line_iter(
const line_iter& other) =
default;
904 GPIOD_API line_iter(line_iter&& other) =
default;
961 ::std::shared_ptr<::gpiod_line_iter> _m_iter;
static GPIOD_API const ::std::bitset< 32 > FLAG_OPEN_SOURCE
The line is an open-source port.
Assume the string is a path to the GPIO chardev.
GPIOD_API line find_line(const ::std::string &name) const
Get the line exposed by this chip by name.
Stores the configuration for line requests.
GPIOD_API line_bulk get_all_lines(void) const
Get all lines exposed by this chip.
GPIOD_API chip_iter make_chip_iter(void)
Create a new chip_iter.
static GPIOD_API const ::std::bitset< 32 > FLAG_OPEN_DRAIN
The line is an open-drain port.
::std::chrono::nanoseconds timestamp
Best estimate of time of event occurrence in nanoseconds.
::std::bitset< 32 > flags
Additional request flags.
Represents a single GPIO line.
Represents a set of GPIO lines.
Assume the string is the name of the chip.
#define GPIOD_API
Makes symbol visible.
GPIOD_API bool operator!(void) const noexcept
Check if this object doesn't hold a reference to a GPIO chip.
GPIOD_API void open(const ::std::string &device, int how=OPEN_LOOKUP)
Open a GPIO chip.
static GPIOD_API const unsigned int MAX_LINES
Max number of lines that this object can hold.
GPIOD_API line_bulk get_lines(const ::std::vector< unsigned int > &offsets) const
Get a set of lines exposed by this chip at given offsets.
int request_type
Type of the request.
GPIOD_API bool operator==(const chip &rhs) const noexcept
Equality operator.
GPIOD_API void reset(void) noexcept
Reset the internal smart pointer owned by this object.
GPIOD_API bool operator!=(const chip &rhs) const noexcept
Inequality operator.
Open based on the best guess what the supplied string is.
Allows to iterate over all lines owned by a GPIO chip.
GPIOD_API line get_line(unsigned int offset) const
Get the line exposed by this chip at given offset.
GPIOD_API line_iter end(const line_iter &iter) noexcept
Support for range-based loops for line iterators.
Iterator for iterating over lines held by line_bulk.
Helper structure for storing a set of GPIO line objects.
static GPIOD_API const ::std::bitset< 32 > FLAG_ACTIVE_LOW
Set the active state to 'low' (high is the default).
GPIOD_API chip(void)=default
Default constructor.
::std::string consumer
Consumer name to pass to the request.
GPIOD_API ::std::string label(void) const
Return the label of the chip held by this object.
Assume the string is the label of the GPIO chip.
Assume the string is the number of the GPIO chip.
line source
Line object referencing the GPIO line on which the event occurred.
GPIOD_API ~chip(void)=default
Destructor.
GPIOD_API unsigned int num_lines(void) const
Return the number of lines exposed by this chip.
int event_type
Type of the event that occurred.
GPIOD_API line_iter begin(line_iter iter) noexcept
Support for range-based loops for line iterators.
Describes a single GPIO line event.
Allows to iterate over all GPIO chips present on the system.
GPIOD_API ::std::string name(void) const
Return the name of the chip held by this object.
GPIOD_API chip & operator=(const chip &other)=default
Assignment operator.
GPIOD_API line_bulk find_lines(const ::std::vector<::std::string > &names) const
Get a set of lines exposed by this chip by their names.