Access to an input/HID device using the HID API from the Windows Driver Kit.
More...
#include <SurgSim/Devices/MultiAxis/win32/WdkHidDeviceHandle.h>
Access to an input/HID device using the HID API from the Windows Driver Kit.
- See also
- SystemInputDeviceHandle
SurgSim::Device::WdkHidDeviceHandle::~WdkHidDeviceHandle |
( |
| ) |
|
Constructor.
Cannot be called directly.
- See also
- open
SurgSim::Device::WdkHidDeviceHandle::WdkHidDeviceHandle |
( |
const WdkHidDeviceHandle & |
other | ) |
|
|
private |
void SurgSim::Device::WdkHidDeviceHandle::cancelAsynchronousRead |
( |
| ) |
|
|
private |
Cancels an asynchronous read from the device.
Should be executed in the context of the thread that called startAsynchronousRead.
void SurgSim::Device::WdkHidDeviceHandle::decodeStateUpdates |
( |
const unsigned char * |
rawData, |
|
|
size_t |
rawDataSize, |
|
|
AxisStates * |
axisStates, |
|
|
ButtonStates * |
buttonStates, |
|
|
bool * |
updated |
|
) |
| |
|
private |
Decode the raw state update data received from the device.
- Parameters
-
| rawData | Raw state update data. |
| rawDataSize | Size of the raw state update data. |
[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.) |
Enumerates input devices.
- Parameters
-
logger | The logger to be used during enumeration. |
- Returns
- A list of device paths.
bool SurgSim::Device::WdkHidDeviceHandle::finishAsynchronousRead |
( |
size_t * |
numBytesRead | ) |
|
|
private |
Checks if an asynchronous read from the device has completed.
Updates the internal flags to indicate the state of the device I/O.
- Parameters
-
[out] | numBytesRead | If the function returns true, the number of bytes read from the device. |
- Returns
- true if data has been received; false if the asynchronous read is still pending or an error has occurred.
bool SurgSim::Device::WdkHidDeviceHandle::getCapabilities |
( |
struct _HIDP_CAPS * |
capabilities | ) |
const |
|
private |
Gets the device capabilities.
- Parameters
-
[out] | capabilities | The capabilities data for the device. |
- Returns
- true if it succeeds.
bool SurgSim::Device::WdkHidDeviceHandle::getDeviceIds |
( |
int * |
vendorId, |
|
|
int * |
productId |
|
) |
| const |
|
overridevirtual |
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.
Implements SurgSim::Device::SystemInputDeviceHandle.
std::string SurgSim::Device::WdkHidDeviceHandle::getDeviceName |
( |
| ) |
const |
|
overridevirtual |
bool SurgSim::Device::WdkHidDeviceHandle::hasTranslationAndRotationAxes |
( |
| ) |
const |
|
overridevirtual |
Opens the given path and creates an access wrapper for the device.
- Parameters
-
path | Full pathname for the device. |
logger | The logger to be used by the device. |
- Returns
- The created device object, or an empty unique_ptr on failure.
void SurgSim::Device::WdkHidDeviceHandle::prepareForShutdown |
( |
| ) |
|
|
overridevirtual |
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 from SurgSim::Device::SystemInputDeviceHandle.
bool SurgSim::Device::WdkHidDeviceHandle::startAsynchronousRead |
( |
| ) |
|
|
private |
Starts an asynchronous read from the device.
Updates the internal flags to indicate the state of the device I/O.
- Returns
- true if an asynchronous read has been started, or the read has already completed synchronously.
bool SurgSim::Device::WdkHidDeviceHandle::updateStates |
( |
AxisStates * |
axisStates, |
|
|
ButtonStates * |
buttonStates, |
|
|
bool * |
updated |
|
) |
| |
|
overridevirtual |
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.
Implements SurgSim::Device::SystemInputDeviceHandle.
std::unique_ptr<State> SurgSim::Device::WdkHidDeviceHandle::m_state |
|
private |
The documentation for this class was generated from the following files: