Index: trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h
===================================================================
--- trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h	(revision 8865)
+++ trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h	(revision 8869)
@@ -48,6 +48,6 @@
 
 public:
-    MCeCoCom(const char *addr, MLog *out)
-        : MTcpIpIO(addr, 7304, 7404), fOut(out), fStatus(0), fComStat(kNoCmdReceived),
+    MCeCoCom(const char *addr, const int tx=7304, const int rx=7404, MLog *out=NULL)
+        : MTcpIpIO(addr, tx, rx), fOut(out), fStatus(0), fComStat(kNoCmdReceived),
         fHumidity(0), fTemperature(0), fWindSpeed(0), fSolarRadiation(-1),
         fAlarmCounter(0)
@@ -55,4 +55,6 @@
     }
     //virtual bool SendMsg(const char *msg, bool force);
+
+    void SetOutRep(MLog *out) { fOut = out; }
 
     bool SendRep(const char *cmd, const char *str, bool force);
Index: trunk/MagicSoft/Cosy/tcpip/MDriveCom.cc
===================================================================
--- trunk/MagicSoft/Cosy/tcpip/MDriveCom.cc	(revision 8865)
+++ trunk/MagicSoft/Cosy/tcpip/MDriveCom.cc	(revision 8869)
@@ -61,5 +61,6 @@
 
     //cout << "MDriveCom - TRACK... start." << endl;
-    fQueue->PostMsg(WM_TRACK, &rd, sizeof(rd));
+    if (fQueue)
+        fQueue->PostMsg(WM_TRACK, &rd, sizeof(rd));
     //cout << "MDriveCom - TRACK... done." << endl;
     return true;
@@ -87,5 +88,6 @@
 
     //cout << "MDriveCom - TRACK... start." << endl;
-    fQueue->PostMsg(WM_GRB, &rd, sizeof(rd));
+    if (fQueue)
+        fQueue->PostMsg(WM_GRB, &rd, sizeof(rd));
     //cout << "MDriveCom - TRACK... done." << endl;
     return true;
@@ -112,5 +114,6 @@
 
     //cout << "MDriveCom - POSITION... start." << endl;
-    fQueue->PostMsg(WM_POSITION, &za, sizeof(za));
+    if (fQueue)
+        fQueue->PostMsg(WM_POSITION, &za, sizeof(za));
     //cout << "MDriveCom - POSITION... done." << endl;
     return true;
@@ -136,6 +139,13 @@
 
     //cout << "MDriveCom - TRACK... start." << endl;
-    fQueue->PostMsg(WM_PREPS, (void*)str.Data(), str.Length()+1);
+    if (fQueue)
+        fQueue->PostMsg(WM_PREPS, (void*)str.Data(), str.Length()+1);
     //cout << "MDriveCom - TRACK... done." << endl;
+    return true;
+}
+
+bool MDriveCom::CommandTPOINT(TString &str)
+{
+    cout << "CC-COMMAND " << MTime(-1) << " TPOIN " << str << endl;
     return true;
 }
@@ -166,5 +176,6 @@
     bool lock = str=="lock";
 
-    fQueue->PostMsg(WM_ARM, &lock, sizeof(lock));
+    if (fQueue)
+        fQueue->PostMsg(WM_ARM, &lock, sizeof(lock));
     return true;
 }
@@ -176,5 +187,6 @@
         //cout << "MDriveCom - WAIT... start." << endl;
         cout << "CC-COMMAND " << MTime(-1) << " WAIT" << endl;
-        fQueue->PostMsg(WM_WAIT);
+        if (fQueue)
+            fQueue->PostMsg(WM_WAIT);
         //cout << "MDriveCom - WAIT... done." << endl;
         return true;
@@ -185,5 +197,6 @@
         //cout << "MDriveCom - STOP!... start." << endl;
         cout << "CC-COMMAND " << MTime(-1) << " STOP!" << endl;
-        fQueue->PostMsg(WM_STOP);
+        if (fQueue)
+            fQueue->PostMsg(WM_STOP);
         //cout << "MDriveCom - STOP!... done." << endl;
         return true;
@@ -202,4 +215,10 @@
         return CommandPREPS(str);
 
+    if (cmd==(TString)"TPOIN")
+        return CommandTPOINT(str);
+
+    if (cmd==(TString)"ARM")
+        return CommandARM(str);
+
     if (cmd.IsNull() && str.IsNull())
     {
@@ -223,5 +242,5 @@
 }
 
-bool MDriveCom::SendReport(UInt_t stat, RaDec rd, ZdAz so, ZdAz is, ZdAz er)
+bool MDriveCom::SendReport(UInt_t stat, RaDec rd, ZdAz so, ZdAz is, ZdAz er, Bool_t armed)
 {
     // rd [rad]
@@ -259,5 +278,6 @@
     Print(str, is.Az());
     str += txt.Print("%08.3f ", er.Zd());
-    str += txt.Print("%08.3f", er.Az());
+    str += txt.Print("%08.3f ", er.Az());
+    str += armed ? "1 " : "0 ";
 
     return SendRep("DRIVE-REPORT", str, kFALSE);
@@ -303,2 +323,39 @@
     return SendRep("STARG-REPORT", str, kTRUE);
 }
