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

Last change on this file since 70 was 63, checked in by DHERBOMEZ Gérald, 10 years ago

Small bug corrections in headers of cangateway

File size: 1.9 KB
RevLine 
[1]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//
[59]10// purpose: Management of the Can Interface
[1]11//
12*********************************************************************/
13
14#ifndef WIN32CANINTERFACE_H
15#define WIN32CANINTERFACE_H
16
17// we use the Vector driver
18#ifdef WIN32
[63]19# define CAN_DRIVER_TYPE VECTOR_CAN_DRIVER
20//# define CAN_DRIVER_TYPE VECTOR_CANXL_DRIVER
[59]21//# define CAN_DRIVER_TYPE PEAK_CAN_DRIVER_WIN
[1]22#else
[4]23# define CAN_DRIVER_TYPE IGEP_CAN_DRIVER
[1]24#endif
25
26#include <iostream>
27#include <qsemaphore.h>
28#include <qthread.h>
29
[2]30#include "CanDecoderBase.h"
[1]31
[2]32#include "driver/CanDriver.h"
[4]33#include "structureCan.h"
[2]34
[1]35namespace pacpus {
36
37class ShMem;
38
39class Win32CanInterface
40 : public QThread
41{
42public:
43 Win32CanInterface();
44 ~Win32CanInterface();
45
[4]46 enum DataSource {VectorCard, SharedMemory, PeakCard, XLVectorCard, igepCard};
[1]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();
[4]62 void igepLoop();
[1]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.