libevdevxx 0.5.0
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 int
64 const noexcept;
65
66 std::filesystem::path
68 const;
69
70 std::optional<std::filesystem::path>
72 const;
73
74 std::filesystem::path
76 const;
77
78 std::optional<std::filesystem::path>
80 const;
81
82
83 void
84 write(Type type,
85 Code code,
86 int value);
87
88 void
89 write(TypeCode type_code,
90 int value);
91
92 void
93 write(const Event& event);
94
95
96 // convenience methods
97
98 void
100 int value);
101
102 void
104 int value);
105
106 void
108 int value);
109
110 void
112 int value);
113
114 void
116 int value);
117
118 void
120 int value);
121
122 void
124 int value);
125
126 void
128 int value);
129
130 void
132 int value);
133
134 void
136 int value);
137
138 void
140 int value);
141
142 void
144 int value);
145
146 void
148
149 }; // class Uinput
150
151} // namespace evdev
152
153#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:28