Index: trunk/FACT++/src/agilentctrl.cc
===================================================================
--- trunk/FACT++/src/agilentctrl.cc	(revision 14315)
+++ trunk/FACT++/src/agilentctrl.cc	(revision 14316)
@@ -31,4 +31,6 @@
     ofstream fDumpStream;
     int fState;
+    float fMeasuredVoltage;
+    float fMeasuredCurrent;
     
 
@@ -72,5 +74,5 @@
 
         fCheckStatusTimer.expires_from_now(boost::posix_time::seconds(60));
-        fCheckStatusTimer.async_wait(boost::bind(&ConnectionWeather::HandleRequest,
+        fCheckStatusTimer.async_wait(boost::bind(&ConnectionAgilent::HandleRequest,
                                           this, bapla::error));
     }
@@ -101,5 +103,5 @@
         // may have moved the deadline before this actor had a chance
         // to run.
-        if (fKeepAlive.expires_at() > ba::deadline_timer::traits_type::now())
+        if (fCheckStatusTimer.expires_at() > ba::deadline_timer::traits_type::now())
             return;
 
@@ -112,6 +114,4 @@
     void ReceivedStatusHandler(const bs::error_code& err, size_t bytes_received, int /*type*/)
     {
-        float measured_voltage;
-        float measured_current;
         
         // Do not schedule a new read if the connection failed.
@@ -137,4 +137,5 @@
         if (fIsVerbose)
            Out() << kBold << "Received (" << bytes_received << " bytes):" << endl;
+        /*
         if (fDump)
         {
@@ -143,5 +144,5 @@
             Dump(msg.str());
         }
-
+*/
         istream is(&fBuffer);
         // data should contain two floats:
@@ -162,19 +163,29 @@
         {
             // this should be a float containing the measured voltage
-            is >> measured_voltage;
-            data.push_back(measured_voltage);
-            Out() << "voltage: " << measured_voltage << endl;
+            is >> fMeasuredVoltage;
+            data.push_back(fMeasuredVoltage);
+            Out() << "voltage: " << fMeasuredVoltage << endl;
         }
         else if (fLineCounter >= 3)
         {
             // this should be a float containing the measured voltage
-            is >> measured_current;
-            data.push_back(measured_current);
-            Out() << "current: " << measured_current << endl;
+            is >> fMeasuredCurrent;
+            data.push_back(fMeasuredCurrent);
+            Out() << "current: " << fMeasuredCurrent << endl;
             fLineCounter = 0;
-            fSendRequest = true;
-        }
-        
-        if (measured_voltage > 1.0)
+        }
+       
+        // read the buffer empty ...
+        // FIXME: I surely misunderstand that damn fBuffer thing.
+        // I thought it should be emtpy by now...
+        string buffer;
+        while (getline(is,buffer, '\n'))
+        {
+            buffer = Tools::Trim(buffer);
+            if (buffer.empty()) continue;
+        }
+
+
+        if (fMeasuredVoltage > 1.0)
         {
             fState = State::kVoltage_On;
@@ -206,5 +217,5 @@
         fState = State::kConnected;
         Start_async_read_until();
-        PostStatusRequest();
+        RequestStatus();
         
         fLineCounter = 0;
@@ -216,9 +227,11 @@
     ConnectionAgilent(ba::io_service& ioservice, MessageImp &imp) : Connection(ioservice, imp()),
         fIsVerbose(true),
-        fCheckStatusTimer(ioservice),
-        fDump(true)
+        fDump(true),
+        fCheckStatusTimer(ioservice)
     {
         SetLogStream(&imp);
         fState = State::kDisconnected;
+        fMeasuredVoltage=-1;
+        fMeasuredCurrent=-1;
     }
 
@@ -335,5 +348,5 @@
         
         if ( fAgilent.IsConnected() )
-            return fWeather.GetState();
+            return fAgilent.GetState();
         else
             return State::kDisconnected;
@@ -381,9 +394,4 @@
     }
 
-    int Identify()
-    {
-        fAgilent.Identify();
-        return T::GetCurrentState();
-    }
 
 public:
@@ -437,8 +445,4 @@
             ("set output on or off"
              "|[state][boolean]: output setting (1;0 or 'on';'off')");
-
-        T::AddEvent("IDENTIFY", State::kConnected)
-            (bind(&StateMachineAgilent::Identify, this))
-            ("Request Agilent ID");
 
         fAgilent.StartConnect();
