libevdevxx 0.5.3
A C++ wrapper for libevdev.
Loading...
Searching...
No Matches
Uinput.hpp
Go to the documentation of this file.
1/*
2 * libevdevxx - a C++ wrapper for libevdev
3 *
4 * Copyright (C) 2025 Daniel K. O.
5 * SPDX-License-Identifier: MIT
6 */
7
8#ifndef LIBEVDEVXX_UINPUT_HPP
9#define LIBEVDEVXX_UINPUT_HPP
10
11#include <cstddef>
12#include <filesystem>
13#include <memory>
14#include <optional>
15
16#include <libevdev/libevdev-uinput.h>
17
18#include "basic_wrapper.hpp"
19#include "Device.hpp"
20#include "Event.hpp"
21
22
23namespace evdev {
24
26 class Uinput :
27 public detail::basic_wrapper<libevdev_uinput*> {
28
30
31 public:
32
33 Uinput(std::nullptr_t p = nullptr)
34 noexcept;
35
36 Uinput(const Device& dev,
37 int fd = LIBEVDEV_UINPUT_OPEN_MANAGED);
38
40 noexcept;
41
42
44 Uinput(Uinput&& other)
45 noexcept;
46
48 Uinput&
49 operator =(Uinput&& other)
50 noexcept;
51
52
53 void
54 create(const Device& dev,
55 int fd = LIBEVDEV_UINPUT_OPEN_MANAGED);
56
57 void
59 noexcept override;
60
61
62 [[nodiscard]]
63 int
65 const noexcept;
66
67 [[nodiscard]]
68 std::filesystem::path
70 const;
71
72 [[nodiscard]]
73 std::optional<std::filesystem::path>
75 const;
76
77 [[nodiscard]]
78 std::filesystem::path
80 const;
81
82 [[nodiscard]]
83 std::optional<std::filesystem::path>
85 const;
86
87
88 void
89 write(Type type,
90 Code code,
91 int value);
92
93 void
94 write(TypeCode type_code,
95 int value);
96
97 void
98 write(const Event& event);
99
100
101 // convenience methods
102
103 void
105 int value);
106
107 void
109 int value);
110
111 void
113 int value);
114
115 void
117 int value);
118
119 void
121 int value);
122
123 void
125 int value);
126
127 void
129 int value);
130
131 void
133 int value);
134
135 void
137 int value);
138
139 void
141 int value);
142
143 void
145 int value);
146
147 void
149 int value);
150
151 void
153
154 }; // class Uinput
155
156} // namespace evdev
157
158#endif
Represents a device (real or not).
Definition Device.hpp:46
Definition Type.hpp:26
void write_key(Code code, int value)
std::filesystem::path get_syspath() const
void create(const Device &dev, int fd=LIBEVDEV_UINPUT_OPEN_MANAGED)
void destroy() noexcept override
void write(Type type, Code code, int value)
void write_ff(Code code, int value)
void write_abs(Code code, int value)
Uinput(std::nullptr_t p=nullptr) noexcept
void write_ff_status(Code code, int value)
void write_syn(Code code, int value)
std::optional< std::filesystem::path > try_get_devnode() const
int get_fd() const noexcept
void write_pwr(Code code, int value)
void write_led(Code code, int value)
std::filesystem::path get_devnode() const
void write_msc(Code code, int value)
void write_snd(Code code, int value)
void write_rep(Code code, int value)
void write_rel(Code code, int value)
std::optional< std::filesystem::path > try_get_syspath() const
void write_sw(Code code, int value)
Definition basic_wrapper.hpp:21
The namespace of libevdevxx.
Definition AbsInfo.hpp:18
Definition TypeCode.hpp:20
Type-safe class for evdev codes (KEY_*, BTN_*, REL_*, etc).
Definition Code.hpp:30
Definition Event.hpp:27