diff --git a/include/AbstractElectrometerClass.h b/include/AbstractElectrometerClass.h index dea993a6037ac4e5b376ebd594d14425f16e2792..95beda0086fa48b3ac1b25d4dd95e77d78429761 100644 --- a/include/AbstractElectrometerClass.h +++ b/include/AbstractElectrometerClass.h @@ -9,9 +9,13 @@ // // $Author: xavela $ // -// $Revision: 1.16 $ +// $Revision: 1.17 $ // // $Log: not supported by cvs2svn $ +// Revision 1.16 2009/03/12 09:29:00 xavela +// xavier: +// Keithley part : support for 6517. +// // Revision 1.15 2009/03/10 10:29:14 xavela // xavier: // range values ordered @@ -97,6 +101,7 @@ #ifndef _ABSTRACT_ELECTROMETER_CLASS_H_ #define _ABSTRACT_ELECTROMETER_CLASS_H_ +#include <tango.h> //- Tango exceptions #include "ElectrometerProtocol.h" /** @@ -122,31 +127,32 @@ public: /** * \brief Electrometer common functions. */ - virtual void range_up (void) = 0; - virtual void range_down (void) = 0; - virtual void reset (void); - virtual void local (void); - virtual void remote (void); + virtual bool init_protocol (void) = 0; + virtual void range_up (void) = 0; + virtual void range_down (void) = 0; + virtual void reset (void); + virtual void local (void); + virtual void remote (void); /** * \brief Electrometer : cmd to get electrometer data. */ - std::string get_value (void); + std::string get_value (void); virtual std::vector<double> get_integratedValue (void); virtual std::vector<double> get_fetchValue (void); /** * \brief Keithley Electrometer methods */ - void autoRange_on (void); + void autoRange_on (void); void zero_check_on (void); void zero_check_off (void); void zero_correct_on (void); void zero_correct_off (void); - virtual void auto_zero_on (void); + virtual void auto_zero_on (void); virtual void auto_zero_off (void); virtual void autoRange_off (void); - virtual void setAmperMeterMode (void); + virtual void setAmperMeterMode(void); virtual void setVoltMeterMode (void); virtual void setOhmMeterMode (void); virtual void setCoulombMeterMode(void); @@ -155,34 +161,34 @@ public: * \brief Following functions are only supported for SCPI protocol * */ - void abort (void); + void abort (void); virtual void init_keithley (void); - void clear_registers (void); + void clear_registers (void); virtual void averageStateON (void); virtual void averageStateOFF (void); - virtual void set_knplc (float nPLC); + virtual void set_knplc (float nPLC); virtual void set_triggercount (short trigcounts); - void set_triggerdelay (std::string trigdelay); - void set_triggerdelayAuto (std::string trigdelAuto); + void set_triggerdelay (std::string trigdelay); + void set_triggerdelayAuto (std::string trigdelAuto); virtual void set_averagecount (std::string avercounts); virtual void set_averagecontrol (std::string averctrl); - std::string get_knplc (void); + std::string get_knplc (void); std::string get_triggercount (void); std::string get_triggerdelay (void); std::string get_triggerdelayAuto(void); virtual std::string get_averagecount (void); - virtual std::string get_averagecontrol (void); + virtual std::string get_averagecontrol(void); virtual void clear_buffer (void); - virtual void store_raw_input (void); - virtual void start_storing (void); + virtual void store_raw_input (void); + virtual void start_storing (void); void enable_SRQBufferFull (void); - void disable_SRQBufferFull (void); + void disable_SRQBufferFull (void); virtual bool SRQLineState (void); //- used to know if the integration cycle is done! virtual short readStatusByteRegister (void); //- device status byte register value on SRQ! bool get_overloadRangeState (void); //- used to know if the device range is overloaded (DDC Keithley ONLY)! virtual void set_buffer_size (short); virtual void set_triggerMode (short); - virtual void set_integrationTime (double); + virtual void set_integrationTime (double); virtual short get_buffer_size (void); virtual short get_triggerMode (void) { return _trigMod;}; @@ -192,8 +198,8 @@ public: * Following functions are only supported for Novelec Protocol */ virtual void set_Zero_VonF_function (void); - virtual void set_Offset_ZeroV1_function (void); - virtual void set_Leakage_ZeroV2_function (void); + virtual void set_Offset_ZeroV1_function (void); + virtual void set_Leakage_ZeroV2_function(void); virtual void set_Test_function (void); virtual void set_Measure_function (void); virtual void mcce_on (void); @@ -205,10 +211,10 @@ public: virtual std::string get_ElectroMeterPolarity (void); virtual std::string get_ElectroMeterFrequency (void); virtual std::string get_ElectroMeterGain (void); - virtual unsigned short get_ElectroChannel (void); - virtual void set_ElectroMeterRange (std::string rang); - virtual void set_ElectroMeterPolarity (std::string pola); - virtual void set_ElectroMeterFrequency (std::string freq); + virtual unsigned short get_ElectroChannel (void); + virtual void set_ElectroMeterRange (std::string rang); + virtual void set_ElectroMeterPolarity (std::string pola); + virtual void set_ElectroMeterFrequency (std::string freq); virtual void set_ElectroMeterGain (std::string gain); virtual void set_ElectroChannel (unsigned short address); @@ -249,9 +255,9 @@ protected : void set_electroState(ElectroState newState) { electrometerState = newState; }; short _range; - std::string _rangeStr; - std::string _mode; - std::string _device_proxy_name; + std::string _rangeStr; + std::string _mode; + std::string _device_proxy_name; ElectrometerProtocol* _electrometerProtocol; //- for internal use -> to configure the Integration mode diff --git a/include/ElectrometerProtocol.h b/include/ElectrometerProtocol.h index b539a9bbd6e691575a87db7d4bc1964cf83144aa..5240db57fd5abc5673e4c7621758e321085b2635 100644 --- a/include/ElectrometerProtocol.h +++ b/include/ElectrometerProtocol.h @@ -12,9 +12,13 @@ // // $Author: xavela $ // -// $Revision: 1.11 $ +// $Revision: 1.12 $ // // $Log: not supported by cvs2svn $ +// Revision 1.11 2009/01/19 12:00:25 xavela +// xavier : +// - MCCE2 (Novelec part) : methods to change the active channel to communicate with. +// // Revision 1.10 2008/06/20 14:36:24 xavela // xavier : // - DDC status show only errors if any @@ -102,6 +106,12 @@ public: */ virtual ~ElectrometerProtocol (); + + /** + * \brief create the communication device proxy. + */ + virtual bool build_communicationLink() = 0; + /** * \brief Common Electrometer Functions. */ @@ -138,10 +148,10 @@ public: */ virtual void init_keithley (void); virtual void abort (void); - virtual void set_knplc (std::string nPLC); + virtual void set_knplc (std::string nPLC); virtual void set_triggercount (std::string trigcounts); virtual void set_triggerdelay (std::string trigdelay); - virtual void set_triggerMode (std::string); + virtual void set_triggerMode (std::string); virtual void set_triggerdelayAuto (std::string trigdelAuto); virtual void set_averagecount (std::string avercounts); virtual void set_averagecontrol (std::string averctrl); @@ -149,23 +159,23 @@ public: virtual std::string get_triggercount (void); virtual std::string get_triggerdelay (void); virtual std::string get_triggerdelayAuto(void); - virtual std::string get_averagecount (void); + virtual std::string get_averagecount (void); virtual std::string get_averagecontrol (void); virtual void clear_registers (void); virtual void averageStateON (void); virtual void averageStateOFF (void); - virtual void setAmperMeterMode (void); + virtual void setAmperMeterMode(void); virtual void setVoltMeterMode (void); virtual void setOhmMeterMode (void); virtual void setCoulombMeterMode(void); - virtual void autoRange_on (void); + virtual void autoRange_on (void); virtual void autoRange_off (void); virtual void zero_check_on (void); virtual void zero_check_off (void); virtual void zero_correct_on (void); virtual void zero_correct_off (void); - virtual void auto_zero_on (void); + virtual void auto_zero_on (void); virtual void auto_zero_off (void); /** @@ -186,37 +196,38 @@ public: virtual void enable_readingsFromBuffer_K486_487 (void); virtual void read_data_with_no_timestamp (void); - virtual std::string get_buffer_size (void); + virtual std::string get_buffer_size (void); //- only for K_486 and K_487 devices - virtual void enable_integrationPeriod (void); + virtual void enable_integrationPeriod(void); /** * \brief Electrometer : Novelec protocol dependent commands. */ - virtual void switch_MCCE2_ON (void); - virtual void switch_MCCE2_OFF (void); - virtual void init_MCCE2_for_communication (void); - virtual void unable_zeroVF_func (void); + virtual void switch_MCCE2_ON (void); + virtual void switch_MCCE2_OFF (void); + virtual void init_MCCE2_for_communication(void); + virtual void unable_zeroVF_func (void); virtual void unable_offset_zeroV1_func (void); virtual void unable_leakage_zeroV2_func (void); - virtual void unable_test_func (void); + virtual void unable_test_func (void); virtual void unable_measure_func (void); - virtual std::string get_polarity (void); - virtual std::string get_frequency (void); - virtual std::string get_gain (void); + virtual std::string get_polarity (void); + virtual std::string get_frequency (void); + virtual std::string get_gain(void); virtual void set_polarity (std::string pola); - virtual void set_frequency (std::string freq); - virtual void set_gain (std::string gain); + virtual void set_frequency (std::string freq); + virtual void set_gain (std::string gain); virtual unsigned short get_electrometer_active_channel(void); - virtual void set_electrometer_active_channel (unsigned short address); + virtual void set_electrometer_active_channel(unsigned short address); protected : short _range; - std::string _mode; + std::string _mode; + std::string _commDevName; //- communication device proxy name CommunicationLink* _communication_link; private : diff --git a/include/KeithleyDDCProtocol.h b/include/KeithleyDDCProtocol.h index 1e4939c13d8225b114bd5d1e1ac77e2cb6bc4e22..34cc954cf65e77be0e3f3ddc3e2337d514d24c0e 100644 --- a/include/KeithleyDDCProtocol.h +++ b/include/KeithleyDDCProtocol.h @@ -44,6 +44,11 @@ public: virtual ~KeithleyDDCProtocol (void); /** + * \brief create the communication device proxy. + */ + bool build_communicationLink(); + + /** * \brief Electrometer Functions. */ void set_range (std::string value); diff --git a/include/KeithleySCPIProtocol.h b/include/KeithleySCPIProtocol.h index acb7ae77dd93018bcaeb899abba63739f6843d1a..d8c7b4cf000bf5eec8b201c198036e9d6711013a 100644 --- a/include/KeithleySCPIProtocol.h +++ b/include/KeithleySCPIProtocol.h @@ -44,6 +44,11 @@ public: */ virtual ~KeithleySCPIProtocol (void); + /** + * \brief create the communication device proxy. + */ + bool build_communicationLink(); + /** * \brief Electrometer Functions. */ diff --git a/include/Keithley_485.h b/include/Keithley_485.h index 7623bf5aaa376ae0e8eb424d763150a667eb21f5..90ce6bb7f6e99ec6a65dbe04cfefb3ebb1e437fd 100644 --- a/include/Keithley_485.h +++ b/include/Keithley_485.h @@ -42,6 +42,11 @@ public: */ virtual ~Keithley_485 (void); + /** + * \brief protocole initailisation. + */ + bool init_protocol (void); + /** * \brief Device dependent commands. */ diff --git a/include/Keithley_486.h b/include/Keithley_486.h index 53d060aeb02564715d32498c6ee5805dac06cf49..1f74840d619d93d38a3994edbbb42a60f0e067e9 100644 --- a/include/Keithley_486.h +++ b/include/Keithley_486.h @@ -42,16 +42,21 @@ public: */ virtual ~Keithley_486 (void); + /** + * \brief protocole initailisation. + */ + bool init_protocol (void); + /** * \brief Device dependent commands. */ - void range_up (void); - void range_down (void); - void autoRange_off (void); - void set_buffer_size (short); - void set_triggerMode (short); - void init_keithley (void); - short get_buffer_size (void) { return _size; }; + void range_up (void); + void range_down (void); + void autoRange_off (void); + void set_buffer_size (short); + void set_triggerMode (short); + void init_keithley (void); + short get_buffer_size (void) { return _size; }; /** * \brief The integration time (sec). diff --git a/include/Keithley_487.h b/include/Keithley_487.h index ca4bd7d6894787d00ebf2ac933131761110d1780..33baa33f99d26098caef4b65fb13b343ee5b6641 100644 --- a/include/Keithley_487.h +++ b/include/Keithley_487.h @@ -42,6 +42,11 @@ public: */ virtual ~Keithley_487 (void); + /** + * \brief protocole initailisation. + */ + bool init_protocol (void); + /** * \brief Electrometer methods. */ diff --git a/include/Keithley_617.h b/include/Keithley_617.h index d4a11f96cea4ff1773db56f55afe2f48ffcd637b..d90bf9f8d4f730d919af5c4cc2e41f88fcb0ba8b 100644 --- a/include/Keithley_617.h +++ b/include/Keithley_617.h @@ -42,6 +42,11 @@ public: */ virtual ~Keithley_617 (void); + /** + * \brief protocole initailisation. + */ + bool init_protocol (void); + /** * \brief Device dependent commands. */ diff --git a/include/Keithley_6485.h b/include/Keithley_6485.h index a42829aaef05d144f9d4b78b080ee8030eaecebb..a8c9de0651e2263f446edfa100a9eb0607150654 100644 --- a/include/Keithley_6485.h +++ b/include/Keithley_6485.h @@ -42,6 +42,11 @@ public: */ virtual ~Keithley_6485 (void); + /** + * \brief protocole initailisation. + */ + bool init_protocol (void); + std::vector<double> get_integratedValue (void); std::vector<double> get_fetchValue (void); /** diff --git a/include/Keithley_6487.h b/include/Keithley_6487.h index 7b4c13de7f6fece6ebc33edfbb4958ff2e5f917b..67cf108ef91f394861ac1946859363dd0562316a 100644 --- a/include/Keithley_6487.h +++ b/include/Keithley_6487.h @@ -42,6 +42,11 @@ public: */ virtual ~Keithley_6487 (void); + /** + * \brief protocole initailisation. + */ + bool init_protocol (void); + /** * \brief Device dependent commands. */ diff --git a/include/Keithley_6512.h b/include/Keithley_6512.h index 11b7749aace7c925a9440bb9c7386c0401bb520f..e834aa296df24e065116b92156b162b3da329edd 100644 --- a/include/Keithley_6512.h +++ b/include/Keithley_6512.h @@ -42,6 +42,11 @@ public: */ virtual ~Keithley_6512 (void); + /** + * \brief protocole initailisation. + */ + bool init_protocol (void); + /** * \brief Device dependent commands. */ diff --git a/include/Keithley_6514.h b/include/Keithley_6514.h index 1b2c73b7d3c02ddf2a85c55cd0d67c212ee3f6a1..f2346401360bbbad841304a2738484ad6c1729d1 100644 --- a/include/Keithley_6514.h +++ b/include/Keithley_6514.h @@ -42,6 +42,11 @@ public: */ virtual ~Keithley_6514 (void); + /** + * \brief protocole initailisation. + */ + bool init_protocol (void); + /** * \brief Device dependent commands. */ diff --git a/include/Keithley_6517.h b/include/Keithley_6517.h index fcccd5aaf52c83b2222528b074f995498e58b55b..cffe442262f08341aee694033e70c6ceb5fd4c39 100644 --- a/include/Keithley_6517.h +++ b/include/Keithley_6517.h @@ -42,6 +42,11 @@ public: */ virtual ~Keithley_6517 (void); + /** + * \brief protocole initailisation. + */ + bool init_protocol (void); + /** * \brief Device dependent commands. */ diff --git a/include/NovelecProtocol.h b/include/NovelecProtocol.h index 1d4c12c8473793098744dd770461cd3e483d4790..9f89837d6e4ae87efed023177a05c589b03d716f 100644 --- a/include/NovelecProtocol.h +++ b/include/NovelecProtocol.h @@ -36,7 +36,7 @@ public: /** * \brief Initialization. */ - NovelecProtocol (std::string& gpib_device_name, short channel_address, short electroTypeNumber); + NovelecProtocol (std::string& gpib_device_name, unsigned short channel_address, unsigned short electroTypeNumber); /** * \brief Release resources. @@ -44,6 +44,11 @@ public: virtual ~NovelecProtocol(void); /** + * \brief create the communication device proxy. + */ + bool build_communicationLink(); + + /** * \brief Electrometer Functions. */ void set_range (std::string value); diff --git a/include/Novelec_MCCE2.h b/include/Novelec_MCCE2.h index 16c01dda0b25ea49f99c068410c058022d74333c..95b8c3ba122ce4ad71ccb1556078ad5d29ba7483 100644 --- a/include/Novelec_MCCE2.h +++ b/include/Novelec_MCCE2.h @@ -35,13 +35,15 @@ public: /** * \brief Initialization. */ - Novelec_MCCE2 (std::string& comLink_device_name, short channel_address, short electroType); + Novelec_MCCE2 (std::string& comLink_device_name, unsigned short channel_address, unsigned short electroType); /** * \brief Release resources. */ virtual ~Novelec_MCCE2 (void); + bool init_protocol(void); + std::string get_ElectroMeterPolarity(void); void set_ElectroMeterPolarity (std::string); @@ -75,8 +77,9 @@ public: std::string electrometer_status (void); protected : - unsigned short _rangeLimit; //- define the range limit for each novelec type - unsigned short _MCCE2electroTypeNumber; //- the mcce2 electrometer type number (to check rang value) + unsigned short _rangeLimit; //- define the range limit for each novelec type + unsigned short _address; //- a DAIP manages 2 "channels" (or address) + unsigned short _MCCE2electroTypeNumber; //- the mcce2 electrometer type number (to check range value) /** * \brief Checks the new range value diff --git a/src/AbstractElectrometerClass.cpp b/src/AbstractElectrometerClass.cpp index 44e36c880dc77932b7ce48a3e1a53b0157b3653f..b4187610a3e59e8a664ca63ce6870af471045a00 100644 --- a/src/AbstractElectrometerClass.cpp +++ b/src/AbstractElectrometerClass.cpp @@ -11,9 +11,12 @@ // // $Author: xavela $ // -// $Revision: 1.18 $ +// $Revision: 1.19 $ // // $Log: not supported by cvs2svn $ +// Revision 1.18 2009/10/12 08:50:41 xavela +// minor change : cmd reset (*RST) added for DDCs. +// // Revision 1.17 2009/03/18 10:25:29 xavela // xavier : // - Novelec part updated and tested ! @@ -151,7 +154,6 @@ AbstractElectrometerClass::~AbstractElectrometerClass (void) // std::cout << "AbstractElectrometerClass::~AbstractElectrometerClass ->" << std::endl; } - // ============================================================================ // AbstractElectrometerClass::zero_check_on // ============================================================================ diff --git a/src/KeithleyDDCProtocol.cpp b/src/KeithleyDDCProtocol.cpp index 46836e03c8aab9ab66ea5a6eb07367b1ee047afc..399fcf7717454fe7e62a3395096e1472c1647082 100644 --- a/src/KeithleyDDCProtocol.cpp +++ b/src/KeithleyDDCProtocol.cpp @@ -26,11 +26,11 @@ // ============================================================================ KeithleyDDCProtocol::KeithleyDDCProtocol (std::string& gpib_device_name) : ElectrometerProtocol(), -_is_overloaded(false) + _is_overloaded(false) { std::cout << "KeithleyDDCProtocol::KeithleyDDCProtocol <-" << std::endl; - _communication_link = new TangoGpibLink (gpib_device_name); + _commDevName = gpib_device_name; std::cout << "KeithleyDDCProtocol::KeithleyDDCProtocol ->" << std::endl; } @@ -45,6 +45,22 @@ KeithleyDDCProtocol::~KeithleyDDCProtocol (void) std::cout << "KeithleyDDCProtocol::~KeithleyDDCProtocol ->" << std::endl; } +// ============================================================================ +// KeithleyDDCProtocol::build_communicationLink +// ============================================================================ +bool KeithleyDDCProtocol::build_communicationLink() +{ + if (_commDevName.empty()) + return false; + + _communication_link = new TangoGpibLink (_commDevName); + + if (!_communication_link) + return false; + + return true; +} + // ============================================================================ // KeithleyDDCProtocol::set_range // ============================================================================ diff --git a/src/KeithleySCPIProtocol.cpp b/src/KeithleySCPIProtocol.cpp index 3389d145481af1049853e18de59f00ce72aa6c37..b9f1cb32e08b5bbfb96556b3a02c7e666c6fcb22 100644 --- a/src/KeithleySCPIProtocol.cpp +++ b/src/KeithleySCPIProtocol.cpp @@ -36,18 +36,7 @@ KeithleySCPIProtocol::KeithleySCPIProtocol (std::string& gpib_device_name) { std::cout << "KeithleySCPIProtocol::KeithleySCPIProtocol <-" << std::endl; - _communication_link = new TangoGpibLink (gpib_device_name); - -std::string cmd_to_send(""); - //- Select reading only - cmd_to_send = "FORM:ELEM READ"; - _communication_link->write(cmd_to_send); - //- Select control source : IMMediate - cmd_to_send = "ARM:SOUR IMM"; - _communication_link->write(cmd_to_send); - //- Set measure count - cmd_to_send = "ARM:COUNT 1"; - _communication_link->write(cmd_to_send); + _commDevName = gpib_device_name; std::cout << "KeithleySCPIProtocol::KeithleySCPIProtocol ->" << std::endl; } @@ -62,6 +51,34 @@ KeithleySCPIProtocol::~KeithleySCPIProtocol (void) std::cout << "KeithleySCPIProtocol::~KeithleySCPIProtocol ->" << std::endl; } +// ============================================================================ +// KeithleySCPIProtocol::build_communicationLink +// ============================================================================ +bool KeithleySCPIProtocol::build_communicationLink() +{ + if (_commDevName.empty()) + return false; + + _communication_link = new TangoGpibLink (_commDevName); + + if (!_communication_link) + return false; + + //- configure tthe SCPI Keithley device + std::string cmd_to_send(""); + //- Select reading only + cmd_to_send = "FORM:ELEM READ"; + _communication_link->write(cmd_to_send); + //- Select control source : IMMediate + cmd_to_send = "ARM:SOUR IMM"; + _communication_link->write(cmd_to_send); + //- Set measure count + cmd_to_send = "ARM:COUNT 1"; + _communication_link->write(cmd_to_send); + + return true; +} + // ============================================================================ // KeithleySCPIProtocol::set_range // ============================================================================ diff --git a/src/Keithley_485.cpp b/src/Keithley_485.cpp index 6d53f398d0d7c86657720108da94648988e450be..015081d528e912244cb0ee6db1ad4c812c57b8e9 100644 --- a/src/Keithley_485.cpp +++ b/src/Keithley_485.cpp @@ -43,8 +43,6 @@ Keithley_485::Keithley_485 (std::string& comLink_device_name):AbstractElectromet { std::cout << "Keithley_485::Keithley_485 <-" << std::endl; - - _electrometerProtocol = new KeithleyDDCProtocol (_device_proxy_name); std::cout << "Keithley_485::Keithley_485 ->" << std::endl; } @@ -59,6 +57,42 @@ Keithley_485::~Keithley_485 (void) std::cout << "Keithley_485::~Keithley_485 ->" << std::endl; } +// ============================================================================ +// Keithley_485::init_protocol +// ============================================================================ +bool Keithley_485::init_protocol (void) +{ + std::string description(""); + bool success = false; + try + { + //- build the keithley Electrometer protocol obj + _electrometerProtocol = new KeithleyDDCProtocol (_device_proxy_name); + + if(_electrometerProtocol) + success = _electrometerProtocol->build_communicationLink(); + } + catch(Tango::DevFailed& df) + { + description = "FAILED to create proxy on : " + _device_proxy_name; + + Tango::Except::re_throw_exception (df, + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_485::init_protocol"); + } + catch(...) + { + description = "FAILED to create proxy on : " + _device_proxy_name + ". Caught [...]."; + + Tango::Except::throw_exception ( + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_485::init_protocol"); + } + return success; +} + // ============================================================================ // Keithley_485::range_up // ============================================================================ diff --git a/src/Keithley_486.cpp b/src/Keithley_486.cpp index f7a68311fcf75ece05b7238da6bc9f696fc68929..a42bb3abd91e93501f76644aa616dfe60396a6dc 100644 --- a/src/Keithley_486.cpp +++ b/src/Keithley_486.cpp @@ -48,8 +48,6 @@ Keithley_486::Keithley_486 (std::string& comLink_device_name):AbstractElectromet { std::cout << "Keithley_486::Keithley_486 <-" << std::endl; - //- build the keithley Electrometer obj - _electrometerProtocol = new KeithleyDDCProtocol(_device_proxy_name); _size = -1; _trigMod = -1; @@ -66,6 +64,43 @@ Keithley_486::~Keithley_486 (void) std::cout << "Keithley_486::~Keithley_486 ->" << std::endl; } +// ============================================================================ +// Keithley_486::init_protocol +// ============================================================================ +bool Keithley_486::init_protocol (void) +{ + std::string description(""); + bool success = false; + + try + { + //- build the keithley Electrometer protocol obj + _electrometerProtocol = new KeithleyDDCProtocol (_device_proxy_name); + + if(_electrometerProtocol) + success = _electrometerProtocol->build_communicationLink(); + } + catch(Tango::DevFailed& df) + { + description = "FAILED to create proxy on : " + _device_proxy_name; + + Tango::Except::re_throw_exception (df, + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_486::init_protocol"); + } + catch(...) + { + description = "FAILED to create proxy on : " + _device_proxy_name + ". Caught [...]."; + + Tango::Except::throw_exception ( + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_486::init_protocol"); + } + return success; +} + // ============================================================================ // Keithley_486::autoRange_off // ============================================================================ diff --git a/src/Keithley_487.cpp b/src/Keithley_487.cpp index 7e7f1fdd2b447e792bc5352f350065da5c7e689e..248b679e96519ccc0cc179047698e7735ce8fcec 100644 --- a/src/Keithley_487.cpp +++ b/src/Keithley_487.cpp @@ -64,6 +64,43 @@ Keithley_487::~Keithley_487 (void) std::cout << "Keithley_487::~Keithley_487 ->" << std::endl; } +// ============================================================================ +// Keithley_487::init_protocol +// ============================================================================ +bool Keithley_487::init_protocol (void) +{ + std::string description(""); + bool success = false; + + try + { + //- build the keithley Electrometer protocol obj + _electrometerProtocol = new KeithleyDDCProtocol (_device_proxy_name); + + if(_electrometerProtocol) + success = _electrometerProtocol->build_communicationLink(); + } + catch(Tango::DevFailed& df) + { + description = "FAILED to create proxy on : " + _device_proxy_name; + + Tango::Except::re_throw_exception (df, + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_487::init_protocol"); + } + catch(...) + { + description = "FAILED to create proxy on : " + _device_proxy_name + ". Caught [...]."; + + Tango::Except::throw_exception ( + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_487::init_protocol"); + } + return success; +} + // ============================================================================ // Keithley_487::autoRange_off // ============================================================================ diff --git a/src/Keithley_617.cpp b/src/Keithley_617.cpp index 8ee8b25ec83b2b3890218ccd55ff3b868a8d488c..4647207e550d3f9294fe1d80af81c794ac060782 100644 --- a/src/Keithley_617.cpp +++ b/src/Keithley_617.cpp @@ -47,9 +47,6 @@ Keithley_617::Keithley_617 (std::string& comLink_device_name):AbstractElectromet { std::cout << "Keithley_617::Keithley_617 <-" << std::endl; - //- build the keithley Electrometer obj - _electrometerProtocol = new KeithleyDDCProtocol (_device_proxy_name); - std::cout << "Keithley_617::Keithley_617 ->" << std::endl; } @@ -63,6 +60,43 @@ Keithley_617::~Keithley_617 (void) std::cout << "Keithley_617::~Keithley_617 ->" << std::endl; } +// ============================================================================ +// Keithley_617::init_protocol +// ============================================================================ +bool Keithley_617::init_protocol (void) +{ + std::string description(""); + bool success = false; + + try + { + //- build the keithley Electrometer protocol obj + _electrometerProtocol = new KeithleyDDCProtocol (_device_proxy_name); + + if(_electrometerProtocol) + success = _electrometerProtocol->build_communicationLink(); + } + catch(Tango::DevFailed& df) + { + description = "FAILED to create proxy on : " + _device_proxy_name; + + Tango::Except::re_throw_exception (df, + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_617::init_protocol"); + } + catch(...) + { + description = "FAILED to create proxy on : " + _device_proxy_name + ". Caught [...]."; + + Tango::Except::throw_exception ( + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_617::init_protocol"); + } + return success; +} + // ============================================================================ // Keithley_617::autoRange_off // ============================================================================ diff --git a/src/Keithley_6485.cpp b/src/Keithley_6485.cpp index 6c4331d947e5d98daff82c661e73382fc49cf66d..9174d00ec6a7fb8788de869f4b3ce57a63d3c9a8 100644 --- a/src/Keithley_6485.cpp +++ b/src/Keithley_6485.cpp @@ -38,16 +38,9 @@ Keithley_6485::Keithley_6485 (std::string& comLink_device_name) { std::cout << "Keithley_6485::Keithley_6485 <-" << std::endl; - //- build the keithley Electrometer obj - _electrometerProtocol = new KeithleySCPIProtocol (_device_proxy_name); - _numPLC = 0; _trigCounts = 0; _size = 0; - //- this model does not support different mode (OhmMeter, VoltMeter and so on ) - KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol); - if(_kscpi) - _kscpi->set_isDiffSuportedMode(false); std::cout << "Keithley_6485::Keithley_6485 ->" << std::endl; } @@ -62,6 +55,50 @@ Keithley_6485::~Keithley_6485 (void) std::cout << "Keithley_6485::~Keithley_6485 ->" << std::endl; } +// ============================================================================ +// Keithley_6485::init_protocol +// ============================================================================ +bool Keithley_6485::init_protocol (void) +{ + std::string description(""); + bool success = false; + + try + { + //- build the keithley Electrometer protocol obj + _electrometerProtocol = new KeithleySCPIProtocol(_device_proxy_name); + + if (_electrometerProtocol) + { + //- this model supports different mode (OhmMeter, VoltMeter and so on ) + KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol); + if(_kscpi) + _kscpi->set_isDiffSuportedMode(false); + + success = _electrometerProtocol->build_communicationLink(); + } + } + catch(Tango::DevFailed& df) + { + description = "FAILED to create proxy on : " + _device_proxy_name; + + Tango::Except::re_throw_exception (df, + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_6485::init_protocol"); + } + catch(...) + { + description = "FAILED to create proxy on : " + _device_proxy_name + ". Caught [...]."; + + Tango::Except::throw_exception ( + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_6485::init_protocol"); + } + return success; +} + // ============================================================================ // Keithley_6485::range_up // ============================================================================ diff --git a/src/Keithley_6487.cpp b/src/Keithley_6487.cpp index b9ee2b919ab93be26ec5610284fc5987b4c22ee4..9c5998fd07fcd640ae4f14bf6e0866ff7cd363eb 100644 --- a/src/Keithley_6487.cpp +++ b/src/Keithley_6487.cpp @@ -38,16 +38,9 @@ Keithley_6487::Keithley_6487 (std::string& comLink_device_name) { std::cout << "Keithley_6487::Keithley_6487 <-" << std::endl; - //- build the keithley Electrometer obj - _electrometerProtocol = new KeithleySCPIProtocol (_device_proxy_name); - _numPLC = 0; _trigCounts = 0; _size = 0; - //- this model does not support different mode (OhmMeter, VoltMeter and so on ) - KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol); - if(_kscpi) - _kscpi->set_isDiffSuportedMode(false); std::cout << "Keithley_6487::Keithley_6487 ->" << std::endl; } @@ -62,6 +55,50 @@ Keithley_6487::~Keithley_6487 (void) std::cout << "Keithley_6487::~Keithley_6487 ->" << std::endl; } +// ============================================================================ +// Keithley_6487::init_protocol +// ============================================================================ +bool Keithley_6487::init_protocol (void) +{ + std::string description(""); + bool success = false; + + try + { + //- build the keithley Electrometer protocol obj + _electrometerProtocol = new KeithleySCPIProtocol(_device_proxy_name); + + if (_electrometerProtocol) + { + //- this model supports different mode (OhmMeter, VoltMeter and so on ) + KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol); + if(_kscpi) + _kscpi->set_isDiffSuportedMode(true); + + success = _electrometerProtocol->build_communicationLink(); + } + } + catch(Tango::DevFailed& df) + { + description = "FAILED to create proxy on : " + _device_proxy_name; + + Tango::Except::re_throw_exception (df, + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_6487::init_protocol"); + } + catch(...) + { + description = "FAILED to create proxy on : " + _device_proxy_name + ". Caught [...]."; + + Tango::Except::throw_exception ( + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_6487::init_protocol"); + } + return success; +} + // ============================================================================ // Keithley_6487::range_up // ============================================================================ diff --git a/src/Keithley_6512.cpp b/src/Keithley_6512.cpp index 8307f0d302f1668cd5047983aff09651923abef5..e923dc8053b15d31b53017e03a550f30df6e028f 100644 --- a/src/Keithley_6512.cpp +++ b/src/Keithley_6512.cpp @@ -48,9 +48,6 @@ Keithley_6512::Keithley_6512 (std::string& comLink_device_name) { std::cout << "Keithley_6512::Keithley_6512 <-" << std::endl; - //- build the keithley Electrometer obj - _electrometerProtocol = new KeithleyDDCProtocol (_device_proxy_name); - std::cout << "Keithley_6512::Keithley_6512 ->" << std::endl; } @@ -65,6 +62,43 @@ Keithley_6512::~Keithley_6512 (void) } // ============================================================================ +// Keithley_6512::init_protocol +// ============================================================================ +bool Keithley_6512::init_protocol (void) +{ + std::string description(""); + bool success = false; + + try + { + //- build the keithley Electrometer protocol obj + _electrometerProtocol = new KeithleyDDCProtocol (_device_proxy_name); + + if(_electrometerProtocol) + success = _electrometerProtocol->build_communicationLink(); + } + catch(Tango::DevFailed& df) + { + description = "FAILED to create proxy on : " + _device_proxy_name; + + Tango::Except::re_throw_exception (df, + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_6512::init_protocol"); + } + catch(...) + { + description = "FAILED to create proxy on : " + _device_proxy_name + ". Caught [...]."; + + Tango::Except::throw_exception ( + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_6512::init_protocol"); + } + return success; +} + + // ============================================================================ // Keithley_6512::autoRange_off // ============================================================================ void Keithley_6512::autoRange_off (void) diff --git a/src/Keithley_6514.cpp b/src/Keithley_6514.cpp index 19dc4b737221ef29b047f4c6adcf8a234a34690a..b8dae17a5771f3e3583e1626dbd2ab42452520c2 100644 --- a/src/Keithley_6514.cpp +++ b/src/Keithley_6514.cpp @@ -19,6 +19,7 @@ #include <string> #include <math.h> //- for ceil #include <Xstring.h> +#include <tango.h> //- Tango exceptions #include "Keithley_6514.h" #include "KeithleySCPIProtocol.h" /* @@ -50,16 +51,9 @@ Keithley_6514::Keithley_6514 (std::string& comLink_device_name) { std::cout << "Keithley_6514::Keithley_6514 <-" << std::endl; - //- build the keithley Electrometer obj - _electrometerProtocol = new KeithleySCPIProtocol(_device_proxy_name); - _numPLC = 0; _trigCounts = 0; _size = 0; - //- this model supports different mode (OhmMeter, VoltMeter and so on ) - KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol); - if(_kscpi) - _kscpi->set_isDiffSuportedMode(true); std::cout << "Keithley_6514::Keithley_6514 ->" << std::endl; } @@ -74,6 +68,49 @@ Keithley_6514::~Keithley_6514 (void) std::cout << "Keithley_6514::~Keithley_6514 ->" << std::endl; } +// ============================================================================ +// Keithley_6514::init_protocol +// ============================================================================ +bool Keithley_6514::init_protocol (void) +{ + std::string description(""); + bool success = false; + + try + { + //- build the keithley Electrometer protocol obj + _electrometerProtocol = new KeithleySCPIProtocol(_device_proxy_name); + + if (_electrometerProtocol) + { + //- this model supports different mode (OhmMeter, VoltMeter and so on ) + KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol); + if(_kscpi) + _kscpi->set_isDiffSuportedMode(true); + + success = _electrometerProtocol->build_communicationLink(); + } + } + catch(Tango::DevFailed& df) + { + description = "FAILED to create proxy on : " + _device_proxy_name; + + Tango::Except::re_throw_exception (df, + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_6514::init_protocol"); + } + catch(...) + { + description = "FAILED to create proxy on : " + _device_proxy_name + ". Caught [...]."; + + Tango::Except::throw_exception ( + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_6514::init_protocol"); + } + return success; +} // ============================================================================ // Keithley_6514::range_up diff --git a/src/Keithley_6517.cpp b/src/Keithley_6517.cpp index 3e012c509cb7df1a29993006de2d54337a95662f..16ce41f5bdd44ab21ba01739c01f35d286686fe2 100644 --- a/src/Keithley_6517.cpp +++ b/src/Keithley_6517.cpp @@ -45,14 +45,6 @@ _kmode("") { std::cout << "Keithley_6517::Keithley_6517 <-" << std::endl; - //- build the keithley Electrometer obj - _electrometerProtocol = new KeithleySCPIProtocol(_device_proxy_name); - - //- this model supports different mode (OhmMeter, VoltMeter and so on ) - KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol); - if(_kscpi) - _kscpi->set_isDiffSuportedMode(true); - std::cout << "Keithley_6517::Keithley_6517 ->" << std::endl; } @@ -66,6 +58,50 @@ Keithley_6517::~Keithley_6517 (void) std::cout << "Keithley_6517::~Keithley_6517 ->" << std::endl; } +// ============================================================================ +// Keithley_6517::init_protocol +// ============================================================================ +bool Keithley_6517::init_protocol (void) +{ + std::string description(""); + bool success = false; + + try + { + //- build the keithley Electrometer protocol obj + _electrometerProtocol = new KeithleySCPIProtocol(_device_proxy_name); + + if (_electrometerProtocol) + { + //- this model supports different mode (OhmMeter, VoltMeter and so on ) + KeithleySCPIProtocol* _kscpi = dynamic_cast<KeithleySCPIProtocol*>(_electrometerProtocol); + if(_kscpi) + _kscpi->set_isDiffSuportedMode(true); + + success = _electrometerProtocol->build_communicationLink(); + } + } + catch(Tango::DevFailed& df) + { + description = "FAILED to create proxy on : " + _device_proxy_name; + + Tango::Except::re_throw_exception (df, + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_6517::init_protocol"); + } + catch(...) + { + description = "FAILED to create proxy on : " + _device_proxy_name + ". Caught [...]."; + + Tango::Except::throw_exception ( + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Keithley_6517::init_protocol"); + } + + return success; +} // ============================================================================ // Keithley_6517::range_up diff --git a/src/NovelecProtocol.cpp b/src/NovelecProtocol.cpp index ddd38989da49b61ff96fc6a0d07095e798a3ad7a..955707623f3249598792d6dd18d2ade02dedb9f2 100644 --- a/src/NovelecProtocol.cpp +++ b/src/NovelecProtocol.cpp @@ -49,19 +49,44 @@ static const std::string gain_str[] = {"1","10","100"}; // ============================================================================ // NovelecProtocol::NovelecProtocol // ============================================================================ -NovelecProtocol::NovelecProtocol (std::string& serial_device_name, short devAddress, short novelecType) +NovelecProtocol::NovelecProtocol (std::string& serial_device_name, unsigned short devAddress, unsigned short novelecType) : ElectrometerProtocol(), _devAdd(devAddress), _novType(novelecType) { - - _communication_link = new TangoSerialLink (serial_device_name); + _commDevName = serial_device_name; _rangeParameterNum = _novType + 2; _function = "Not updated"; _is_measure_mode_on = false; _is_explicite_resp_enabled = false; } +// ============================================================================ +// NovelecProtocol::~NovelecProtocol +// ============================================================================ +NovelecProtocol::~NovelecProtocol (void) +{ +// std::cout << "NovelecProtocol::~NovelecProtocol <-" << std::endl; + +// std::cout << "NovelecProtocol::~NovelecProtocol ->" << std::endl; +} + +// ============================================================================ +// NovelecProtocol::build_communicationLink +// ============================================================================ +bool NovelecProtocol::build_communicationLink() +{ + if (_commDevName.empty()) + return false; + + _communication_link = new TangoSerialLink (_commDevName); + + if (!_communication_link) + return false; + + return true; +} + // ============================================================================ // NovelecProtocol::NovelecProtocol // ============================================================================ @@ -87,16 +112,6 @@ std::string tmp("no data"); _is_explicite_resp_enabled = true; } -// ============================================================================ -// NovelecProtocol::~NovelecProtocol -// ============================================================================ -NovelecProtocol::~NovelecProtocol (void) -{ -// std::cout << "NovelecProtocol::~NovelecProtocol <-" << std::endl; - -// std::cout << "NovelecProtocol::~NovelecProtocol ->" << std::endl; -} - // ============================================================================ // NovelecProtocol::switch_MCCE2_ON // ============================================================================ diff --git a/src/Novelec_MCCE2.cpp b/src/Novelec_MCCE2.cpp index e1809605db1e7796310bf3a1c19fbf0f2cd97644..15dffff2be52b25d7db983aa17b76ef6f781ffdf 100644 --- a/src/Novelec_MCCE2.cpp +++ b/src/Novelec_MCCE2.cpp @@ -25,16 +25,14 @@ // ============================================================================ // Novelec_MCCE2::Novelec_MCCE2 // ============================================================================ -Novelec_MCCE2::Novelec_MCCE2 (std::string& comLink_device_name, short address, short novTypeNumber) +Novelec_MCCE2::Novelec_MCCE2 (std::string& comLink_device_name, unsigned short address, unsigned short novTypeNumber) : AbstractElectrometerClass(comLink_device_name), _rangeLimit(0), + _address(address), _MCCE2electroTypeNumber(novTypeNumber) { //std::cout << "Novelec_MCCE2::Novelec_MCCE2 <-" << std::endl; - //- build the Novelec Electrometer obj - _electrometerProtocol = new NovelecProtocol(_device_proxy_name, address, novTypeNumber); - //std::cout << "Novelec_MCCE2::Novelec_MCCE2 ->" << std::endl; } @@ -48,6 +46,42 @@ Novelec_MCCE2::~Novelec_MCCE2 (void) //std::cout << "Novelec_MCCE2::~Novelec_MCCE2 ->" << std::endl; } +// ============================================================================ +// Novelec_MCCE2::init_protocol +// ============================================================================ +bool Novelec_MCCE2::init_protocol (void) +{ + std::string description(""); + bool success = false; + try + { + //- build the keithley Electrometer protocol obj + _electrometerProtocol = new NovelecProtocol(_device_proxy_name, _address, _MCCE2electroTypeNumber); + + if(_electrometerProtocol) + success = _electrometerProtocol->build_communicationLink(); + } + catch(Tango::DevFailed& df) + { + description = "FAILED to create proxy on : " + _device_proxy_name; + + Tango::Except::re_throw_exception (df, + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Novelec_MCCE2::init_protocol"); + } + catch(...) + { + description = "FAILED to create proxy on : " + _device_proxy_name + ". Caught [...]."; + + Tango::Except::throw_exception ( + (const char*)"COMMUNICATION_ERROR", + description.c_str(), + (const char*)"Novelec_MCCE2::init_protocol"); + } + return success; +} + // ============================================================================ // Novelec_MCCE2::get_ElectroMeterPolarity // ============================================================================