Changeset 94 in pacpussensors for trunk/CanGateway/Win32CanInterface.cpp


Ignore:
Timestamp:
Sep 28, 2015, 10:49:02 PM (9 years ago)
Author:
DHERBOMEZ Gérald
Message:

kvaser CAN driver testing on Linux. Works fine.
TODO: test back the code on Windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CanGateway/Win32CanInterface.cpp

    r89 r94  
    1414#include "Win32CanInterface.h"
    1515
    16 #include "Pacpus/PacpusTools/ShMem.h"
     16// #include "Pacpus/PacpusTools/ShMem.h" // runtime crash because PosixShMem
    1717
    1818namespace pacpus {
     
    104104    vectorLoop();
    105105    break;
    106   case SharedMemory:
    107     shMemLoop();
    108     break;
     106  // case SharedMemory:  // runtime crash because PosixShMem
     107  //   shMemLoop();
     108  //   break;
    109109  case PeakCard:
    110110    peakLoop();
     
    181181/* The loop used for waiting CAN data from a shared memory
    182182/************************************************************************/
    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 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_)
     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_)
    201201 
    202   delete shMem_;
    203 }
     202//   delete shMem_;
     203// }
    204204
    205205/************************************************************************/
Note: See TracChangeset for help on using the changeset viewer.