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

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

Added: automated license updating lines:
%pacpus:license{
%pacpus:license}

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