BADA: Moved timer manager to backends/timer/bada

This commit is contained in:
Chris Warren-Smith 2011-08-20 10:41:32 +10:00
parent 773f61253c
commit 43059b1878
4 changed files with 13 additions and 13 deletions

View file

@ -117,6 +117,11 @@ MODULE_OBJS += \
mixer/sdl13/sdl13-mixer.o mixer/sdl13/sdl13-mixer.o
endif endif
ifeq ($(BACKEND),bada)
MODULE_OBJS += \
timer/bada/timer.o
endif
ifeq ($(BACKEND),ds) ifeq ($(BACKEND),ds)
MODULE_OBJS += \ MODULE_OBJS += \
fs/ds/ds-fs.o \ fs/ds/ds-fs.o \

View file

@ -33,12 +33,12 @@
#include "backends/audiocd/default/default-audiocd.h" #include "backends/audiocd/default/default-audiocd.h"
#include "backends/mutex/mutex.h" #include "backends/mutex/mutex.h"
#include "backends/fs/fs-factory.h" #include "backends/fs/fs-factory.h"
#include "backends/timer/bada/timer.h"
#include "backends/platform/bada/form.h" #include "backends/platform/bada/form.h"
#include "backends/platform/bada/system.h" #include "backends/platform/bada/system.h"
#include "backends/platform/bada/graphics.h" #include "backends/platform/bada/graphics.h"
#include "backends/platform/bada/audio.h" #include "backends/platform/bada/audio.h"
#include "backends/platform/bada/timer.h"
using namespace Osp::Base; using namespace Osp::Base;
using namespace Osp::Base::Runtime; using namespace Osp::Base::Runtime;

View file

@ -20,8 +20,9 @@
* *
*/ */
#include "backends/platform/bada/timer.h" #if defined (BADA)
#include "backends/platform/bada/system.h"
#include "backends/timer/bada/timer.h"
// //
// TimerSlot // TimerSlot
@ -32,16 +33,12 @@ TimerSlot::TimerSlot(Common::TimerManager::TimerProc callback,
_callback(callback), _callback(callback),
_interval(interval), _interval(interval),
_refCon(refCon) { _refCon(refCon) {
logEntered();
} }
TimerSlot::~TimerSlot() { TimerSlot::~TimerSlot() {
logEntered();
} }
bool TimerSlot::OnStart() { bool TimerSlot::OnStart() {
logEntered();
_timer = new Osp::Base::Runtime::Timer(); _timer = new Osp::Base::Runtime::Timer();
if (!_timer || IsFailed(_timer->Construct(*this))) { if (!_timer || IsFailed(_timer->Construct(*this))) {
AppLog("Failed to create timer"); AppLog("Failed to create timer");
@ -58,7 +55,7 @@ bool TimerSlot::OnStart() {
} }
void TimerSlot::OnStop() { void TimerSlot::OnStop() {
logEntered(); AppLog("timer stopped");
if (_timer) { if (_timer) {
_timer->Cancel(); _timer->Cancel();
delete _timer; delete _timer;
@ -75,11 +72,9 @@ void TimerSlot::OnTimerExpired(Timer &timer) {
// BadaTimerManager // BadaTimerManager
// //
BadaTimerManager::BadaTimerManager() { BadaTimerManager::BadaTimerManager() {
logEntered();
} }
BadaTimerManager::~BadaTimerManager() { BadaTimerManager::~BadaTimerManager() {
logEntered();
for (Common::List<TimerSlot>::iterator slot = _timers.begin(); for (Common::List<TimerSlot>::iterator slot = _timers.begin();
slot != _timers.end(); ++slot) { slot != _timers.end(); ++slot) {
slot->Stop(); slot->Stop();
@ -89,7 +84,6 @@ BadaTimerManager::~BadaTimerManager() {
bool BadaTimerManager::installTimerProc(TimerProc proc, int32 interval, void *refCon, bool BadaTimerManager::installTimerProc(TimerProc proc, int32 interval, void *refCon,
const Common::String &id) { const Common::String &id) {
logEntered();
TimerSlot *slot = new TimerSlot(proc, interval / 1000, refCon); TimerSlot *slot = new TimerSlot(proc, interval / 1000, refCon);
if (IsFailed(slot->Construct(THREAD_TYPE_EVENT_DRIVEN))) { if (IsFailed(slot->Construct(THREAD_TYPE_EVENT_DRIVEN))) {
@ -109,7 +103,6 @@ bool BadaTimerManager::installTimerProc(TimerProc proc, int32 interval, void *re
} }
void BadaTimerManager::removeTimerProc(TimerProc proc) { void BadaTimerManager::removeTimerProc(TimerProc proc) {
logEntered();
for (Common::List<TimerSlot>::iterator slot = _timers.begin(); for (Common::List<TimerSlot>::iterator slot = _timers.begin();
slot != _timers.end(); ++slot) { slot != _timers.end(); ++slot) {
if (slot->_callback == proc) { if (slot->_callback == proc) {
@ -118,3 +111,5 @@ void BadaTimerManager::removeTimerProc(TimerProc proc) {
} }
} }
} }
#endif

View file

@ -55,7 +55,7 @@ public:
const Common::String &id); const Common::String &id);
void removeTimerProc(TimerProc proc); void removeTimerProc(TimerProc proc);
private: private:
Common::List<TimerSlot> _timers; Common::List<TimerSlot> _timers;
}; };