|
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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include "musavatimer.h" |
|
21 #include <e32std.h> |
|
22 |
|
23 const TUint KMicroSecondsInMilliSecond = 1000; |
|
24 |
|
25 // ---------------------------------------------------------------------------- |
|
26 // CMusAvaTimer::NewL |
|
27 // ---------------------------------------------------------------------------- |
|
28 // |
|
29 CMusAvaTimer* CMusAvaTimer::NewL() |
|
30 { |
|
31 CMusAvaTimer* self = CMusAvaTimer::NewLC (); |
|
32 CleanupStack::Pop (self); |
|
33 return self; |
|
34 } |
|
35 |
|
36 // ---------------------------------------------------------------------------- |
|
37 // CMusAvaTimer::NewLC |
|
38 // ---------------------------------------------------------------------------- |
|
39 // |
|
40 CMusAvaTimer* CMusAvaTimer::NewLC () |
|
41 { |
|
42 CMusAvaTimer* self = new(ELeave)CMusAvaTimer; |
|
43 CleanupStack::PushL (self); |
|
44 self->ConstructL (); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // ---------------------------------------------------------------------------- |
|
49 // CMusAvaTimer::ConstructL |
|
50 // ---------------------------------------------------------------------------- |
|
51 // |
|
52 void CMusAvaTimer::ConstructL () |
|
53 { |
|
54 CActiveScheduler::Add(this); |
|
55 User::LeaveIfError (iTimer.CreateLocal()); |
|
56 } |
|
57 |
|
58 |
|
59 // ---------------------------------------------------------------------------- |
|
60 // CMusAvaTimer::ConstructL |
|
61 // ---------------------------------------------------------------------------- |
|
62 // |
|
63 CMusAvaTimer::CMusAvaTimer () |
|
64 : CActive(EPriorityHigh) |
|
65 { |
|
66 } |
|
67 |
|
68 |
|
69 // ---------------------------------------------------------------------------- |
|
70 // CMusAvaTimer::~CMusAvaTimer |
|
71 // ---------------------------------------------------------------------------- |
|
72 // |
|
73 CMusAvaTimer::~CMusAvaTimer () |
|
74 { |
|
75 CActive::Cancel(); |
|
76 iTimer.Close(); |
|
77 } |
|
78 |
|
79 // ---------------------------------------------------------------------------- |
|
80 // CMusAvaTimer::StopActiveSchedulerAfter |
|
81 // ---------------------------------------------------------------------------- |
|
82 // |
|
83 void CMusAvaTimer::StopActiveSchedulerAfter ( TInt aMilliSeconds, |
|
84 TRequestStatus* aStatus ) |
|
85 { |
|
86 |
|
87 |
|
88 if (!IsActive()) |
|
89 { |
|
90 iTimer.After( iStatus, TTimeIntervalMicroSeconds32(aMilliSeconds * 1000) ); |
|
91 |
|
92 iRequestStatus = aStatus; |
|
93 //*iRequestStatus = KRequestPending; |
|
94 *iRequestStatus = KErrNone; |
|
95 SetActive (); |
|
96 TRequestStatus* ptr = &iStatus; |
|
97 //User::RequestComplete(ptr, KErrNone); |
|
98 //TInt result = KErrNone; |
|
99 //CActiveScheduler::RunIfReady( result, EPriorityStandard ); |
|
100 /*TRequestStatus* ptr = &iStatus; |
|
101 iStatus = KRequestPending; |
|
102 SetActive(); |
|
103 User::RequestComplete(ptr, KErrNone); |
|
104 TInt result = KErrNone; |
|
105 CActiveScheduler::RunIfReady( result, EPriorityStandard );*/ |
|
106 } |
|
107 } |
|
108 |
|
109 // ---------------------------------------------------------------------------- |
|
110 // CMusAvaTimer::RunL |
|
111 // ---------------------------------------------------------------------------- |
|
112 // |
|
113 void CMusAvaTimer::RunL () |
|
114 { |
|
115 TRequestStatus* pRS = iRequestStatus; |
|
116 User::RequestComplete(pRS, KErrNone ); |
|
117 } |
|
118 |
|
119 // ---------------------------------------------------------------------------- |
|
120 // CMusAvaTimer::DoCancel |
|
121 // ---------------------------------------------------------------------------- |
|
122 // |
|
123 void CMusAvaTimer::DoCancel () |
|
124 { |
|
125 iTimer.Cancel(); |
|
126 } |
|
127 |
|
128 // End of File |
|
129 |