Index: /trunk/FACT++/src/fscctrl.cc
===================================================================
--- /trunk/FACT++/src/fscctrl.cc	(revision 11033)
+++ /trunk/FACT++/src/fscctrl.cc	(revision 11034)
@@ -39,5 +39,22 @@
 
 protected:
-/*
+
+    virtual void UpdateTemp(float, const vector<float> &)
+    {
+    }
+
+    virtual void UpdateHum(float, const vector<float>&)
+    {
+    }
+
+    virtual void UpdateVolt(float, const vector<float>&)
+    {
+    }
+
+    virtual void UpdateCur(float, const vector<float>&)
+    {
+    }
+
+    /*
     virtual void UpdateError()
     {
@@ -75,12 +92,60 @@
         }
 
+        if (fIsVerbose)
+           Out() << kBold << "Received:" << endl;
+
         istream is(&fBuffer);
 
+        int state = 0;
+        bool values = false;
+        int offset = 0;
+/*
         string buffer;
         while (getline(is, buffer, '\n'))
         {
-            cout << "Line: " << buffer << endl;
+            if (fIsVerbose)
+                Out() << buffer << endl;
+
+            buffer = Tools::Trim(buffer);
+
+            if (buffer.empty())
+                continue;
+
+            if (buffer.substr(0, 4)=="end.")
+                break;
+
+            if (buffer.substr(0, 8)=="status: ")
+            {
+            }
+
+            if (buffer.substr(0, 8)=="time_s: ")
+            {
+            }
+
+            if (buffer.substr(0, 8)=="VOLTAGES")
+                state = 1;
+
+            if (buffer.substr(0, 11)=="RESISTANCES")
+                state = 2;
+
+            if (state==1 && buffer.substr(0, 7)=="values:")
+            {
+            }
+
+            if (state==2 && buffer.substr(0, 7)=="values:")
+            {
+                values = true;
+                continue;
+            }
+
+            istringtream str(buffer);
+            for (int i=0; i<8; i++)
+            {
+                float f;
+                str >> f;
+                offset += 8;
+            }
         }
-        cout << endl;
+*/
 /*
 "status: 00000538 \n"
@@ -108,6 +173,4 @@
 */
         StartRead();
-
-
     }
 
@@ -117,4 +180,6 @@
                              boost::bind(&ConnectionFSC::HandleReceivedData, this,
                                          dummy::error, dummy::bytes_transferred, 0));
+
+        // FIXME: Add timeout here
     }
 
@@ -124,5 +189,5 @@
         PostMessage("m", 1);
 
-        fBuffer.prepare(100000);
+        fBuffer.prepare(10000);
         StartRead();
     }
@@ -178,6 +243,4 @@
 };
 
-//const uint16_t ConnectionFSC::kMaxAddr = 0xfff;
-
 // ------------------------------------------------------------------------
 
@@ -188,33 +251,43 @@
 private:
 
-    DimDescribedService fDimPassport;
-
-    template<class T>
-        void Update(DimDescribedService &svc, const T &data) const
-    {
-        //cout << "Update: " << svc.getName() << " (" << sizeof(T) << ")" << endl;
-        svc.setData(const_cast<T*>(&data), sizeof(T));
+    DimDescribedService fDimTemp;
+    DimDescribedService fDimHum;
+    DimDescribedService fDimVolt;
+    DimDescribedService fDimCurrent;
+
+    void Update(DimDescribedService &svc, vector<float> data, float time) const
+    {
+        data.insert(data.begin(), time);
+        svc.setData(data.data(), data.size()*sizeof(float));
         svc.updateService();
     }
 
-    /*
-    void UpdateFirstHeader()
-    {
-        ConnectionFSC::UpdateFirstHeader();
-
-        const FTM::DimPassport data(fHeader);
-        Update(fDimPassport, data);
-    }*/
+    void UpdateTemp(float time, const vector<float> &temp)
+    {
+        Update(fDimTemp, temp, time);
+    }
+
+    void UpdateHum(float time, const vector<float> &hum)
+    {
+        Update(fDimHum, hum, time);
+    }
+
+    void UpdateVolt(float time, const vector<float> &volt)
+    {
+        Update(fDimVolt, volt, time);
+    }
+
+    void UpdateCur(float time, const vector<float> &curr)
+    {
+        Update(fDimCurrent, curr, time);
+    }
 
 public:
     ConnectionDimFSC(ba::io_service& ioservice, MessageImp &imp) :
         ConnectionFSC(ioservice, imp),
-        fDimPassport      ("FSC_CONTROL/PASSPORT",        "I:1", "")
-
-//        DimService Update     (SERVER_NAME"/Time",        "F", Val+TIME_OFF, sizeof(float));
-//        DimService Temperature(SERVER_NAME"/Temperature", "F", Val+TEMP_OFF, sizeof(float)*TEMP_NUM);
-//        DimService Humidity   (SERVER_NAME"/Humindity",   "F", Val+HUMI_OFF, sizeof(float)*HUMI_NUM);
-//        DimService Voltage    (SERVER_NAME"/Voltage",     "F", Val+VOLT_OFF, sizeof(float)*VOLT_NUM);
-//        DimService Current    (SERVER_NAME"/Current",     "F", Val+CURR_OFF, sizeof(float)*CURR_NUM);
+        fDimTemp   ("FSC_CONTROL/TEMPERATURE", "F:1;F:64", ""),
+        fDimHum    ("FSC_CONTROL/HUMIDITY",    "F:1;F:40", ""),
+        fDimVolt   ("FSC_CONTROL/VOLTAGE",     "F:1;F:40", ""),
+        fDimCurrent("FSC_CONTROL/CURRENT",     "F:1;F:4",  "")
     {
     }
@@ -246,6 +319,4 @@
         kStateDisconnected = 1,
         kStateConnected    = 2,
-
-        kCmdTest
     };
 
