AnalogOutInterface.hpp

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 
00055 namespace RTT
00056 {
00057 
00066     class AnalogOutInterface
00067         : private NameServerRegistrator<AnalogOutInterface*>
00068     {
00069     public:
00070 
00075         enum AnalogReference { Ground = 0, 
00076                                Common, 
00077                                Differential, 
00078                                Other 
00079         };
00080 
00084         AnalogOutInterface()
00085         {}
00086 
00091         AnalogOutInterface( const std::string& name )
00092             : NameServerRegistrator<AnalogOutInterface*>( nameserver, name, this )
00093         {}
00094 
00095         virtual ~AnalogOutInterface()
00096         {}
00097 
00105         virtual void rangeSet(unsigned int chan,
00106                               unsigned int range) = 0;
00107 
00115         virtual void arefSet(unsigned int chan,
00116                              unsigned int aref) = 0;
00117 
00122         virtual int rawWrite( unsigned int chan, int value ) = 0;
00123 
00127         virtual int rawRead( unsigned int chan, int& value ) = 0;
00128 
00132         virtual unsigned int rawRange() const = 0;
00133 
00138         virtual int write( unsigned int chan, double value ) = 0;
00139 
00143         virtual int read( unsigned int chan, double& value ) = 0;
00144 
00149         virtual double lowest(unsigned int chan) const = 0;
00150 
00155         virtual double highest(unsigned int chan) const = 0;
00156 
00160         virtual double resolution(unsigned int chan) const = 0;
00161 
00165         virtual unsigned int nbOfChannels() const = 0;
00166 
00171         unsigned int binaryRange() const { return rawRange(); }
00172 
00177         int binaryLowest() const { return 0; }
00178 
00183         int binaryHighest() const { return rawRange(); }
00184 
00189         static NameServer<AnalogOutInterface*> nameserver;
00190     };
00191 }
00192 
00193 #endif

Generated on Tue Aug 25 14:17:22 2009 for Orocos Real-Time Toolkit by  doxygen 1.5.8