opensurgsim
|
A wrapper for system-dependent access to an input/HID device. More...
#include <SystemInputDeviceHandle.h>
Public Types | |
typedef std::array< int, MAX_NUM_AXES > | AxisStates |
Type used to store axis states. | |
typedef std::array< bool, MAX_NUM_BUTTONS > | ButtonStates |
Type used to store button states. | |
Public Member Functions | |
virtual | ~SystemInputDeviceHandle () |
Destructor. | |
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. | |
static const size_t | MAX_NUM_BUTTONS = 4 |
The maximum number of buttons supported by any device object. | |
Protected Member Functions | |
SystemInputDeviceHandle () | |
Default constructor. More... | |
A wrapper for system-dependent access to an input/HID device.
|
protected |
Default constructor.
Cannot be called directly; see open and enumerate.
|
pure virtual |
Gets the device identifiers.
[out] | vendorId | The USB or PCI vendor identifier. |
[out] | productId | The USB or PCI product identifier. |
Implemented in SurgSim::Devices::WdkHidDeviceHandle, and SurgSim::Devices::InputDeviceHandle.
|
pure virtual |
Gets the name returned by the operating system for this device.
Implemented in SurgSim::Devices::WdkHidDeviceHandle, and SurgSim::Devices::InputDeviceHandle.
|
pure virtual |
Queries if this device has 3 translation and 3 rotation axes.
Implemented in SurgSim::Devices::WdkHidDeviceHandle, and SurgSim::Devices::InputDeviceHandle.
|
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.
|
pure virtual |
Updates the axis and states from the device input, if any.
[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.) |
Implemented in SurgSim::Devices::WdkHidDeviceHandle, and SurgSim::Devices::InputDeviceHandle.