diff --git a/conanfile.py b/conanfile.py index 49309718085bcfc169d45864d996f4e818999afe..cdadf4a7f2ff3f03df685b2effde70a90eb4f0ed 100644 --- a/conanfile.py +++ b/conanfile.py @@ -3,7 +3,7 @@ from conan import ConanFile class XiaDxpRecipe(ConanFile): name = "xiadxp" executable = "ds_XiaDxp" - version = "3.3.0" + version = "3.4.0" package_type = "application" user = "soleil" python_requires = "base/[>=1.0]@soleil/stable" diff --git a/pom.xml b/pom.xml index 3c3df2d6acca834b2c81c6313ca37687e271ca68..3d4190065dd1b9b2f50e32ef3d023159b0add9d2 100755 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ <groupId>fr.soleil.device</groupId> <artifactId>XiaDxp-${aol}-${mode}</artifactId> - <version>3.3.0</version> + <version>3.4.0</version> <packaging>nar</packaging> <name>XiaDxp</name> <description>XiaDxp device</description> diff --git a/src/AcquisitionMca.cpp b/src/AcquisitionMca.cpp index 517a95f5e77bf267362714ecca10d2df3aae6388..722e8c434190b0a216ed58d4b5c34ccbd7d6b41b 100644 --- a/src/AcquisitionMca.cpp +++ b/src/AcquisitionMca.cpp @@ -133,15 +133,15 @@ void AcquisitionMca::stop_acquisition(bool sync) //---------------------------------------------------------------------------------------------------------------------- //- collect_data //---------------------------------------------------------------------------------------------------------------------- -void AcquisitionMca::collect_data() +void AcquisitionMca::collect_data(bool is_final) { DEBUG_STREAM << "AcquisitionMca::collect_data() - [BEGIN]" << endl; if(m_board_type == XMAP_TYPE) - collect_data_xmap(); + collect_data_xmap(is_final); else if(m_board_type == FALCONX_TYPE) - collect_data_falconx(); + collect_data_falconx(is_final); else//SIMULATOR - collect_data_xmap(); + collect_data_xmap(is_final); DEBUG_STREAM << "AcquisitionMca::collect_data() - [END]" << endl << endl; DEBUG_STREAM << " " << endl; } @@ -149,7 +149,7 @@ void AcquisitionMca::collect_data() //---------------------------------------------------------------------------------------------------------------------- //- collect_data_xmap //---------------------------------------------------------------------------------------------------------------------- -void AcquisitionMca::collect_data_xmap() +void AcquisitionMca::collect_data_xmap(bool is_final) { DEBUG_STREAM << "AcquisitionMca::collect_data_xmap() - [BEGIN]" << endl; //for each module @@ -193,7 +193,8 @@ void AcquisitionMca::collect_data_xmap() ichannel, //numero of channel 0, //always 0 in MCA (DataType*) & spectrum[0], - spectrum.size() + spectrum.size(), + is_final ); } } @@ -205,7 +206,7 @@ void AcquisitionMca::collect_data_xmap() //---------------------------------------------------------------------------------------------------------------------- //- collect_data_falconx //---------------------------------------------------------------------------------------------------------------------- -void AcquisitionMca::collect_data_falconx() +void AcquisitionMca::collect_data_falconx(bool is_final) { DEBUG_STREAM << "AcquisitionMca::collect_data_falconx() - [BEGIN]" << endl; //for each module @@ -250,7 +251,8 @@ void AcquisitionMca::collect_data_falconx() ichannel, //numero of channel 0, //always 0 in MCA (DataType*) & spectrum[0], - spectrum.size() + spectrum.size(), + is_final ); } } @@ -315,7 +317,7 @@ void AcquisitionMca::process_message(yat::Message& msg) throw (Tango::DevFailed) } //get statistics/data values from board via handle library and store into dataStore - collect_data(); + collect_data(false); } else//when board is stopped { @@ -323,7 +325,7 @@ void AcquisitionMca::process_message(yat::Message& msg) throw (Tango::DevFailed) if(is_need_collecting_last_data()) { INFO_STREAM << "collecting the final data ..." << endl; - collect_data(); + collect_data(true); m_store->close_data(); disable_collecting_last_data(); } diff --git a/src/AcquisitionMca.h b/src/AcquisitionMca.h index 5971ce0dd022c16ca483ba6d9ac22fc3c55ff630..e13d7c52657698f78c5444b05abb76e6d3c10a1c 100644 --- a/src/AcquisitionMca.h +++ b/src/AcquisitionMca.h @@ -52,13 +52,13 @@ protected: private: /// collect data according to board_type - void collect_data(); + void collect_data(bool is_final = false); /// collect data from a XMAP board - void collect_data_xmap(); + void collect_data_xmap(bool is_final = false); /// collect data from a FALCONX board - void collect_data_falconx(); + void collect_data_falconx(bool is_final =false); /// vector to store the 9 statistics for each channel (falconx)) std::vector<double> m_statistics; diff --git a/src/Controller.cpp b/src/Controller.cpp index 0bde927fc74200e796b6c17eada85065a38185a7..45ceaa48415d454acf9e4fe1f1e737eeed96ba15 100755 --- a/src/Controller.cpp +++ b/src/Controller.cpp @@ -637,14 +637,17 @@ void Controller::build_stream(const std::string& type, const std::string& mode) //create the stream if(stream_type == "NEXUS_STREAM")//NEXUS_STREAM { - if(mode == "MAPPING" ||mode == "MAPPING_FULL") //Nexus is available in MAPPING mode only + if(mode == "MAPPING" ||mode == "MAPPING_FULL" || mode =="MCA") //Nexus is available in MAPPING mode only { - m_stream.reset(new StreamNexus(m_device)); + m_stream.reset(new StreamNexus(m_device)); static_cast<StreamNexus*>(m_stream.get())->set_target_path(m_conf.stream_path); static_cast<StreamNexus*>(m_stream.get())->set_file_name(m_conf.stream_file); static_cast<StreamNexus*>(m_stream.get())->set_memory_mode(m_conf.stream_memory_mode); static_cast<StreamNexus*>(m_stream.get())->set_write_mode(m_conf.stream_write_mode); - static_cast<StreamNexus*>(m_stream.get())->set_nb_acq_per_file(m_conf.stream_nb_acq_per_file); + if(mode =="MCA") + static_cast<StreamNexus*>(m_stream.get())->set_nb_acq_per_file(1); + else + static_cast<StreamNexus*>(m_stream.get())->set_nb_acq_per_file(m_conf.stream_nb_acq_per_file); } else { @@ -661,7 +664,7 @@ void Controller::build_stream(const std::string& type, const std::string& mode) } else if(stream_type == "CSV_STREAM")//CSV_STREAM { - if(mode == "MAPPING" ||mode == "MAPPING_FULL") //CSV is available in MAPPING mode only + if(mode == "MAPPING" ||mode == "MAPPING_FULL" ||mode =="MCA") //CSV is available in MAPPING mode only { m_stream.reset(new StreamCsv(m_device)); static_cast<StreamCsv*>(m_stream.get())->set_target_path(m_conf.stream_path); @@ -726,15 +729,17 @@ void Controller::build_attributes(const std::string& mode) // ============================================================================ // Controller::update_data() // ============================================================================ -void Controller::update_data(int ichannel) +void Controller::update_data(int ichannel, bool update_stream, bool update_view) { DEBUG_STREAM << "Controller::update_data() - [BEGIN]" << endl; //update streamer view data - m_stream->update_data(ichannel, m_store); + if(update_stream) + m_stream->update_data(ichannel, m_store); //update tango view data - m_attr_view->update_data(ichannel, m_store); + if(update_view) + m_attr_view->update_data(ichannel, m_store); DEBUG_STREAM << "Controller::update_data() - [END]" << endl; } @@ -1006,7 +1011,7 @@ void Controller::write_memory_usage_to_file(std::string const & conf) } // ============================================================================ -// Controller::update_view() +// Controller::is_library_loaded() // ============================================================================ bool Controller::is_library_loaded() { diff --git a/src/Controller.h b/src/Controller.h index 8716c12dc842567024e2cde46a4ae8a08b053f91..f9ce3d4a09ae12256f1e12d0d4c660b4e2f4fef2 100755 --- a/src/Controller.h +++ b/src/Controller.h @@ -178,7 +178,7 @@ public: void set_status(const std::string& status); /// notification from DataStore, to inform that datas are refreshed - void update_data(int ichannel); + void update_data(int ichannel, bool update_stream = true, bool update_view = true); /// notification from controller::update_data() or directly from device (rois management). this will refresh tango view. void update_view(); diff --git a/src/DataStore.cpp b/src/DataStore.cpp index ae5ff030650c0cc64c003757bd64f8ab73b8286b..5d1f4484ef4aa7f5063a31edd623b54eb4742706 100644 --- a/src/DataStore.cpp +++ b/src/DataStore.cpp @@ -261,30 +261,35 @@ void DataStore::store_statistics(int module, int channel, int pixel, PixelData p //---------------------------------------------------------------------------------------------------------------------- //- DataStore::store_data //---------------------------------------------------------------------------------------------------------------------- -void DataStore::store_data(int module, int channel, int pixel, DataType* data, size_t length) +void DataStore::store_data(int module, int channel, int pixel, DataType* data, size_t length, bool is_last_mca) { DEBUG_STREAM << "DataStore::store_data() - [BEGIN]" << endl; DEBUG_STREAM << "module = " << module << " - channel = " << channel << " - pixel = " << pixel << endl; yat::MutexLock scoped_lock(m_data_lock); + int channel_cluster = TO_CHANNEL_CLUSTER(module, channel); set_state(Tango::RUNNING); m_data.module_data[module].channel_data[channel].pixel_data.pixel = pixel; if(m_acquisition_mode == "MAPPING" ||m_acquisition_mode == "MAPPING_FULL") { std::copy(data, data + length, &m_data.module_data[module].channel_data[channel].pixel_data.data[0]); + //inform observers that data is changed + notify_data(channel_cluster); //data+view } else if(m_acquisition_mode == "MAPPING_SCA") { m_data.module_data[module].channel_data[channel].pixel_data.sca_rois.resize(length);//resize because nb_roi of a channel can changed often if(length!=0) std::copy(data, data + length, &m_data.module_data[module].channel_data[channel].pixel_data.sca_rois[0]); + //inform observers that data is changed + notify_data(channel_cluster); //data+view } else if(m_acquisition_mode == "MCA") { std::copy(data, data + length, &m_data.module_data[module].channel_data[channel].pixel_data.data[0]); + //inform observers that data is changed + notify_data(channel_cluster, is_last_mca, true); //data if last + view } - //inform observers that data is changed - int channel_cluster = TO_CHANNEL_CLUSTER(module, channel); - notify_data(channel_cluster); //data+view + DEBUG_STREAM << "DataStore::store_data() - [END]" << endl; } @@ -654,12 +659,12 @@ void DataStore::subscribe(Controller* observer) //---------------------------------------------------------------------------------------------------------------------- //- DataStore::notify_data //---------------------------------------------------------------------------------------------------------------------- -void DataStore::notify_data(int ichannel) +void DataStore::notify_data(int ichannel, bool update_stream , bool update_view ) { DEBUG_STREAM << "DataStore::notify_data() - [BEGIN]" << endl; yat::MutexLock scoped_lock(m_data_lock); if(m_controller != 0) - m_controller->update_data(ichannel); + m_controller->update_data(ichannel, update_stream, update_view); DEBUG_STREAM << "DataStore::notify_data() - [END]" << endl; } diff --git a/src/DataStore.h b/src/DataStore.h index 154fabc40e3490ebc0eb843e7389b67fffcfa269..b5b4ebb0235c0a5adaa0a865eb1375c3f1628527 100644 --- a/src/DataStore.h +++ b/src/DataStore.h @@ -152,7 +152,7 @@ public: //a light init when acquisition_mode is not changed : used to reset state & exception flag only void reinit(); void store_statistics(int module, int channel, int pixel, PixelData pix_data); - void store_data(int module, int channel, int pixel, DataType* data, size_t length); + void store_data(int module, int channel, int pixel, DataType* data, size_t length, bool is_last_mca = false); void process_data(DataBufferContainerPtr map_buffer_ptr); void close_data(); void abort_data(); @@ -202,7 +202,7 @@ protected: void process_message(yat::Message& msg) throw (Tango::DevFailed); private: ///inform controller (observer) about new datas . it has to update_data on (stream & view) - void notify_data(int ichannel); + void notify_data(int ichannel, bool update_stream = true, bool update_view = true); ///inform controller (observer) about end of datas . it has to close the stream void on_close_data(); ///inform controller (observer) about anormal end of datas . it has to abort the stream diff --git a/src/XiaDxpClass.cpp b/src/XiaDxpClass.cpp index cd084eaae40705ffb8c46fa54ffe50fe32d71f5e..c7a647e0e5feacb887c019027195c3608836c82a 100644 --- a/src/XiaDxpClass.cpp +++ b/src/XiaDxpClass.cpp @@ -727,7 +727,7 @@ void XiaDxpClass::attribute_factory(vector<Tango::Attr *> &att_list) stream_nb_acq_per_file_prop.set_standard_unit(" "); stream_nb_acq_per_file_prop.set_display_unit(" "); stream_nb_acq_per_file_prop.set_format("%d"); - stream_nb_acq_per_file_prop.set_description("Define the number of acquisition for each Stream file."); + stream_nb_acq_per_file_prop.set_description("Define the number of acquisition for each Stream file.<BR>This parameter is useful only in MAPPING mode, in MCA mode it is always equal to 1 "); stream_nb_acq_per_file->set_default_properties(stream_nb_acq_per_file_prop); stream_nb_acq_per_file->set_disp_level(Tango::EXPERT); att_list.push_back(stream_nb_acq_per_file);