1 | /********************************************************************
|
---|
2 | // created: 2006/08/07 - 14:12
|
---|
3 | // filename: CanDriverBase.h
|
---|
4 | //
|
---|
5 | // author: Gerald Dherbomez
|
---|
6 | //
|
---|
7 | // version: $Id: CanDriverBase.h 1069 2012-03-07 15:57:30Z kurdejma $
|
---|
8 | //
|
---|
9 | // purpose: This is an abstract class that manages the CAN card.
|
---|
10 | // Use UPF frames to communicate with it.
|
---|
11 | // Contains basic decoding functions for CAN data.
|
---|
12 | //
|
---|
13 | *********************************************************************/
|
---|
14 |
|
---|
15 |
|
---|
16 | #ifndef _CANDRIVERBASE_H_
|
---|
17 | #define _CANDRIVERBASE_H_
|
---|
18 |
|
---|
19 | #include "kernel/road_time.h"
|
---|
20 | #include "PacpusTools/BinaryDecoder.h"
|
---|
21 | #include "structure/structureCanCarmen.h"
|
---|
22 |
|
---|
23 | /*
|
---|
24 |
|
---|
25 | #define MAX_CAN_MSG_LENGTH 8
|
---|
26 |
|
---|
27 |
|
---|
28 | // Basic structure of a CAN frame
|
---|
29 | struct CanFrame {
|
---|
30 | unsigned long id;
|
---|
31 | unsigned char dlc;
|
---|
32 | unsigned char data [MAX_CAN_MSG_LENGTH];
|
---|
33 | };
|
---|
34 |
|
---|
35 | // Can structure with timestamping
|
---|
36 | struct TimestampedCanFrame {
|
---|
37 | CanFrame frame;
|
---|
38 | road_time_t time;
|
---|
39 | road_timerange_t timerange;
|
---|
40 | };
|
---|
41 |
|
---|
42 | */
|
---|
43 |
|
---|
44 | class CanDriverBase
|
---|
45 | {
|
---|
46 | public:
|
---|
47 | CanDriverBase(){}
|
---|
48 | ~CanDriverBase(){}
|
---|
49 |
|
---|
50 | virtual short initPort (void) = 0;
|
---|
51 | virtual short cleanUpPort (void) = 0;
|
---|
52 | virtual short sendFrame (struct CanFrame frame) = 0 ;
|
---|
53 | virtual short receiveFrame (struct CanFrame &frame) = 0;
|
---|
54 | virtual void waitReceivingFrame (void) = 0;
|
---|
55 |
|
---|
56 | protected:
|
---|
57 |
|
---|
58 | private:
|
---|
59 | };
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 | #endif
|
---|