Index: trunk/MagicSoft/Cosy/candrv/canopen.cc
===================================================================
--- trunk/MagicSoft/Cosy/candrv/canopen.cc	(revision 1137)
+++ trunk/MagicSoft/Cosy/candrv/canopen.cc	(revision 1138)
@@ -1,2 +1,33 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of Stesy, the MAGIC Steering System
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 2001 <mailto:tbretz@uni-sw.gwdg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2001
+!
+!
+\* ======================================================================== */
+
+///////////////////////////////////////////////////////////////////////
+//
+// CanOpen
+//
+// implements the canopen layer over the raw device driver
+//
+///////////////////////////////////////////////////////////////////////
 #include "canopen.h"
 
@@ -6,4 +37,9 @@
 ClassImp(CanOpen);
 
+// --------------------------------------------------------------------------
+//
+// Initializes a conditional and a mutex semaphore for all possible
+// PDO combinations
+//
 CanOpen::CanOpen(const char *dev, const int baud, MLog &out) : VmodIcan(dev, baud, out)
 {
@@ -17,4 +53,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Destroys all conditional and mutex semaphores
+//
 CanOpen::~CanOpen()
 {
@@ -27,4 +67,15 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// This overloads VmodIcan::HandleCanMessage. It is called if a can
+// message was received with all message relevant data (COBId, data, time)
+// It distributes the data depending on its function code to several
+// functions (to be obverloaded)
+// In case of a PDO the conditional semaphore corresponding to this PDO
+// is raised (WaitForNextPDO)
+//  HandleSDO:       handles a SDO message
+//  HandlePDO1/2/3/4:handles received PDOs
+//
 void CanOpen::HandleCanMessage(WORD_t cobid, BYTE_t *data, struct timeval *tv)
 {
@@ -95,4 +146,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Enables can messaged for a given node ID and function code.
+//
 void CanOpen::EnableCanMsg(BYTE_t node, BYTE_t fcode, int flag)
 {
@@ -103,4 +158,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Enables Emergency messages for a given node
+//
 void CanOpen::EnableEmcy(BYTE_t node)
 {
@@ -109,4 +168,8 @@
 
 
+// --------------------------------------------------------------------------
+//
+// Enables SDO rx messages for a given node
+//
 void CanOpen::EnableSdoRx(BYTE_t node)
 {
@@ -114,4 +177,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Enables PDO1 tx messages for a given node
+//
 void CanOpen::EnablePdo1Rx(BYTE_t node)
 {
@@ -119,4 +186,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Enables PDO2 tx messages for a given node
+//
 void CanOpen::EnablePdo2Rx(BYTE_t node)
 {
@@ -124,4 +195,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Enables PDO3 rx messages for a given node
+//
 void CanOpen::EnablePdo3Rx(BYTE_t node)
 {
@@ -129,4 +204,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Enables PDO4 rx messages for a given node
+//
 void CanOpen::EnablePdo4Rx(BYTE_t node)
 {
@@ -134,4 +213,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Sends a PDO1 message with the given data to the given node
+//
 void CanOpen::SendPDO1(BYTE_t node, BYTE_t data[8])
 {
@@ -139,4 +222,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Sends a PDO2 message with the given data to the given node
+//
 void CanOpen::SendPDO2(BYTE_t node, BYTE_t data[8])
 {
@@ -144,4 +231,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Sends a PDO3 message with the given data to the given node
+//
 void CanOpen::SendPDO3(BYTE_t node, BYTE_t data[8])
 {
@@ -149,4 +240,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Sends a PDO4 message with the given data to the given node
+//
 void CanOpen::SendPDO4(BYTE_t node, BYTE_t data[8])
 {
@@ -154,4 +249,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Sends a PDO1 message with the given data to the given node
+//
 void CanOpen::SendPDO1(BYTE_t node,
               BYTE_t m0=0, BYTE_t m1=0, BYTE_t m2=0, BYTE_t m3=0,
@@ -162,4 +261,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Sends a PDO2 message with the given data to the given node
+//
 void CanOpen::SendPDO2(BYTE_t node,
               BYTE_t m0=0, BYTE_t m1=0, BYTE_t m2=0, BYTE_t m3=0,
@@ -170,4 +273,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Sends a PDO3 message with the given data to the given node
+//
 void CanOpen::SendPDO3(BYTE_t node,
               BYTE_t m0=0, BYTE_t m1=0, BYTE_t m2=0, BYTE_t m3=0,
@@ -178,4 +285,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Sends a PDO4 message with the given data to the given node
+//
 void CanOpen::SendPDO4(BYTE_t node,
               BYTE_t m0=0, BYTE_t m1=0, BYTE_t m2=0, BYTE_t m3=0,
@@ -186,4 +297,13 @@
 }
   
+// --------------------------------------------------------------------------
+//
+// Sends a SDO message with the given data to the given node:
+//  - index describing the dictionary index to set
+//  - subindex describing the dictionary subindex of theindex to set
+//  - val describing the value to set.
+//  - store describes whether the sdo should be stored in a list to
+//    be able to wait for an answer
+//
 void CanOpen::SendSDO(BYTE_t node, WORD_t idx, BYTE_t subidx, BYTE_t val, bool store)
 {
@@ -195,4 +315,13 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Sends a SDO message with the given data to the given node:
+//  - index describing the dictionary index to set
+//  - subindex describing the dictionary subindex of theindex to set
+//  - val describing the value to set.
+//  - store describes whether the sdo should be stored in a list to
+//    be able to wait for an answer
+//
 void CanOpen::SendSDO(BYTE_t node, WORD_t idx, BYTE_t subidx, WORD_t val, bool store)
 {
@@ -205,4 +334,13 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Sends a SDO message with the given data to the given node:
+//  - index describing the dictionary index to set
+//  - subindex describing the dictionary subindex of theindex to set
+//  - val describing the value to set.
+//  - store describes whether the sdo should be stored in a list to
+//    be able to wait for an answer
+//
 void CanOpen::SendSDO(BYTE_t node, WORD_t idx, BYTE_t subidx, LWORD_t val, bool store)
 {
@@ -216,4 +354,10 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Request a SDO message from the given node:
+//  - index describing the dictionary index to request
+//  - subindex describing the dictionary subindex of the index to request
+//
 void CanOpen::RequestSDO(BYTE_t node, WORD_t idx, BYTE_t subidx)
 {
@@ -223,4 +367,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Send an NMT Message to the given node with command cmd
+//
 void CanOpen::SendNMT(BYTE_t node, BYTE_t cmd)
 {
@@ -228,4 +376,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Decodes node and function code into a CobId
+//
 WORD_t CanOpen::CobId(BYTE_t node, BYTE_t fcode) const
 {
Index: trunk/MagicSoft/Cosy/candrv/network.cc
===================================================================
--- trunk/MagicSoft/Cosy/candrv/network.cc	(revision 1137)
+++ trunk/MagicSoft/Cosy/candrv/network.cc	(revision 1138)
@@ -1,2 +1,33 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of Stesy, the MAGIC Steering System
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 2001 <mailto:tbretz@uni-sw.gwdg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2001
+!
+!
+\* ======================================================================== */
+
+///////////////////////////////////////////////////////////////////////
+//
+// Network
+//
+// is a collection of nodes which coordinates the network
+//
+///////////////////////////////////////////////////////////////////////
 #include "network.h"
 
@@ -6,4 +37,9 @@
 ClassImp(Network);
 
+// --------------------------------------------------------------------------
+//
+// Start the canopen module
+// Initialize all nodes (calling NodeDrv::Init()
+//
 void Network::Start()
 {
@@ -16,4 +52,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Stop all nodes, stop the can module
+//
 void Network::Stop()
 {
@@ -26,4 +66,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Initialize the network, set all nodes to NULL (n/a)
+//
 Network::Network(const char *dev, const int baud, MLog &out) : CanOpen(dev, baud, out)
 {
@@ -32,4 +76,13 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Distributes the received SDO messages to the addressed nodes.
+// Depending on the received command either HandleSDO, HandleSDOOK or
+// HandleSDOError called.
+//  HandleSDO:      Handles a received value
+//  HandleSDOOK:    Handles the acknoledgment of a trasmitted SDO
+//  HandleSDOError: Handles error occursion (see CanOpen standard)
+//
 void Network::HandleSDO(BYTE_t node, BYTE_t cmd, WORD_t idx, BYTE_t subidx, LWORD_t data, struct timeval *tv)
 {
@@ -82,4 +135,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Distributes PDO1 messages to the correspoding node calling HandlePDO1
+//
 void Network::HandlePDO1(BYTE_t node, BYTE_t *data, struct timeval *tv)
 {
@@ -96,4 +153,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Distributes PDO2 messages to the correspoding node calling HandlePDO2
+//
 void Network::HandlePDO2(BYTE_t node, BYTE_t *data, struct timeval *tv)
 {
@@ -110,4 +171,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Distributes PDO3 messages to the correspoding node calling HandlePDO3
+//
 void Network::HandlePDO3(BYTE_t node, BYTE_t *data, struct timeval *tv)
 {
@@ -124,4 +189,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Distributes PDO4 messages to the correspoding node calling HandlePDO4
+//
 void Network::HandlePDO4(BYTE_t node, BYTE_t *data, struct timeval *tv)
 {
@@ -138,4 +207,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Sets a node to a given nodedrv. The id is requested from the drv object.
+//
 void Network::SetNode(NodeDrv *drv)
 {
@@ -151,4 +224,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Initializes all nodes calling InitDevice
+//
 void Network::InitNodes()
 {
@@ -163,4 +240,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Stop all nodes calling StopDevice
+//
 void Network::StopNodes()
 {
@@ -174,4 +255,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// returns true if one of the nodes has the error-flag set (HasError).
+//
 bool Network::HasError() const
 {
Index: trunk/MagicSoft/Cosy/candrv/nodedrv.cc
===================================================================
--- trunk/MagicSoft/Cosy/candrv/nodedrv.cc	(revision 1137)
+++ trunk/MagicSoft/Cosy/candrv/nodedrv.cc	(revision 1138)
@@ -140,5 +140,4 @@
 // Sends the given PDO1 through the network to this device
 // A PDO is carrying up to eight bytes of information.
-// PDO messages are broadcasts.
 //
 void NodeDrv::SendPDO1(BYTE_t data[8])
@@ -151,5 +150,4 @@
 // Sends the given PDO2 through the network to this device
 // A PDO is carrying up to eight bytes of information.
-// PDO messages are broadcasts.
 //
 void NodeDrv::SendPDO2(BYTE_t data[8])
@@ -162,5 +160,4 @@
 // Sends the given PDO1 through the network to this device
 // A PDO is carrying up to eight bytes of information.
-// PDO messages are broadcasts.
 //
 void NodeDrv::SendPDO1(BYTE_t m0=0, BYTE_t m1=0, BYTE_t m2=0, BYTE_t m3=0,
@@ -174,5 +171,4 @@
 // Sends the given PDO2 through the network to this device
 // A PDO is carrying up to eight bytes of information.
-// PDO messages are broadcasts.
 //
 void NodeDrv::SendPDO2(BYTE_t m0=0, BYTE_t m1=0, BYTE_t m2=0, BYTE_t m3=0,
Index: trunk/MagicSoft/Cosy/candrv/nodedrv.h
===================================================================
--- trunk/MagicSoft/Cosy/candrv/nodedrv.h	(revision 1137)
+++ trunk/MagicSoft/Cosy/candrv/nodedrv.h	(revision 1138)
@@ -23,5 +23,5 @@
     BYTE_t   fId;
 
-    char *fName;
+    TString fName;
 
     int fError;
