1 /* |
|
2 * Copyright (c) 2006 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 service for SVP |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "svptimer.h" |
|
20 #include "svptimerobserver.h" |
|
21 |
|
22 |
|
23 const TInt KMicroSecondsCoefficient = 1000; |
|
24 |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // CSVPTimer::CSVPTimer |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 CSVPTimer::CSVPTimer( MSVPTimerObserver& aObserver, TInt aTimerId ): |
|
31 CTimer( EPriorityHigh ), |
|
32 iObserver( aObserver ), |
|
33 iId( aTimerId ) |
|
34 { |
|
35 CActiveScheduler::Add( this ); |
|
36 } |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // CSVPTimer::CSVPTimer |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 void CSVPTimer::ConstructL() |
|
43 { |
|
44 CTimer::ConstructL(); |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CSVPTimer::CSVPTimer |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CSVPTimer* CSVPTimer::NewL( MSVPTimerObserver& aObserver, |
|
52 TInt aTimerId ) |
|
53 { |
|
54 CSVPTimer* self = new (ELeave) CSVPTimer( aObserver, aTimerId ); |
|
55 |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL(); |
|
58 CleanupStack::Pop( self ); |
|
59 |
|
60 return self; |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // CSVPTimer::~CSVPTimer |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 CSVPTimer::~CSVPTimer() |
|
68 { |
|
69 Cancel(); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // CSVPTimer::RunL |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 void CSVPTimer::RunL() |
|
77 { |
|
78 iObserver.TimedOut( iId ); |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // CSVPTimer::SetTime |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 void CSVPTimer::SetTime( TInt aMilliSeconds ) |
|
86 { |
|
87 // Milliseconds to microseconds conversion |
|
88 const TTimeIntervalMicroSeconds32 time( |
|
89 KMicroSecondsCoefficient * aMilliSeconds ); |
|
90 |
|
91 CTimer::After( time ); // NB, CTimer::After calls SetActive |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // CSVPTimer::Stop |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 void CSVPTimer::Stop() |
|
99 { |
|
100 Cancel(); |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // CSVPTimer::Id |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 TInt CSVPTimer::Id() const |
|
108 { |
|
109 return iId; |
|
110 } |
|
111 |
|
112 // End of File |
|