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

Last change on this file since 63 was 62, checked in by Marek Kurdej, 12 years ago

Update: license info.

File size: 2.0 KB
Line 
1// This file is part of the PACPUS framework distributed under the
2// CECILL-C License, Version 1.0.
3//
4/// @version $Id$
5
6////////////////////////////////////////////////////////////////////////////////
7// created: 2007/04/12 - 16:30
8//
9// author: Elie Al Alam & Gerald Dherbomez
10//
11// version: $Id: DbtPlyTrigger.cpp 1009 2012-08-01 19:03:32Z morasjul $
12//
13// purpose: Dbite Player Trigger implementation
14////////////////////////////////////////////////////////////////////////////////
15
16#include <Pacpus/DbitePlayer/DbtPlyTrigger.h>
17
18#include <Pacpus/kernel/ComponentManager.h>
19#include <Pacpus/kernel/Log.h>
20
21namespace pacpus {
22
23DECLARE_STATIC_LOGGER("pacpus.core.DbtPlyTrigger");
24
25// Construction de la fabrique de composant DbtPlyTrigger
26//static ComponentFactory<DbtPlyTrigger> factory("DbtPlyTrigger");
27
28DbtPlyTrigger::DbtPlyTrigger(QString name)
29 : ComponentBase(name)
30 , mEngine(NULL)
31{
32 THREAD_ALIVE = false;
33}
34
35DbtPlyTrigger::~DbtPlyTrigger()
36{
37}
38
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 THREAD_ALIVE = true;
58 start();
59}
60
61void DbtPlyTrigger::stopActivity()
62{
63 THREAD_ALIVE = false;
64}
65
66// The thread is started when the user press the play button
67void DbtPlyTrigger::run()
68{
69#ifdef WIN32
70 timeBeginPeriod(1);
71#endif
72
73 while(THREAD_ALIVE) {
74 if (mEngine->isPlaying()) {
75 Q_EMIT triggerSig();
76 }
77 msleep(1);
78 }
79
80#ifdef WIN32
81 timeEndPeriod(1);
82#endif
83}
84
85} // namespace pacpus
Note: See TracBrowser for help on using the repository browser.