Index: /trunk/MagicSoft/Cosy/Changelog
===================================================================
--- /trunk/MagicSoft/Cosy/Changelog	(revision 8855)
+++ /trunk/MagicSoft/Cosy/Changelog	(revision 8856)
@@ -1,8 +1,38 @@
                                                                   -*-*- END -*-*-
 
+ 2008/02/05 Thomas Bretz (La Palma)
+
+   * cosy.cc:
+     - setup address and port in constructor of Ethernet
+
+   * candrv/ethernet.[h,cc]:
+     - added new data mebers fTxAddress and fTxPort
+     - get all io addresses in constructor
+
+   * gui/MGCosy.cc:
+     - switch off debug mode
+
+   * main/MCosy.cc, main/MStarguider.cc, videodev/Camera.cc:
+     - added missing stream manipulators
+
+   * tcpip/MCeCoCom.h:
+     - set address of CeCo in constructor of MTCpIpIO
+
+   * tcpip/MTcpIpIO.[h,cc]:
+     - moved setting of destination address into arguments of constructor
+
+   * videodev/MVideo.cc:
+     - tiny improfements to logging output
+
+
+
  2008/02/04 Thomas Bretz (La Palma)
 
-   * candrv/interface.[h,cc], candrv/ethernet.[h,cc]:
+   * candrv/interface.[h,cc], candrv/ethernet.[h,cc],
+     MIncl.h, MLinkDef.h:
      - added
+
+   * Makefile:
+     - removed readcam from list of programs
 
 
Index: /trunk/MagicSoft/Cosy/candrv/ethernet.cc
===================================================================
--- /trunk/MagicSoft/Cosy/candrv/ethernet.cc	(revision 8855)
+++ /trunk/MagicSoft/Cosy/candrv/ethernet.cc	(revision 8856)
@@ -53,5 +53,6 @@
 //  and switch the can bus communication on
 //
