Cat
SpecsInterface.h
Go to the documentation of this file.
1 //$Id: SpecsInterface.h,v 1.9 2006/10/24 13:28:40 fmachefe Exp $
2 //-----------------------------------------------------------------------------
3 //
4 // Package : SpecsInterface
5 //
6 // Description:
7 //
8 // Author(s) : F. Machefert -
9 // Date : 18 January 2004
10 //
11 //-----------------------------------------------------------------------------
12 
17 #ifndef SPECSINTERFACE_H
18 #define SPECSINTERFACE_H 1
19 
20 #include <algorithm>
21 #include <string>
22 #include <vector>
23 #include <list>
24 
25 #include "Interface.h"
26 
27 // SpecsLib include files
28 #ifndef _NODEVICE_
29 #include "SpecsUser.h"
30 #else
31 typedef unsigned char U8;
32 typedef unsigned short U16;
33 typedef unsigned long U32;
34 #endif
35 
36 class SpecsSlave;
37 class SpecsMaster;
38 
39 namespace CATApp {
40  enum Quality { BAD , GOOD } ;
41  enum Mode { BUS , I2C } ;
42  typedef std::pair< U32 , Quality > IntWQuality ;
43 }
44 
54 class SpecsInterface : public Interface {
55 public:
56  SpecsInterface( );
57  virtual ~SpecsInterface( ){} //< Destructor
58 
59 
63  virtual void help() { info("SpecsInterface "+name()+". No help.","SpecsInterface::help"); };
64 
69  virtual StatusCode init() {
70  info("SpecsInterface "+name()+" initialization.","SpecsInterface::init");
71  return StatusCode::SUCCESS;
72  };
73 
81  virtual void reset() { info("SpecsInterface "+name()+" reset.","SpecsInterface::reset");};
82 
86  virtual void update () {info("SpecsInterface "+name()+". Nothing to do.","SpecsInterface::update");};
87 
88 
89  // Element Address
90  void setAddress(unsigned char); //< set the element address
91 
92  unsigned char address(); //< return the element address
93 
94  void setOutputSelect(unsigned char); //< i2c Output selection if applicable
95 
96  unsigned char outputSelect(); //< return i2c output selection id applicable
97 
102  virtual SpecsSlave* specsSlave();
103 
108  virtual SpecsMaster* specsMaster();
109 
110 #ifndef _NODEVICE_
111 
115  virtual SPECSSLAVE* specsSlaveDevice();
116 
121  virtual SPECSMASTER* specsMasterDevice();
122 #endif
123 
124  virtual StatusCode read(IOdata* io) { return StatusCode::SUCCESS; };
125  virtual StatusCode write(IOdata* io) { return StatusCode::SUCCESS; };
126 
134  bool specsWriteI2c( unsigned char address ,
135  unsigned char nData ,
136  U8* data );
137 
144  bool specsWriteI2c( unsigned char address ,
145  std::vector<U8> data );
146 
157  bool specsReadI2c( unsigned char address ,
158  unsigned char nOctects ,
159  U8* i2cWords );
160 
167  bool specsReadI2c( unsigned char address ,
168  std::vector<unsigned char>& specsWords );
169 
177  bool specsWriteI2c( unsigned char address ,
178  unsigned char subAddress ,
179  unsigned char nData ,
180  U8* data );
181 
190  bool specsWriteI2c( unsigned char address ,
191  unsigned char outputSel,
192  unsigned char subAddress ,
193  unsigned char nData ,
194  U8* data );
195 
206  bool specsReadI2c( unsigned char address ,
207  unsigned char subAddress ,
208  unsigned char nOctets ,
209  U8* i2cWords );
210 
222  bool specsReadI2c( unsigned char address ,
223  unsigned char outputSel ,
224  unsigned char subAddress ,
225  unsigned char nOctets ,
226  U8* i2cWords );
227 
234  bool specsWriteParallel( unsigned char address,
235  unsigned short data);
236 
243  bool specsReadParallel( unsigned char address,
244  U16& data);
245 
252  bool specsWriteRegister( unsigned char ,
253  unsigned short );
254 
261  bool specsReadRegister( unsigned char ,
262  U16 & );
263 
264 
265 private:
266  int m_slot; //< Element Slot if applicable
267 protected:
268  unsigned char m_address; //< Element electronics address
269  unsigned char m_outputSelect;//< Element output Select for i2c protocol
270 
271 };
272 
273 #endif
274 
virtual ~SpecsInterface()
virtual void update()
unsigned char U8
Definition: ICECALv3.h:55
def data(object, stream=None)
Definition: shell.py:150
virtual StatusCode read(IOdata *io)
unsigned char m_address
virtual StatusCode init()
std::pair< U32, Quality > IntWQuality
Definition: IOdata.h:17
unsigned char m_outputSelect
unsigned long U32
Definition: ICECALv3.h:53
virtual void reset()
virtual StatusCode write(IOdata *io)
virtual void help()
unsigned short U16
Definition: ICECALv3.h:54