|
1 /* |
|
2 * Copyright (c) 2002, 2003 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: Timer. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CLogsTimer.h" |
|
21 |
|
22 // ================= MEMBER FUNCTIONS ======================= |
|
23 |
|
24 // --------------------------------------------------------- |
|
25 // CLogsTimer::CLogsTimer |
|
26 // --------------------------------------------------------- |
|
27 // |
|
28 CLogsTimer::CLogsTimer( TInt aPriority ) |
|
29 : CTimer( aPriority) |
|
30 { |
|
31 CActiveScheduler::Add( this ); |
|
32 } |
|
33 |
|
34 // --------------------------------------------------------- |
|
35 // CLogsTimer::ConstructL |
|
36 // --------------------------------------------------------- |
|
37 // |
|
38 void CLogsTimer::ConstructL() |
|
39 { |
|
40 CTimer::ConstructL(); |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------- |
|
44 // CLogsTimer::NewL |
|
45 // --------------------------------------------------------- |
|
46 // |
|
47 CLogsTimer* CLogsTimer::NewL( TInt aPriority ) |
|
48 { |
|
49 CLogsTimer* self = new (ELeave) CLogsTimer( aPriority ); |
|
50 |
|
51 CleanupStack::PushL( self ); |
|
52 self->ConstructL(); |
|
53 CleanupStack::Pop(); |
|
54 |
|
55 return self; |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------- |
|
59 // CLogsTimer::~CLogsTimer |
|
60 // --------------------------------------------------------- |
|
61 // |
|
62 CLogsTimer::~CLogsTimer() |
|
63 { |
|
64 CTimer::Cancel(); |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------- |
|
68 // CLogsTimer::RunL() |
|
69 // --------------------------------------------------------- |
|
70 // |
|
71 void CLogsTimer::RunL() |
|
72 { |
|
73 if ( iStatus != KErrNone ) |
|
74 { |
|
75 //error code is ignored, as CPeriodic. |
|
76 return; |
|
77 } |
|
78 |
|
79 if( iTimerObserver == NULL ) |
|
80 { |
|
81 iCallBack.CallBack(); |
|
82 } |
|
83 else |
|
84 { |
|
85 iTimerObserver->HandleLogsTimerL( iTimerObserverParam ); |
|
86 } |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------- |
|
90 // CLogsTimer::After() |
|
91 // --------------------------------------------------------- |
|
92 // |
|
93 void CLogsTimer::After( TTimeIntervalMicroSeconds32 anInterval, |
|
94 TCallBack aCallBack ) |
|
95 { |
|
96 if ( IsActive() ) |
|
97 { |
|
98 Cancel(); |
|
99 } |
|
100 |
|
101 iTimerObserver = NULL; |
|
102 iCallBack = aCallBack; |
|
103 CTimer::After( anInterval ); |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------- |
|
107 // CLogsTimer::After() |
|
108 // --------------------------------------------------------- |
|
109 // |
|
110 void CLogsTimer::After( TTimeIntervalMicroSeconds32 anInterval, |
|
111 MLogsTimer* aObserver, |
|
112 TAny* aPtr ) |
|
113 { |
|
114 if ( IsActive() ) |
|
115 { |
|
116 Cancel(); |
|
117 } |
|
118 |
|
119 iTimerObserver = aObserver; |
|
120 iTimerObserverParam = aPtr; |
|
121 CTimer::After( anInterval ); |
|
122 } |
|
123 |
|
124 // End of File |
|
125 |