nidas  v1.2-1520
ViperDIO.h
Go to the documentation of this file.
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2 // vim: set shiftwidth=4 softtabstop=4 expandtab:
3 /*
4  ********************************************************************
5  ** NIDAS: NCAR In-situ Data Acquistion Software
6  **
7  ** 2007, Copyright University Corporation for Atmospheric Research
8  **
9  ** This program is free software; you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation; either version 2 of the License, or
12  ** (at your option) any later version.
13  **
14  ** This program is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** The LICENSE.txt file accompanying this software contains
20  ** a copy of the GNU General Public License. If it is not found,
21  ** write to the Free Software Foundation, Inc.,
22  ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  **
24  ********************************************************************
25 */
26 #ifndef NIDAS_DYNLD_VIPER_DIO_H
27 #define NIDAS_DYNLD_VIPER_DIO_H
28 
30 
31 #include <nidas/core/DOMable.h>
32 
33 #include <nidas/util/IOException.h>
35 #include <nidas/util/BitArray.h>
36 
37 namespace nidas { namespace dynld {
38 
45 class ViperDIO {
46 
47 public:
48 
49  ViperDIO();
50 
51  ~ViperDIO();
52 
53  void setDeviceName(const std::string& val)
54  {
55  _devName = val;
56  }
57 
58  const std::string& getDeviceName() const
59  {
60  return _devName;
61  }
62 
63  const std::string& getName() const
64  {
65  return _devName;
66  }
67 
68  int getFd() const { return _fd; }
69 
73  void open() throw(nidas::util::IOException);
74 
78  void close() throw(nidas::util::IOException);
79 
85  int getNumOutputs() const
86  {
87  return _noutputs;
88  }
89 
95  int getNumInputs() const
96  {
97  return _ninputs;
98  }
99 
104  void clearOutputs(const nidas::util::BitArray& which)
107 
112  void setOutputs(const nidas::util::BitArray& which)
115 
120  void setOutputs(const nidas::util::BitArray& which,
121  const nidas::util::BitArray& val)
124 
128  nidas::util::BitArray getOutputs() throw(nidas::util::IOException);
129 
133  nidas::util::BitArray getInputs() throw(nidas::util::IOException);
134 
135 private:
136 
137  std::string _devName;
138 
142  int _fd;
143 
148 
152  int _ninputs;
153 
154 };
155 
156 }} // namespace nidas namespace dynld
157 
158 #endif
void close()
Close the DIO device.
Definition: ViperDIO.cc:69
std::string _devName
Definition: ViperDIO.h:137
int _noutputs
How many DOUT pins are on this device?
Definition: ViperDIO.h:147
A class for holding bits.
Definition: BitArray.h:39
int getNumOutputs() const
Return number of DOUT pins on this device (8).
Definition: ViperDIO.h:85
void open()
Open the DIO device.
Definition: ViperDIO.cc:55
int getFd() const
Definition: ViperDIO.h:68
const std::string & getDeviceName() const
Definition: ViperDIO.h:58
void setDeviceName(const std::string &val)
Definition: ViperDIO.h:53
Support for the digital IO on an Arcom Viper.
Definition: ViperDIO.h:45
void clearOutputs(const nidas::util::BitArray &which)
Clear, to low state, viper digital output ports OUT0-7, as selected by bits 0-7 of which...
Definition: ViperDIO.cc:90
Definition: IOException.h:37
int getNumInputs() const
Return number of DIN pins on this device (8).
Definition: ViperDIO.h:95
nidas::util::BitArray getOutputs()
Get current settings of OUT0-7.
Definition: ViperDIO.cc:121
ViperDIO()
Definition: ViperDIO.cc:43
~ViperDIO()
Definition: ViperDIO.cc:47
nidas::util::BitArray getInputs()
get current settings of IN0-7
Definition: ViperDIO.cc:132
const std::string & getName() const
Definition: ViperDIO.h:63
int _fd
The file descriptor of this device.
Definition: ViperDIO.h:142
int _ninputs
How many DIN pins are on this device?
Definition: ViperDIO.h:152
void setOutputs(const nidas::util::BitArray &which)
Set, to high state, viper digital output ports OUT0-7, as selected by bits 0-7 of which...
Definition: ViperDIO.cc:76
Definition: InvalidParameterException.h:35