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

Last change on this file since 66 was 66, checked in by Marek Kurdej, 11 years ago

Documentation: file info.

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