opensurgsim
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
SurgSim::Devices::SystemInputDeviceHandle Class Referenceabstract

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

#include <SystemInputDeviceHandle.h>

Inheritance diagram for SurgSim::Devices::SystemInputDeviceHandle:
SurgSim::Devices::InputDeviceHandle SurgSim::Devices::WdkHidDeviceHandle

Public Types

typedef std::array< int, MAX_NUM_AXESAxisStates
 Type used to store axis states.
 
typedef std::array< bool, MAX_NUM_BUTTONSButtonStates
 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...
 

Detailed Description

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

Constructor & Destructor Documentation

§ SystemInputDeviceHandle()

SurgSim::Devices::SystemInputDeviceHandle::SystemInputDeviceHandle ( )
protected

Default constructor.

Cannot be called directly; see open and enumerate.

Member Function Documentation

§ getDeviceIds()

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

Gets the device identifiers.

Parameters
[out]vendorIdThe USB or PCI vendor identifier.
[out]productIdThe 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.

§ 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]axisStatesThe states for each axis of the device.
[in,out]buttonStatesThe states for each device button.
[out]updatedTrue 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.


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