![]() |
libvirtualhid 17
Cross-platform C++ library for virtual HID devices.
|
Virtual gamepad device handle. More...
#include <src/include/libvirtualhid/runtime.hpp>
Public Member Functions | |
| OperationStatus | close () override |
| Close the virtual device. | |
| DeviceId | device_id () const override |
| Get the device identifier assigned by the runtime. | |
| std::vector< DeviceNode > | device_nodes () const override |
| Get platform-visible nodes associated with the device. | |
| OperationStatus | dispatch_output (const GamepadOutput &output) |
| Dispatch an output event to the registered callback. | |
| Gamepad (const Gamepad &)=delete | |
| Copy construction is disabled because the handle owns device lifetime. | |
| Gamepad (detail::RuntimeConstructionToken token, std::shared_ptr< detail::GamepadDevice > device) | |
| Construct a gamepad handle for Runtime-owned state. | |
| Gamepad (Gamepad &&other) noexcept | |
| Move construct a gamepad handle. | |
| bool | is_open () const override |
| Check whether the device is open. | |
| std::vector< std::uint8_t > | last_input_report () const |
| Get the most recently packed input report. | |
| GamepadState | last_submitted_state () const |
| Get the most recently submitted gamepad state. | |
| const GamepadMetadata & | metadata () const |
| Get the metadata supplied when the gamepad was created. | |
| Gamepad & | operator= (const Gamepad &)=delete |
| Copy assignment is disabled because the handle owns device lifetime. | |
| Gamepad & | operator= (Gamepad &&other) noexcept |
| Move assign a gamepad handle. | |
| const DeviceProfile & | profile () const override |
| Get the profile used to create this device. | |
| void | set_output_callback (const OutputCallback &callback) |
| Register a callback for backend output events. | |
| OperationStatus | submit (const GamepadState &state) |
| Submit the latest gamepad input state. | |
| std::size_t | submit_count () const |
| Get the number of successful submit operations. | |
| ~Gamepad () override | |
| Destroy the gamepad handle and close the virtual device if it is still open. | |
Public Member Functions inherited from lvh::VirtualDevice | |
| virtual | ~VirtualDevice ()=default |
| Destroy the virtual device handle. | |
Virtual gamepad device handle.
|
noexcept |
Move construct a gamepad handle.
| other | Handle to move from. |
| lvh::Gamepad::Gamepad | ( | detail::RuntimeConstructionToken | token, |
| std::shared_ptr< detail::GamepadDevice > | device ) |
Construct a gamepad handle for Runtime-owned state.
| token | Runtime construction token. |
| device | Shared gamepad state. |
|
overridevirtual |
|
overridevirtual |
Get the device identifier assigned by the runtime.
Implements lvh::VirtualDevice.
|
overridevirtual |
Get platform-visible nodes associated with the device.
Implements lvh::VirtualDevice.
| OperationStatus lvh::Gamepad::dispatch_output | ( | const GamepadOutput & | output | ) |
Dispatch an output event to the registered callback.
| output | Output event. |
|
overridevirtual |
Check whether the device is open.
true when the device can accept operations. Implements lvh::VirtualDevice.
| std::vector< std::uint8_t > lvh::Gamepad::last_input_report | ( | ) | const |
Get the most recently packed input report.
| GamepadState lvh::Gamepad::last_submitted_state | ( | ) | const |
Get the most recently submitted gamepad state.
| const GamepadMetadata & lvh::Gamepad::metadata | ( | ) | const |
Get the metadata supplied when the gamepad was created.
Copy assignment is disabled because the handle owns device lifetime.
Move assign a gamepad handle.
| other | Handle to move from. |
|
overridevirtual |
| void lvh::Gamepad::set_output_callback | ( | const OutputCallback & | callback | ) |
Register a callback for backend output events.
| callback | Output callback copied into the handle. Passing an empty callback clears it. |
| OperationStatus lvh::Gamepad::submit | ( | const GamepadState & | state | ) |
Submit the latest gamepad input state.
| state | Gamepad input state. |
| std::size_t lvh::Gamepad::submit_count | ( | ) | const |
Get the number of successful submit operations.