|
1 /* |
|
2 * Copyright (c) 2009 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: Timeout timer implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "ProcessTimer.h" |
|
21 |
|
22 const TInt KSecond = 1000000; // 1 seconds |
|
23 |
|
24 /********************************** |
|
25 * Method: NewL |
|
26 **********************************/ |
|
27 CProcessTimer* CProcessTimer::NewL(MObserverPreInstall& aObserver) |
|
28 { |
|
29 CProcessTimer * self = new ( ELeave ) CProcessTimer(aObserver); |
|
30 CleanupStack::PushL( self ); |
|
31 self->ConstructL(); |
|
32 CleanupStack::Pop(); |
|
33 |
|
34 return self; |
|
35 } |
|
36 |
|
37 /********************************** |
|
38 * Method: Constructor |
|
39 **********************************/ |
|
40 CProcessTimer::CProcessTimer(MObserverPreInstall& aObserver) : |
|
41 CTimer( CActive::EPriorityStandard ),iObserver(aObserver) |
|
42 { |
|
43 __LOG_CONSTRUCT( "IMS", "CProcessTimer" ) |
|
44 } |
|
45 |
|
46 /********************************** |
|
47 * Method: ConstructorL |
|
48 **********************************/ |
|
49 void CProcessTimer::ConstructL() |
|
50 { |
|
51 __LOG_ENTER( "ConstructL" ) |
|
52 |
|
53 CTimer::ConstructL(); |
|
54 CActiveScheduler::Add( this ); |
|
55 |
|
56 __LOG_EXIT |
|
57 } |
|
58 |
|
59 /********************************** |
|
60 * Method: Destructor |
|
61 **********************************/ |
|
62 CProcessTimer::~CProcessTimer() |
|
63 { |
|
64 Cancel(); |
|
65 __LOG_ENTER( "Destructor Timeout Timer" ) |
|
66 __LOG_EXIT |
|
67 __LOG_DESTRUCT |
|
68 } |
|
69 |
|
70 /********************************** |
|
71 * Method: StartTimeoutTimer |
|
72 * aTimerValue - value of the timeout |
|
73 **********************************/ |
|
74 void CProcessTimer::StartTimeoutTimer( TInt aTimerValue ) |
|
75 { |
|
76 CTimer::After( aTimerValue * KSecond ); |
|
77 } |
|
78 |
|
79 /********************************** |
|
80 * Method: RunL |
|
81 **********************************/ |
|
82 void CProcessTimer::RunL() |
|
83 { |
|
84 __LOG_ENTER("RunL") |
|
85 __LOG_WRITE_FORMAT1_INFO( "iStatus=%d", CTimer::iStatus.Int() ) |
|
86 |
|
87 if ( KErrNone == iStatus.Int() ) |
|
88 { |
|
89 iObserver.Timeout(); |
|
90 } |
|
91 __LOG_EXIT; |
|
92 } |
|
93 |