source: pacpussensors/trunk/CanGateway/CanGateway.h@ 17

Last change on this file since 17 was 4, checked in by guyardro, 11 years ago

add igep can driver for CanGateway and add support for igep compilation

File size: 1.7 KB
Line 
1// *********************************************************************
2// created: 2008/2/11 - 12:56
3// filename: CanGateway.h
4//
5// author: Gerald Dherbomez
6// Copyright Heudiasyc UMR UTC/CNRS 7239
7//
8// version: $Id: $
9//
10// purpose: Decoding of the CAN bus
11//
12// *********************************************************************
13
14#ifndef __CanGateway_h__
15#define __CanGateway_h__
16
17#include <fstream>
18
19#include "CanGatewayConfig.h"
20#include "CanSubscription.h"
21
22#include "Pacpus/kernel/ComponentBase.h"
23#include "Pacpus/kernel/DbiteFile.h"
24#include "Win32CanInterface.h"
25
26#define INCOMINGCANFRAMES_SIZE 100
27
28// forward declarations
29class QSemaphore;
30
31namespace pacpus {
32
33class CANGATEWAY_API CanGateway
34 : public QThread
35 , public ComponentBase
36 , public CanSubscription
37{
38 Q_OBJECT
39
40public:
41 CanGateway(QString name);
42 ~CanGateway();
43
44 virtual void startActivity();
45 virtual void stopActivity();
46 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
47
48virtual Win32CanInterface* getCanIf()
49{
50 return &canIf_;
51}
52
53protected:
54 void run();
55
56
57private:
58 road_time_t tic_;
59 void tic() { tic_ = road_time(); }
60 void toc(char * text) { printf("duration = %d %s\n", (int)(road_time() - tic_), text ); }
61
62 Win32CanInterface canIf_;
63 QSemaphore semaphore_;
64 TimestampedCanFrame incomingCanFrames_[INCOMINGCANFRAMES_SIZE];
65
66 // Properties
67 int channel_;
68 int speed_;
69
70 char port_[64];
71 char accessMode_[64];
72
73 QString source_;
74
75 int counter_;
76
77 // dbt files
78 pacpus::DbiteFile rawCanFile_;
79
80};
81
82}
83
84#endif // __CanGateway_h__
Note: See TracBrowser for help on using the repository browser.