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

Last change on this file since 17 was 4, checked in by guyardro, 11 years ago

add igep can driver for CanGateway and add support for igep compilation

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: Windows specific 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#else
22# define CAN_DRIVER_TYPE IGEP_CAN_DRIVER
23#endif
24
25#include <iostream>
26#include <qsemaphore.h>
27#include <qthread.h>
28
29#include "CanDecoderBase.h"
30
31#include "driver/CanDriver.h"
32#include "structureCan.h"
33
34namespace pacpus {
35
36class ShMem;
37
38class Win32CanInterface
39 : public QThread
40{
41public:
42 Win32CanInterface();
43 ~Win32CanInterface();
44
45 enum DataSource {VectorCard, SharedMemory, PeakCard, XLVectorCard, igepCard};
46
47 bool openInterface(const int number, const unsigned int speed);
48 bool openInterface(char* port, char* accessMode);
49 bool closeInterface(const int number);
50 void stop();
51
52 void setSignalSempahore(QSemaphore * semaphore) { semaphore_ = semaphore;};
53 void setExchangeBuffer(TimestampedCanFrame * framesArray, const int framesArraySize);
54 void setSource(DataSource source);
55 CanDriver * canDriver_;
56protected:
57 void run();
58 void vectorLoop();
59 void shMemLoop();
60 void peakLoop();
61 void igepLoop();
62 void vectorXlLoop();
63
64private:
65 CanFrame frame_;
66 bool continue_;
67 DataSource source_;
68
69 QSemaphore *semaphore_;
70 TimestampedCanFrame * receivedFrames_;
71 int receivedFramesArraySize_;
72
73 ShMem * shMem_;
74
75 int counter_;
76};
77
78} // namespace pacpus
79
80#endif // WIN32CANINTERFACE_H
Note: See TracBrowser for help on using the repository browser.