# cGenericDevice Class Reference
[Devices]

cGenericDevice Provides an general interface to communicate with hardware devices. A number of constants define a set of generic commands supported by the cGenericDevice:command method. For each generic command, we describe the data type and information that must be passed by parameter for index and data. command contains of course the command number corresponding to the following list of command constants. More...

`#include <CGenericDevice.h>`

Inheritance diagram for cGenericDevice:

[legend]

List of all members.

## Public Member Functions
| cGenericDevice ()
| Constructor of cGenericDevice.
virtual | ~cGenericDevice ()
| Destructor of cGenericDevice.
virtual int | open ()
| Open connection to device (0 indicates success).
virtual int | close ()
| Close connection to device (0 indicates success).
virtual int | initialize (const bool a_resetEncoders=false)
| Initialize or calibrate device (0 indicates success).
virtual int | command (int a_command, void *a_data)
| Send a command to the device (0 indicates success).
virtual unsigned int | getNumDevices ()
| Returns the number of devices available from this class of device.
bool | isSystemAvailable ()
| Returns true if the device is available for communication.
bool | isSystemReady ()
| Returns true if the connection to the device has been created.
virtual bool | setCallback (cCallback *a_callback)
| Ask the device to call me back periodically.
## Protected Attributes
bool | m_systemAvailable
| Flag that indicates if the hardware device is available to the computer.
bool | m_systemReady
| Flag that indicates if connection to system was opened successfully.
cCallback * | m_callback
| A callback method for this device (or zero if none has been registered).

## Detailed Description

cGenericDevice Provides an general interface to communicate with hardware devices. A number of constants define a set of generic commands supported by the cGenericDevice:command method. For each generic command, we describe the data type and information that must be passed by parameter for index and data. command contains of course the command number corresponding to the following list of command constants.

## Member Function Documentation

bool cGenericDevice::setCallback | ( | cCallback * | m_callback | ) | `[virtual]`

Ask the device to call me back periodically.

Ask the device to call me back periodically. If this device supports timed callbacks, this function will return 'true' and will call the supplied m_callback method at haptic rates. If not, this function will return 'false', and you should create your own haptic thread.

Parameters:

  | m_callback | The callback to trigger periodically, or 0 to cancel an existing callback.

Returns:
  Returns true if this device supports callbacks, false otherwise.

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

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

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