|
1 /** @file |
|
2 * Copyright (c) 2005-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: Session timeout |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "httpnotifytimer.h" |
|
22 |
|
23 // ============================ MEMBER FUNCTIONS =============================== |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CHttpNotifyTimer::CHttpNotifyTimer |
|
27 // C++ default constructor |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 CHttpNotifyTimer::CHttpNotifyTimer(MHttpNotifyTimerObserver* aObserver) |
|
31 : CActive(EPriorityStandard) |
|
32 { |
|
33 CActiveScheduler::Add(this); |
|
34 iObserver = aObserver; |
|
35 } |
|
36 |
|
37 // ---------------------------------------------------------------------------- |
|
38 // CHttpNotifyTimer::NewL |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CHttpNotifyTimer* CHttpNotifyTimer::NewL(MHttpNotifyTimerObserver* aObserver) |
|
42 { |
|
43 CHttpNotifyTimer* self = new (ELeave) CHttpNotifyTimer(aObserver); |
|
44 CleanupStack::PushL( self ); |
|
45 self->ConstructL(); |
|
46 CleanupStack::Pop( self ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 // ---------------------------------------------------------------------------- |
|
51 // CHttpNotifyTimer::ConstructL |
|
52 // Two-phased constructor. |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 void CHttpNotifyTimer::ConstructL() |
|
56 { |
|
57 TInt err = iTimer.CreateLocal(); |
|
58 if ( KErrNone != err ) |
|
59 { |
|
60 User::Leave( err ); |
|
61 } |
|
62 } |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CHttpNotifyTimer::~CHttpNotifyTimer |
|
65 // C++ default destructor |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 CHttpNotifyTimer::~CHttpNotifyTimer() |
|
69 { |
|
70 iObserver=NULL; |
|
71 Cancel(); |
|
72 iTimer.Close(); |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CHttpNotifyTimer::AfterSeconds |
|
77 // Start timer |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void CHttpNotifyTimer::AfterSeconds( TInt aIntervalInSeconds ) |
|
81 { |
|
82 if ( !IsActive() ) |
|
83 { |
|
84 TUint32 microsec = aIntervalInSeconds * KSecond; |
|
85 iTimer.After( iStatus, microsec ); |
|
86 SetActive(); |
|
87 } |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CHttpNotifyTimer::RunL |
|
92 // Timer RunL |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 void CHttpNotifyTimer::RunL() |
|
96 { |
|
97 if ( iObserver ) |
|
98 { |
|
99 TRAP_IGNORE( iObserver->TimerEventL( this ) ); |
|
100 } |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // CHttpNotifyTimer::RunError |
|
105 // RunError in case RunL leaves. |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 TInt CHttpNotifyTimer::RunError( TInt /*aError*/ ) |
|
109 { |
|
110 return KErrNone; |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CHttpNotifyTimer::DoCancel |
|
115 // Timer DoCanel for active timers |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 void CHttpNotifyTimer::DoCancel() |
|
119 { |
|
120 iTimer.Cancel(); |
|
121 } |
|
122 |
|
123 // End Of File |