Ignore:
Timestamp:
01/24/08 16:38:40 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/candrv/nodedrv.cc

    r8823 r8835  
    5252#include "MTime.h"
    5353#include "network.h"
     54
    5455#include "MLogManip.h"
    5556
     
    6566// and the node name. The name is a name for debug output.
    6667//
    67 NodeDrv::NodeDrv(BYTE_t nodeid, const char *name, MLog &out) : Log(out), fNetwork(NULL), fId(32), fError(0), fIsZombie(kTRUE), fGuard(NULL)
     68NodeDrv::NodeDrv(BYTE_t nodeid, const char *name) : fNetwork(NULL), fId(32), fError(0), fIsZombie(kTRUE), fGuard(NULL)
    6869{
    6970    if (nodeid>0x1f)
    7071    {
    71         cout << "SetNode - Error: Only node Numbers < 32 are allowed"<< endl;
     72        gLog << err << "ERROR - NodeDrv::NodeDrv: Only node Numbers < 32 are allowed"<< endl;
    7273        return;
    7374    }
     
    8384    }
    8485
    85     lout << "- Node #" << (int)nodeid << " (" << name << ") initialized." << endl;
     86    gLog << inf2 << "- Node #" << (int)nodeid << " (" << name << ") initialized." << endl;
    8687
    8788}
     
    149150void NodeDrv::HandleSDOOK(WORD_t idx, BYTE_t subidx, LWORD_t data, const timeval_t &tv)
    150151{
    151     const Bool_t gui = lout.IsOutputDeviceEnabled(MLog::eGui);
     152    const Bool_t gui = gLog.IsOutputDeviceEnabled(MLog::eGui);
    152153
    153154    if (gui)
    154         lout << ddev(MLog::eGui);
    155 
    156     lout << hex << setfill('0');
    157     lout << "Node #" << dec << (int)fId << ": Sdo=" << hex << idx  << "/" << (int)subidx << " set.";
    158     lout << endl;
     155        gLog << ddev(MLog::eGui);
     156
     157    gLog << warn << setfill('0') << "WARNING - Nodedrv::HandleSDOOK: ";
     158    gLog << "Node #" << dec << (int)fId << ": Sdo=" << hex << idx  << "/" << (int)subidx << " set.";
     159    gLog << endl;
    159160
    160161    if (gui)
    161         lout << edev(MLog::eGui);
     162        gLog << edev(MLog::eGui);
    162163}
    163164
     
    168169void NodeDrv::HandleSDOError(LWORD_t data)
    169170{
    170     lout << "Nodedrv: SDO Error: Entry not found in dictionary (data=0x";
    171     lout << hex << setfill('0') << setw(4) << data << ")";
    172     lout << endl;
     171    gLog << warn << "WARNING - Nodedrv::HandleSDOError: Entry not found in dictionary (data=0x";
     172    gLog << hex << setfill('0') << setw(4) << data << ")";
     173    gLog << endl;
    173174}
    174175
     
    179180void NodeDrv::HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, const timeval_t &tv)
    180181{
    181     cout << "SdoRx: Idx=0x"<< hex << idx << "/" << (int)subidx;
    182     cout << ", val=0x" << val << endl;
     182    gLog << warn << "WARNING - Nodedrv::HandleSDO: Idx=0x"<< hex << idx << "/" << (int)subidx;
     183    gLog << ", val=0x" << val << endl;
    183184}
    184185
     
    426427        return true;
    427428
    428     lout << " + " << GetNodeName() << ": NodeDrv::WaitForSdo: 0x" << hex << idx << "/" << dec << (int)subidx << " --> ZOMBIE! " << MTime(-1) << endl;
     429    gLog << inf2 << " + " << GetNodeName() << ": NodeDrv::WaitForSdo: 0x" << hex << idx << "/" << dec << (int)subidx << " --> ZOMBIE! " << MTime(-1) << endl;
    429430    if (zombie)
    430431        SetZombie();
     
    555556    fGuard->RunThread();
    556557
    557     lout << "- " << GetNodeName() << ": Guarding (" << dec;
    558     lout << fLifeTimeFactor << "*" << fGuardTime << "ms) started." << endl;
     558    gLog << inf << "- " << GetNodeName() << ": Guarding (" << dec;
     559    gLog << fLifeTimeFactor << "*" << fGuardTime << "ms) started." << endl;
    559560}
    560561
     
    563564    if (fGuard)
    564565    {
    565         lout << "- " << GetNodeName() << ": ERROR - Guarding already started." << endl;
     566        gLog << err << "- " << GetNodeName() << ": ERROR - Guarding already started." << endl;
    566567        return;
    567568    }
     
    581582    fGuard=NULL;
    582583
    583     lout << "- " << GetNodeName() << ": Guarding stopped." << endl;
     584    gLog << inf << "- " << GetNodeName() << ": Guarding stopped." << endl;
    584585}
    585586
     
    601602        StopGuarding();
    602603    else
    603         lout << " - " << GetNodeName() << ": Zombie set due to timeout." << endl;
    604 }
     604        gLog << warn << " - " << GetNodeName() << ": Zombie set due to timeout." << endl;
     605}
Note: See TracChangeset for help on using the changeset viewer.