Ignore:
Timestamp:
02/13/08 19:44:39 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r8856 r8862  
    3939ClassImp(Ethernet);
    4040
     41#undef DEBUG
     42
    4143using namespace std;
    4244
     
    5456//
    5557Ethernet::Ethernet(const char *addr, const int tx, const int rx, CanOpen *receiver)
    56     : MTcpIpI(rx), Interface(receiver), fTxAddress(addr), fTxPort(tx)
     58    : MTcpIpI(rx),/* MTcpIpO(addr, tx),*/ Interface(receiver), fTxAddress(addr), fTxPort(tx)
    5759{
    5860    gLog << inf2 << "- Ethernet initialized." << endl;
     
    8183    msg.data[1] = 0;
    8284
     85    const TString address = MTcpIpO::GetSocketAddress(rx);
     86
    8387    while (!IsThreadCanceled())
    8488    {
     
    100104        if (len==0)
    101105        {
    102             // THIS MEANS CONNECTIION LOST!!!!
    103             cout << "============> LEN==0 (CONNECTION LOST?)" << endl;
    104             break; // This break is for TEST PURPOSE FIXME!!!
     106            gLog << warn << "WARNING - Connection lost (received 0bytes) to " << address << endl;
     107            //break; // This break is for TEST PURPOSE FIXME!!!
    105108            continue;
    106109        }
     
    109112        if (len>1)
    110113        {
    111             cout << "Data too long!!!" << endl;
     114            gLog << err << "Data received from " << address << " is more than one byte!" << endl;
    112115            break;
    113116        }
     
    117120            if (c>=MSGLEN)
    118121            {
    119                 cout << "Received data too long (> " << MSGLEN << ")" << endl;
     122                cout << "Data received from " << address << " too long (> " << MSGLEN << ")" << endl;
    120123                break;
    121124            }
     
    133136            continue;
    134137
     138#ifdef DEBUG
    135139        cout << "*** RcvdCanFrame len=" << dec << msg.len << ": ";
    136140        for (int i=0; i<msg.len; i++)
    137141            cout << "0x" << setfill('0') << setw(2) << hex << (int)((msg.data+2)[i]) << " ";
    138         cout << endl;
     142        cout << dec << endl;
     143#endif
    139144
    140145        pos = -1;
     
    192197    */
    193198
     199#ifdef DEBUG
    194200    // FIXME: MUST BECOME NON-BLOCKING!!!!!
    195     cout << "*** Send CanFrame over IP" << endl;
     201    cout << "*** Send CanFrame over IP " << endl;
    196202    // FIXME: MUST BECOME NON-BLOCKING!!!!!
     203#endif
    197204
    198205    MTcpIpO::SendFrame(fTxAddress, fTxPort, (char*)(msg.data+1), msg.len-1);
     206    //Send((char*)(msg.data+1), msg.len-1);
    199207
    200208    /*
Note: See TracChangeset for help on using the changeset viewer.