Index: trunk/MagicSoft/Cosy/main/MCosy.cc
===================================================================
--- trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 2280)
+++ trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 2384)
@@ -18,4 +18,5 @@
 
 #include "MGCosy.h"
+#include "MDriveCom.h"
 #include "MStarguider.h"
 #include "SlaStars.h"
@@ -52,4 +53,5 @@
 
 #define EXPERT
+//#undef EXPERT
 
 double MCosy::Rad2SE(double rad) const
@@ -296,5 +298,5 @@
         return;
 
-    SetStatus(MCosy::kMoving);
+    SetStatus(MDriveCom::kMoving);
 
     if (axe1) fMac2->StartRelPos(rd.Zd());
@@ -364,5 +366,5 @@
     if (!HasError())
     {
-        SetStatus(MCosy::kStopped);
+        SetStatus(MDriveCom::kStopped);
         return;
     }
@@ -371,5 +373,5 @@
     // If there is an error, the error status is set to Error.
     //
-    SetStatus(MCosy::kError);
+    SetStatus(MDriveCom::kError);
 
     /*
@@ -391,5 +393,5 @@
      // Set motor status to stopped
      //
-     SetStatus(MCosy::kStopped);
+     SetStatus(MDriveCom::kStopped);
      */
 }
@@ -471,5 +473,5 @@
 
     int i;
-    for (i=0; i<10 && !(Break() || HasError() || HasZombie()); i++)
+    for (i=0; i<(track?1:10) && !(Break() || HasError() || HasZombie()); i++)
     {
 
@@ -511,5 +513,5 @@
             t.Now();
             lout << t << " - Positioning done in " << i << (i==1?" step.":" steps.") << endl;
-            SetStatus(MCosy::kStopped);
+            SetStatus(MDriveCom::kStopped);
             return TRUE;
         }
@@ -560,5 +562,5 @@
             fMac2->SetAcceleration(0.4*vr);// 0.4
             fMac2->SetDeceleration(0.4*vr);// 0.4
-            SetPosVelocity(fabs(rd.Ratio()), 0.2); // 0.175
+            SetPosVelocity(fabs(rd.Ratio()), 0.2); // fast: 0.6, slow: 0.2
 #else
             fMac2->SetAcceleration(0.2*vr);
@@ -592,5 +594,5 @@
         StopMovement();
     else
-        SetStatus(MCosy::kStopped);
+        SetStatus(MDriveCom::kStopped);
 
     t.Now();
@@ -662,5 +664,5 @@
         return false;
 
-    SetStatus(MCosy::kMoving | MCosy::kTracking);
+    SetStatus(MDriveCom::kMoving | MDriveCom::kTracking);
 
     fMac2->SetRpmMode(TRUE);
@@ -1042,5 +1044,5 @@
     // Set status to Stopping
     //
-    SetStatus(MCosy::kStopping);
+    SetStatus(MDriveCom::kStopping);
 
     //
@@ -1095,5 +1097,5 @@
     // Set status to Stopping
     //
-    SetStatus(MCosy::kStopping);
+    SetStatus(MDriveCom::kStopping);
 
     //
@@ -1281,4 +1283,16 @@
         return (void*)0x7777;
 
+    case WM_POSITION1:
+        cout << "WM_Position1: start." << endl;
+        {
+            if (!CheckNetwork())
+                return (void*)0xebb0;
+
+            ZdAz dest = *((ZdAz*)mp);
+            SetPosition(dest*kDeg2Rad, kTRUE);
+        }
+        cout << "WM_Position: done. (return 0x7777)" << endl;
+        return (void*)0x7777;
+
     case WM_TESTSE:
         cout << "WM_TestSe: start." << endl;
@@ -1341,5 +1355,5 @@
             TEnv env(".cosyrc");
 
-            SetStatus(MCosy::kMoving);
+            SetStatus(MDriveCom::kMoving);
 
             fMac1->SetHome(250000, env.GetValue("Az_MaxTime2ReachHome[s]", 100));
@@ -1348,5 +1362,5 @@
             lout << "SETHOME DONE" << endl;
 
-            SetStatus(HasError() ? MCosy::kError : MCosy::kStopped);
+            SetStatus(HasError() ? MDriveCom::kError : MDriveCom::kStopped);
 
             fAz->SetPreset();
@@ -1833,5 +1847,5 @@
 
     if (HasError())
-        SetStatus(MCosy::kError);
+        SetStatus(MDriveCom::kError);
 
     lout.UpdateGui();
@@ -1849,4 +1863,11 @@
         DisplayHistGear(!trigger);
 
+    // FIXME: Not thread safe!
+    static int i=0;
+    if (i++==8)
+    {
+        fCom->SendReport(fStatus, fRaDec, fZdAzSoll, bendist, fTrackingError);
+        i=0;
+    }
     return kTRUE;
 }
@@ -2103,5 +2124,5 @@
 
 MCosy::MCosy(int mode, const char *dev, const int baud, MLog &out)
-: Network(dev, baud, out), fObservatory(MObservatory::kMagic1), fStarguider(NULL), fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), fMac3(0), fBackground(kBgdNone), fStatus(kStopped)
+: Network(dev, baud, out), fObservatory(MObservatory::kMagic1), fStarguider(NULL), fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), fMac3(0), fBackground(kBgdNone), fStatus(MDriveCom::kStopped)
 {
     TEnv env(".cosyrc");
@@ -2158,4 +2179,7 @@
     *tpout << /*"20 1013.25 300 0.5 0.55 0.0065" <<*/ endl;
     // temp(°C) pressure(mB) height(m) humidity(1) wavelength(microm) troplapserate(K/m)
+
+    fCom = new MDriveCom(out);
+    fCom->Start();
 }
 
@@ -2189,4 +2213,5 @@
 
     delete fUpdateGui;
+    delete fCom;
 
     cout << "Deleting Nodes." << endl;
Index: trunk/MagicSoft/Cosy/main/MCosy.h
===================================================================
--- trunk/MagicSoft/Cosy/main/MCosy.h	(revision 2280)
+++ trunk/MagicSoft/Cosy/main/MCosy.h	(revision 2384)
@@ -30,4 +30,5 @@
 #define WM_DISPLAY      0x100d
 #define WM_TRACKPOS     0x100e
+#define WM_POSITION1    0x100f
 
 class ShaftEncoder;
@@ -37,4 +38,5 @@
 class TH1;
 class MStarguider;
+class MDriveCom;
 
 class MTTalk : public MThread
@@ -61,13 +63,4 @@
 
 private:
-    enum
-    {
-        kError    = 0x01,
-        kMoving   = 0x02,
-        kTracking = 0x04,
-        kStopping = 0x08,
-        kStopped  = 0x10
-    };
-
     const MObservatory::LocationName_t fObservatory;
 
@@ -82,5 +75,6 @@
     Macs *fMac3;
 
-    MGCosy *fWin;
+    MGCosy    *fWin;
+    MDriveCom *fCom;
 
     TTimer *fUpdateGui;
Index: trunk/MagicSoft/Cosy/main/Makefile
===================================================================
--- trunk/MagicSoft/Cosy/main/Makefile	(revision 2280)
+++ trunk/MagicSoft/Cosy/main/Makefile	(revision 2384)
@@ -21,5 +21,5 @@
 
 INCLUDES = -I. -I../base -I.. -I../gui -I../catalog -I../devdrv \
-	   -I../candrv -I../incl -I../videodev -I../caos
+	   -I../candrv -I../incl -I../videodev -I../caos -I../tcpip
 
 # @code 
