source: pacpusframework/trunk/include/Pacpus/DbitePlayer/DbtPlyFileManager.h@ 3

Last change on this file since 3 was 3, checked in by sgosseli, 12 years ago
  • Add the existing Pacpus files from pacpusdev and pacpuscore.
  • Provide a clean build system based on multiple CMake files.
File size: 4.1 KB
Line 
1/*********************************************************************
2// created: 2007/04/12 - 16:30
3//
4// author: Elie Al Alam & Gerald Dherbomez
5//
6// version: $Id: $
7//
8// purpose: Dbite Player File Manager header file
9
10*********************************************************************/
11
12#ifndef DBTPLYFILEMANAGER_H
13#define DBTPLYFILEMANAGER_H
14
15#include <qthread.h>
16
17#include "DbitePlayerConfig.h"
18#include "kernel/road_time.h"
19#include "kernel/ComponentBase.h"
20#include "kernel/DbiteFile.h"
21#include "DbitePlayer/DbtPlyEngine.h"
22
23class QSemaphore;
24
25namespace pacpus {
26
27class DbtPlyEngine;
28
29/// XML config properties:
30/// dbt PATH(S) path to DBT data file(s), separated by pipe symbol '|', relative to datadir property of DbtPlyEngine
31/// e.g. dbt="gps/ublox.dbt|gps/ublox2.dbt"
32/// ui INT graphical user interface (GUI) window number
33/// e.g. ui="0"
34/// verbose INT verbosity level
35/// e.g. verbose="1"
36/// @see DbtPlyEngine
37class DBITE_PLAYER_API DbtPlyFileManager
38 : public QThread
39 , public ComponentBase
40{
41 Q_OBJECT
42
43public:
44 // constructor
45 DbtPlyFileManager(QString name);
46 // destructor
47 virtual ~DbtPlyFileManager();
48
49 // the player replays only the last data that has not been yet replayed
50 void playMode1 (road_time_t tDbt, bool reverse);
51 // the player replays all the data that have not been yet replayed
52 void playMode2 (road_time_t tDbt, bool reverse);
53
54 // virtual method: call when new DBT data are replayed
55 virtual void processData(road_time_t time, road_timerange_t timeRange, void * data) = 0;
56 virtual void displayUI();
57
58 // 3 Virtual methods relative to the ComponentBase inheritance
59 virtual COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
60 virtual void startActivity();
61 virtual void stopActivity();
62
63 // The loop of the thread
64 virtual void run();
65
66public Q_SLOTS:
67 // slot activated by the engine when it computes new DBT time
68 void playData(road_time_t tDbt,road_time_t tNow, bool reverse);
69
70 // put the file descriptor to the beginning of the file
71 void beginfile();
72
73Q_SIGNALS:
74 // signal sent to the engine to provide to it the tmin and tmax of the file
75 void tMinMaxIs(road_time_t tmin, road_time_t tmax);
76
77protected:
78 /// Verbosity level
79 int mVerbose;
80
81 // a pointer on the player engine
82 DbtPlyEngine * mEngine;
83
84 // the absolute path of the DBT file
85 QString dbtProperty_;
86 QStringList mDbtFilenameList;
87
88 // The directory where the DBT file is located
89 QString mDbtDataPath;
90
91 // Display or not the graphical interface
92 bool mShowGui;
93
94 struct dbtStruct
95 {
96 char * buffer;
97 road_time_t t;
98 road_timerange_t tr;
99 };
100
101 struct dbtStructFile
102 {
103 // the DBT file descriptor
104 pacpus::DbiteFile * pfile;
105 // the buffer where the data are stored after the reading and the associated time, timerange and file descriptor
106 dbtStruct cur;
107 // the previous DBT data, these ones that must be processed
108 dbtStruct toProcess;
109 };
110
111 QList<dbtStructFile> dbt_;
112 int dbtIndex_;
113
114private:
115 bool processDbtFileHdfile(dbtStructFile & dbtFile, pacpus::DbiteFile::ReadDirection direction);
116
117private:
118 // reading backward?
119 bool reverse_;
120
121 // the estimated DBT time sent by the engine and computed relatively to the state of the player
122 road_time_t timeToRead_;
123
124 // The mode of replay
125 // see playModeN method
126 int mode_;
127
128 // The minimum and maximum time of the data contained in the file
129 road_time_t tMin_, tMax_;
130
131 // the synchronization semaphore with the engine
132 QSemaphore * sync_;
133
134 // For statistics purpose - delta time between the instant when the tDbt is computed and the instant when it is
135 // taken into account by the file manager
136 int deltaTDbtTab_[1000];
137 int deltaTDbtTabLoop_;
138};
139
140} // namespace pacpus
141
142#endif // DBTPLYFILEMANAGER_H
Note: See TracBrowser for help on using the repository browser.