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