xorg-gtest  0.1
Xorg testing extension to Google Test
 All Classes Functions Variables Enumerations Enumerator Pages
xorg::testing::evemu::Device Class Reference

evemu input device for replaying events through the Linux uinput evdev subsystem. More...

#include <xorg/gtest/evemu/xorg-gtest-device.h>

Public Member Functions

 Device (const std::string &path)
 Create a new device context.
 
void Play (const std::string &path) const
 Play a evemu recording through the device.
 
void PlayOne (int type, int code, int value, bool sync=false)
 Play a single event through the device.
 
const std::string & GetDeviceNode (void)
 Return the /dev/input/eventX device node for this device.
 

Detailed Description

evemu input device for replaying events through the Linux uinput evdev subsystem.

Use the Recording class to play back a specific recording.

Constructor & Destructor Documentation

xorg::testing::evemu::Device::Device ( const std::string &  path)
explicit

Create a new device context.

Parameters
[in]pathPath to evemu device property file.
Exceptions
std::runtime_errorif the device property file could not be found or the device could not be created.

Member Function Documentation

const std::string& xorg::testing::evemu::Device::GetDeviceNode ( void  )

Return the /dev/input/eventX device node for this device.

Note that evemu doesn't know the device node, so we traverse the file system looking for it. There is a tiny chance of the device node being wrong, or the device disappearing before we find it. If the device node cannot be found, an empty string is returned.

Returns
The string representing the device node
void xorg::testing::evemu::Device::Play ( const std::string &  path) const

Play a evemu recording through the device.

Plays the recording from the beginning through the end. This call will block until the recording has finished.

Parameters
[in]pathPath to evemu recording file.
Exceptions
std::runtime_errorif playback failed for any reason.
void xorg::testing::evemu::Device::PlayOne ( int  type,
int  code,
int  value,
bool  sync = false 
)

Play a single event through the device.

Plays an event with the given type, code and value through the device.

Parameters
[in]typeEvdev interface event type, e.g. EV_ABS, EV_REL, EV_KEY.
[in]codeEvdev interface event code, e.g. ABS_X, REL_Y, BTN_LEFT
[in]valueEvent value
[in]syncIf true, submit an EV_SYN event after this event
Exceptions
std::runtime_errorif playback failed for any reason.

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