ComediDevice Class Reference

Minimal C++ API to a comedi device. More...

#include <ComediDevice.hpp>

Inheritance diagram for ComediDevice:
ComediThreadScope

List of all members.

Classes

class  DeviceInfo
 This class stores a comedi_t struct. More...

Public Types

typedef unsigned int Data

Public Member Functions

 ComediDevice (unsigned int minor)
Data getMaxData (unsigned int subd)
 Returns the maximum valid data value for channel chan of subdevice subdevice belonging to this device.
int read (unsigned int subd, unsigned int chanNr, unsigned int range, unsigned int aref, Data &value)
 Read a single sample on the channel specified by the subdevice subdevice, and the channel channel.
int write (unsigned int subd, unsigned int chanNr, unsigned int range, unsigned int aref, const ComediDevice::Data &value)
int getSubDeviceType (unsigned int subd)
 Returns an integer describing the type of subdevice that belongs to this comedi device and has the index subdevice.
DeviceInfogetDevice ()
 Return a pointer to a comedi device info.

Protected Attributes

boost::shared_ptr< DeviceInfod

Detailed Description

Minimal C++ API to a comedi device.

You require the ComediSubDevice family classes in order to access subdevices.

See also:
http://www.comedi.org

Definition at line 38 of file ComediDevice.hpp.


Member Function Documentation

ComediDevice::DeviceInfo * getDevice (  ) 

Return a pointer to a comedi device info.

This may be null if the device could not be found.

Definition at line 95 of file ComediDevice.cpp.

Referenced by ComediSubDeviceAIn::ComediSubDeviceAIn(), ComediSubDeviceAOut::ComediSubDeviceAOut(), and ComediSubDeviceDOut::ComediSubDeviceDOut().

Data getMaxData ( unsigned int  subd  ) 

Returns the maximum valid data value for channel chan of subdevice subdevice belonging to this device.

This function returns 0 on error.

Returns:
Maximum data value on that subdevice (always unsigned int in comedi)
Parameters:
subdevice : the number of the subdevice to interrogate

Definition at line 52 of file ComediDevice.cpp.

Referenced by ComediSubDeviceAIn::ComediSubDeviceAIn(), and ComediSubDeviceAOut::ComediSubDeviceAOut().

int getSubDeviceType ( unsigned int  subd  ) 

Returns an integer describing the type of subdevice that belongs to this comedi device and has the index subdevice.

Returns:
an integer describing the type of subdevice, -1 if there is an error.
Parameters:
subd : the number of the subdevice of which the type has to be retrieved

Definition at line 60 of file ComediDevice.cpp.

Referenced by ComediSubDeviceAIn::ComediSubDeviceAIn(), ComediSubDeviceAOut::ComediSubDeviceAOut(), and ComediSubDeviceDOut::ComediSubDeviceDOut().

int read ( unsigned int  subd,
unsigned int  chanNr,
unsigned int  range,
unsigned int  aref,
ComediDevice::Data &  value 
)

Read a single sample on the channel specified by the subdevice subdevice, and the channel channel.

For the A/D conversion (if appropriate), the device is configured to use range specification range and (if appropriate) analog reference type aref. Analog reference types that are not supported by the device are silently ignored. The function reads one data value from the specified channel and places the data value in the location pointed to by data.

Data values returned by this function are unsigned integers less than or equal to the maximum sample value of the channel, which can be determined using the function getMaxData().

Returns:
0 on succes (not with all drivers, unfortunately, -1 on error
Parameters:
subd : the number of the subdevice to read on
chanNr : the number of the channel of subdevice subdevice to read on
value : the data
range : number between 0 and get_num_ranges(),
See also:
get_num_ranges()
Parameters:
aref : possible options (see comedi doc) AREF_GROUND, AREF_COMMON, AREF_DIFF, AREF_OTHER

Definition at line 67 of file ComediDevice.cpp.

Referenced by ComediSubDeviceAIn::ComediSubDeviceAIn(), and ComediSubDeviceAOut::ComediSubDeviceAOut().


The documentation for this class was generated from the following files:
Generated on Thu Dec 23 15:05:28 2010 for OrocosComponentLibrary by  doxygen 1.6.3