Changeset 8835 for trunk/MagicSoft/Cosy/candrv/network.cc
- Timestamp:
- 01/24/08 16:38:40 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/candrv/network.cc
r8813 r8835 32 32 #include "network.h" 33 33 34 #include <iostream> // cout35 #include <iomanip> // setw, setfill34 #include "MLog.h" 35 #include "MLogManip.h" 36 36 37 37 ClassImp(Network); … … 46 46 void Network::Start() 47 47 { 48 gLog << "- Starting network." << endl;48 gLog << inf << "- Starting network." << endl; 49 49 50 50 CanOpen::Start(); 51 51 InitNodes(); 52 52 53 gLog << "- Network started." << endl;53 gLog << inf << "- Network started." << endl; 54 54 } 55 55 … … 60 60 void Network::Stop() 61 61 { 62 gLog << "- Stopping network." << endl;62 gLog << inf << "- Stopping network." << endl; 63 63 64 64 StopNodes(); 65 65 CanOpen::Stop(); 66 66 67 gLog << "- Network stopped." << endl;67 gLog << inf << "- Network stopped." << endl; 68 68 } 69 69 … … 77 77 memset(fNodeInitialized, 0, 32*sizeof(*fNodeInitialized)); 78 78 79 gLog << "- Network initialized." << endl;79 gLog << inf << "- Network initialized." << endl; 80 80 } 81 81 … … 115 115 } 116 116 117 cout<< dec << setfill('0');118 cout<< "Network::HandleSDO: Node=" << (int)node << " Cmd=0x" << hex << (int)cmd << ": ";119 cout<< "Sdo=" << idx << "/" << (int)subidx << ": 0x" << setw(8) << data;120 cout<< endl;117 gLog << warn << dec << setfill('0'); 118 gLog << "Network::HandleSDO: Node=" << (int)node << " Cmd=0x" << hex << (int)cmd << ": "; 119 gLog << "Sdo=" << idx << "/" << (int)subidx << ": 0x" << setw(8) << data; 120 gLog << endl; 121 121 } 122 122 … … 129 129 if (!fNodes[node]) 130 130 { 131 cout << "Network::HandlePDO1: Node #" << dec << (int)node << " not found - PDO1: " << hex;131 gLog << err << "ERROR - Network::HandlePDO1: Node #" << dec << (int)node << " not found - PDO1: " << hex; 132 132 for (int i=0; i<8; i++) 133 cout<< " 0x" << (int)data[i];134 cout<< endl;133 gLog << " 0x" << (int)data[i]; 134 gLog << endl; 135 135 return; 136 136 } … … 147 147 if (!fNodes[node]) 148 148 { 149 cout << "Network::HandlePDO2: Node #" << dec << (int)node << " not found - PDO2: " << hex;149 gLog << err << "ERROR - Network::HandlePDO2: Node #" << dec << (int)node << " not found - PDO2: " << hex; 150 150 for (int i=0; i<8; i++) 151 cout<< " 0x" << (int)data[i];152 cout<< endl;151 gLog << " 0x" << (int)data[i]; 152 gLog << endl; 153 153 return; 154 154 } … … 165 165 if (!fNodes[node]) 166 166 { 167 cout << "Network::HandlePDO3: Node #" << dec << (int)node << " not found - PDO3: " << hex;167 gLog << err << "ERROR - Network::HandlePDO3: Node #" << dec << (int)node << " not found - PDO3: " << hex; 168 168 for (int i=0; i<8; i++) 169 cout<< " 0x" << (int)data[i];170 cout<< endl;169 gLog << " 0x" << (int)data[i]; 170 gLog << endl; 171 171 return; 172 172 } … … 183 183 if (!fNodes[node]) 184 184 { 185 cout << "Network::HandlePDO4: Node #" << dec << (int)node << " not found - PDO4: " << hex;185 gLog << err << "ERROR - Network::HandlePDO4: Node #" << dec << (int)node << " not found - PDO4: " << hex; 186 186 for (int i=0; i<8; i++) 187 cout<< " 0x" << (int)data[i];188 cout<< endl;187 gLog << " 0x" << (int)data[i]; 188 gLog << endl; 189 189 return; 190 190 } … … 202 202 if (!fNodes[node]) 203 203 { 204 cout << "Network::HandleNodeguard: Node #" << dec << (int)node << " not found: Nodeguard." << endl;204 gLog << err << "ERROR - Network::HandleNodeguard: Node #" << dec << (int)node << " not found: Nodeguard." << endl; 205 205 return; 206 206 } … … 218 218 if (!fNodes[node]) 219 219 { 220 cout << "Network::HandleEmergency: Node #" << dec << (int)node << " not found: Emergency." << endl;220 gLog << err << "ERROR - Network::HandleEmergency: Node #" << dec << (int)node << " not found: Emergency." << endl; 221 221 return; 222 222 } … … 236 236 if (nodeid>31) 237 237 { 238 cout << "SetNode - Error: Only node Numbers < 32 are allowed"<< endl;238 gLog << err << "ERROR - Network::SetNode: Only node Numbers < 32 are allowed"<< endl; 239 239 return; 240 240 } … … 252 252 if (fNodes[i]) 253 253 { 254 gLog << "- Setting up Node #" << dec << i << " (";254 gLog << inf2 << "- Setting up Node #" << dec << i << " ("; 255 255 gLog << fNodes[i]->GetNodeName() << ")" << endl; 256 256 if (fNodes[i]->InitDevice(this)) 257 257 fNodeInitialized[i] = TRUE; 258 258 else 259 gLog << "- " << fNodes[i]->GetNodeName() << ": InitDevice failed." << endl;259 gLog << err << "- " << fNodes[i]->GetNodeName() << ": InitDevice failed." << endl; 260 260 } 261 gLog << "- All Nodes setup." << endl;261 gLog << inf << "- All Nodes setup." << endl; 262 262 } 263 263 … … 271 271 if (fNodes[i] && fNodeInitialized[i]) 272 272 { 273 gLog << "- Stopping Node #" << dec << i;273 gLog << inf2 << "- Stopping Node #" << dec << i; 274 274 gLog << " (" << fNodes[i]->GetNodeName() << ")" << endl; 275 275 fNodes[i]->StopDevice(); 276 276 } 277 gLog << "- All Nodes stopped." << endl;277 gLog << inf << "- All Nodes stopped." << endl; 278 278 } 279 279 … … 292 292 continue; 293 293 294 gLog << "- Node #" << dec << i << " '" << fNodes[i]->GetNodeName() << "' ";294 gLog << err << "- Node #" << dec << i << " '" << fNodes[i]->GetNodeName() << "' "; 295 295 296 296 if (fNodes[i]->GetError() <= 0) … … 362 362 } 363 363 364 if (rc)365 gLog<< "- All Zombies rebooted." << endl;364 // if (rc) 365 // gLog << inf << "- All Zombies rebooted." << endl; 366 366 367 367 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.