# cVirtualDevice Class Reference
[Devices]

Class which interfaces with the virtual device. More...

`#include <CVirtualDevice.h>`

Inheritance diagram for cVirtualDevice:

[legend]

List of all members.

## Public Member Functions
| cVirtualDevice ()
| Constructor of cVirtualDevice.
virtual | ~cVirtualDevice ()
| Destructor of cVirtualDevice.
int | open ()
| Open connection to virtual device.
int | close ()
| Close connection to virtual device.
int | initialize (const bool a_resetEncoders)
| Initialize virtual device.
unsigned int | getNumDevices ()
| Returns the number of devices available from this class of device.
int | getPosition (cVector3d &a_position)
| Read the position of the device. Units are meters [m].
int | getRotation (cMatrix3d &a_rotation)
| Read the orientation frame of the device end-effector.
int | getUserSwitch (int a_switchIndex, bool &a_status)
| Read the status of the user switch [true = ON / false = OFF].
int | setForce (cVector3d &a_force)
| Send a force [N] to the haptic device.
int | getForce (cVector3d &a_force)
| Read a force [N] from the haptic device.

## Detailed Description

Class which interfaces with the virtual device.

## Member Function Documentation

int cVirtualDevice::close | ( |  | ) | `[virtual]`

Close connection to virtual device.

Close connection to virtual device

Returns:
  Return 0 is operation succeeds, -1 if an error occurs.

Reimplemented from cGenericHapticDevice.

int cVirtualDevice::getForce | ( | cVector3d & | a_force | ) | `[virtual]`

Read a force [N] from the haptic device.

Return the last force sent to the device.

Parameters:

  | a_force | Return value.

Reimplemented from cGenericHapticDevice.

unsigned int cVirtualDevice::getNumDevices | ( |  | ) | `[virtual]`

Returns the number of devices available from this class of device.

Returns the number of devices available from this class of device.

Returns:
  Returns the result

Reimplemented from cGenericDevice.

int cVirtualDevice::getPosition | ( | cVector3d & | a_position | ) | `[virtual]`

Read the position of the device. Units are meters [m].

Read the position of the device. Units are meters [m].

Parameters:

  | a_position | Return value.

Reimplemented from cGenericHapticDevice.

int cVirtualDevice::getRotation | ( | cMatrix3d & | a_rotation | ) | `[virtual]`

Read the orientation frame of the device end-effector.

Read the orientation frame of the device end-effector.

Parameters:

  | a_rotation | Return value.

Reimplemented from cGenericHapticDevice.

int cVirtualDevice::getUserSwitch | ( | int | a_switchIndex,
|  | bool & | a_status |
| ) |  |  | `[virtual]`

Read the status of the user switch [true = ON / false = OFF].

Read the status of the user switch [true = ON / false = OFF].

Parameters:

  | a_switchIndex | index number of the switch.
  | a_status | result value from reading the selected input switch.

Reimplemented from cGenericHapticDevice.

int cVirtualDevice::initialize | ( | const bool | a_resetEncoders = `false` | ) | `[virtual]`

Initialize virtual device.

Initialize virtual device. a_resetEncoders is ignored

Parameters:

  | a_resetEncoders | ignored

Returns:
  Return 0 is operation succeeds, -1 if an error occurs.

Reimplemented from cGenericHapticDevice.

int cVirtualDevice::open | ( |  | ) | `[virtual]`

Open connection to virtual device.

Open connection to virtual device.

Returns:
  Return 0 is operation succeeds, -1 if an error occurs.

Reimplemented from cGenericHapticDevice.

int cVirtualDevice::setForce | ( | cVector3d & | a_force | ) | `[virtual]`

Send a force [N] to the haptic device.

Send a force [N] to the haptic device.

Parameters:

  | a_force | Force command to be applied to device.

Reimplemented from cGenericHapticDevice.

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

- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/devices/CVirtualDevice.h
- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/devices/CVirtualDevice.cpp

CHAI3D 2.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2009 - CHAI 3D
All Rights Reserved.