Jetson Inference
DNN Vision Library

HID input devices including gamepad controllers, joysticks, and keyboard. More...

Classes

class  InputDevices
 Input device manager. More...
 
class  JoystickDevice
 Joystick device. More...
 
class  KeyboardDevice
 Keyboard device. More...
 

Typedefs

typedef std::vector< std::pair< std::string, std::string > > DeviceList
 Typedef of device <path, name> pairs. More...
 

Detailed Description

HID input devices including gamepad controllers, joysticks, and keyboard.


Class Documentation

◆ InputDevices

class InputDevices

Input device manager.

Public Member Functions

 ~InputDevices ()
 Destructor. More...
 
bool Poll (uint32_t timeout=0)
 Poll the devices for updates. More...
 
KeyboardDeviceGetKeyboard () const
 Retrieve the keyboard device. More...
 
JoystickDeviceGetJoystick () const
 Retrieve the gamepad device. More...
 

Static Public Member Functions

static InputDevicesCreate ()
 Create device. More...
 
static void Enumerate (DeviceList &devices)
 Scan /dev/input for devices. More...
 
static std::string FindPathByName (const char *name)
 Find /dev/input path by device name. More...
 

Protected Member Functions

 InputDevices ()
 

Protected Attributes

KeyboardDevicemKeyboard
 
JoystickDevicemJoystick
 

Constructor & Destructor Documentation

◆ ~InputDevices()

InputDevices::~InputDevices ( )

Destructor.

◆ InputDevices()

InputDevices::InputDevices ( )
protected

Member Function Documentation

◆ Create()

static InputDevices* InputDevices::Create ( )
static

Create device.

◆ Enumerate()

static void InputDevices::Enumerate ( DeviceList devices)
static

Scan /dev/input for devices.

◆ FindPathByName()

static std::string InputDevices::FindPathByName ( const char *  name)
static

Find /dev/input path by device name.

◆ GetJoystick()

JoystickDevice* InputDevices::GetJoystick ( ) const
inline

Retrieve the gamepad device.

◆ GetKeyboard()

KeyboardDevice* InputDevices::GetKeyboard ( ) const
inline

Retrieve the keyboard device.

◆ Poll()

bool InputDevices::Poll ( uint32_t  timeout = 0)

Poll the devices for updates.

Member Data Documentation

◆ mJoystick

JoystickDevice* InputDevices::mJoystick
protected

◆ mKeyboard

KeyboardDevice* InputDevices::mKeyboard
protected

◆ JoystickDevice

class JoystickDevice

Joystick device.

Public Member Functions

 ~JoystickDevice ()
 Destructor. More...
 
bool Poll (uint32_t timeout=0)
 Poll the device for updates. More...
 

Static Public Member Functions

static JoystickDeviceCreate (const char *device="Microntek USB Joystick ")
 Create device. More...
 

Protected Member Functions

 JoystickDevice ()
 

Protected Attributes

float mAxisNorm [MAX_AXIS]
 
int mAxisRaw [MAX_AXIS]
 
int mFD
 
std::string mPath
 

Static Protected Attributes

static const int MAX_AXIS = 256
 

Constructor & Destructor Documentation

◆ ~JoystickDevice()

JoystickDevice::~JoystickDevice ( )

Destructor.

◆ JoystickDevice()

JoystickDevice::JoystickDevice ( )
protected

Member Function Documentation

◆ Create()

static JoystickDevice* JoystickDevice::Create ( const char *  device = "Microntek              USB Joystick          ")
static

Create device.

◆ Poll()

bool JoystickDevice::Poll ( uint32_t  timeout = 0)

Poll the device for updates.

Member Data Documentation

◆ MAX_AXIS

const int JoystickDevice::MAX_AXIS = 256
staticprotected

◆ mAxisNorm

float JoystickDevice::mAxisNorm[MAX_AXIS]
protected

◆ mAxisRaw

int JoystickDevice::mAxisRaw[MAX_AXIS]
protected

◆ mFD

int JoystickDevice::mFD
protected

◆ mPath

std::string JoystickDevice::mPath
protected

◆ KeyboardDevice

class KeyboardDevice

Keyboard device.

Public Member Functions

 ~KeyboardDevice ()
 Destructor. More...
 
bool Poll (uint32_t timeout=0)
 Poll the device for updates. More...
 
bool KeyDown (uint32_t code) const
 Check if a particular key is pressed. More...
 

Static Public Member Functions

static KeyboardDeviceCreate (const char *path="/dev/input/by-path/platform-i8042-serio-0-event-kbd")
 Create device. More...
 

Protected Member Functions

 KeyboardDevice ()
 

Protected Attributes

int mKeyMap [MAX_KEYS]
 
int mFD
 
std::string mPath
 

Static Protected Attributes

static const int MAX_KEYS = 256
 

Constructor & Destructor Documentation

◆ ~KeyboardDevice()

KeyboardDevice::~KeyboardDevice ( )

Destructor.

◆ KeyboardDevice()

KeyboardDevice::KeyboardDevice ( )
protected

Member Function Documentation

◆ Create()

static KeyboardDevice* KeyboardDevice::Create ( const char *  path = "/dev/input/by-path/platform-i8042-serio-0-event-kbd")
static

Create device.

◆ KeyDown()

bool KeyboardDevice::KeyDown ( uint32_t  code) const

Check if a particular key is pressed.

◆ Poll()

bool KeyboardDevice::Poll ( uint32_t  timeout = 0)

Poll the device for updates.

Member Data Documentation

◆ MAX_KEYS

const int KeyboardDevice::MAX_KEYS = 256
staticprotected

◆ mFD

int KeyboardDevice::mFD
protected

◆ mKeyMap

int KeyboardDevice::mKeyMap[MAX_KEYS]
protected

◆ mPath

std::string KeyboardDevice::mPath
protected

Typedef Documentation

◆ DeviceList

typedef std::vector< std::pair<std::string, std::string> > DeviceList

Typedef of device <path, name> pairs.