- Main Page
- Classes
- Files
- Directories

- Class List
- Class Hierarchy
- Class Members

# cPhantomDevice Class Reference

Class to interface with Phantom devices. More...

`#include <CPhantomDevices.h>`

Inheritance diagram for cPhantomDevice:

List of all members.

## Public Member Functions
| cPhantomDevice (int a_num=0, bool a_dio_access=false)
| Constructor of cPhantomDevice.
| ~cPhantomDevice ()
| Destructor of cPhantomDevices.
virtual int | open ()
| Open connection to phantom device.
virtual int | close ()
| Close connection to phantom device.
virtual int | initialize (const bool a_resetEncoders=false)
| Calibrate phantom device.
virtual int | command (int a_command, void *a_data)
| Send a command to the phantom device.
## Static Private Member Functions
static void | callbackFunc (void *a_data)
| Callback function passed to phantom dll.
## Private Attributes
int | m_phantomHandle
| handle for specific phantom use.
## Static Private Attributes
static int | m_num_phantoms = 0
| Number of Phantoms that have been started.

## Detailed Description

Class to interface with Phantom devices.

## Constructor & Destructor Documentation

cPhantomDevice::cPhantomDevice | ( | int | a_num = `0`,
|  | bool | a_dio_access = `false` |
| ) |  |  |

Constructor of cPhantomDevice.

Constructor of cPhantomDevice. No servo loop is yet created, encoders are NOT reset.

Parameters:

  | a_num | 0-based index of the Phantom that this tool should talk to.
  | a_dio_access | If this is 'true', the tool will use the Ghost API's direct-i/o model, if it's available. Otherwise the gstEffect i/o model will be used.

cPhantomDevice::~cPhantomDevice | ( |  | ) |

Destructor of cPhantomDevices.

Destructor of cPhantomDevice.

## Member Function Documentation

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

Open connection to phantom device.

Open connection to phantom device.

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

Reimplemented from cGenericDevice.

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

Close connection to phantom device.

Close connection to phantom device.

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

Reimplemented from cGenericDevice.

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

Calibrate phantom device.

Initialize the phantom device.

For desktops and omnis, the a_resetEncoders parameter is ignored. For premiums, if you specify a_resetEncoders as true, you should be holding the Phantom in its rest position when this is called.

Parameters:

  | a_resetEncoders | Should I re-zero the encoders? (affects premiums only...)

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

Reimplemented from cGenericDevice.

int cPhantomDevice::command | ( | int | iCommand,
|  | void * | iData |
| ) |  |  | `[virtual]`

Send a command to the phantom device.

Set command for the phantom device

Parameters:

  | iCommand | Selected command.
  | iData | Pointer to the corresponding data structure.

Returns:
  Return status of command.

Reimplemented from cGenericDevice.

void cPhantomDevice::callbackFunc | ( | void * | a_data | ) | `[static, private]`

Callback function passed to phantom dll.

Function passed to SetCallbackPhantom Calls m_callback->callback()

Parameters:

  | a_data | Pointer to instance of cPhantomDevice

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

- chai3d/src/devices/CPhantomDevices.h
- chai3d/src/devices/CPhantomDevices.cpp