source: pacpussensors/trunk/CanGateway/driver/PeakCanDriverWin.h@ 134

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

Integration of new modules:

  • GPS NMEA0183 decoder
  • Span CPT Decoder

Update of:

File size: 1.5 KB
Line 
1/********************************************************************
2// created: 2011/02/21 - 10:39
3// filename: PeakCanDriverWin.h
4//
5// author: Danilo Alves de Lima
6//
7// version: $Id: PeakCanDriverWin.h dalvesde $
8//
9// purpose: Inherits from the CanDriver class
10// Reimplement all the virtual members of the CanDriverBase
11// class in order to be used with the Peak driver.
12// platform : Windows specific
13//
14*********************************************************************/
15
16#ifndef PEAKCANDRIVERWIN_H
17#define PEAKCANDRIVERWIN_H
18
19#include <windows.h>
20
21#include "CanDriverBase.h"
22#include "PCANBasic.h"
23#include <fcntl.h> // O_RDWR
24#include <errno.h>
25#include <string>
26
27#define PSUCCESS 0
28#define READ_TIMEOUT 100000// 100 miliseconds timeout
29
30class PeakCanDriverWin : public CanDriverBase
31{
32public:
33 PeakCanDriverWin(void);
34 PeakCanDriverWin(int);
35 PeakCanDriverWin(const char* port, const char* mode);
36 PeakCanDriverWin(int channel, unsigned int bitRate);
37 ~PeakCanDriverWin(void);
38
39 short initPort (void);
40 short cleanUpPort (void);
41
42 short sendFrame (struct CanFrame frame);
43 short receiveFrame (struct CanFrame &frame);
44 void waitReceivingFrame(void);
45
46 enum OperationMode{ReadOnly, WriteOnly, ReadWrite};
47
48protected:
49
50private:
51 char * szDevNode_;
52 OperationMode mode_;
53
54 TPCANHandle canDeviceHandle_;
55 TPCANBaudrate canBaudrate_;
56
57 void print_message(TPCANMsg *m);
58
59};
60
61#endif // PEAKCANDRIVERWIN_H
Note: See TracBrowser for help on using the repository browser.