Index: trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc
===================================================================
--- trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc	(revision 2618)
+++ trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc	(revision 4076)
@@ -2,4 +2,6 @@
 
 #include <iostream>
+
+#include "MString.h"
 
 using namespace std;
@@ -53,15 +55,12 @@
     }
 
-    cout << "Zd/Az: " << zd << "/" << az << "   ";
-    cout << "Ra/Dec: " << ra << "/" << dec << "   ";
-    cout << "Temp: " << temp << "'C   ";
-    cout << "Hum: " << hum << "%   ";
-    cout << "SolRad: " << solar << "W/m²   ";
-    cout << "Wind: " << wind << "km/h" << endl;
-
     fHumidity = hum;
     fTemperature = temp;
     fSolarRadiation = solar;
     fWindSpeed = wind;
+
+    cout << "Zd/Az: " << zd << "/" << az << "  ";
+    cout << "Ra/Dec: " << ra/15 << "h/" << dec << "  ";
+    cout << "SolRad: " << solar << "W/m²" << endl;
 
     fComStat = kCmdReceived;
@@ -86,5 +85,5 @@
 }
 
-bool MCeCoCom::Send(const char *str)
+bool MCeCoCom::Send(const char *cmd, const char *str)
 {
     MTime t;
@@ -100,9 +99,9 @@
     fT.GetTime(h2, m2, s2, ms2);
 
-    const char *msg =
-        Form("%s "
+    MString msg;
+    msg.Print("%s "
              "%02d %04d %02d %02d %02d %02d %02d %03d "
              "%02d %04d %02d %02d %02d %02d %02d %03d "
-             "%s\n", (const char*)fCommand,
+             "%s\n", cmd,
              fStatus,  y1, mon1, d1, h1, m1, s1, ms1,
              fComStat, y2, mon2, d2, h2, m2, s2, ms2,
@@ -113,2 +112,30 @@
     return rc;
 }
+
+TString MCeCoCom::GetWeather() const
+{
+    if (fSolarRadiation<0 || (double)MTime(-1)-(double)fT>11)
+        return "";
+
+    MString str;
+    return str.Print("Temp: %.1f'C  Hum: %.1f%%  Wind: %.1fkm/h",
+                     fTemperature, fHumidity, fWindSpeed);
+}
+
+Int_t MCeCoCom::GetWeatherStatus() const
+{
+    if (fSolarRadiation<0 || (double)MTime(-1)-(double)fT>11)
+        return 0;
+
+    Int_t rc = 0;
+    if (fHumidity>80)
+        rc++;
+    if (fWindSpeed>20)
+        rc++;
+    if (fWindSpeed>30)
+        rc++;
+    if (fWindSpeed>50)
+        rc++;
+
+    return rc;
+}
Index: trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h
===================================================================
--- trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h	(revision 2618)
+++ trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h	(revision 4076)
@@ -24,5 +24,5 @@
     };
 
-    TString fCommand;     // report string of the current system
+    //TString fCommand;     // report string of the current system
     MTime   fT;           // time of last report received
     char    fStatus;      // current status of this system
@@ -43,13 +43,17 @@
 public:
     MCeCoCom::MCeCoCom(const char *cmd, MLog &out=gLog)
-        : MTcpIpIO(out), fCommand(cmd), fStatus(0), fComStat(kNoCmdReceived)
+        : MTcpIpIO(out), /*fCommand(cmd),*/ fStatus(0), fComStat(kNoCmdReceived), fSolarRadiation(-1)
     {
     }
 
-    bool Send(const char *str);
+    bool Send(const char *cmd, const char *str);
     void SetStatus(Byte_t s) { fStatus=s; }
 
     Float_t GetHumidity() const { return fHumidity; }
     Float_t GetTemperature() const { return fTemperature; }
+    Float_t GetWindSpeed() const { return fWindSpeed; }
+
+    TString GetWeather() const;
+    Int_t   GetWeatherStatus() const;
 };
 
Index: trunk/MagicSoft/Cosy/tcpip/MDriveCom.cc
===================================================================
--- trunk/MagicSoft/Cosy/tcpip/MDriveCom.cc	(revision 2618)
+++ trunk/MagicSoft/Cosy/tcpip/MDriveCom.cc	(revision 4076)
@@ -6,4 +6,5 @@
 #include "MAstro.h"
 #include "MCosy.h"
