RADLib
RADical C++ application framework
RADInput::InputManager Class Reference

Input manager that reads evdev events and emits RADCore events. More...

#include <RADInput.h>

+ Inheritance diagram for RADInput::InputManager:
+ Collaboration diagram for RADInput::InputManager:

Public Member Functions

 InputManager (InputPaths paths={}, RADCore::EventLoop *loop=nullptr)
 Creates a manager using paths and optional target event loop. More...
 
 ~InputManager ()
 Stops all readers. More...
 
std::vector< InputDeviceInfodiscover () const
 Discovers event devices from devInput and sysClassInput. More...
 
bool startDevice (const std::string &path, std::string *error=nullptr)
 Starts reading a single evdev event path. More...
 
void startHotplugMonitor (int intervalMs=1000)
 Starts lightweight polling hotplug detection and emits devicesChanged on changes. More...
 
void stopHotplugMonitor ()
 Stops the hotplug monitor thread. More...
 
void stopAll ()
 Stops all active readers. More...
 
bool isRunning () const
 Returns true when at least one device reader is active. More...
 
const InputPathspaths () const
 Returns the configured paths. More...
 
- Public Member Functions inherited from RADCore::RADObject
 RADObject ()
 Creates a RADObject bound to the current thread. More...
 
virtual ~RADObject ()
 Disconnects tracked event links and releases lifetime token. More...
 
void registerLink (const ConnectionRecord &record)
 Registers a connection for cleanup when this object is destroyed. More...
 
std::thread::id threadId () const
 Returns the thread id this object is currently associated with. More...
 
EventLoopassociatedEventLoop () const
 Returns the associated event loop, if any. More...
 
ThreadAffinity threadAffinity () const
 Returns both thread id and associated loop atomically. More...
 
std::weak_ptr< void > lifetimeToken () const
 Returns a weak token used to drop queued callbacks after destruction. More...
 
void moveToThread (std::thread::id tId, EventLoop *loop=nullptr)
 Moves the object's affinity to tId and optional loop. More...
 

Public Attributes

RADCore::Event< void(const RADInput::InputEvent &) > eventReceived
 Emitted when a raw input event is read. More...
 
RADCore::Event< void(const std::vector< RADInput::InputDeviceInfo > &) > devicesChanged
 Emitted when discovery finds a changed device list. More...
 

Detailed Description

Input manager that reads evdev events and emits RADCore events.

Constructor & Destructor Documentation

◆ InputManager()

RADInput::InputManager::InputManager ( InputPaths  paths = {},
RADCore::EventLoop loop = nullptr 
)
explicit

Creates a manager using paths and optional target event loop.

◆ ~InputManager()

RADInput::InputManager::~InputManager ( )

Stops all readers.

Member Function Documentation

◆ discover()

std::vector<InputDeviceInfo> RADInput::InputManager::discover ( ) const

Discovers event devices from devInput and sysClassInput.

◆ isRunning()

bool RADInput::InputManager::isRunning ( ) const

Returns true when at least one device reader is active.

◆ paths()

const InputPaths& RADInput::InputManager::paths ( ) const

Returns the configured paths.

◆ startDevice()

bool RADInput::InputManager::startDevice ( const std::string &  path,
std::string *  error = nullptr 
)

Starts reading a single evdev event path.

◆ startHotplugMonitor()

void RADInput::InputManager::startHotplugMonitor ( int  intervalMs = 1000)

Starts lightweight polling hotplug detection and emits devicesChanged on changes.

◆ stopAll()

void RADInput::InputManager::stopAll ( )

Stops all active readers.

◆ stopHotplugMonitor()

void RADInput::InputManager::stopHotplugMonitor ( )

Stops the hotplug monitor thread.

Member Data Documentation

◆ devicesChanged

RADCore::Event<void (const std::vector<RADInput::InputDeviceInfo>&) > RADInput::InputManager::devicesChanged

Emitted when discovery finds a changed device list.

◆ eventReceived

RADCore::Event<void (const RADInput::InputEvent&) > RADInput::InputManager::eventReceived

Emitted when a raw input event is read.


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