libvirtualhid 16
Cross-platform C++ library for virtual HID devices.
lvh::Keyboard Class Referencefinal

Virtual keyboard device handle. More...

#include <src/include/libvirtualhid/runtime.hpp>

Inheritance diagram for lvh::Keyboard:
[legend]
Collaboration diagram for lvh::Keyboard:
[legend]

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< DeviceNodedevice_nodes () const override
 Get platform-visible nodes associated with the device.
 
bool is_open () const override
 Check whether the device is open.
 
 Keyboard (const Keyboard &)=delete
 Copy construction is disabled because the handle owns device lifetime.
 
 Keyboard (detail::RuntimeConstructionToken token, std::shared_ptr< detail::KeyboardDevice > device)
 Construct a keyboard handle for Runtime-owned state.
 
 Keyboard (Keyboard &&other) noexcept
 Move construct a keyboard handle.
 
KeyboardEvent last_submitted_event () const
 Get the most recently submitted keyboard event.
 
Keyboardoperator= (const Keyboard &)=delete
 Copy assignment is disabled because the handle owns device lifetime.
 
Keyboardoperator= (Keyboard &&other) noexcept
 Move assign a keyboard handle.
 
OperationStatus press (KeyboardKeyCode key_code)
 Press a keyboard key.
 
const DeviceProfileprofile () const override
 Get the profile used to create this device.
 
OperationStatus release (KeyboardKeyCode key_code)
 Release a keyboard key.
 
OperationStatus submit (const KeyboardEvent &event)
 Submit a keyboard key transition.
 
std::size_t submit_count () const
 Get the number of successful submit operations.
 
OperationStatus type_text (const KeyboardTextEvent &event)
 Type UTF-8 text.
 
 ~Keyboard () override
 Destroy the keyboard handle.
 
- Public Member Functions inherited from lvh::VirtualDevice
virtual ~VirtualDevice ()=default
 Destroy the virtual device handle.
 

Detailed Description

Virtual keyboard device handle.

Constructor & Destructor Documentation

◆ Keyboard() [1/2]

lvh::Keyboard::Keyboard ( Keyboard && other)
noexcept

Move construct a keyboard handle.

Parameters
otherHandle to move from.

◆ Keyboard() [2/2]

lvh::Keyboard::Keyboard ( detail::RuntimeConstructionToken token,
std::shared_ptr< detail::KeyboardDevice > device )

Construct a keyboard handle for Runtime-owned state.

Parameters
tokenRuntime construction token.
deviceShared keyboard state.

Member Function Documentation

◆ close()

OperationStatus lvh::Keyboard::close ( )
overridevirtual

Close the virtual device.

Returns
Close operation status.

Implements lvh::VirtualDevice.

◆ device_id()

DeviceId lvh::Keyboard::device_id ( ) const
overridevirtual

Get the device identifier assigned by the runtime.

Returns
Device identifier.

Implements lvh::VirtualDevice.

◆ device_nodes()

std::vector< DeviceNode > lvh::Keyboard::device_nodes ( ) const
overridevirtual

Get platform-visible nodes associated with the device.

Returns
Device nodes and diagnostic paths currently known to the backend.

Implements lvh::VirtualDevice.

◆ is_open()

bool lvh::Keyboard::is_open ( ) const
overridevirtual

Check whether the device is open.

Returns
true when the device can accept operations.

Implements lvh::VirtualDevice.

◆ last_submitted_event()

KeyboardEvent lvh::Keyboard::last_submitted_event ( ) const

Get the most recently submitted keyboard event.

Returns
Last submitted keyboard event.

◆ operator=() [1/2]

Keyboard & lvh::Keyboard::operator= ( const Keyboard & )
delete

Copy assignment is disabled because the handle owns device lifetime.

Returns
This keyboard handle.

◆ operator=() [2/2]

Keyboard & lvh::Keyboard::operator= ( Keyboard && other)
noexcept

Move assign a keyboard handle.

Parameters
otherHandle to move from.
Returns
This keyboard handle.

◆ press()

OperationStatus lvh::Keyboard::press ( KeyboardKeyCode key_code)

Press a keyboard key.

Parameters
key_codePortable key code.
Returns
Submit operation status.

◆ profile()

const DeviceProfile & lvh::Keyboard::profile ( ) const
overridevirtual

Get the profile used to create this device.

Returns
Device profile.

Implements lvh::VirtualDevice.

◆ release()

OperationStatus lvh::Keyboard::release ( KeyboardKeyCode key_code)

Release a keyboard key.

Parameters
key_codePortable key code.
Returns
Submit operation status.

◆ submit()

OperationStatus lvh::Keyboard::submit ( const KeyboardEvent & event)

Submit a keyboard key transition.

Parameters
eventKeyboard event.
Returns
Submit operation status.

◆ submit_count()

std::size_t lvh::Keyboard::submit_count ( ) const

Get the number of successful submit operations.

Returns
Submit count.

◆ type_text()

OperationStatus lvh::Keyboard::type_text ( const KeyboardTextEvent & event)

Type UTF-8 text.

Parameters
eventText event.
Returns
Submit operation status.

The documentation for this class was generated from the following file: