From de9ddb2d6e3f5da43d2ce651ddeb9d97c41a4789 Mon Sep 17 00:00:00 2001
From: Xavier Elattaoui <xavier.elattaoui@synchrotron-soleil.fr>
Date: Mon, 9 Oct 2017 06:52:19 +0000
Subject: [PATCH] Release preparation : roll back to version 1.1.14

---
 pom.xml                          |  2 +-
 src/AcquireWaveformLecroy.cpp    | 53 ++++++++------------------------
 src/AcquireWaveformLecroy.h      |  2 ++
 src/AcquireWaveformLecroyClass.h |  4 +--
 4 files changed, 18 insertions(+), 43 deletions(-)

diff --git a/pom.xml b/pom.xml
index c2ba98f..a90968d 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 512e00c..cde8ccd 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 5e4fa3e..3ee8b1a 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 e3dbfbf..11b483e 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)
-- 
GitLab