source: pacpusframework/trunk/src/DBITEPlayerLib/DbtPlyTrigger.cpp@ 243

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

Major update.
Renamed: addInput -> addInputs, addOutput -> addOutputs and made pure virtual (=0).
Transformed macro definitions into template methods: ADD_INPUT -> ComponentBase::addInput, ADD_OUTPUT -> ComponentBase::addOutput, GET_INPUT -> ComponentBase::getTypedInput, GET_OUTPUT -> ComponentBase::getTypedOutput.
Fixed: added public/protected set/get methods in ComponentBase, made member fields private.

  • Property svn:executable set to *
File size: 1.8 KB
RevLine 
[89]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/// @version $Id: DbtPlyTrigger.cpp 76 2013-01-10 17:05:10Z kurdejma $
6
7#include <Pacpus/DbitePlayer/DbtPlyTrigger.h>
8
9#include <Pacpus/kernel/ComponentManager.h>
10#include <Pacpus/kernel/Log.h>
11
12namespace pacpus {
13
14DECLARE_STATIC_LOGGER("pacpus.core.DbtPlyTrigger");
15
16// Construction de la fabrique de composant DbtPlyTrigger
17//static ComponentFactory<DbtPlyTrigger> factory("DbtPlyTrigger");
18
19DbtPlyTrigger::DbtPlyTrigger(QString name)
20 : ComponentBase(name)
21 , mEngine(NULL)
22{
23}
24
25DbtPlyTrigger::~DbtPlyTrigger()
26{
27}
28
[152]29void DbtPlyTrigger::addInputs()
30{
31 // empty: no inputs
32}
33
34void DbtPlyTrigger::addOutputs()
35{
36 // empty: no outputs
37}
38
[89]39ComponentBase::COMPONENT_CONFIGURATION DbtPlyTrigger::configureComponent(XmlComponentConfig /*config*/)
40{
41 ComponentManager * mgr = ComponentManager::getInstance();
42 // we get a pointer to the engine component
43 mEngine = dynamic_cast<DbtPlyEngine *>(mgr->getComponent("dbiteEngine"));
44 if (NULL == mEngine) {
45 LOG_FATAL("cannot get a pointer of the 'dbiteEngine' component");
46 return CONFIGURED_FAILED;
47 }
48 connect(this, SIGNAL(triggerSig()),
49 mEngine,SLOT(engReceiver()),
50 Qt::DirectConnection);
51
52 return CONFIGURED_OK;
53}
54
55void DbtPlyTrigger::startActivity()
56{
57 start();
58}
59
60void DbtPlyTrigger::stopActivity()
61{
62}
63
64// The thread is started when the user press the play button
65void DbtPlyTrigger::run()
66{
67#ifdef WIN32
68 timeBeginPeriod(1);
69#endif
70
[152]71 while(isActive()) {
[89]72 if (mEngine->isPlaying()) {
73 Q_EMIT triggerSig();
74 }
75 msleep(1);
76 }
77
78#ifdef WIN32
79 timeEndPeriod(1);
80#endif
81}
82
83} // namespace pacpus
Note: See TracBrowser for help on using the repository browser.