Changeset 8862 for trunk/MagicSoft/Cosy/candrv/ethernet.cc
- Timestamp:
- 02/13/08 19:44:39 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/candrv/ethernet.cc
r8856 r8862 39 39 ClassImp(Ethernet); 40 40 41 #undef DEBUG 42 41 43 using namespace std; 42 44 … … 54 56 // 55 57 Ethernet::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) 57 59 { 58 60 gLog << inf2 << "- Ethernet initialized." << endl; … … 81 83 msg.data[1] = 0; 82 84 85 const TString address = MTcpIpO::GetSocketAddress(rx); 86 83 87 while (!IsThreadCanceled()) 84 88 { … … 100 104 if (len==0) 101 105 { 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!!! 105 108 continue; 106 109 } … … 109 112 if (len>1) 110 113 { 111 cout << "Data too long!!!" << endl;114 gLog << err << "Data received from " << address << " is more than one byte!" << endl; 112 115 break; 113 116 } … … 117 120 if (c>=MSGLEN) 118 121 { 119 cout << " Received datatoo long (> " << MSGLEN << ")" << endl;122 cout << "Data received from " << address << " too long (> " << MSGLEN << ")" << endl; 120 123 break; 121 124 } … … 133 136 continue; 134 137 138 #ifdef DEBUG 135 139 cout << "*** RcvdCanFrame len=" << dec << msg.len << ": "; 136 140 for (int i=0; i<msg.len; i++) 137 141 cout << "0x" << setfill('0') << setw(2) << hex << (int)((msg.data+2)[i]) << " "; 138 cout << endl; 142 cout << dec << endl; 143 #endif 139 144 140 145 pos = -1; … … 192 197 */ 193 198 199 #ifdef DEBUG 194 200 // FIXME: MUST BECOME NON-BLOCKING!!!!! 195 cout << "*** Send CanFrame over IP " << endl;201 cout << "*** Send CanFrame over IP " << endl; 196 202 // FIXME: MUST BECOME NON-BLOCKING!!!!! 203 #endif 197 204 198 205 MTcpIpO::SendFrame(fTxAddress, fTxPort, (char*)(msg.data+1), msg.len-1); 206 //Send((char*)(msg.data+1), msg.len-1); 199 207 200 208 /*
Note:
See TracChangeset
for help on using the changeset viewer.