source: pacpusframework/trunk/include/Pacpus/DbitePlayer/DbtPlyEngine.h@ 91

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

Improvement of the build system to avoid some workarounds

  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
1// %pacpus:license{
2// This file is part of the PACPUS framework distributed under the
3// CECILL-C License, Version 1.0.
4// %pacpus:license}
5/// @file
6/// @author Gerald Dherbomez <firstname.surname@utc.fr>
7/// @author Marek Kurdej <firstname.surname@utc.fr>
8/// @date April, 2007
9/// @version $Id: DbtPlyEngine.h 91 2013-05-19 10:32:48Z gdherbom $
10/// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
11/// @brief DbitePlayer DbitePlayer.
12///
13/// Detailed description.
14
15#ifndef DEF_PACPUS_DBTPLYENGINE_H
16#define DEF_PACPUS_DBTPLYENGINE_H
17
18#include <Pacpus/kernel/ComponentBase.h>
19#include <Pacpus/kernel/ComponentFactory.h>
20#include <Pacpus/DbitePlayer/DbitePlayerConfig.h>
21#include <Pacpus/DbitePlayer/DbtPlyEngineStateChart.h>
22#include <Pacpus/DbitePlayer/DbtPlyUserInterface.h>
23
24#include <QSemaphore>
25#include <QThread>
26
27namespace pacpus {
28
29class DbtPlyEngineStateChart;
30class DbtPlyEngineState;
31
32/// @todo Documentation
33enum PlayMode
34{
35 PlayModeLastData = 1, ///< replay_mode="1"
36 PlayModeAllData = 2 ///< replay_mode="2"
37};
38
39/// XML config properties:
40/// datadir PATH root data directory,
41/// e.g. datadir="/home/user/dbt_data"
42/// replay_mode STRING {1}|2
43/// e.g. replay_mode="2"
44class DBITE_PLAYER_API DbtPlyEngine
45 : public QThread
46 , public ComponentBase
47{
48 Q_OBJECT
49
50public:
51 /// Constructor
52 DbtPlyEngine(QString name);
53 /// Destructor
54 ~DbtPlyEngine();
55
56 /// @returns the directory where the data are stored
57 QString getDataDir();
58
59 /// @returns the current replay time
60 road_time_t getTime()
61 {
62 return tDbt_;
63 }
64
65 /// @returns @b true if the player is playing, @b false otherwise
66 bool isPlaying();
67 /// Accessor to playmode
68 int replayMode()
69 {
70 return replayMode_;
71 }
72
73 /// @todo Documentation
74 const DbtPlyEngineState * getState();
75 /// @todo Documentation
76 void setState(DbtPlyEngineState * newState);
77
78 /// Goes back to the beginning, sets speed to initial value
79 void reset();
80
81 /// @todo Documentation
82 void speedUp();
83 /// @todo Documentation
84 void speedDown();
85 /// @todo Documentation
86 void setLastTNow(road_time_t newTNow)
87 {
88 this->lastTNow_= newTNow;
89 }
90
91protected:
92 /// @todo Documentation
93 virtual void startActivity();
94 /// @todo Documentation
95 virtual void stopActivity();
96 /// @todo Documentation
97 virtual COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
98
99 /// Thread main loop
100 virtual void run();
101
102private:
103 DbtPlyEngineState * mCurrentState;
104 float mSpeed;
105 bool mIsReverse;
106
107 /// The state chart of the engine (speed, state and direction)
108 DbtPlyEngineStateChart * stateChart_;
109
110 /// A semaphore of protection of the critical section
111 QSemaphore * tMinMaxSem_;
112 /// tmin and tmax regarding to all the DBT files replayed
113 road_time_t tDbtMin_, tDbtMax_;
114
115 /// tNow_ = the current time when the trigger alerts the engine
116 road_time_t tNow_;
117 /// lastTNow_ = previous tNow_
118 road_time_t lastTNow_;
119 /// tDbt_ = the DBT time at which the data have to be replayed corresponding the state of the engine
120 road_time_t tDbt_;
121 /// lastTDbt_ = previous tDbt_
122 road_time_t lastTDbt_;
123
124 /// the direction of reading: forward=1 or backward=-1 used to compute the tDbt that must be replayed
125 short direction_;
126
127 /// the synchronization semaphore with the trigger
128 QSemaphore * sync_;
129
130 /// where the data are stored
131 QString dataDir_;
132
133 /// mode
134 PlayMode replayMode_;
135
136Q_SIGNALS:
137 /// @todo Documentation
138 void play(road_time_t timeToPlay, road_time_t actualTime, bool direction);
139 /// @todo Documentation
140 void stopfile();
141 /// @todo Documentation
142 void displayStateSig(DbtPlyEngineState * state, float speed);
143 /// @todo Documentation
144 void timeMinMax(road_time_t tMin, road_time_t tMax);
145 /// @todo Documentation
146 void curReplayTime(road_time_t time);
147
148public Q_SLOTS:
149 /// @todo Documentation
150 void engReceiver();
151 /// @todo Documentation
152 void changeDirection(bool reverse);
153 /// @todo Documentation
154 void tMinMax(road_time_t tMin, road_time_t tMax);
155
156 /// @todo Documentation
157 void playEvent();
158 /// @todo Documentation
159 void pauseEvent();
160 /// @todo Documentation
161 void stopEvent();
162 /// @todo Documentation
163 void speedUpEvent();
164 /// @todo Documentation
165 void speedDownEvent();
166};
167
168} // namespace pacpus
169
170#endif // DEF_PACPUS_DBTPLYENGINE_H
Note: See TracBrowser for help on using the repository browser.