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

Last change on this file since 118 was 116, checked in by ydroniou, 9 years ago

Fix KVaser for Linux \o/

File size: 1.8 KB
RevLine 
[1]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
[2]22#include "Pacpus/kernel/ComponentBase.h"
23#include "Pacpus/kernel/DbiteFile.h"
[1]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
[41]48 bool sendFrame(const CanFrame frame);
[4]49
[41]50 //virtual Win32CanInterface* getCanIf()
51 //{
52 // return &canIf_;
53 //}
54
[1]55protected:
56 void run();
57
58
59private:
60 road_time_t tic_;
61 void tic() { tic_ = road_time(); }
62 void toc(char * text) { printf("duration = %d %s\n", (int)(road_time() - tic_), text ); }
63
[116]64 Win32CanInterface canIfRead_;
65 Win32CanInterface canIfWrite_;
66 bool sameCanIf;
[1]67 QSemaphore semaphore_;
68 TimestampedCanFrame incomingCanFrames_[INCOMINGCANFRAMES_SIZE];
69
70 // Properties
71 int channel_;
72 int speed_;
73
74 char port_[64];
75 char accessMode_[64];
76
77 QString source_;
78
79 int counter_;
80
81 // dbt files
82 pacpus::DbiteFile rawCanFile_;
83
[44]84 bool THREAD_ALIVE;
85
[91]86 bool verbose_;
87
[1]88};
89
90}
91
92#endif // __CanGateway_h__
Note: See TracBrowser for help on using the repository browser.