RTXI  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
analogy_device.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 University of Bristol, UK
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 
19 #ifndef ANALOGY_DEVICE_H
20 #define ANALOGY_DEVICE_H
21 
22 #include <daq.h>
23 #include <plugin.h>
24 #include <string>
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #include <errno.h>
28 #include <analogy/analogy.h>
29 #include <rtdk.h>
30 
31 class AnalogyDevice : public DAQ::Device
32 {
33 
34 public:
35  AnalogyDevice(a4l_desc_t *,std::string,IO::channel_t *,size_t);
36  ~AnalogyDevice(void);
37 
38  size_t getChannelCount(DAQ::type_t) const;
41 
69 
72 
73  void read(void);
74  void write(void);
75 
76 protected:
77  virtual void doLoad(const Settings::Object::State &);
78  virtual void doSave(Settings::Object::State &) const;
79 
80 private:
82 
84  {
85  double gain;
89  double conv;
90  double offset;
91  double zerooffset;
92  lsampl_t maxdata;
94  size_t downsample;
95  size_t counter;
97  double calOffset;
98  };
99 
101  {
104  };
105 
106  struct channel_t
107  {
108  bool active;
109  union
110  {
113  };
114  };
115 
116  struct subdevice_t
117  {
118  int id;
122  };
123 
124  std::string deviceName;
126  a4l_desc_t dsc;
127 };
128 
129 #endif /* ANALOGY_DEVICE_H */
int setChannelActive(DAQ::type_t, DAQ::index_t, bool)
int setAnalogOffsetUnits(DAQ::type_t, DAQ::index_t, DAQ::index_t)
int setDigitalDirection(DAQ::index_t, DAQ::direction_t)
std::string deviceName
analog_channel_t analog
unsigned long index_t
Definition: daq.h:49
DAQ::index_t getAnalogReference(DAQ::type_t, DAQ::index_t) const
DAQ::index_t getAnalogUnits(DAQ::type_t, DAQ::index_t) const
size_t getAnalogRangeCount(DAQ::type_t, DAQ::index_t) const
size_t getChannelCount(DAQ::type_t) const
int setAnalogReference(DAQ::type_t, DAQ::index_t, DAQ::index_t)
bool getAnalogCalibrationActive(DAQ::type_t, DAQ::index_t) const
size_t getAnalogUnitsCount(DAQ::type_t, DAQ::index_t) const
DAQ::direction_t getDigitalDirection(DAQ::index_t) const
std::string getAnalogUnitsString(DAQ::type_t, DAQ::index_t, DAQ::index_t) const
void write(void)
DAQ::index_t getAnalogOffsetUnits(DAQ::type_t, DAQ::index_t) const
int setAnalogConversion(DAQ::type_t, DAQ::index_t)
int setAnalogZeroOffset(DAQ::type_t, DAQ::index_t, double)
a4l_desc_t dsc
int setAnalogCalibrationValue(DAQ::type_t, DAQ::index_t, double)
int setAnalogCalibrationActive(DAQ::type_t, DAQ::index_t, bool)
bool getAnalogCalibrationState(DAQ::type_t, DAQ::index_t) const
int setAnalogGain(DAQ::type_t, DAQ::index_t, double)
int setAnalogCounter(DAQ::type_t, DAQ::index_t)
direction_t
Definition: daq.h:57
size_t getAnalogDownsample(DAQ::type_t, DAQ::index_t) const
subdevice_t subdevice[3]
std::string getAnalogRangeString(DAQ::type_t, DAQ::index_t, DAQ::index_t) const
size_t getAnalogReferenceCount(DAQ::type_t, DAQ::index_t) const
double getAnalogGain(DAQ::type_t, DAQ::index_t) const
int setAnalogRange(DAQ::type_t, DAQ::index_t, DAQ::index_t)
int setAnalogUnits(DAQ::type_t, DAQ::index_t, DAQ::index_t)
bool getChannelActive(DAQ::type_t, DAQ::index_t) const
int setAnalogDownsample(DAQ::type_t, DAQ::index_t, size_t)
AnalogyDevice(a4l_desc_t *, std::string, IO::channel_t *, size_t)
std::string getAnalogReferenceString(DAQ::type_t, DAQ::index_t, DAQ::index_t) const
double getAnalogCalibrationValue(DAQ::type_t, DAQ::index_t) const
bool analog_exists(DAQ::type_t, DAQ::index_t) const
type_t
Definition: daq.h:38
virtual void doSave(Settings::Object::State &) const
digital_channel_t digital
DAQ::index_t getAnalogRange(DAQ::type_t, DAQ::index_t) const
double getAnalogZeroOffset(DAQ::type_t, DAQ::index_t) const
virtual void doLoad(const Settings::Object::State &)