My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
Labjack.h
1 #ifndef GCP_UTIL_LABJACK_H
2 #define GCP_UTIL_LABJACK_H
3 
13 #include "gcp/util/common/CondVar.h"
14 #include "gcp/util/common/SerialClient.h"
15 #include "gcp/util/common/SpawnableTask.h"
16 #include "gcp/util/common/GenericTaskMsg.h"
17 #include "gcp/util/common/TimeOut.h"
18 
19 #include "gcp/util/common/LabjackMsg.h"
20 #include "gcp/util/common/LabjackU3.h"
21 
22 #include <sstream>
23 
24 namespace gcp {
25  namespace util {
26 
27  class Labjack {
28  public:
29 
33  Labjack(); //done
34 
38  ~Labjack(); //done
39 
40 
46  bool connect(int serialNumber); //done
47 
51  void disconnect(); //done
52 
56  bool isConnected(); //done
57 
58  //function to update the calibration information of the U3
59  long getCalibrationInfo();
60 
61  //and a function to configure the IO of the ADC
62  int configAllIO();
63  //function to read in the data from the Labjack
64  int AllIO();
68  int writeString(std::string message); //done
69 
73  LabjackMsg packCommand(LabjackMsg::Request req, int input); // done
74 
78  int serial_;
79 
83  void sendCommand(LabjackMsg& msg); // done
84 
88  LabjackMsg issueCommand(LabjackMsg::Request req, int input); //done
89  LabjackMsg issueCommand(LabjackMsg::Request req, int input, bool withQ); //done
90 
91  std::vector<float> queryAllVoltages();
92 
93  bool connected_;
94  private:
95 
99  int fd_;
100  uint8 numChannels_;
101  uint8 quickSample_;
102  uint8 longSettling_;
103  /*this is a handle to the labjack device*/
104  HANDLE hDevice_;
105 
106  //calibration info pointer for the U3 device
107  u3CalibrationInfo caliInfo_;
111  gcp::util::FdSet fdSet_;
112 
117  public:
121  int readPort(LabjackMsg& msg); //done
122  int readPort(LabjackMsg& msg, bool withQ); //done
123 
124  private:
128  void waitForResponse(); //done
129 
133  void parseResponse(LabjackMsg& msg); //done
134  void parseResponse(LabjackMsg& msg, bool withQ); //done
135 
139  struct termios termioSave_;
140 
141  void print_bits(unsigned char feature);
142 
143 
144  }; //End class DlpUsbThermal
145 
146  }; //End namespace util
147 }; // End namesapce gcp
148 
149 #endif // End #ifndef
150 
Request
Definition: LabjackMsg.h:34
Definition: LabjackMsg.h:27
Definition: FdSet.h:16
int writeString(std::string message)
Definition: Labjack.cc:911
bool isConnected()
Definition: Labjack.cc:902
~Labjack()
Definition: Labjack.cc:45
void sendCommand(LabjackMsg &msg)
LabjackMsg packCommand(LabjackMsg::Request req, int input)
int serial_
Definition: Labjack.h:78
LabjackMsg issueCommand(LabjackMsg::Request req, int input)
Definition: LabjackU3.h:32
Labjack()
Definition: Labjack.cc:36
void disconnect()
Definition: Labjack.cc:151
int readPort(LabjackMsg &msg)
Definition: Labjack.cc:932
Definition: Labjack.h:27
bool connect(int serialNumber)
Definition: Labjack.cc:54