|
1 /* |
|
2 * Copyright (c) 2000 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: Implementation of terminalsecurity components |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32debug.h> |
|
21 |
|
22 #include "SCPTimer.h" |
|
23 #include "SCPServer.h" |
|
24 |
|
25 // ================= MEMBER FUNCTIONS ======================= |
|
26 |
|
27 // C++ default constructor can NOT contain any code, that |
|
28 // might leave. |
|
29 // |
|
30 CSCPTimer::CSCPTimer( TAny* aParam, MSCPTimeoutHandler* aHandler ) |
|
31 : CActive( EPriorityNormal ), |
|
32 iParam( aParam ), |
|
33 iHandler( aHandler ) |
|
34 { |
|
35 Dprint( (_L("--> CSCPTimer::CSCPTimer()") )); |
|
36 |
|
37 // No implementation required |
|
38 |
|
39 Dprint( (_L("<-- CSCPTimer::CSCPTimer()") )); |
|
40 } |
|
41 |
|
42 |
|
43 // Static constructor. |
|
44 CSCPTimer* CSCPTimer::NewL( TUint aTimeout, TAny* aParam, MSCPTimeoutHandler* aHandler ) |
|
45 { |
|
46 Dprint( (_L("--> CSCPTimer::NewL()") )); |
|
47 |
|
48 CSCPTimer* self = CSCPTimer::NewLC( aTimeout, aParam, aHandler ); |
|
49 CleanupStack::Pop( self ); |
|
50 |
|
51 Dprint( (_L("<-- CSCPTimer::NewL()") )); |
|
52 return self; |
|
53 } |
|
54 |
|
55 |
|
56 // Static constructor, leaves object pointer to the cleanup stack. |
|
57 CSCPTimer* CSCPTimer::NewLC( TUint aTimeout, TAny* aParam, MSCPTimeoutHandler* aHandler ) |
|
58 { |
|
59 Dprint( (_L("--> CSCPTimer::NewLC()") )); |
|
60 |
|
61 CSCPTimer* self = new (ELeave) CSCPTimer( aParam, aHandler ); |
|
62 |
|
63 CleanupStack::PushL( self ); |
|
64 self->ConstructL( aTimeout ); |
|
65 |
|
66 Dprint( (_L("<-- CSCPTimer::NewLC()") )); |
|
67 return self; |
|
68 } |
|
69 |
|
70 |
|
71 // Symbian 2nd phase constructor can leave. |
|
72 void CSCPTimer::ConstructL( TUint aTimeout ) |
|
73 { |
|
74 Dprint( (_L("--> CSCPTimer::ConstructL()") )); |
|
75 CActiveScheduler::Add( this ); |
|
76 |
|
77 iTimer.CreateLocal(); |
|
78 |
|
79 // Start the timer |
|
80 iTimer.After( iStatus, aTimeout ); |
|
81 // No need to check for isActive, this is the constructor |
|
82 SetActive(); |
|
83 |
|
84 Dprint( (_L("<-- CSCPTimer::ConstructL()") )); |
|
85 } |
|
86 |
|
87 |
|
88 // Destructor |
|
89 CSCPTimer::~CSCPTimer() |
|
90 { |
|
91 Dprint( (_L("--> CSCPTimer::~CSCPTimer()") )); |
|
92 |
|
93 if ( IsActive() ) |
|
94 { |
|
95 Cancel(); |
|
96 } |
|
97 |
|
98 iParam = NULL; |
|
99 iHandler = NULL; |
|
100 |
|
101 iTimer.Close(); |
|
102 |
|
103 Dprint( (_L("<-- CSCPTimer::~CSCPTimer()") )); |
|
104 } |
|
105 |
|
106 |
|
107 // --------------------------------------------------------- |
|
108 // void CSCPTimer::RunL() |
|
109 // Handle the timeout by calling the callback method |
|
110 // |
|
111 // Status : Approved |
|
112 // --------------------------------------------------------- |
|
113 // |
|
114 void CSCPTimer::RunL() |
|
115 { |
|
116 Dprint( (_L("--> CSCPTimer::RunL()") )); |
|
117 |
|
118 Dprint( (_L("--> CSCPTimer::RunL(): TIMEOUT occured, signalling the handler") )); |
|
119 iHandler->Timeout( iParam ); |
|
120 |
|
121 Dprint( (_L("<-- CSCPTimer::RunL()") )); |
|
122 } |
|
123 |
|
124 |
|
125 // --------------------------------------------------------- |
|
126 // void CSCPTimer::DoCancel() |
|
127 // Cancel the call using the RTimer member |
|
128 // |
|
129 // Status : Approved |
|
130 // --------------------------------------------------------- |
|
131 // |
|
132 void CSCPTimer::DoCancel() |
|
133 { |
|
134 Dprint( (_L("--> CSCPTimer::DoCancel()") )); |
|
135 |
|
136 iTimer.Cancel(); |
|
137 |
|
138 Dprint( (_L("<-- CSCPTimer::DoCancel()") )); |
|
139 } |
|
140 |
|
141 // End of File |
|
142 |