Changeset 91 in pacpussensors for trunk


Ignore:
Timestamp:
07/28/15 16:28:08 (9 years ago)
Author:
DHERBOMEZ Gérald
Message:

Small corrections during tests: CAN reading OK under Windows with Kvaser Leaf Light.

Location:
trunk/CanGateway
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/CanGateway/CanGateway.cpp

    r44 r91  
    9191                        qFatal("Failed to open the CAN interface port %s in %s mode",port_, accessMode_);
    9292        }
     93        else if (source_ == "kvaser")
     94        {
     95                canIf_.setSource(Win32CanInterface::KvaserCard);
     96                // open interface
     97                if (canIf_.openInterface(channel_,speed_)==0)
     98                        qFatal("Failed to open the CAN interface num %d at speed %d",channel_,speed_);
     99        }
    93100        else
    94101        {
     
    112119        canIf_.stop();
    113120
    114         if ((source_ == "vector")||(source_=="peak")||(source_=="vectorXL")||(source_=="igep"))
     121        if ((source_ == "vector")||(source_=="peak")||(source_=="vectorXL")||(source_=="igep")||(source_=="kvaser"))
    115122                canIf_.closeInterface(channel_);
    116123       
     
    151158        }
    152159        setRecording( config.getProperty("recording") == "true" ? true : false );
     160
     161        verbose_ = config.getProperty("verbose") == "true" ? true : false;
    153162
    154163        return ComponentBase::CONFIGURED_OK;
     
    193202                }
    194203
    195         //displayData(incomingCanFrames_[counter_].frame.data, incomingCanFrames_[counter_].frame.dlc, incomingCanFrames_[counter_].frame.id);
     204        if (verbose_) displayData(incomingCanFrames_[counter_].frame.data, incomingCanFrames_[counter_].frame.dlc, incomingCanFrames_[counter_].frame.id);
    196205        if (isRecording())
    197206        {
  • trunk/CanGateway/CanGateway.h

    r44 r91  
    8282  bool THREAD_ALIVE;
    8383
     84  bool verbose_;
     85
    8486};
    8587
  • trunk/CanGateway/cangateway.xml

    r66 r91  
    66                        channel="1"
    77                        speed="500"
    8                         recording="true"/>
     8                        recording="true"
     9                        verbose="true" />
    910                </components>
    1011                        <connections>
  • trunk/CanGateway/driver/KVaserCanDriver.cpp

    r89 r91  
    248248                        memcpy(frame.data, msg, frame.dlc);
    249249                        return 0;
    250                 } else if (stat == canERR_NOMSG ) {
     250                }
     251        }
     252        else if (stat == canERR_NOMSG ) {
    251253                        // timeout occurs
    252254                        LOG_WARN("Kvaser card - receiveFrame() method - TIMEOUT");
    253255                        return 1;
    254                 } else {
     256        }
     257        else {
    255258                        // An error frame.
    256259                        LOG_WARN("Kvaser card, error frame");
    257260                        return 1;
    258                 }
    259         }
    260 
    261         return 0;
     261        }
     262
     263
     264        return 1;
    262265}
    263266
Note: See TracChangeset for help on using the changeset viewer.