|
1 /* |
|
2 * Copyright (c) 2003 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 for Imps Transport. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDES |
|
21 #include "ImpsTransportTimer.h" |
|
22 #include "ImpsTimingRequester.h" |
|
23 #include "HttpTransportadapter.h" |
|
24 |
|
25 // ================= MEMBER FUNCTIONS ======================= |
|
26 |
|
27 // --------------------------------------------------------- |
|
28 // C++ constructor can NOT contain any code, that |
|
29 // might leave. |
|
30 // --------------------------------------------------------- |
|
31 // |
|
32 CImpsTransportTimer::CImpsTransportTimer( MImpsTransportTimerCallback* aCallback, |
|
33 TImpsTimingRequester* aRequester ) : |
|
34 CActive( 0 ), |
|
35 iRequester( aRequester ), |
|
36 iCallback( aCallback ) |
|
37 |
|
38 { |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------- |
|
42 // CImpsTransportTimer::ConstructL() |
|
43 // |
|
44 // --------------------------------------------------------- |
|
45 // |
|
46 void CImpsTransportTimer::ConstructL() |
|
47 { |
|
48 User::LeaveIfError( iTimer.CreateLocal() ); |
|
49 CActiveScheduler::Add( this ); |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------- |
|
53 // CImpsTransportTimer::NewL |
|
54 // |
|
55 // --------------------------------------------------------- |
|
56 // |
|
57 CImpsTransportTimer* CImpsTransportTimer::NewL( MImpsTransportTimerCallback* aCallback, |
|
58 TImpsTimingRequester* aRequester ) |
|
59 { |
|
60 CImpsTransportTimer* self = new ( ELeave ) CImpsTransportTimer( aCallback, aRequester ); |
|
61 CleanupStack::PushL( self ); |
|
62 self->ConstructL(); |
|
63 CleanupStack::Pop(); |
|
64 return self; |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------- |
|
68 // CImpsTransportTimer::~CImpsTransportTimer() |
|
69 // |
|
70 // --------------------------------------------------------- |
|
71 // |
|
72 CImpsTransportTimer::~CImpsTransportTimer() |
|
73 { |
|
74 #ifdef _DEBUG |
|
75 CHttpTransportAdapter::WriteToLog( _L8( "CImpsTransportTimer::~CImpsTransportTimer(), destructor called." ) ); |
|
76 #endif |
|
77 Cancel(); |
|
78 iTimer.Close(); |
|
79 } |
|
80 |
|
81 |
|
82 // --------------------------------------------------------- |
|
83 // CImpsTransportTimer::ActivateTimer |
|
84 // |
|
85 // --------------------------------------------------------- |
|
86 // |
|
87 void CImpsTransportTimer::ActivateTimer( TTimeIntervalMicroSeconds32 aDelay ) |
|
88 { |
|
89 __ASSERT_ALWAYS( !IsActive(), User::Panic( _L( "CImpsTransportTimer" ), 1 ) ); |
|
90 iTimer.After( iStatus, aDelay ); |
|
91 #ifdef _DEBUG |
|
92 CHttpTransportAdapter::WriteToLog( _L8( "CImpsTransportTimer activated." ) ); |
|
93 #endif |
|
94 SetActive(); |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------- |
|
98 // CImpsTransportTimer::RunL |
|
99 // |
|
100 // --------------------------------------------------------- |
|
101 // |
|
102 void CImpsTransportTimer::RunL() |
|
103 { |
|
104 #ifdef _DEBUG |
|
105 CHttpTransportAdapter::WriteToLog( _L8( "CImpsTransportTimer::RunL()." ) ); |
|
106 #endif |
|
107 iCallback->HandleTransportTimerEventL( iRequester, iStatus.Int() ); |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------- |
|
111 // CImpsTransportTimer::DoCancel |
|
112 // |
|
113 // --------------------------------------------------------- |
|
114 // |
|
115 void CImpsTransportTimer::DoCancel() |
|
116 { |
|
117 iTimer.Cancel(); |
|
118 #ifdef _DEBUG |
|
119 CHttpTransportAdapter::WriteToLog( _L8( "CImpsTransportTimer cancelled." ) ); |
|
120 #endif |
|
121 } |
|
122 |
|
123 // End of File |
|
124 |