00001 // Copyright (C) 2002 Peter Soetens 00002 // Copyright (C) 2003,2007 Klaas Gadeyne 00003 /*************************************************************************** 00004 * This library is free software; you can redistribute it and/or * 00005 * modify it under the terms of the GNU Lesser General Public * 00006 * License as published by the Free Software Foundation; either * 00007 * version 2.1 of the License, or (at your option) any later version. * 00008 * * 00009 * This library is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00012 * Lesser General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU Lesser General Public * 00015 * License along with this library; if not, write to the Free Software * 00016 * Foundation, Inc., 59 Temple Place, * 00017 * Suite 330, Boston, MA 02111-1307 USA * 00018 * * 00019 ***************************************************************************/ 00020 00021 /* Klaas Gadeyne, August 14, 2003 00022 Major rewrite of original file by Peter Soetens 00023 */ 00024 00025 #ifndef OCL_COMEDIDEVICE_HPP 00026 #define OCL_COMEDIDEVICE_HPP 00027 00028 #include <boost/shared_ptr.hpp> 00029 00030 namespace OCL 00031 { 00038 class ComediDevice 00039 { 00040 protected: 00041 class DeviceInfo; 00042 boost::shared_ptr<DeviceInfo> d; 00043 public: 00044 typedef unsigned int Data; 00045 00046 ComediDevice( unsigned int minor ); 00047 virtual ~ComediDevice( ); 00048 00057 Data getMaxData(unsigned int subd); 00058 00081 int read( unsigned int subd, unsigned int chanNr, 00082 unsigned int range, unsigned int aref, Data& value ); 00083 00084 /* 00085 Writes a single sample on the channel that is specified by the 00086 subdevice subdevice, and the channel channel. If appropriate, 00087 the device is configured to use range specification range and 00088 analog reference type aref. Analog reference types that are not 00089 supported by the device are silently ignored. The function 00090 writes the data value specified by the parameter data to the 00091 specified channel. 00092 00093 @return 0 on succes (not with all drivers, unfortunately, -1 on error 00094 @param subd : the subdevice to write on 00095 @param chanNr : the channel of subdevice subdevice to write on 00096 @param value : the data sample to write 00097 @param range : number between 0 and get_num_ranges(), @see get_num_ranges() 00098 @param aref : possible options (see comedi doc) AREF_GROUND, 00099 AREF_COMMON, AREF_DIFF, AREF_OTHER 00100 */ 00101 int write( unsigned int subd, unsigned int chanNr, 00102 unsigned int range, unsigned int aref, 00103 const ComediDevice::Data& value); 00104 00113 int getSubDeviceType(unsigned int subd); 00114 00119 DeviceInfo* getDevice(); 00120 00121 }; 00122 00123 00124 }; 00125 00126 #endif