nidas  v1.2-1520
IR104_Relays.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  ** 2011, 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_IR104_RELAYS_H
27 #define NIDAS_DYNLD_IR104_RELAYS_H
28 
30 
31 #include <nidas/core/DSMSensor.h>
32 
33 #include <nidas/util/IOException.h>
35 #include <nidas/util/BitArray.h>
36 
37 namespace nidas { namespace dynld {
38 
46 
47 public:
48 
49  IR104_Relays();
50 
51  ~IR104_Relays();
52 
54 
57 
61  void open(int flags) throw(nidas::util::IOException,
63 
67  bool process(const nidas::core::Sample*,std::list<const nidas::core::Sample*>& result)
68  throw();
69 
75  int getNumOutputs() const
76  {
77  return _noutputs;
78  }
79 
85  int getNumInputs() const
86  {
87  return _ninputs;
88  }
89 
93  void clearOutputs(const nidas::util::BitArray& which)
96 
100  void setOutputs(const nidas::util::BitArray& which)
103 
108  void setOutputs(const nidas::util::BitArray& which,
109  const nidas::util::BitArray& val)
112 
116  nidas::util::BitArray getOutputs() throw(nidas::util::IOException);
117 
121  nidas::util::BitArray getInputs() throw(nidas::util::IOException);
122 
123 private:
124 
129 
133  int _ninputs;
134 
135 };
136 
137 }} // namespace nidas namespace dynld
138 
139 #endif
A class for holding bits.
Definition: BitArray.h:39
int _ninputs
How many DIN pins are on this device?
Definition: IR104_Relays.h:133
nidas::util::BitArray getInputs()
get current settings of inputs.
Definition: IR104_Relays.cc:165
int _noutputs
How many DOUT pins are on this device?
Definition: IR104_Relays.h:128
nidas::core::IODevice * buildIODevice()
Factory method for an IODevice for this DSMSensor.
Definition: IR104_Relays.cc:55
void open(int flags)
Open the IR104 device.
Definition: IR104_Relays.cc:66
nidas::core::SampleScanner * buildSampleScanner()
Factory method for a SampleScanner for this DSMSensor.
Definition: IR104_Relays.cc:60
Support for the digital IO on a Diamond Systems IR104 board.
Definition: IR104_Relays.h:45
bool process(const nidas::core::Sample *, std::list< const nidas::core::Sample * > &result)
Process a raw sample of the relay bit settings.
Definition: IR104_Relays.cc:78
nidas::util::BitArray getOutputs()
Get current settings of relays.
Definition: IR104_Relays.cc:152
int getNumInputs() const
Return number of DIN pins on this device (8).
Definition: IR104_Relays.h:85
~IR104_Relays()
Definition: IR104_Relays.cc:51
int getNumOutputs() const
Return number of DOUT pins on this device (8).
Definition: IR104_Relays.h:75
An interface to an IO device.
Definition: IODevice.h:41
Interface to a data sample.
Definition: Sample.h:189
IR104_Relays()
Definition: IR104_Relays.cc:45
DSMSensor provides the basic support for reading, processing and distributing samples from a sensor a...
Definition: DSMSensor.h:87
Definition: IOException.h:37
void setOutputs(const nidas::util::BitArray &which)
Set relays as selected by bits 0-19 of which.
Definition: IR104_Relays.cc:107
A scanner of sample data.
Definition: SampleScanner.h:73
void clearOutputs(const nidas::util::BitArray &which)
Unset relays as selected by bits 0-19 of which.
Definition: IR104_Relays.cc:121
Definition: InvalidParameterException.h:35