Changeset 152 in pacpusframework for branches/2.0-beta1/src/DBITEPlayerLib
- Timestamp:
- Aug 1, 2013, 10:45:50 AM (11 years ago)
- Location:
- branches/2.0-beta1/src/DBITEPlayerLib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0-beta1/src/DBITEPlayerLib/DbtPlyEngine.cpp
r89 r152 23 23 DECLARE_STATIC_LOGGER("pacpus.core.DbtPlyEngine"); 24 24 25 static const stringkPropertyDataDirectory = "datadir";26 27 static const stringkPropertyLoggerConfiguration = "log-config-file";28 29 static const stringkPropertyReplayMode = "replay_mode";30 static const stringkPropertyReplayModeLastData = "1";31 static const stringkPropertyReplayModeAllData = "2";25 static const char * kPropertyDataDirectory = "datadir"; 26 27 static const char * kPropertyLoggerConfiguration = "log-config-file"; 28 29 static const char * kPropertyReplayMode = "replay_mode"; 30 static const char * kPropertyReplayModeLastData = "1"; 31 static const char * kPropertyReplayModeAllData = "2"; 32 32 33 33 typedef float SpeedType; … … 63 63 } 64 64 65 void DbtPlyEngine::addInputs() 66 { 67 // empty: no inputs 68 } 69 70 void DbtPlyEngine::addOutputs() 71 { 72 // empty: no outputs 73 } 74 65 75 //////////////////////////////////////////////////////////////////////////////// 66 76 /// Returns the directory where the data are stored. … … 103 113 int i = 0; 104 114 105 while ( THREAD_ALIVE) {115 while (isActive()) { 106 116 tNow_ = road_time(); 107 117 float elapsedTime = tNow_ - lastTNow_; … … 145 155 /// Configuration method of the engine 146 156 /// called automatically by the component manager 147 ComponentBase::COMPONENT_CONFIGURATION DbtPlyEngine::configureComponent(XmlComponentConfig /*config*/)157 ComponentBase::COMPONENT_CONFIGURATION DbtPlyEngine::configureComponent(XmlComponentConfig config) 148 158 { 149 159 // datadir 150 dataDir_ = param.getProperty(kPropertyDataDirectory.c_str());151 LOG_INFO("property " << kPropertyDataDirectory .c_str()<< "=\""160 dataDir_ = config.getProperty(kPropertyDataDirectory); 161 LOG_INFO("property " << kPropertyDataDirectory << "=\"" 152 162 << dataDir_ << "\""); 153 163 if (dataDir_.isNull()) { 154 LOG_FATAL("The data directory '" << componentName<< "' is invalid or unavailable!");164 LOG_FATAL("The data directory '" << name() << "' is invalid or unavailable!"); 155 165 } 156 166 … … 162 172 //////////////////////////////////////////////////////////////////////////////// 163 173 // logger configuration 164 QString loggerConfig = param.getProperty(kPropertyLoggerConfiguration.c_str());165 LOG_INFO("property " << kPropertyLoggerConfiguration .c_str()<< "=\""174 QString loggerConfig = config.getProperty(kPropertyLoggerConfiguration); 175 LOG_INFO("property " << kPropertyLoggerConfiguration << "=\"" 166 176 << loggerConfig << "\""); 167 177 if (!loggerConfig.isNull()) { … … 172 182 //////////////////////////////////////////////////////////////////////////////// 173 183 // Replay Mode 174 QString replayModeValue = param.getProperty(kPropertyReplayMode.c_str());175 LOG_INFO("property " << kPropertyReplayMode .c_str()<< "=\""184 QString replayModeValue = config.getProperty(kPropertyReplayMode); 185 LOG_INFO("property " << kPropertyReplayMode << "=\"" 176 186 << replayModeValue << "\""); 177 187 if (replayModeValue.isNull()) { 178 LOG_INFO("property " << kPropertyReplayMode .c_str()<< " unset."188 LOG_INFO("property " << kPropertyReplayMode << " unset." 179 189 << " Set to default = 1."); 180 190 replayMode_ = PlayModeLastData; … … 185 195 replayMode_ = PlayModeAllData; 186 196 } else { 187 LOG_WARN("unknown " << kPropertyReplayMode .c_str()<< " '" << replayModeValue << "'."197 LOG_WARN("unknown " << kPropertyReplayMode << " '" << replayModeValue << "'." 188 198 << " Set to default = 1."); 189 199 replayMode_ = PlayModeLastData; … … 200 210 LOG_INFO("Starting..."); 201 211 202 THREAD_ALIVE = true;212 setActive(true); 203 213 start(); 204 214 } … … 210 220 LOG_TRACE("stopping activity..."); 211 221 212 THREAD_ALIVE = false;222 setActive(false); 213 223 } 214 224 -
branches/2.0-beta1/src/DBITEPlayerLib/DbtPlyFileManager.cpp
r141 r152 21 21 DECLARE_STATIC_LOGGER("pacpus.core.DbtPlyFileManager"); 22 22 23 const stringkPropertyVerbose = "verbose";23 const char * kPropertyVerbose = "verbose"; 24 24 const int kPropertyVerboseDefaultValue = 1; 25 25 26 const stringkPropertyDbiteFileName = "dbt";26 const char * kPropertyDbiteFileName = "dbt"; 27 27 28 28 // It is the maximum time elapsed between the computation of the tDbt and the data replay in microseconds … … 31 31 //////////////////////////////////////////////////////////////////////////////// 32 32 /// Constructor. 33 DbtPlyFileManager::DbtPlyFileManager(QString name):ComponentBase(name) 33 DbtPlyFileManager::DbtPlyFileManager(QString name) 34 : ComponentBase(name) 34 35 { 35 36 LOG_TRACE("constructor"); … … 85 86 ///////////////////////////////////////// 86 87 { 87 QString verbose = param.getProperty(kPropertyVerbose.c_str());88 QString verbose = config.getProperty(kPropertyVerbose); 88 89 if (verbose.isNull()) { 89 90 LOG_INFO("property " << kPropertyVerbose << " not set." … … 103 104 104 105 ///////////////////////////////////////// 105 dbtProperty_ = param.getProperty(kPropertyDbiteFileName.c_str());106 mShowGui = param.getProperty("ui").toInt();106 dbtProperty_ = config.getProperty(kPropertyDbiteFileName); 107 mShowGui = config.getProperty("ui").toInt(); 107 108 mDbtDataPath = mEngine->getDataDir(); 108 109 … … 180 181 void DbtPlyFileManager::displayUI() 181 182 { 182 LOG_WARN("component '" << componentName<< "' has no user interface. Please set ui property to 0 in your XML configuration");183 LOG_WARN("component '" << name() << "' has no user interface. Please set ui property to 0 in your XML configuration"); 183 184 } 184 185 … … 300 301 deltaTDbtTab_[(deltaTDbtTabLoop_++)%1000] = deltaT; 301 302 if (deltaT > kMaxPendingTimeFromEngineMicrosecs) { 302 LOG_WARN( componentName<< ": data not replayed: elapsed time since engine notification too big:" << deltaT << "us");303 LOG_WARN(name() << ": data not replayed: elapsed time since engine notification too big:" << deltaT << "us"); 303 304 return; 304 305 } -
branches/2.0-beta1/src/DBITEPlayerLib/DbtPlyTrigger.cpp
r89 r152 21 21 , mEngine(NULL) 22 22 { 23 THREAD_ALIVE = false;24 23 } 25 24 26 25 DbtPlyTrigger::~DbtPlyTrigger() 27 26 { 27 } 28 29 void DbtPlyTrigger::addInputs() 30 { 31 // empty: no inputs 32 } 33 34 void DbtPlyTrigger::addOutputs() 35 { 36 // empty: no outputs 28 37 } 29 38 … … 46 55 void DbtPlyTrigger::startActivity() 47 56 { 48 THREAD_ALIVE = true;49 57 start(); 50 58 } … … 52 60 void DbtPlyTrigger::stopActivity() 53 61 { 54 THREAD_ALIVE = false;55 62 } 56 63 … … 62 69 #endif 63 70 64 while( THREAD_ALIVE) {71 while(isActive()) { 65 72 if (mEngine->isPlaying()) { 66 73 Q_EMIT triggerSig(); -
branches/2.0-beta1/src/DBITEPlayerLib/DbtPlyUserInterface.cpp
r89 r152 48 48 } 49 49 50 void DbtPlyUserInterface::addInputs() 51 { 52 // empty: no inputs 53 } 54 55 void DbtPlyUserInterface::addOutputs() 56 { 57 // empty: no outputs 58 } 59 50 60 //////////////////////////////////////////////////////////////////////////////// 51 61 ComponentBase::COMPONENT_CONFIGURATION DbtPlyUserInterface::configureComponent(XmlComponentConfig /*config*/)
Note:
See TracChangeset
for help on using the changeset viewer.