equal
deleted
inserted
replaced
|
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 #include "Timer.h" |
|
16 |
|
17 |
|
18 CTimerOut* CTimerOut::NewL(MTimerObserver& aObserver) |
|
19 { |
|
20 |
|
21 CTimerOut* iSelf = new (ELeave) CTimerOut(aObserver); |
|
22 CleanupStack::PushL(iSelf); |
|
23 iSelf->ConstructL(); |
|
24 CleanupStack::Pop(); |
|
25 |
|
26 return iSelf; |
|
27 } |
|
28 |
|
29 |
|
30 CTimerOut::CTimerOut(MTimerObserver& aObserver) : CActive(EPriorityStandard), iObserver(aObserver) |
|
31 { |
|
32 |
|
33 } |
|
34 |
|
35 |
|
36 void CTimerOut::ConstructL() |
|
37 { |
|
38 User::LeaveIfError(iTimer.CreateLocal()); |
|
39 CActiveScheduler::Add(this); |
|
40 |
|
41 } |
|
42 |
|
43 |
|
44 CTimerOut::~CTimerOut() |
|
45 { |
|
46 Deque(); |
|
47 iTimer.Close(); |
|
48 |
|
49 } |
|
50 |
|
51 |
|
52 void CTimerOut::Start(TTimeIntervalMicroSeconds32 aInterval) |
|
53 { |
|
54 |
|
55 iTimer.After(iStatus,aInterval); |
|
56 SetActive(); |
|
57 |
|
58 } |
|
59 |
|
60 |
|
61 void CTimerOut::Stop() |
|
62 { |
|
63 |
|
64 Cancel(); |
|
65 |
|
66 } |
|
67 |
|
68 |
|
69 void CTimerOut::DoCancel() |
|
70 { |
|
71 |
|
72 iTimer.Cancel(); |
|
73 |
|
74 } |
|
75 |
|
76 |
|
77 void CTimerOut::RunL() |
|
78 { |
|
79 if(iStatus == KErrNone) |
|
80 iObserver.HandleTimerEventL(ETimerExpired); |
|
81 else |
|
82 iObserver.HandleTimerEventL(ETimerCancled); |
|
83 |
|
84 } |
|
85 |