+#include "MString.h"
 
 using namespace std;
@@ -53,6 +54,5 @@
     }
 
-    lout << "CC-COMMAND: Track " << ra << "h " << dec << "deg '" << str 
-<< "'" << endl;
+    cout << "CC-COMMAND " << MTime(-1) << " RADEC " << ra << "h " << dec << "d '" << str << "'" << endl;
 
     ra *= 15; // h -> deg
@@ -60,7 +60,7 @@
     RaDec rd[2] = { RaDec(ra, dec), RaDec(ra, dec) };
 
-    cout << "MDriveCom - TRACK... start." << endl;
+    //cout << "MDriveCom - TRACK... start." << endl;
     fQueue->PostMsg(WM_TRACK, &rd, sizeof(rd));
-    cout << "MDriveCom - TRACK... done." << endl;
+    //cout << "MDriveCom - TRACK... done." << endl;
     return true;
 }
@@ -81,11 +81,11 @@
     }
 
-    lout << "CC-COMMAND: Move " << zd << "deg " << az << "deg" << endl;
+    cout << "CC-COMMAND " << MTime(-1) << " ZDAZ " << zd << "deg " << az << "deg" << endl;
 
     ZdAz za(zd, az);
 
-    cout << "MDriveCom - POSITION... start." << endl;
+    //cout << "MDriveCom - POSITION... start." << endl;
     fQueue->PostMsg(WM_POSITION, &za, sizeof(za));
-    cout << "MDriveCom - POSITION... done." << endl;
+    //cout << "MDriveCom - POSITION... done." << endl;
     return true;
 }
@@ -95,7 +95,8 @@
     if (cmd==(TString)"WAIT" && str.IsNull())
     {
-        cout << "MDriveCom - WAIT... start." << endl;
+        //cout << "MDriveCom - WAIT... start." << endl;
+        cout << "CC-COMMAND " << MTime(-1) << " WAIT" << endl;
         fQueue->PostMsg(WM_WAIT);
-        cout << "MDriveCom - WAIT... done." << endl;
+        //cout << "MDriveCom - WAIT... done." << endl;
         return true;
     }
@@ -103,8 +104,8 @@
     if (cmd==(TString)"STOP!" && str.IsNull())
     {
-        cout << "MDriveCom - STOP!... start." << endl;
-        lout << "CC-COMMAND: STOP!" << endl;       
+        //cout << "MDriveCom - STOP!... start." << endl;
+        cout << "CC-COMMAND " << MTime(-1) << " STOP!" << endl;
         fQueue->PostMsg(WM_STOP);
-        cout << "MDriveCom - STOP!... done." << endl;
+        //cout << "MDriveCom - STOP!... done." << endl;
         return true;
     }
@@ -124,9 +125,9 @@
     if (cmd.IsNull() && str.IsNull())
     {
-        cout << "Empty command (single '\\n') received." << endl;
+        cout << "CC-COMMAND " << MTime(-1) << " Empty command (single '\\n') received." << endl;
         return false;
     }
 
-    cout << "Unknown Command: '" << cmd << "':'" << str << "'" << endl;
+    cout << "CC-COMMAND " << MTime(-1) << " Syntax error: '" << cmd << "':'" << str << "'" << endl;
     return false;
 }
@@ -139,5 +140,6 @@
     MAstro::Deg2Dms(deg, sgn, d, m, s);
 
-    str += Form("%c %03d %02d %03d ", sgn, d, m, s);
+    MString txt;
+    str += txt.Print("%c %03d %02d %03d ", sgn, d, m, s);
 }
 
@@ -148,4 +150,5 @@
     // is [deg]
     // er [rad]
+    const MTime t(-1);
 
     rd *= kRad2Deg;
@@ -165,6 +168,5 @@
         SetStatus(4);
 
-    MTime t;
-    t.Now();
+    MString txt;
 
     TString str;
@@ -172,12 +174,17 @@
     Print(str, rd.Dec());   // Dec
     Print(str, 0);          // HA
