diff --git a/pom.xml b/pom.xml index c2ba98fd47a1598f4755108a4e7b3e9f31359532..a90968d2730d718006233c06301d30967360c8ee 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ <groupId>fr.soleil.device</groupId> <artifactId>AcquireWaveformLecroy-${aol}-${mode}</artifactId> - <version>1.1.18-SNAPSHOT</version> + <version>1.1.18</version> <packaging>nar</packaging> <name>AcquireWaveformLecroy</name> <description>AcquireWaveformLecroy device</description> diff --git a/src/AcquireWaveformLecroy.cpp b/src/AcquireWaveformLecroy.cpp index 512e00cea6c72c04018163e64ec3a34443d50455..cde8ccd6875ca4f5e801ff543dfaf084d9d6dda5 100644 --- a/src/AcquireWaveformLecroy.cpp +++ b/src/AcquireWaveformLecroy.cpp @@ -146,14 +146,14 @@ AcquireWaveformLecroy::AcquireWaveformLecroy(Tango::DeviceClass *cl,const char * void AcquireWaveformLecroy::delete_device() { //- Delete device's allocated object - if (attr_rawWaveformData_read) { - delete [] attr_rawWaveformData_read; - attr_rawWaveformData_read = 0; - } - if (attr_verticalScaledData_read) { - delete [] attr_verticalScaledData_read; - attr_verticalScaledData_read = 0; - } + //if (attr_rawWaveformData_read) { + // delete [] attr_rawWaveformData_read; + // attr_rawWaveformData_read = 0; + //} + //if (attr_verticalScaledData_read) { + // delete [] attr_verticalScaledData_read; + // attr_verticalScaledData_read = 0; + //} if (attr_waveArray1_read) { delete attr_waveArray1_read; attr_waveArray1_read = 0; @@ -266,6 +266,7 @@ void AcquireWaveformLecroy::init_device() *attr_triggerTime_read = new char[MAX_STRING_LENGTH]; ::memset(*attr_triggerTime_read, 0, MAX_STRING_LENGTH * sizeof(char)); + _deviceResponse = new char[MAX_RESPONSE_LENGTH]; //- Initialise variables to default values //-------------------------------------------- @@ -471,18 +472,14 @@ yat::Timer t; //- get the waveform length try { - long previous_lgth = data_length; //- TODO : retirer les copies dans les attr !!!! data_length = waveform_ptr->get_wavedesc_descriptor()->wave_array_count; //- check data does not exceed the MAX defined : if ( data_length > MAX_WAVEFORM_DATA_LENGTH ) data_length = MAX_WAVEFORM_DATA_LENGTH; - if (previous_lgth <= data_length) - { - reallocate_spectrums(data_length); - } - - + //- get waveform data + attr_rawWaveformData_read = waveform_ptr->get_raw_waveform_data(); + attr_verticalScaledData_read = waveform_ptr->get_vertical_scaled_waveform_data(); } catch(const lecroy::WaveformException &we) { @@ -765,6 +762,7 @@ Tango::DevString AcquireWaveformLecroy::write_read(Tango::DevString argin) ptr_com->TCP_WriteDevice(argin, cmd_to_send.size(), true); //- check if a response is expected (must found ? character) + strcpy(_deviceResponse, "No response"); if( cmd_to_send.find('?') != std::string::npos ) { #ifdef WIN32 @@ -774,34 +772,9 @@ Tango::DevString AcquireWaveformLecroy::write_read(Tango::DevString argin) #endif ptr_com->TCP_ReadDevice(_deviceResponse, MAX_RESPONSE_LENGTH, &bytes_received); } - else - { - strcpy(_deviceResponse, "No response"); - } return _deviceResponse; } -//- method to manage memory -void AcquireWaveformLecroy::reallocate_spectrums(long new_data_size) -{ - if (new_data_size) - { - //- delete previous memory - if (attr_rawWaveformData_read) - { - delete[] attr_rawWaveformData_read; - attr_rawWaveformData_read = 0; - } - if (attr_verticalScaledData_read) - { - delete[] attr_verticalScaledData_read; - attr_verticalScaledData_read = 0; - } - //- allocate memory - attr_rawWaveformData_read = new Tango::DevShort[new_data_size]; - attr_verticalScaledData_read= new Tango::DevDouble[new_data_size]; - } -} } // namespace diff --git a/src/AcquireWaveformLecroy.h b/src/AcquireWaveformLecroy.h index 5e4fa3e611311bd7f7ba96e4e74137f299afc918..3ee8b1adf21a9d38fc71bebab7b25e93e5b2ee1a 100644 --- a/src/AcquireWaveformLecroy.h +++ b/src/AcquireWaveformLecroy.h @@ -78,6 +78,8 @@ // Add your own constants definitions here. //----------------------------------------------- +const int MAX_STRING_LENGTH = 256; +const int MAX_SIZE = 150000; namespace AcquireWaveformLecroy_ns diff --git a/src/AcquireWaveformLecroyClass.h b/src/AcquireWaveformLecroyClass.h index e3dbfbfeb59488d2a18a6ce0677b1a546a5daf5c..11b483e5364eaee0de03034b65f167c61901dbb4 100644 --- a/src/AcquireWaveformLecroyClass.h +++ b/src/AcquireWaveformLecroyClass.h @@ -68,7 +68,7 @@ namespace AcquireWaveformLecroy_ns class rawWaveformDataAttrib: public Tango::SpectrumAttr { public: - rawWaveformDataAttrib():SpectrumAttr("rawWaveformData", Tango::DEV_SHORT, Tango::READ, 100000) {}; + rawWaveformDataAttrib():SpectrumAttr("rawWaveformData", Tango::DEV_SHORT, Tango::READ, 1500000) {}; ~rawWaveformDataAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) @@ -80,7 +80,7 @@ public: class verticalScaledDataAttrib: public Tango::SpectrumAttr { public: - verticalScaledDataAttrib():SpectrumAttr("verticalScaledData", Tango::DEV_DOUBLE, Tango::READ, 100000) {}; + verticalScaledDataAttrib():SpectrumAttr("verticalScaledData", Tango::DEV_DOUBLE, Tango::READ, 1500000) {}; ~verticalScaledDataAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)