source: pacpussensors/trunk/CanGateway/CanGateway.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.6 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
48protected:
49 void run();
50
51
52private:
53 road_time_t tic_;
54 void tic() { tic_ = road_time(); }
55 void toc(char * text) { printf("duration = %d %s\n", (int)(road_time() - tic_), text ); }
56
57 Win32CanInterface canIf_;
58 QSemaphore semaphore_;
59 TimestampedCanFrame incomingCanFrames_[INCOMINGCANFRAMES_SIZE];
60
61 // Properties
62 int channel_;
63 int speed_;
64
65 char port_[64];
66 char accessMode_[64];
67
68 QString source_;
69
70 int counter_;
71
72 // dbt files
73 pacpus::DbiteFile rawCanFile_;
74
75};
76
77}
78
79#endif // __CanGateway_h__
Note: See TracBrowser for help on using the repository browser.