-    str += Form("%12.6f ", t.GetMjd()); // mjd
+    str += txt.Print("%12.6f ", t.GetMjd()); // mjd
     Print(str, so.Zd());
     Print(str, so.Az());
     Print(str, is.Zd());
     Print(str, is.Az());
-    str += Form("%08.3f ", er.Zd());
-    str += Form("%08.3f", er.Az());
+    str += txt.Print("%08.3f ", er.Zd());
+    str += txt.Print("%08.3f", er.Az());
 
-    return Send(str);
+    return Send("DRIVE-REPORT", str);
 }
+
+bool MDriveCom::SendStatus(const char *stat)
+{
+    return Send("DRIVE-STATUS", stat);
+}
Index: trunk/MagicSoft/Cosy/tcpip/MDriveCom.h
===================================================================
--- trunk/MagicSoft/Cosy/tcpip/MDriveCom.h	(revision 2618)
+++ trunk/MagicSoft/Cosy/tcpip/MDriveCom.h	(revision 4076)
@@ -37,4 +37,5 @@
 
     bool SendReport(UInt_t stat, RaDec rd, ZdAz so, ZdAz is, ZdAz er);
+    bool SendStatus(const char *stat);
 };
 
Index: trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc
===================================================================
--- trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc	(revision 2618)
+++ trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc	(revision 4076)
@@ -33,5 +33,6 @@
      */
 
-MTcpIpIO::MTcpIpIO(MLog &out) : MThread(false), Log(out), fRxSocket(NULL), fServSock(NULL)
+MTcpIpIO::MTcpIpIO(MLog &out)
+    : MThread(false), Log(out), fRxSocket(NULL), fServSock(NULL), fSendInterval(1000)
 {
     fTxSocket = new TSocket("ceco", 7304);
@@ -49,18 +50,18 @@
     // Now delete all TCP/IP objects
     //
-    cout << "Delete TxSocket " << fTxSocket << "..." << flush;
+    //cout << "Delete TxSocket " << fTxSocket << "..." << flush;
     delete fTxSocket;
-    cout << "Done." << endl;
+    //cout << "Done." << endl;
     if (fServSock)
     {
-        cout << "Delete ServSock " << fServSock << "..." << flush;
+        //cout << "Delete ServSock " << fServSock << "..." << flush;
         delete fServSock;
-        cout << "Done." << endl;
+        //cout << "Done." << endl;
     }
     if (fRxSocket)
     {
-        cout << "Delete RxSocket " << fRxSocket << "..." << flush;
+        //cout << "Delete RxSocket " << fRxSocket << "..." << flush;
         delete fRxSocket;
-        cout << "Done." << endl;
+        //cout << "Done." << endl;
     }
 }
@@ -68,4 +69,19 @@
 bool MTcpIpIO::Send(const char *msg)
 {
+    const MTime t(-1);
+
+    if ((double)t-(double)fTime<0.001*fSendInterval)
+        return true;
+
+    const Int_t rc = lout.IsOutputDeviceEnabled(MLog::eGui);
+    lout.DisableOutputDevice(MLog::eGui);
+    lout.Lock();
+    lout << msg << flush;
+    lout.UnLock();
+    if (rc)
+        lout.EnableOutputDevice(MLog::eGui);
+
+    fTime = t;
+
     if (!fTxSocket->IsValid())
         return false;
@@ -112,5 +128,5 @@
             switch (fServSock->GetErrorCode())
             {
-            case 0: cout << "No error." << endl; break;
+            case  0: cout << "No error." << endl; break;
             case -1: cout << "low level socket() call failed." << endl; break;
             case -2: cout << "low level bind() call failed." << endl; break;
Index: trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.h
===================================================================
--- trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.h	(revision 2618)
+++ trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.h	(revision 4076)
@@ -7,4 +7,7 @@
 #ifndef COSY_Log
 #include "log.h"
+#endif
+#ifndef MARS_MTime
+#include "MTime.h"
 #endif
 
@@ -19,4 +22,7 @@
     TSocket       *fRxSocket;
     TServerSocket *fServSock;
+
+    MTime fTime;
+    Int_t fSendInterval; // [ms]
 
     void Clear();
