00001 /*************************************************************************** 00002 tag: Peter Soetens Thu Oct 10 16:16:56 CEST 2002 AnalogOutInterface.hpp 00003 00004 AnalogOutInterface.hpp - description 00005 ------------------- 00006 begin : Thu October 10 2002 00007 copyright : (C) 2002 Peter Soetens 00008 email : peter.soetens@mech.kuleuven.ac.be 00009 00010 *************************************************************************** 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU General Public * 00013 * License as published by the Free Software Foundation; * 00014 * version 2 of the License. * 00015 * * 00016 * As a special exception, you may use this file as part of a free * 00017 * software library without restriction. Specifically, if other files * 00018 * instantiate templates or use macros or inline functions from this * 00019 * file, or you compile this file and link it with other files to * 00020 * produce an executable, this file does not by itself cause the * 00021 * resulting executable to be covered by the GNU General Public * 00022 * License. This exception does not however invalidate any other * 00023 * reasons why the executable file might be covered by the GNU General * 00024 * Public License. * 00025 * * 00026 * This library is distributed in the hope that it will be useful, * 00027 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00028 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00029 * Lesser General Public License for more details. * 00030 * * 00031 * You should have received a copy of the GNU General Public * 00032 * License along with this library; if not, write to the Free Software * 00033 * Foundation, Inc., 59 Temple Place, * 00034 * Suite 330, Boston, MA 02111-1307 USA * 00035 * * 00036 ***************************************************************************/ 00037 /* Klaas Gadeyne, Mon August 11 2003 00038 - Added "channel" param to lowest(), highest(), resolution() calls (these 00039 are mostly configurable on a per channel basis. If not, there's 00040 no problem 00041 - In comedi, this is also done for their "binary"-counterpoles. I 00042 don't know if this is necessary 00043 00044 Klaas Gadeyne, Wed August 20 2003 00045 - Added rangeSet() and arefSet() methods, that allready existed in 00046 the comedi implementations of these interfaces 00047 */ 00048 00049 #ifndef ANALOGOUTINTERFACE_HPP 00050 #define ANALOGOUTINTERFACE_HPP 00051 00052 #include "../NameServer.hpp" 00053 #include "../NameServerRegistrator.hpp" 00054 #include "../rtt-config.h" 00055 00056 namespace RTT 00057 { 00058 00067 class RTT_API AnalogOutInterface 00068 : private NameServerRegistrator<AnalogOutInterface*> 00069 { 00070 public: 00071 00076 enum AnalogReference { Ground = 0, 00077 Common, 00078 Differential, 00079 Other 00080 }; 00081 00085 AnalogOutInterface() 00086 {} 00087 00092 AnalogOutInterface( const std::string& name ) 00093 : NameServerRegistrator<AnalogOutInterface*>( nameserver, name, this ) 00094 {} 00095 00096 virtual ~AnalogOutInterface() 00097 {} 00098 00106 virtual void rangeSet(unsigned int chan, 00107 unsigned int range) = 0; 00108 00116 virtual void arefSet(unsigned int chan, 00117 unsigned int aref) = 0; 00118 00123 virtual int rawWrite( unsigned int chan, int value ) = 0; 00124 00128 virtual int rawRead( unsigned int chan, int& value ) = 0; 00129 00133 virtual unsigned int rawRange() const = 0; 00134 00139 virtual int write( unsigned int chan, double value ) = 0; 00140 00144 virtual int read( unsigned int chan, double& value ) = 0; 00145 00150 virtual double lowest(unsigned int chan) const = 0; 00151 00156 virtual double highest(unsigned int chan) const = 0; 00157 00161 virtual double resolution(unsigned int chan) const = 0; 00162 00166 virtual unsigned int nbOfChannels() const = 0; 00167 00172 unsigned int binaryRange() const { return rawRange(); } 00173 00178 int binaryLowest() const { return 0; } 00179 00184 int binaryHighest() const { return rawRange(); } 00185 00190 static NameServer<AnalogOutInterface*> nameserver; 00191 }; 00192 } 00193 00194 #endif