SurgSim::Devices::SystemInputDeviceHandle Class Referenceabstract

A wrapper for system-dependent access to an input/HID device. More...

`#include <SurgSim/Devices/MultiAxis/SystemInputDeviceHandle.h>`

Inheritance diagram for SurgSim::Devices::SystemInputDeviceHandle:

## Public Types

typedef std::array< int, MAX_NUM_AXES > | AxisStates
| Type used to store axis states. More...
typedef std::array< bool, MAX_NUM_BUTTONS > | ButtonStates
| Type used to store button states. More...

## Public Member Functions

virtual | ~SystemInputDeviceHandle ()
| Destructor. More...
virtual std::string | getDeviceName () const =0
| Gets the name returned by the operating system for this device. More...
virtual bool | getDeviceIds (int *vendorId, int *productId) const =0
| Gets the device identifiers. More...
virtual bool | hasTranslationAndRotationAxes () const =0
| Queries if this device has 3 translation and 3 rotation axes. More...
virtual bool | updateStates (AxisStates *axisStates, ButtonStates *buttonStates, bool *updated)=0
| Updates the axis and states from the device input, if any. More...
virtual void | prepareForShutdown ()
| Prepares the handle for sampling thread shutdown. More...

## Static Public Attributes

static const size_t | MAX_NUM_AXES = 6
| The maximum number of axes supported by any device object. More...
static const size_t | MAX_NUM_BUTTONS = 4
| The maximum number of buttons supported by any device object. More...

## Protected Member Functions

| SystemInputDeviceHandle ()
| Default constructor. More...

## Private Member Functions

| SystemInputDeviceHandle (const SystemInputDeviceHandle &other)
SystemInputDeviceHandle & | operator= (const SystemInputDeviceHandle &other)

## Detailed Description

A wrapper for system-dependent access to an input/HID device.

## Member Typedef Documentation

## AxisStates

typedef std::array<int, MAX_NUM_AXES> SurgSim::Devices::SystemInputDeviceHandle::AxisStates

Type used to store axis states.

## ButtonStates

typedef std::array<bool, MAX_NUM_BUTTONS> SurgSim::Devices::SystemInputDeviceHandle::ButtonStates

Type used to store button states.

## Constructor & Destructor Documentation

## ~SystemInputDeviceHandle()

SurgSim::Devices::SystemInputDeviceHandle::~SystemInputDeviceHandle | ( |  | ) |

virtual

Destructor.

## SystemInputDeviceHandle() [1/2]

SurgSim::Devices::SystemInputDeviceHandle::SystemInputDeviceHandle | ( |  | ) |

protected

Default constructor.

Cannot be called directly; see open and enumerate.

## SystemInputDeviceHandle() [2/2]

SurgSim::Devices::SystemInputDeviceHandle::SystemInputDeviceHandle | ( | const SystemInputDeviceHandle & | other | ) |

private

## Member Function Documentation

## getDeviceIds()

virtual bool SurgSim::Devices::SystemInputDeviceHandle::getDeviceIds | ( | int * | vendorId,
|  | int * | productId
| ) |  | const

pure virtual

Gets the device identifiers.

Parameters

  [out] | vendorId | The USB or PCI vendor identifier.
  [out] | productId | The USB or PCI product identifier.

Returns
  true if it succeeds.

Implemented in SurgSim::Devices::WdkHidDeviceHandle, and SurgSim::Devices::InputDeviceHandle.

## getDeviceName()

virtual std::string SurgSim::Devices::SystemInputDeviceHandle::getDeviceName | ( |  | ) | const

pure virtual

Gets the name returned by the operating system for this device.

Returns
  The reported name, or "???" if no name information could be found.

Implemented in SurgSim::Devices::WdkHidDeviceHandle, and SurgSim::Devices::InputDeviceHandle.

## hasTranslationAndRotationAxes()

virtual bool SurgSim::Devices::SystemInputDeviceHandle::hasTranslationAndRotationAxes | ( |  | ) | const

pure virtual

Queries if this device has 3 translation and 3 rotation axes.

Returns
  true if the desired axes are present.

Implemented in SurgSim::Devices::WdkHidDeviceHandle, and SurgSim::Devices::InputDeviceHandle.

## operator=()

SystemInputDeviceHandle& SurgSim::Devices::SystemInputDeviceHandle::operator= | ( | const SystemInputDeviceHandle & | other | ) |

private

## prepareForShutdown()

void SurgSim::Devices::SystemInputDeviceHandle::prepareForShutdown | ( |  | ) |

virtual

Prepares the handle for sampling thread shutdown.

Should be called from the same thread that was calling updateStates, after the calls to updateStates have been stopped, but before object destruction.

Reimplemented in SurgSim::Devices::WdkHidDeviceHandle.

## updateStates()

virtual bool SurgSim::Devices::SystemInputDeviceHandle::updateStates | ( | AxisStates * | axisStates,
|  | ButtonStates * | buttonStates,
|  | bool * | updated
| ) |  |

pure virtual

Updates the axis and states from the device input, if any.

Parameters

  [in,out] | axisStates | The states for each axis of the device.
  [in,out] | buttonStates | The states for each device button.
  [out] | updated | True if any states were actually updated. (Note that even if this value is true, the states may not have changed value; one or more states could have been updated to the same value.)

Returns
  true if the operation was successful; false if the device is no longer in a usable state.

Implemented in SurgSim::Devices::WdkHidDeviceHandle, and SurgSim::Devices::InputDeviceHandle.

## Member Data Documentation

## MAX_NUM_AXES

const size_t SurgSim::Devices::SystemInputDeviceHandle::MAX_NUM_AXES = 6

static

The maximum number of axes supported by any device object.

## MAX_NUM_BUTTONS

const size_t SurgSim::Devices::SystemInputDeviceHandle::MAX_NUM_BUTTONS = 4

static

The maximum number of buttons supported by any device object.

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

- SurgSim/Devices/MultiAxis/SystemInputDeviceHandle.h
- SurgSim/Devices/MultiAxis/SystemInputDeviceHandle.cpp