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

Last change on this file since 110 was 91, checked in by DHERBOMEZ Gérald, 9 years ago

Small corrections during tests: CAN reading OK under Windows with Kvaser Leaf Light.

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
64 Win32CanInterface canIf_;
65 QSemaphore semaphore_;
66 TimestampedCanFrame incomingCanFrames_[INCOMINGCANFRAMES_SIZE];
67
68 // Properties
69 int channel_;
70 int speed_;
71
72 char port_[64];
73 char accessMode_[64];
74
75 QString source_;
76
77 int counter_;
78
79 // dbt files
80 pacpus::DbiteFile rawCanFile_;
81
[44]82 bool THREAD_ALIVE;
83
[91]84 bool verbose_;
85
[1]86};
87
88}
89
90#endif // __CanGateway_h__
Note: See TracBrowser for help on using the repository browser.