-Ethernet::Ethernet(CanOpen *rx) : MTcpIpI(5358), Interface(rx)
+Ethernet::Ethernet(const char *addr, const int tx, const int rx, CanOpen *receiver)
+    : MTcpIpI(rx), Interface(receiver), fTxAddress(addr), fTxPort(tx)
 {
     gLog << inf2 << "- Ethernet initialized." << endl;
@@ -191,10 +192,9 @@
     */
 
+    // FIXME: MUST BECOME NON-BLOCKING!!!!!
     cout << "*** Send CanFrame over IP" << endl;
-
-    // MUST BECOME NON-BLOCKING!!!!!
-
-//    MTcpIpO::SendFrame("192.168.0.2", 5357, (char*)(msg.data+1), msg.len-1);
-    MTcpIpO::SendFrame("192.168.1.1", 5357, (char*)(msg.data+1), msg.len-1);
+    // FIXME: MUST BECOME NON-BLOCKING!!!!!
+
+    MTcpIpO::SendFrame(fTxAddress, fTxPort, (char*)(msg.data+1), msg.len-1);
 
     /*
Index: /trunk/MagicSoft/Cosy/candrv/ethernet.h
===================================================================
--- /trunk/MagicSoft/Cosy/candrv/ethernet.h	(revision 8855)
+++ /trunk/MagicSoft/Cosy/candrv/ethernet.h	(revision 8856)
@@ -13,4 +13,7 @@
 {
 private:
+    TString fTxAddress;
+    Int_t   fTxPort;
+
     // Send interface based on MTcpIpI
     void ReadSocket(TSocket &rx);
@@ -21,5 +24,5 @@
 
 public:
-    Ethernet(CanOpen *rx);
+    Ethernet(const char *addr, const int tx, const int rx, CanOpen *receiver);
     virtual ~Ethernet();
 
Index: /trunk/MagicSoft/Cosy/cosy.cc
===================================================================
--- /trunk/MagicSoft/Cosy/cosy.cc	(revision 8855)
+++ /trunk/MagicSoft/Cosy/cosy.cc	(revision 8856)
@@ -180,5 +180,5 @@
     MCosy *cosy = new MCosy();
 
-    Interface *interface = new Ethernet(cosy);
+    Interface *interface = new Ethernet("127.0.0.1", 5357, 5358, cosy);
     // Interface *interface = new VmodIcan(cosy, "/dev/dpm_00", 125);
 
Index: /trunk/MagicSoft/Cosy/gui/MGCosy.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 8855)
+++ /trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 8856)
@@ -35,6 +35,6 @@
 #include "SlaStars.h"
 
-#define DEBUG
-//#undef DEBUG
+//#define DEBUG
+#undef DEBUG
 //#define EXPERT
 //#define HAS_DEMO
Index: /trunk/MagicSoft/Cosy/main/MCosy.cc
===================================================================
--- /trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 8855)
+++ /trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 8856)
@@ -549,5 +549,5 @@
     if (HasZombie())
     {
-        lout << "- Found Zombies in Network..." << endl;
+        gLog << warn << "- Found Zombies in Network..." << endl;
         if (!RebootZombies())
             return false;
Index: /trunk/MagicSoft/Cosy/main/MStarguider.cc
===================================================================
--- /trunk/MagicSoft/Cosy/main/MStarguider.cc	(revision 8855)
+++ /trunk/MagicSoft/Cosy/main/MStarguider.cc	(revision 8856)
@@ -216,5 +216,5 @@
 
     TString disp=gVirtualX->DisplayName();
-    cout << "Display: " << disp << endl;
+    gLog << all << "Display: " << disp << endl;
     if (disp.First(':')>=0)
         disp=disp(0, disp.First(':'));
@@ -507,5 +507,5 @@
       fStatus(MDriveCom::kStandby)
 {
-    cout << " #### FIXME: Make MCaos Thread safe!" << endl;
+    gLog << warn << " #### FIXME: Make MCaos Thread safe!" << endl;
 
     // This means that all objects added with AddFrame are deleted
@@ -582,5 +582,5 @@
     delete fAmcSocket;
 
-    cout << "Camera Display destroyed." << endl;
+    gLog << inf2 << "Camera Display destroyed." << endl;
 }
 
@@ -596,10 +596,10 @@
     if (len<0)
     {
-        cout << "ERROR - Sending Trigger to Amc" << endl;
+        gLog << err << "ERROR - Sending Trigger to Amc" << endl;
         return false;
     }
     if (len!=txt.Length())
     {
-        cout << "Send wrong number (" << len << ") of Bytes to Amc." << endl;
+        gLog << err << "Send wrong number (" << len << ") of Bytes to Amc." << endl;
         return false;
     }
@@ -615,5 +615,5 @@
 void MStarguider::CloseWindow()
 {
-    cout << "EventDisplay::CloseWindow: Exit Application Loop." << endl;
+    gLog << inf2 << "EventDisplay::CloseWindow: Exit Application Loop." << endl;
 
     //fClient.ExitLoop();
@@ -817,5 +817,5 @@
                 {
                     const Float_t pixsize = atof(fPixSize->GetText());
-                    cout << "Pixel Size changed to " << pixsize << "\"/pix" << endl;
+                    gLog << all << "Pixel Size changed to " << pixsize << "\"/pix" << endl;
                     fSao->SetPixSize(pixsize);
                     return kTRUE;
@@ -824,5 +824,5 @@
                 {
                     const Float_t angle = atof(fAngle->GetText());
-                    cout << "Rotation Angle changed to " << angle << "deg" << endl;
+                    gLog << all << "Rotation Angle changed to " << angle << "deg" << endl;
                     fSao->SetRotationAngle(angle);
                     return kTRUE;
@@ -831,5 +831,5 @@
                 {
                     const Float_t cut = atof(fCut->GetText());
-                    cout << "Starguider cleaning level changed to " << cut << " sigma." << endl;
+                    gLog << all << "Starguider cleaning level changed to " << cut << " sigma." << endl;
                     return kTRUE;
                 }
@@ -1364,5 +1364,5 @@
     if (num < 3) //was 1
     {
-        cout << "Sorry, less than 3 detected spot in FOV!" << endl;
+        gLog << warn << "Sorry, less than 3 detected spot in FOV!" << endl;
         if (fStargTPoint->IsDown())
             fStargTPoint->SetDown(kFALSE);
@@ -1373,5 +1373,5 @@
     if (stars.GetRealEntries() < 3)
     {
-        cout << "Sorry, less than 3 stars in FOV!" << endl;
+        gLog << warn << "Sorry, less than 3 stars in FOV!" << endl;
         if (fStargTPoint->IsDown())
             fStargTPoint->SetDown(kFALSE);
@@ -1466,5 +1466,5 @@
         // open tpoint file
         const TString name = MCosy::GetFileName("tpoint", "starg", "txt");
-        cout << "TPoint-Starg File ********* " << name << " ********** " << endl;
+        gLog << all << "TPoint-Starg File ********* " << name << " ********** " << endl;
 
         fOutStargTp = new ofstream(name);
@@ -1579,5 +1579,5 @@
         {
             fTPoint->SetDown(kFALSE);
-            cout << "No star found. Couldn't take a tpoint." << endl;
+            gLog << warn << "No star found. Couldn't take a tpoint." << endl;
         }
         return ZdAz(.0,.0);
Index: /trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h
===================================================================
--- /trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h	(revision 8855)
+++ /trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h	(revision 8856)
@@ -49,5 +49,5 @@
 public:
     MCeCoCom(MLog *out)
-        : MTcpIpIO(7304, 7404), fOut(out), fStatus(0), fComStat(kNoCmdReceived),
+        : MTcpIpIO("ceco", 7304, 7404), fOut(out), fStatus(0), fComStat(kNoCmdReceived),
         fHumidity(0), fTemperature(0), fWindSpeed(0), fSolarRadiation(-1),
         fAlarmCounter(0)
Index: /trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc
===================================================================
--- /trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc	(revision 8855)
+++ /trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc	(revision 8856)
@@ -35,7 +35,7 @@
      */
 
-MTcpIpO::MTcpIpO(Int_t tx)
-{
-    fTxSocket = new TSocket("ceco", tx);
+MTcpIpO::MTcpIpO(const char *addr, Int_t tx)
+{
+    fTxSocket = new TSocket(addr, tx);
 }
 
@@ -46,5 +46,5 @@
 }
 
-MTcpIpIO::MTcpIpIO(Int_t tx, Int_t rx) : MTcpIpI(rx), MTcpIpO(tx)
+MTcpIpIO::MTcpIpIO(const char *addr, Int_t tx, Int_t rx) : MTcpIpI(rx), MTcpIpO(addr, tx)
 {
     RunThread();
Index: /trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.h
===================================================================
--- /trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.h	(revision 8855)
+++ /trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.h	(revision 8856)
@@ -37,5 +37,5 @@
 
 public:
-    MTcpIpO(Int_t tx);
+    MTcpIpO(const char *addr, Int_t tx);
     ~MTcpIpO();
 
@@ -53,5 +53,5 @@
 
 public:
-    MTcpIpIO(Int_t tx, Int_t rx);
+    MTcpIpIO(const char *addr, Int_t tx, Int_t rx);
     ~MTcpIpIO();
 
Index: /trunk/MagicSoft/Cosy/videodev/Camera.cc
===================================================================
--- /trunk/MagicSoft/Cosy/videodev/Camera.cc	(revision 8855)
+++ /trunk/MagicSoft/Cosy/videodev/Camera.cc	(revision 8856)
@@ -102,5 +102,5 @@
     if (!fVideo->IsOpen())
     {
-        gLog << "ERROR - Process: Device not open." << endl;
+        gLog << err << "Camera::Thread: ERROR - Device not open." << endl;
         return kFALSE;
     }
Index: /trunk/MagicSoft/Cosy/videodev/MVideo.cc
===================================================================
--- /trunk/MagicSoft/Cosy/videodev/MVideo.cc	(revision 8855)
+++ /trunk/MagicSoft/Cosy/videodev/MVideo.cc	(revision 8856)
@@ -104,11 +104,11 @@
                 return -4;
 
-            gLog << err << "ERROR - MVideo::Ioctl -ioctl returned rc=" << rc << " '";
-            gLog << strerror(errno) << "' (errno = " << errno << ")" << endl;
+            gLog << err << "ERROR - MVideo::Ioctl 0x" << hex << req << ": errno=" << dec << errno << " - ";
+            gLog << strerror(errno) << " (rc=" << rc << ")" << endl;
             usleep(10);
             continue;
         }
 
-        gLog << err << "ERROR - MVideo::Ioctl " << hex << req << ": errno=" << dec << errno << " - ";
+        gLog << err << "ERROR - MVideo::Ioctl 0x" << hex << req << ": errno=" << dec << errno << " - ";
         gLog << strerror(errno) << " (rc=" << rc << ")" << endl;
         return rc;
@@ -161,5 +161,5 @@
     }
 
-    gLog << all << "Opening " << fPath << "..." << flush;
+    gLog << all << "Opening " << fPath << "... " << flush;
     do
     {
@@ -171,5 +171,5 @@
     if (fFileDesc == -1)
     {
-        gLog << err << "ERROR!" << endl;
+        gLog << err << "ERROR: " << strerror(errno) << endl;
         return kFALSE;
     }
@@ -263,4 +263,6 @@
         fCaps.maxheight, fCaps.maxwidth, // height, width
         VIDEO_PALETTE_RGB24              // palette
+        //768, 576, 
+        //VIDEO_PALETTE_RGB555             // palette
     };
 
@@ -271,5 +273,5 @@
         return kTRUE;
 
-    if (errno == EAGAIN)
+//    if (errno == EAGAIN)
         gLog << err << "ERROR - Couldn't start capturing frame " << frame << " - unable to sync." << endl;
 
@@ -341,4 +343,6 @@
 
     memcpy(&fChannel, &ch, sizeof(fChannel));
+
+    gLog << all << "Switched to channel " << chan << endl;
 
     return kTRUE;
