Orocos Real-Time Toolkit  2.9.0
AnalogInInterface.hpp
Go to the documentation of this file.
1 // $Id: AnalogInInterface.hpp,v 1.10 2003/08/20 08:16:55 kgadeyne Exp $
2 /***************************************************************************
3  tag: Peter Soetens Thu Oct 10 16:16:56 CEST 2002 AnalogInInterface.hpp
4 
5  AnalogInInterface.hpp - description
6  -------------------
7  begin : Thu October 10 2002
8  copyright : (C) 2002 Peter Soetens
9  email : peter.soetens@mech.kuleuven.ac.be
10 
11  ***************************************************************************
12  * This library is free software; you can redistribute it and/or *
13  * modify it under the terms of the GNU General Public *
14  * License as published by the Free Software Foundation; *
15  * version 2 of the License. *
16  * *
17  * As a special exception, you may use this file as part of a free *
18  * software library without restriction. Specifically, if other files *
19  * instantiate templates or use macros or inline functions from this *
20  * file, or you compile this file and link it with other files to *
21  * produce an executable, this file does not by itself cause the *
22  * resulting executable to be covered by the GNU General Public *
23  * License. This exception does not however invalidate any other *
24  * reasons why the executable file might be covered by the GNU General *
25  * Public License. *
26  * *
27  * This library is distributed in the hope that it will be useful, *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
30  * Lesser General Public License for more details. *
31  * *
32  * You should have received a copy of the GNU General Public *
33  * License along with this library; if not, write to the Free Software *
34  * Foundation, Inc., 59 Temple Place, *
35  * Suite 330, Boston, MA 02111-1307 USA *
36  * *
37  ***************************************************************************/
38 /* Klaas Gadeyne, Mon August 11 2003
39  - Added "channel" param to lowest(), highest(), resolution() calls (these
40  are mostly configurable on a per channel basis. If not, there's
41  no problem
42  - In comedi, this is also done for their "binary"-counterpoles. I
43  don't know if this is necessary
44 
45  Klaas Gadeyne, Wed August 20 2003
46  - Added rangeSet() and arefSet() methods, that allready existed in
47  the comedi implementations of these interfaces
48 */
49 
50 #ifndef ANALOGININTERFACE_HPP
51 #define ANALOGININTERFACE_HPP
52 
53 #include "NameServer.hpp"
55 #include "../../rtt-config.h"
56 
57 namespace RTT
58 { namespace dev {
59 
69  : private NameServerRegistrator<AnalogInInterface*>
70  {
71  public:
76  enum AnalogReference { Ground = 0,
79  Other
80  };
81 
86  {}
87 
92  AnalogInInterface( const std::string& name )
93  : NameServerRegistrator<AnalogInInterface*>( nameserver, name, this )
94  {}
95 
97  {}
98 
106  virtual void rangeSet(unsigned int chan,
107  unsigned int range) = 0;
108 
116  virtual void arefSet(unsigned int chan,
117  unsigned int aref) = 0;
118 
123  virtual int rawRead( unsigned int chan, int& value ) = 0;
124 
129  virtual int read( unsigned int chan, double& value ) = 0;
130 
134  virtual unsigned int rawRange() const = 0;
135 
140  virtual double lowest(unsigned int chan) const = 0;
141 
146  virtual double highest(unsigned int chan) const = 0;
147 
151  virtual double resolution(unsigned int chan) const = 0;
152 
156  virtual unsigned int nbOfChannels() const = 0;
157 
162  unsigned int binaryRange() const { return rawRange(); }
163 
168  int binaryLowest() const { return 0; }
169 
174  int binaryHighest() const { return rawRange(); }
175 
181 
182  private:
183 
184  };
185 }}
186 
187 #endif
unsigned int binaryRange() const
Returns the binary range (e.g.
An interface for reading analog input, like for addressing a whole subdevice in comedi.
int binaryLowest() const
Returns the binary lowest value.
Utility class to register a given object with a nameserver, and deregister upon destruction.
#define RTT_API
Definition: rtt-config.h:97
int binaryHighest() const
Returns the binary highest value.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52
AnalogInInterface()
Create a not nameserved AnalogInInterface instance.
AnalogInInterface(const std::string &name)
Create a nameserved AnalogInInterface.
static NameServer< AnalogInInterface * > nameserver
The NameServer for this interface.
AnalogReference
This enum can be used to configure the arefSet() function.