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 { namespace dev { 00058 00059 00068 class RTT_API AnalogOutInterface 00069 : private NameServerRegistrator<AnalogOutInterface*> 00070 { 00071 public: 00072 00077 enum AnalogReference { Ground = 0, 00078 Common, 00079 Differential, 00080 Other 00081 }; 00082 00086 AnalogOutInterface() 00087 {} 00088 00093 AnalogOutInterface( const std::string& name ) 00094 : NameServerRegistrator<AnalogOutInterface*>( nameserver, name, this ) 00095 {} 00096 00097 virtual ~AnalogOutInterface() 00098 {} 00099 00107 virtual void rangeSet(unsigned int chan, 00108 unsigned int range) = 0; 00109 00117 virtual void arefSet(unsigned int chan, 00118 unsigned int aref) = 0; 00119 00124 virtual int rawWrite( unsigned int chan, int value ) = 0; 00125 00129 virtual int rawRead( unsigned int chan, int& value ) = 0; 00130 00134 virtual unsigned int rawRange() const = 0; 00135 00140 virtual int write( unsigned int chan, double value ) = 0; 00141 00145 virtual int read( unsigned int chan, double& value ) = 0; 00146 00151 virtual double lowest(unsigned int chan) const = 0; 00152 00157 virtual double highest(unsigned int chan) const = 0; 00158 00162 virtual double resolution(unsigned int chan) const = 0; 00163 00167 virtual unsigned int nbOfChannels() const = 0; 00168 00173 unsigned int binaryRange() const { return rawRange(); } 00174 00179 int binaryLowest() const { return 0; } 00180 00185 int binaryHighest() const { return rawRange(); } 00186 00191 static NameServer<AnalogOutInterface*> nameserver; 00192 }; 00193 }} 00194 00195 #endif