Index: trunk/FACT++/gui/FactGui.h
===================================================================
--- trunk/FACT++/gui/FactGui.h	(revision 11279)
+++ trunk/FACT++/gui/FactGui.h	(revision 11294)
@@ -535,5 +535,5 @@
     void RemoveService(const std::string &server, const std::string &service, bool iscmd)
     {
-        UnsubscribeService(server+'/'+service);
+        UnsubscribeService(server+'/'+service, true);
 
         QApplication::postEvent(this,
@@ -634,5 +634,5 @@
     }
 
-    void UnsubscribeService(const string &service)
+    void UnsubscribeService(const string &service, bool allow_unsubscribed)
     {
         const map<string,DimInfo*>::iterator i=fServices.find(service);
@@ -640,5 +640,6 @@
         if (i==fServices.end())
         {
-            cout << "ERROR - We are not subscribed to " << service << endl;
+            if (!allow_unsubscribed)
+                cout << "ERROR - We are not subscribed to " << service << endl;
             return;
         }
@@ -892,6 +893,9 @@
     void handleFadRuns(const DimData &d)
     {
-        if (!CheckSize(d, 20))
-            return;
+        if (d.size()<20)
+        {
+            cout << "Size mismatch in " << d.name << ": Found=" << d.size() << " Expected>=20" << endl;
+            return;
+        }
 
         const uint32_t *ptr = d.ptr<uint32_t>();
@@ -903,4 +907,11 @@
         fEvtBldLastOpened->setValue(ptr[3]);
         fEvtBldLastClosed->setValue(ptr[4]);
+
+        if (d.size()>=20)
+            fEvtBldFilename->setText(d.ptr<char>(20));
+
+        if (ptr[0]==0)
+            fEvtBldFilename->setText("");
+
     }
 
@@ -1288,34 +1299,51 @@
          int32_t  procStat ;          //processing thread(s)
          int32_t  writStat ;          //write thread
-
-         //info about some rates
-         int32_t  deltaT ;            //time in milli-seconds for rates
-         int32_t  readEvt ;           //#events read
-         int32_t  procEvt ;           //#events processed
-         int32_t  writEvt ;           //#events written
-         int32_t  skipEvt ;           //#events skipped
-
-         //some info about current state of event buffer (snapspot)
-         int32_t  evtBuf;             //#Events currently waiting in Buffer
-         uint64_t totMem;             //#Bytes available in Buffer
-         uint64_t usdMem;             //#Bytes currently used
-         uint64_t maxMem;             //max #Bytes used during past Second
          */
 
         fFadBufferMax->setValue(stat.totMem/1000000);
         fFadBuffer->setMaximum(stat.totMem/100);
-        fFadBuffer->setValue(stat.maxMem/100);
-
-        cout << stat.totMem << " " << stat.maxMem << endl;
-
-        /*
-        fFadEvtWait->setValue(stat[1]);
-        fFadEvtSkip->setValue(stat[2]);
-        fFadEvtDel->setValue(stat[3]);
-        fFadEvtTot->setValue(stat[4]);
-        fFadEthernetRateTot->setValue(stat[6]/1024.);
-        fFadEthernetRateAvg->setValue(stat[6]/1024./stat[7]);
-        fFadEvtConn->setValue(stat[7]);
-        */
+        fFadBuffer->setValue(stat.maxMem/100);  // Max mem used in last second
+
+        uint32_t sum = 0;
+        int32_t  min = 0x7fffff;
+        int32_t  max = 0;
+
+        int cnt = 0;
+        int err = 0;
+
+        for (int i=0; i<40; i++)
+        {
+            if (stat.numConn[i]!=7)
+                continue;
+
+            cnt++;
+
+            sum += stat.rateBytes[i];
+            err += stat.errConn[i];
+
+            if (stat.rateBytes[i]<min)
+                min = stat.rateBytes[i];
+            if (stat.rateBytes[i]>max)
+                max = stat.rateBytes[i];
+        }
+
+        fFadEvtConn->setValue(cnt);
+        fFadEvtConnErr->setValue(err);
+
+        fFadEvtBufNew->setValue(stat.bufNew);  // Incomplete in buffer
+        fFadEvtBufEvt->setValue(stat.bufEvt);  // Complete in buffer
+        fFadEvtWrite->setValue(stat.evtWrite-stat.evtSkip-stat.evtErr);
+        fFadEvtSkip->setValue(stat.evtSkip);
+        fFadEvtErr->setValue(stat.evtErr);
+
+        if (stat.deltaT==0)
+            return;
+
+        fFadEthernetRateMin->setValue(min/stat.deltaT);
+        fFadEthernetRateMax->setValue(max/stat.deltaT);
+        fFadEthernetRateTot->setValue(sum/stat.deltaT);
+        fFadEthernetRateAvg->setValue(cnt==0 ? 0 : sum/cnt/stat.deltaT);
+        fFadEvtRateNew->setValue(1000*stat.rateNew/stat.deltaT);
+        fFadEvtRateWrite->setValue(1000*stat.rateWrite/stat.deltaT);
     }
 
@@ -1325,5 +1353,5 @@
             return;
 
-        const EVT_STAT &stat = d.ref<EVT_STAT>();
+        //const EVT_STAT &stat = d.ref<EVT_STAT>();
 
         /*
@@ -1849,12 +1877,18 @@
             bool enable = false;
 
-            if (s.index<FTM::kDisconnected) // No Dim connection
+            if (s.index<FTM::StateMachine::kDisconnected) // No Dim connection
                 SetLedColor(fStatusFTMLed, kLedGray, time);
-            if (s.index==FTM::kDisconnected) // Dim connection / FTM disconnected
+            if (s.index==FTM::StateMachine::kDisconnected) // Dim connection / FTM disconnected
                 SetLedColor(fStatusFTMLed, kLedYellow, time);
-	    if (s.index==FTM::kConnected || s.index==FTM::kIdle || s.index==FTM::kTakingData) // Dim connection / FTM connected
+            if (s.index==FTM::StateMachine::kConnected    ||
+                s.index==FTM::StateMachine::kIdle         ||
+                s.index==FTM::StateMachine::kConfiguring1 ||
+                s.index==FTM::StateMachine::kConfiguring2 ||
+                s.index==FTM::StateMachine::kConfigured   ||
+                s.index==FTM::StateMachine::kTakingData) // Dim connection / FTM connected
                 SetLedColor(fStatusFTMLed, kLedGreen, time);
 
-            if (s.index==FTM::kConnected || s.index==FTM::kIdle) // Dim connection / FTM connected
+            if (s.index==FTM::StateMachine::kConnected ||
+                s.index==FTM::StateMachine::kIdle) // Dim connection / FTM connected
                 enable = true;
 
@@ -1863,5 +1897,5 @@
             fRatesWidget->setEnabled(enable);
 
-            if (s.index>=FTM::kConnected)
+            if (s.index>=FTM::StateMachine::kConnected)
                 SetFtuStatusLed(time);
             else