+
+bool MDriveCom::SendTPoint(UInt_t stat)
+{
+    /*
+    // miss   [deg]
+    // nompos [deg]
+    const MTime t(-1);
+
+    miss *= 60;        // [arcmin]
+
+    // Set status flag
+    if (stat&kError)
+        SetStatus(0);
+    if (stat&kStandby)
+        SetStatus(2);
+    if (stat&kMonitoring)
+        SetStatus(4);
+    
+    MString txt;
+
+    TString str;
+    str += txt.Print("%05.3f ", miss.Zd());       //[arcmin]
+    str += txt.Print("%05.3f ", miss.Az());       //[arcmin]
+    Print(str, nompos.Zd());                      //[deg]
+    Print(str, nompos.Az());                      //[deg]
+    str += txt.Print("%05.1f ",   center.GetX()); //number
+    str += txt.Print("%05.1f ",   center.GetY()); //number
+    str += txt.Print("%04d ",   n);               //number of correleated stars
+    str += txt.Print("%03.1f ",  bright);
+    str += txt.Print("%12.6f ", t.GetMjd());      // mjd
+    str += txt.Print("%.1f ", x);
+    str += txt.Print("%.1f ", y);
+    str += txt.Print("%04d ", num);               //number of detected stars
+    */
+
+    return SendRep("TPOINT-REPORT", "", kTRUE);
+}
Index: trunk/MagicSoft/Cosy/tcpip/MDriveCom.h
===================================================================
--- trunk/MagicSoft/Cosy/tcpip/MDriveCom.h	(revision 8865)
+++ trunk/MagicSoft/Cosy/tcpip/MDriveCom.h	(revision 8869)
@@ -28,4 +28,5 @@
     bool CommandPREPS(TString &str);
     bool CommandARM(TString &str);
+    bool CommandTPOINT(TString &str);
 
 public:
@@ -41,8 +42,13 @@
     };
 
-    MDriveCom(MsgQueue *q, const char *addr, MLog *out) : MCeCoCom(addr, out), fQueue(q) {}
+    MDriveCom(MsgQueue *q, const char *addr, const int tx, const int rx, MLog *out=NULL) : MCeCoCom(addr, tx, rx, out), fQueue(q) {}
+    MDriveCom(const char *addr, const int tx, const int rx, MLog *out=NULL) : MCeCoCom(addr, tx, rx, out), fQueue(NULL) {}
 
-    bool SendReport(UInt_t stat, RaDec rd, ZdAz so, ZdAz is, ZdAz er);
+    void SetMsgQueue(MsgQueue *q) { fQueue = q; }
+
+
+    bool SendReport(UInt_t stat, RaDec rd, ZdAz so, ZdAz is, ZdAz er, Bool_t armed);
     bool SendStargReport(UInt_t stat, ZdAz miss, ZdAz nompos, Ring center, Int_t num, Int_t n, Double_t bright, Double_t mjd, Double_t x, Double_t y);
+    bool SendTPoint(UInt_t stat);
     bool SendStatus(const char *stat);
 };
Index: trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc
===================================================================
--- trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc	(revision 8865)
+++ trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc	(revision 8869)
@@ -217,5 +217,5 @@
             if (!ReadSocket(sock))
             {
-                gLog << warn << "WARNING - Connection lost to " << MTcpIpO::GetSocketAddress(sock) << endl;
+                gLog << warn << MTime(-1) << " WARNING - Connection lost to " << MTcpIpO::GetSocketAddress(sock) << endl;
                 return kFALSE;
             }
@@ -228,5 +228,5 @@
             if (timeout.HasTimedOut())
             {
-                gLog << warn << "WARNING - Connection to " << MTcpIpO::GetSocketAddress(sock) << " timed out." << endl;
+                gLog << warn << MTime(-1) << " WARNING - Connection to " << MTcpIpO::GetSocketAddress(sock) << " timed out." << endl;
                 return kFALSE;
             }
@@ -245,9 +245,7 @@
 void MTcpIpI::WaitForConnection(TServerSocket &server)
 {
-    gLog << all << " Wait for connection" << endl;
-
     while (!IsThreadCanceled())
     {
-        gLog << all << "Listening for new connection on port " << fPortRx << "..." << endl;
+        gLog << all << MTime(-1) << " Listening for new connection on port " << fPortRx << "..." << endl;
 
         // Check for a connection request (reminder: we are in non-blocking mode)
@@ -256,4 +254,5 @@
         while (!IsThreadCanceled())
         {
+            //cout << (int) IsThreadCanceled() << endl;
             // Wait for a new connection on RX port
             socket = server.Accept();
@@ -281,5 +280,5 @@
             return;
 
-        gLog << all << "Connection established to " << MTcpIpO::GetSocketAddress(*socket) << "..." << endl;
+        gLog << all << MTime(-1) << " Connection established to " << MTcpIpO::GetSocketAddress(*socket) << "..." << endl;
 
         if (!WaitForData(*socket))
@@ -296,5 +295,5 @@
     while (!IsThreadCanceled())
     {
-        TServerSocket *server=new TServerSocket(fPortRx, kTRUE);
+        TServerSocket *server=new TServerSocket(fPortRx, kTRUE, 0);
         server->SetOption(kNoBlock, 1);
 
