source: pacpussensors/trunk/CanGateway/driver/CanDriverBase.h@ 2

Last change on this file since 2 was 2, checked in by DHERBOMEZ Gérald, 11 years ago

correction of minor bugs (include and link). Build on Windows OK.

File size: 1.4 KB
Line 
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
23/*
24
25#define MAX_CAN_MSG_LENGTH 8
26
27
28// Basic structure of a CAN frame
29struct CanFrame {
30 unsigned long id;
31 unsigned char dlc;
32 unsigned char data [MAX_CAN_MSG_LENGTH];
33};
34
35// Can structure with timestamping
36struct TimestampedCanFrame {
37 CanFrame frame;
38 road_time_t time;
39 road_timerange_t timerange;
40};
41
42*/
43
44class CanDriverBase
45{
46public:
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
56protected:
57
58private:
59};
60
61
62
63
64#endif
Note: See TracBrowser for help on using the repository browser.