AnalogInInterface.hpp

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