Changeset 1275 for trunk/MagicSoft/Cosy/candrv
- Timestamp:
- 04/12/02 16:59:23 (23 years ago)
- Location:
- trunk/MagicSoft/Cosy/candrv
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/candrv/canopen.cc
r1266 r1275 67 67 pthread_mutex_destroy(&fPdoMux[i][j]); 68 68 } 69 lout << "- CanOpen destroyed." << endl; 69 70 } 70 71 -
trunk/MagicSoft/Cosy/candrv/vmodican.cc
r1273 r1275 38 38 #include <errno.h> // errno 39 39 #include <unistd.h> // read 40 #include <pthread.h> // pthread_create41 40 #include <sys/time.h> // gettimeofday 42 41 #include <sys/ioctl.h> // ioctl 43 #include <sys/resource.h> // PRIO_PROCESS44 42 45 43 ClassImp(VmodIcan); … … 110 108 while (1) 111 109 { 110 // 111 // Sleeps until a message arrives 112 // 112 113 unsigned char c; 114 const int n = read(fd, &c, 1); 115 116 if (n<0) 117 { 118 cerr << "Vmodican: read(" << dec << (int)fd << "," << (void*)&c; 119 cerr << ",1) returned c=" << (int)c << " '" << strerror(errno); 120 cerr << "' (errno = " << errno << ")" << endl; 121 continue; 122 //return (void *)1; 123 } 124 125 // 126 // read the time for the message as soon as possible 127 // 113 128 timeval_t tv; 114 115 //116 // Sleeps until a message arrives117 //118 const int n = read(fd, &c, 1);119 120 //121 // read the time for the message as soon as possible122 //123 129 gettimeofday(&tv, NULL); 124 130 … … 128 134 if (n == 0) 129 135 { 130 cerr << "panic read (errno=" << errno << ") ..." << endl; 136 cerr << "Vmodican: Panic read '" << strerror(errno) << "' "; 137 cerr << "(errno=" << errno << ")" << endl; 131 138 return (void *)1; 132 139 } … … 155 162 156 163 cout << endl; 157 break;164 continue; 158 165 159 166 // … … 171 178 172 179 HandleMessage(&msg, &tv); 173 174 break; 180 continue; 175 181 } 182 183 cout << "Vmodican: read, Message c=" << (int)c << " unknown." << endl; 176 184 } 177 185 return NULL; … … 495 503 void VmodIcan::DisableCanBusConnection() 496 504 { 497 lout << "- Disconnect from Bus!" << endl;505 lout << "- Disconnect VmodIcan module from Bus!" << endl; 498 506 499 507 Message msg; /* buffer for module messages */ … … 503 511 504 512 while (!Send(&msg)); 513 514 lout << "- VmodIcan disconnected." << endl; 505 515 } 506 516 … … 529 539 void VmodIcan::Close() 530 540 { 531 lout << "- Clos e Device!"<< endl;541 lout << "- Closing device VmodIcan #" << (int)fd << endl; 532 542 533 543 Message msg; /* disconnect message */ … … 539 549 540 550 close(fd); 551 552 lout << "- Device closed." << endl; 541 553 } 542 554 … … 950 962 VmodIcan::~VmodIcan() 951 963 { 964 lout << "- Stopping VmodIcan module." << endl; 952 965 Stop(); 953 966 DisableCanBusConnection(); 954 967 Close(); 968 lout << "- VmodIcan stopped." << endl; 955 969 } 956 970
Note:
See TracChangeset
for help on using the changeset viewer.