Changeset 94 in pacpussensors for trunk/CanGateway/Win32CanInterface.cpp
- Timestamp:
- Sep 28, 2015, 10:49:02 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CanGateway/Win32CanInterface.cpp
r89 r94 14 14 #include "Win32CanInterface.h" 15 15 16 #include "Pacpus/PacpusTools/ShMem.h" 16 // #include "Pacpus/PacpusTools/ShMem.h" // runtime crash because PosixShMem 17 17 18 18 namespace pacpus { … … 104 104 vectorLoop(); 105 105 break; 106 case SharedMemory:107 shMemLoop();108 break;106 // case SharedMemory: // runtime crash because PosixShMem 107 // shMemLoop(); 108 // break; 109 109 case PeakCard: 110 110 peakLoop(); … … 181 181 /* The loop used for waiting CAN data from a shared memory 182 182 /************************************************************************/ 183 void Win32CanInterface::shMemLoop() 184 {185 shMem_ = new ShMem("CARMEN_CAN_2200", sizeof(TimestampedCanFrame));186 while (continue_)187 {188 // Wait incoming data from the shared memory189 if ( shMem_->wait(100) )190 {191 TimestampedCanFrame* ptr = (TimestampedCanFrame*)(shMem_->read());192 memcpy(&frame_, &(ptr->frame), sizeof(CanFrame));193 receivedFrames_[counter_].time = ptr->time;194 receivedFrames_[counter_].timerange = ptr->timerange;195 memcpy(&(receivedFrames_[counter_].frame), &frame_, sizeof(CanFrame) );196 semaphore_->release();197 counter_++;198 counter_ = counter_ % receivedFramesArraySize_;199 }200 } // END while (continue_)183 // void Win32CanInterface::shMemLoop() // runtime crash because PosixShMem 184 // { 185 // shMem_ = new ShMem("CARMEN_CAN_2200", sizeof(TimestampedCanFrame)); 186 // while (continue_) 187 // { 188 // // Wait incoming data from the shared memory 189 // if ( shMem_->wait(100) ) 190 // { 191 // TimestampedCanFrame* ptr = (TimestampedCanFrame*)(shMem_->read()); 192 // memcpy(&frame_, &(ptr->frame), sizeof(CanFrame)); 193 // receivedFrames_[counter_].time = ptr->time; 194 // receivedFrames_[counter_].timerange = ptr->timerange; 195 // memcpy(&(receivedFrames_[counter_].frame), &frame_, sizeof(CanFrame) ); 196 // semaphore_->release(); 197 // counter_++; 198 // counter_ = counter_ % receivedFramesArraySize_; 199 // } 200 // } // END while (continue_) 201 201 202 delete shMem_;203 }202 // delete shMem_; 203 // } 204 204 205 205 /************************************************************************/
Note:
See TracChangeset
for help on using the changeset viewer.