|
1 /* |
|
2 * Copyright (c) 2002 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: Main class for handling provisioning message |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CWPMessage.h" |
|
22 #include "CWPHandler.h" |
|
23 #include "WPHandlerUtil.h" |
|
24 #include "WPHandlerDebug.h" |
|
25 #include "ProvisioningDebug.h" |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CWPHandler::CWPHandler |
|
33 // C++ default constructor can NOT contain any code, that |
|
34 // might leave. |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CWPHandler::CWPHandler() |
|
38 : CContentHandlerBase() |
|
39 { |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CWPHandler::ConstructL |
|
44 // Symbian 2nd phase constructor can leave. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 void CWPHandler::ConstructL() |
|
48 { |
|
49 CActiveScheduler::Add(this); |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CWPHandler::NewL |
|
54 // Two-phased constructor. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 CWPHandler* CWPHandler::NewL() |
|
58 { |
|
59 CWPHandler* self = new(ELeave) CWPHandler; |
|
60 CleanupStack::PushL(self); |
|
61 self->ConstructL(); |
|
62 CleanupStack::Pop(self); |
|
63 return self; |
|
64 } |
|
65 |
|
66 // Destructor |
|
67 CWPHandler::~CWPHandler() |
|
68 { |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CWPHandler::HandleMessageL |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 void CWPHandler::HandleMessageL(CPushMessage* aPushMsg, TRequestStatus& aStatus) |
|
76 { |
|
77 FLOG( _L( "CWPHandler::HandleMessageL: Received message" ) ); |
|
78 |
|
79 iMessage = aPushMsg; |
|
80 iAcknowledge = ETrue; |
|
81 SetConfirmationStatus(aStatus); |
|
82 |
|
83 iState = EProcessing; |
|
84 IdleComplete(); |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CWPHandler::HandleMessageL |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void CWPHandler::HandleMessageL(CPushMessage* aPushMsg) |
|
92 { |
|
93 FLOG( _L( "CWPHandler::HandleMessageL: Received message" ) ); |
|
94 |
|
95 iAcknowledge = EFalse; |
|
96 iMessage = aPushMsg; |
|
97 |
|
98 iState = EProcessing; |
|
99 IdleComplete(); |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CWPHandler::CancelHandleMessage |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 void CWPHandler::CancelHandleMessage() |
|
107 { |
|
108 Cancel(); |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CWPHandler::CPushHandlerBase_Reserved1 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 void CWPHandler::CPushHandlerBase_Reserved1() |
|
116 { |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CWPHandler::CPushHandlerBase_Reserved2 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 void CWPHandler::CPushHandlerBase_Reserved2() |
|
124 { |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CWPHandler::DoCancel |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 void CWPHandler::DoCancel() |
|
132 { |
|
133 Complete(KErrCancel); |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CWPHandler::RunL |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 void CWPHandler::RunL() |
|
141 { |
|
142 // use active state machine routine to manage activites: |
|
143 switch(iState) |
|
144 { |
|
145 case EProcessing: |
|
146 { |
|
147 ProcessingPushMsgEntryL(); |
|
148 break; |
|
149 } |
|
150 case EDone: |
|
151 { |
|
152 Complete(KErrNone); |
|
153 break; |
|
154 } |
|
155 default: |
|
156 { |
|
157 break; |
|
158 } |
|
159 } |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CWPHandler::RunError |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 TInt CWPHandler::RunError(TInt aError) |
|
167 { |
|
168 FLOG( _L( "CWPHandler::RunError" ) ); |
|
169 FTRACE(RDebug::Print(_L("[Provisioning] CWPHandler::RunError (%d)"), aError)); |
|
170 |
|
171 iState = EDone; |
|
172 Complete(aError); |
|
173 return KErrNone; |
|
174 } |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // CWPHandler::ProcessingPushMsgEntryL |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 void CWPHandler::ProcessingPushMsgEntryL() |
|
181 { |
|
182 FLOG( _L( "CWPHandler::ProcessingPushMsgEntryL: Processing message" ) ); |
|
183 |
|
184 CWPMessage* message = CWPMessage::NewL( *iMessage ); |
|
185 CleanupStack::PushL( message ); |
|
186 message->ProcessL(); |
|
187 CleanupStack::PopAndDestroy(); |
|
188 |
|
189 FLOG( _L( "CWPHandler::ProcessingPushMsgEntryL: Processed message" ) ); |
|
190 |
|
191 iState = EDone; |
|
192 IdleComplete(); |
|
193 } |
|
194 |
|
195 // End of File |