Agilent6627A.hh
Go to the documentation of this file.00001
00010 #ifndef _AGILENT_6627A_HH_
00011 #define _AGILENT_6627A_HH_
00012
00013
00014
00015 #include <string>
00016 #include <map>
00017
00018 #include "PowerSupply.hh"
00019 #include "GPIBBaseInterface.hh"
00020
00021 class Agilent6627A: public PowerSupply
00022 {
00023 public:
00024
00026 enum AgilentError_t {
00027 NO_ERROR =0,
00028 INVALID_CHAR=1,
00029 INVALID_NUM =2,
00030 INVALID_STR =3,
00031 SYNTAX_ERROR=4,
00032 NUMBER_RANGE=5,
00033 NO_QUERY =6,
00034 DISP_LENGTH =7,
00035 BUFFER_FULL =8,
00036 EEPROM_ERROR=9,
00037 HARDWARE_ERR=10,
00038 HDW_ERR_CH_1=11,
00039 HDW_ERR_CH_2=12,
00040 HDW_ERR_CH_3=13,
00041 HDW_ERR_CH_4=14,
00042 NO_MODEL_NUM=15,
00044 CAL_ERROR =16,
00045 UNCALIBRATED=17,
00046 CAL_LOCKED =18,
00047 SKIP_SLF_TST=22,
00048
00049 INVALID_CH =30,
00050 UNKNOW_ERR =31
00051 };
00052
00053
00058 Agilent6627A(GPIBBaseInterface* iFace);
00059
00063 virtual ~Agilent6627A();
00064
00065
00075 virtual bool SetVoltage(double voltage, size_t channel);
00076
00086 virtual bool GetVoltage(double& voltage, size_t channel);
00087
00097 virtual bool GetOutputVoltage(double& voltage, size_t channel);
00098
00108 virtual bool GetOutputCurrent(double& current, size_t channel);
00109
00119 virtual bool SetCurrent(double current, size_t channel);
00120
00130 virtual bool GetCurrent(double& current, size_t channel);
00131
00132
00143 virtual bool SetOutputEnable(bool enable, size_t channel);
00144
00155 virtual bool GetOutputEnable(bool& enable, size_t channel);
00156
00157
00161 inline virtual bool IsError() const {return (bool)GetErrorCode();}
00162
00163
00168 inline virtual size_t GetErrorCode() const {return f_error_code;}
00169
00170
00176 inline virtual const std::string& GetErrorMsg() const {return f_error_msg;}
00177
00181 virtual std::string GetIDN();
00182
00183
00187 inline GPIBBaseInterface* GetInterface() const {return f_gpib;}
00188
00189
00190 protected:
00191
00192
00193 private:
00194
00195 GPIBBaseInterface* f_gpib;
00197 std::string f_error_msg;
00198 size_t f_error_code;
00204 inline void SetErrorCode(size_t error) {f_error_code=error;return;}
00205
00209 inline void SetErrorMsg(std::string err_msg) {f_error_msg=err_msg;return;}
00210
00211
00215 inline bool ResetError() {SetErrorCode(0x00);SetErrorMsg("No Error");return true;}
00216
00217
00223 bool ErrorCheck();
00224
00225
00231 bool ChannelCheck(size_t channel);
00232
00233
00243 inline bool GetString(std::string cmd, std::string& value) {return ApplyCommand(cmd,value);}
00244
00254 bool GetDouble(std::string cmd, double& value);
00255
00265 bool GetBool(std::string cmd, bool& value);
00266
00276 bool ApplyCommand(std::string cmd);
00277
00288 bool ApplyCommand(std::string cmd, std::string& answer);
00289
00290 };
00291
00292 #endif // _AGILENT_6627A_HH_
00293