|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CSysApTimer implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 |
|
21 #include <avkon.hrh> |
|
22 #include <avkon.rsg> |
|
23 #include "SysAp.hrh" |
|
24 #include "SysApTimer.h" |
|
25 |
|
26 |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS ============================== |
|
29 |
|
30 // ---------------------------------------------------------------------------- |
|
31 // CSysApTimer::CSysApTimer() |
|
32 // ---------------------------------------------------------------------------- |
|
33 |
|
34 CSysApTimer::CSysApTimer |
|
35 ( |
|
36 MSysApTimerResponder& aSysApTimerResponder |
|
37 ) : CActive( EPriorityStandard ), iTimerResponder( aSysApTimerResponder ) |
|
38 { |
|
39 CActiveScheduler::Add( this ); |
|
40 } |
|
41 |
|
42 // ---------------------------------------------------------------------------- |
|
43 // CSysApTimer::~CSysApTimer() |
|
44 // ---------------------------------------------------------------------------- |
|
45 |
|
46 CSysApTimer::~CSysApTimer() |
|
47 { |
|
48 Cancel(); |
|
49 } |
|
50 |
|
51 |
|
52 // ---------------------------------------------------------------------------- |
|
53 // CSysApTimer::DoCancel() |
|
54 // ---------------------------------------------------------------------------- |
|
55 |
|
56 void CSysApTimer::DoCancel() |
|
57 { |
|
58 iTimer.Close(); |
|
59 } |
|
60 |
|
61 // ---------------------------------------------------------------------------- |
|
62 // CSysApTimer::ActivateTimerL() |
|
63 // ---------------------------------------------------------------------------- |
|
64 |
|
65 void CSysApTimer::ActivateTimerL( TInt aTimeoutInSeconds ) |
|
66 { |
|
67 ActivateMsTimerL( 1000 * aTimeoutInSeconds ); |
|
68 } |
|
69 |
|
70 // ---------------------------------------------------------------------------- |
|
71 // CSysApTimer::ActivateMsTimerL() |
|
72 // ---------------------------------------------------------------------------- |
|
73 |
|
74 void CSysApTimer::ActivateMsTimerL( TInt aTimeoutInMilliSeconds ) |
|
75 { |
|
76 if ( IsActive() ) |
|
77 { |
|
78 Cancel(); |
|
79 } |
|
80 User::LeaveIfError( iTimer.CreateLocal() ); |
|
81 iTimer.After( iStatus, 1000 * aTimeoutInMilliSeconds ); |
|
82 SetActive(); |
|
83 } |
|
84 |
|
85 // ---------------------------------------------------------------------------- |
|
86 // CSysApTimer::RunL() |
|
87 // ---------------------------------------------------------------------------- |
|
88 |
|
89 void CSysApTimer::RunL() |
|
90 { |
|
91 iTimer.Close(); |
|
92 iTimerResponder.TimerExpiredL(); |
|
93 } |
|
94 |
|
95 // ---------------------------------------------------------------------------- |
|
96 // CSysApTimer::RunError() |
|
97 // ---------------------------------------------------------------------------- |
|
98 |
|
99 TInt CSysApTimer::RunError( TInt /* aError */ ) |
|
100 { |
|
101 return KErrNone; |
|
102 } |
|
103 |
|
104 // End of File |
|
105 |