00001
00002
00003 #include "ActiveTimer.h"
00004 #include "ActiveTimerNotify.h"
00005
00006
00007
00008 CActiveTimer* CActiveTimer::NewL(MActiveTimerNotify& aNotifier)
00009 {
00010 CActiveTimer* self = new (ELeave) CActiveTimer(aNotifier);
00011 CleanupStack::PushL(self);
00012 self->ConstructL();
00013 CleanupStack::Pop();
00014 return self;
00015 }
00016
00017
00018
00019 CActiveTimer::~CActiveTimer()
00020 {
00021 Cancel();
00022 iTimer.Close();
00023 }
00024
00025
00026
00027
00028 void CActiveTimer::After(TTimeIntervalMicroSeconds32 anInterval)
00029 {
00030 iTimer.After(iStatus, anInterval);
00031 SetActive();
00032 }
00033
00034
00035
00036 void CActiveTimer::RunL()
00037 {
00038 iNotifier.TimerComplete(iStatus.Int());
00039 }
00040
00041
00042
00043
00044 void CActiveTimer::DoCancel()
00045 {
00046 iTimer.Cancel();
00047 }
00048
00049
00050
00051 CActiveTimer::CActiveTimer(MActiveTimerNotify& aNotifier) :
00052 CActive(EPriorityStandard),
00053 iNotifier(aNotifier)
00054 {
00055 CActiveScheduler::Add(this);
00056 }
00057
00058
00059
00060 void CActiveTimer::ConstructL()
00061 {
00062 User::LeaveIfError(iTimer.CreateLocal());
00063 }
00064
00065