diff --git a/pom.xml b/pom.xml index b068c70bae4d290f35786fd16ee3497293b4102f..35dcfbc1fbb8cc99084c9fd9c80188539579c302 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ </parent> <groupId>fr.soleil.device</groupId> <artifactId>MCCE2Electrometers-${aol}-${mode}</artifactId> - <version>2.2.9-SNAPSHOT</version> + <version>2.2.9</version> <packaging>nar</packaging> <name>MCCE2Electrometers</name> <!-- use for the name of executable --> diff --git a/src/MCCE2Electrometers.cpp b/src/MCCE2Electrometers.cpp index 70b1c95b0c3c473e8e26b8016a00ee5b983e0dab..6487f938c16feab1e4efd72a44845d261a48258e 100644 --- a/src/MCCE2Electrometers.cpp +++ b/src/MCCE2Electrometers.cpp @@ -202,6 +202,10 @@ void MCCE2Electrometers::init_device() //- check connected electrometer(s) create_electrometers_obj(); } + catch(Tango::DevFailed& df) + { + FATAL_STREAM << "Init_dev : create_electrometers_obj -> DF :\n" << df << std::endl; + } catch(...) { FATAL_STREAM << "Device initialization Failed : check logs for more informations."; @@ -2282,45 +2286,25 @@ void MCCE2Electrometers::create_electrometers_obj() } catch(const electrometer::ElectrometerException& ke) { - set_state(Tango::FAULT); + set_state(Tango::ALARM); set_status("Failed to find which Novelec type is connected on channel one : communication caught[...]"); Tango::DevFailed df = electrometer_to_tango_exception(ke); FATAL_STREAM << "Failed to find which Novelec type is connected on channel one : ElectrometerException EXCEPTION -> " << df << std::endl; - Tango::Except::re_throw_exception(df, - "COMMUNICATION_ERROR", - "Failed to find which Novelec type is connected on channel one!", - "MCCE2Electrometers::create_electrometers_obj()", - Tango::ERR - ); } catch(Tango::DevFailed& df) { - set_state(Tango::FAULT); + set_state(Tango::ALARM); set_status("Failed to find which Novelec type is connected on channel one!"); FATAL_STREAM << "Failed to find which Novelec type is connected : DevFailed EXCEPTION -> " << df << std::endl; - - Tango::Except::re_throw_exception(df, - "COMMUNICATION_ERROR", - "Failed to find which Novelec type is connected on channel one!", - "MCCE2Electrometers::create_electrometers_obj()", - Tango::ERR - ); } catch(...) { - set_state(Tango::FAULT); + set_state(Tango::ALARM); set_status("Failed to find which Novelec type is connected on channel one : communication caught[...]"); FATAL_STREAM << "Failed to find which Novelec type is connected on channel one : [...] EXCEPTION " << std::endl; - - Tango::Except::throw_exception( - "UNKNOWN_ERROR", - "find which Novelec type is connected on channel one! [(...) exception]", - "MCCE2Electrometers::create_electrometers_obj()", - Tango::ERR - ); } switch(type1) @@ -2339,6 +2323,7 @@ void MCCE2Electrometers::create_electrometers_obj() this->_electrometerCH1 = new N_PhotoConducteur(communicationLinkName, electrometer1Address); break; default : + this->_electrometerCH1 = 0; FATAL_STREAM << "\nERROR : Electrometers::create_electrometers_obj() -> this " << electrometer1Address << " Novelec type is not supported now!" << endl; return; } @@ -2369,45 +2354,25 @@ void MCCE2Electrometers::create_electrometers_obj() } catch(const electrometer::ElectrometerException& ke) { - set_state(Tango::FAULT); + set_state(Tango::ALARM); set_status("Failed to find which Novelec type is connected on channel two : communication caught[...]"); Tango::DevFailed df = electrometer_to_tango_exception(ke); FATAL_STREAM << "Failed to find which Novelec type is connected on channel two : ElectrometerException EXCEPTION -> " << df << std::endl; - Tango::Except::re_throw_exception(df, - "COMMUNICATION_ERROR", - "Failed to find which Novelec type is connected on channel two!", - "MCCE2Electrometers::create_electrometers_obj()", - Tango::ERR - ); } catch(Tango::DevFailed& df) { - set_state(Tango::FAULT); + set_state(Tango::ALARM); set_status("Failed to find which Novelec type is connected on channel two!"); FATAL_STREAM << "Failed to find which Novelec type is connected on channel two : DevFailed EXCEPTION -> " << df << std::endl; - - Tango::Except::re_throw_exception(df, - "COMMUNICATION_ERROR", - "Failed to find which Novelec type is connected on channel two!", - "MCCE2Electrometers::create_electrometers_obj()", - Tango::ERR - ); } catch(...) { - set_state(Tango::FAULT); + set_state(Tango::ALARM); set_status("Failed to find which Novelec type is connected on channel two : communication caught[...]"); FATAL_STREAM << "Failed to find which Novelec type is connected on channel two : [...] EXCEPTION " << std::endl; - - Tango::Except::throw_exception( - "UNKNOWN_ERROR", - "find which Novelec type is connected on channel two! [(...) exception]", - "MCCE2Electrometers::create_electrometers_obj()", - Tango::ERR - ); } switch(type2) @@ -2425,6 +2390,7 @@ void MCCE2Electrometers::create_electrometers_obj() this->_electrometerCH2 = new N_PhotoConducteur(communicationLinkName, electrometer2Address); break; default : + this->_electrometerCH2 = 0; FATAL_STREAM << "\nERROR : Electrometers::create_electrometers_obj() -> this " << electrometer2Address << " Novelec type is not supported now!" << endl; return; } @@ -2438,6 +2404,8 @@ void MCCE2Electrometers::create_electrometers_obj() //- check if (!this->_electrometerCH1 && !this->_electrometerCH2) { + set_state(Tango::FAULT); + set_status("No electrometer connected on channels 1 and 2!"); ERROR_STREAM << "No connected electrometer(s) found!" << std::endl; Tango::Except::throw_exception( "MEMORY_ERROR", @@ -2456,6 +2424,10 @@ void MCCE2Electrometers::create_electrometers_obj() if ( initCH1 ) this->_electrometerCH1->mcce_init(); + //- read channel range + this->_electrometer = this->_electrometerCH1; + *attr_range1_read = this->get_range(); + INFO_STREAM << "this->_electrometer = this->_electrometerCH1!" << std::endl; } else @@ -2466,6 +2438,11 @@ void MCCE2Electrometers::create_electrometers_obj() initCH2 = this->_electrometerCH2->init_protocol(); if ( initCH2 ) this->_electrometerCH2->mcce_init(); + + //- read channel range + this->_electrometer = this->_electrometerCH2; + *attr_range2_read = this->get_range(); + INFO_STREAM << "this->_electrometer = this->_electrometerCH2!" << std::endl; }