|
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: This file contains the implementation of CIAUpdateUITime |
|
15 * class member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 #include "iaupdateuitimer.h" |
|
20 #include "iaupdateuitimerobserver.h" |
|
21 |
|
22 |
|
23 CIAUpdateUITimer* CIAUpdateUITimer::NewL( |
|
24 MIAUpdateUITimerObserver& aObserver, |
|
25 TTimerType aTimerType ) |
|
26 { |
|
27 CIAUpdateUITimer* self( |
|
28 CIAUpdateUITimer::NewLC( aObserver, aTimerType ) ); |
|
29 CleanupStack::Pop( self ); |
|
30 return self; |
|
31 } |
|
32 |
|
33 |
|
34 CIAUpdateUITimer* CIAUpdateUITimer::NewLC( |
|
35 MIAUpdateUITimerObserver& aObserver, |
|
36 TTimerType aTimerType ) |
|
37 { |
|
38 CIAUpdateUITimer* self( |
|
39 new( ELeave ) CIAUpdateUITimer( aObserver, aTimerType ) ); |
|
40 CleanupStack::PushL( self ); |
|
41 self->ConstructL(); |
|
42 return self; |
|
43 } |
|
44 |
|
45 |
|
46 CIAUpdateUITimer::CIAUpdateUITimer( |
|
47 MIAUpdateUITimerObserver& aObserver, |
|
48 TTimerType aTimerType ) |
|
49 : CTimer( CActive::EPriorityStandard ), |
|
50 iObserver( aObserver ), |
|
51 iTimerType( aTimerType ) |
|
52 { |
|
53 // Active object needs to be added to the scheduler. |
|
54 CActiveScheduler::Add( this ); |
|
55 } |
|
56 |
|
57 |
|
58 CIAUpdateUITimer::~CIAUpdateUITimer() |
|
59 { |
|
60 // No need to call Cancel here because |
|
61 // DoCancel is not implemented in this class |
|
62 // and the parent destructor calls Cancel itself |
|
63 // which also uses the DoCancel of the parent. |
|
64 } |
|
65 |
|
66 |
|
67 void CIAUpdateUITimer::RunL() |
|
68 { |
|
69 // Timer has completed its operation. |
|
70 // Inform observer. |
|
71 switch ( iTimerType ) |
|
72 { |
|
73 case EBackgroundDelay: |
|
74 iObserver.BackgroundDelayComplete( iStatus.Int() ); |
|
75 break; |
|
76 case EForegroundDelay: |
|
77 iObserver.ForegroundDelayComplete( iStatus.Int() ); |
|
78 break; |
|
79 case EProcessStartDelay: |
|
80 iObserver.ProcessStartDelayComplete( iStatus.Int() ); |
|
81 default: |
|
82 break; |
|
83 } |
|
84 } |