source: pacpussensors/trunk/CanGateway/Win32CanInterface.h@ 81

Last change on this file since 81 was 74, checked in by DHERBOMEZ Gérald, 10 years ago
  • Modification of Sick LMS sensor to get the RSSI signal (reflectivity of the laser)
  • Minor changes in data replay component of Sick LDMRS
  • CanGateway: Choose by default of Vector CAN XL card
File size: 1.9 KB
Line 
1/*********************************************************************
2// created: 2008/2/11 - 12:01
3// filename: Win32CanInterface.h
4//
5// author: Gerald Dherbomez
6// Copyright Heudiasyc UMR UTC/CNRS 6599
7//
8// version: $Id: $
9//
10// purpose: Management of the Can Interface
11//
12*********************************************************************/
13
14#ifndef WIN32CANINTERFACE_H
15#define WIN32CANINTERFACE_H
16
17// we use the Vector driver
18#ifdef WIN32
19//# define CAN_DRIVER_TYPE VECTOR_CAN_DRIVER
20# define CAN_DRIVER_TYPE VECTOR_CANXL_DRIVER
21//# define CAN_DRIVER_TYPE PEAK_CAN_DRIVER_WIN
22#else
23# define CAN_DRIVER_TYPE IGEP_CAN_DRIVER
24#endif
25
26#include <iostream>
27#include <qsemaphore.h>
28#include <qthread.h>
29
30#include "CanDecoderBase.h"
31
32#include "driver/CanDriver.h"
33#include "structureCan.h"
34
35namespace pacpus {
36
37class ShMem;
38
39class Win32CanInterface
40 : public QThread
41{
42public:
43 Win32CanInterface();
44 ~Win32CanInterface();
45
46 enum DataSource {VectorCard, SharedMemory, PeakCard, XLVectorCard, igepCard};
47
48 bool openInterface(const int number, const unsigned int speed);
49 bool openInterface(char* port, char* accessMode);
50 bool closeInterface(const int number);
51 void stop();
52
53 void setSignalSempahore(QSemaphore * semaphore) { semaphore_ = semaphore;};
54 void setExchangeBuffer(TimestampedCanFrame * framesArray, const int framesArraySize);
55 void setSource(DataSource source);
56 CanDriver * canDriver_;
57protected:
58 void run();
59 void vectorLoop();
60 void shMemLoop();
61 void peakLoop();
62 void igepLoop();
63 void vectorXlLoop();
64
65private:
66 CanFrame frame_;
67 bool continue_;
68 DataSource source_;
69
70 QSemaphore *semaphore_;
71 TimestampedCanFrame * receivedFrames_;
72 int receivedFramesArraySize_;
73
74 ShMem * shMem_;
75
76 int counter_;
77};
78
79} // namespace pacpus
80
81#endif // WIN32CANINTERFACE_H
Note: See TracBrowser for help on using the repository browser.