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 "Pacpus/kernel/road_time.h"
|
---|
20 | #include "Pacpus/PacpusTools/BinaryDecoder.h"
|
---|
21 |
|
---|
22 | #include "../structureCan.h"
|
---|
23 |
|
---|
24 | /*
|
---|
25 |
|
---|
26 | #define MAX_CAN_MSG_LENGTH 8
|
---|
27 |
|
---|
28 |
|
---|
29 | // Basic structure of a CAN frame
|
---|
30 | struct CanFrame {
|
---|
31 | unsigned long id;
|
---|
32 | unsigned char dlc;
|
---|
33 | unsigned char data [MAX_CAN_MSG_LENGTH];
|
---|
34 | };
|
---|
35 |
|
---|
36 | // Can structure with timestamping
|
---|
37 | struct TimestampedCanFrame {
|
---|
38 | CanFrame frame;
|
---|
39 | road_time_t time;
|
---|
40 | road_timerange_t timerange;
|
---|
41 | };
|
---|
42 |
|
---|
43 | */
|
---|
44 |
|
---|
45 | class CanDriverBase
|
---|
46 | {
|
---|
47 | public:
|
---|
48 | CanDriverBase(){}
|
---|
49 | ~CanDriverBase(){}
|
---|
50 |
|
---|
51 | virtual short initPort (void) = 0;
|
---|
52 | virtual short cleanUpPort (void) = 0;
|
---|
53 | virtual short sendFrame (struct CanFrame frame) = 0 ;
|
---|
54 | virtual short receiveFrame (struct CanFrame &frame) = 0;
|
---|
55 | virtual void waitReceivingFrame (void) = 0;
|
---|
56 |
|
---|
57 | protected:
|
---|
58 |
|
---|
59 | private:
|
---|
60 | };
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 |
|
---|
65 | #endif
|
---|