|
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: Verifier plug-in which derives from CPosPrivacyNotifier. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 |
|
21 #include <lbs/epos_cposprivacynotifier.h> |
|
22 #include <lbs/epos_privacy.h> |
|
23 #include <lbs/epos_cposrequestor.h> |
|
24 |
|
25 |
|
26 #include "lpdrequestao.h" |
|
27 #include "lpdresulthandler.h" |
|
28 #include "lpdperiodicreqinfo.h" |
|
29 #include "lpdperiodicprocessor.h" |
|
30 |
|
31 |
|
32 #ifndef CLPDVERIFIERDLG_H |
|
33 #define CLPDVERIFIERDLG_H |
|
34 |
|
35 // SYSTEM INCLUDE |
|
36 #include <bldvariant.hrh> // For the 3.2 Flag |
|
37 |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CLpdVerifierQueryLauncher; |
|
41 class CLpdNotifierQueryLauncher; |
|
42 class CEikonEnv; |
|
43 class CLpdRequestorProcessor; |
|
44 class RPosRequestorStack; |
|
45 class CLocRequestorUtilsResolver; |
|
46 class CLpdPeriodicProcessor; |
|
47 |
|
48 |
|
49 // CLASS DECLARATION |
|
50 |
|
51 /** |
|
52 * Verifier plug-in which derives from CPosPrivacyNotifier. |
|
53 * Notifiers are based on RNotifier framework, and this particular |
|
54 * notifier is used to launch a privacy query for accepting/rejecting |
|
55 * privacy requests. It also shows informational notes and error |
|
56 * messages, which are received as notification. |
|
57 * |
|
58 * @lib locverifierdlg.lib |
|
59 * @since 2.1 |
|
60 */ |
|
61 class CLpdVerifierPlugin : public CPosPrivacyNotifier, public MLpdResultHandler, |
|
62 public MLpdPeriodicRequestObserver |
|
63 { |
|
64 // To allow calls to HandleNextRequest() from active object |
|
65 friend class CLpdRequestAO; |
|
66 |
|
67 private: |
|
68 |
|
69 /** |
|
70 * Enumeration for defining the type of Verification or notification |
|
71 * request |
|
72 */ |
|
73 enum TDialogType |
|
74 { |
|
75 EVerificationRequest, |
|
76 ENotification, |
|
77 ENotificationTimeout, |
|
78 ECancelNotification, |
|
79 ESuplPeriodicNotification, |
|
80 }; |
|
81 |
|
82 public: // Constructors and destructor |
|
83 |
|
84 /** |
|
85 * Two-phased constructor. |
|
86 * @return created object |
|
87 */ |
|
88 static CLpdVerifierPlugin* NewL(); |
|
89 |
|
90 /** |
|
91 * Destructor. |
|
92 */ |
|
93 virtual ~CLpdVerifierPlugin(); |
|
94 |
|
95 /** |
|
96 * To popup a notification note for verification cancellation event. |
|
97 */ |
|
98 void NotifyCancellationL( |
|
99 TPosRequestSource aSource, |
|
100 TPosVerifyCancelReason aReason, |
|
101 TPosRequestDecision aDecision, |
|
102 const RPosRequestorStack& aRequestors ); |
|
103 |
|
104 /** |
|
105 * Method for cancelling query or freeing |
|
106 * resources after finishing query. |
|
107 */ |
|
108 void FreeQueryResources(); |
|
109 |
|
110 public: // Functions from base classes |
|
111 |
|
112 /** |
|
113 * From CPosPrivacyNotifier, called when a new request arrives. |
|
114 * @param aRequestId identifier of received request |
|
115 */ |
|
116 void HandleNewRequestL( TPosQNRequestId aRequestId ); |
|
117 |
|
118 /** |
|
119 * From CPosPrivacyNotifier, called when request has been cancelled |
|
120 * @param aRequestId identifier of cancelled request |
|
121 */ |
|
122 void HandleRequestCancelled( TPosQNRequestId aRequestId ); |
|
123 |
|
124 /** |
|
125 * From CPosPrivacyNotifier, called when all requests are cancelled. |
|
126 */ |
|
127 void HandleAllRequestCancelled(); |
|
128 |
|
129 /** |
|
130 * From MLpdResultHandler, called when verification result is available. |
|
131 * @param aResultCode |
|
132 */ |
|
133 void HandleVerificationResultL( TInt aResultCode ); |
|
134 |
|
135 /** |
|
136 * From MLpdResultHandler, called when notification has been done. |
|
137 * @param aResultCode |
|
138 */ |
|
139 void HandleNotificationResultL( TInt aResultCode ); |
|
140 |
|
141 /** |
|
142 * From MLpdResultHandler, called if leave occurred in callback method |
|
143 * @param aError code |
|
144 */ |
|
145 void HandleLeave( TInt aError ); |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 protected: // New functions |
|
151 |
|
152 /** |
|
153 * Non-leaving internal method for handling next pending request. |
|
154 */ |
|
155 void HandleNextRequest(); |
|
156 |
|
157 /** |
|
158 * Internal method for handling next pending request. |
|
159 */ |
|
160 void HandleNextRequestL(); |
|
161 |
|
162 /** |
|
163 * Internal helper method used by HandleNextRequestL(). |
|
164 */ |
|
165 void HandleNextVerificationL(); |
|
166 |
|
167 /** |
|
168 * Internal helper method used by HandleNextRequestL(). |
|
169 */ |
|
170 void HandleNextNotificationL(); |
|
171 |
|
172 /** |
|
173 * Internal helper method used by HandleNextNotificationL(). |
|
174 */ |
|
175 void HandleNextNonPeriodicNotificationL(); |
|
176 |
|
177 /** |
|
178 * Internal helper method used by HandleNextNotificationL(). |
|
179 */ |
|
180 void HandleNextPeriodicNotificationL(); |
|
181 |
|
182 /** |
|
183 * Internal helper method. |
|
184 */ |
|
185 void NotifyCancellationL( TPosRequestSource aSource, |
|
186 TPosVerifyCancelReason aReason, |
|
187 TPosRequestDecision aDecision ); |
|
188 |
|
189 /** |
|
190 * Internal helper method. |
|
191 * Completes current request and continues queue handling. |
|
192 */ |
|
193 void CompleteCurrentAndContinue( TInt aResultCode ); |
|
194 |
|
195 /** |
|
196 * Handles assert errors. Panics in debug build but leaves in release |
|
197 * build, as this component runs in EikSrv and must never panic. |
|
198 */ |
|
199 void HandleAssertErrorL() const; |
|
200 |
|
201 /** |
|
202 * Panics in debug build but does nothing in release build. |
|
203 */ |
|
204 void HandleDebugAssertError() const; |
|
205 |
|
206 /** |
|
207 * Handle the request if it is periodic. |
|
208 */ |
|
209 void EnqueIfPeriodicL(TPosQNRequestId aRequestId); |
|
210 |
|
211 /** |
|
212 * From MLperiodicRequestObserver, called if the currently |
|
213 * displayed notifier has to be updated |
|
214 * @param aError code |
|
215 */ |
|
216 void UpdateCurrentNotifierL(); |
|
217 |
|
218 /** |
|
219 * Gets session id of request |
|
220 * @param aSessionId The session id |
|
221 */ |
|
222 void GetSessionIdL( TInt64& aSessionId ); |
|
223 |
|
224 private: |
|
225 |
|
226 /** |
|
227 * C++ default constructor. |
|
228 */ |
|
229 CLpdVerifierPlugin(); |
|
230 |
|
231 /** |
|
232 * By default Symbian 2nd phase constructor is private. |
|
233 */ |
|
234 void ConstructL(); |
|
235 |
|
236 /** |
|
237 * Starts the Query dialog |
|
238 * @param aQueryDialog Query dialog that has to be started |
|
239 * @param aDialogType Dialog type |
|
240 * @param aDecision Decision Type |
|
241 */ |
|
242 void StartQueryDialogL( CLpdQueryLauncherBase* aQueryDialog, |
|
243 TDialogType aDialogType, |
|
244 TPosRequestDecision aDecision ); |
|
245 |
|
246 /** |
|
247 * Packs the Requestor buffer to send across to Cover UI. The |
|
248 * ownership of the buffer is transferred back to the callee |
|
249 * @return CBufFlat* Flat buffer containing the list of requestors |
|
250 */ |
|
251 CBufFlat* PackRequestorBufferL(); |
|
252 |
|
253 /** |
|
254 * Determines the Cover UI command corresponding to a paricular |
|
255 * request |
|
256 * @param TDialogType Request Type |
|
257 * @param TPosRequestDecision Decision Type |
|
258 * @return TInt Cover UI Command ID. |
|
259 */ |
|
260 TInt CoverUICommandL( TDialogType aRequestType, |
|
261 TPosRequestDecision aDecision ); |
|
262 |
|
263 /** |
|
264 * Checks the type of request and helps to know |
|
265 * if a given request is of SUPL periodic type |
|
266 * @param aCurrentRequest request id |
|
267 * @return CPosRequestor::TRequestType type of request enum |
|
268 */ |
|
269 CPosRequestor::TRequestType CheckRequestTypeL(); |
|
270 |
|
271 |
|
272 private: // Data |
|
273 |
|
274 // Cancellation info needed if cancel handling is postponed |
|
275 class TCancelInfo |
|
276 { |
|
277 public: |
|
278 TBool iCancelled; |
|
279 TPosVerifyCancelReason iReason; |
|
280 TPosRequestDecision iDecision; |
|
281 TPosRequestSource iSource; |
|
282 }; |
|
283 |
|
284 // Cancellation info needed if verification query is cancelled |
|
285 // during rule query and handling is therefore postponed |
|
286 TCancelInfo iCancelInfo; |
|
287 |
|
288 // Identifier of currently handled request |
|
289 TPosQNRequestId iCurrentRequest; |
|
290 |
|
291 // Type of the current request, valid if iCurrentRequest valid |
|
292 TRequestType iCurrentRequestType; |
|
293 |
|
294 // Result code of verifier query, needed if user cancels rule query |
|
295 TInt iVerifyResult; |
|
296 |
|
297 // Resource file needs to be explicitely added |
|
298 // to the environment. Adding returns an offset value. |
|
299 TInt iResourceOffset; |
|
300 |
|
301 // Location request accept/reject query object |
|
302 CLpdVerifierQueryLauncher* iVerifierQuery; // owns |
|
303 |
|
304 // Location request accept/reject query object |
|
305 CLpdNotifierQueryLauncher* iNotifier; // owns |
|
306 |
|
307 // Active object, used to let requests run to |
|
308 // completion instead of recursive calls. |
|
309 CLpdRequestAO* iRequestActiveObject; // owns |
|
310 |
|
311 CLpdRequestorProcessor* iRtorProcessor; // owns |
|
312 |
|
313 CLocRequestorUtilsResolver* iUtils; // owns |
|
314 |
|
315 CLpdPeriodicProcessor* iPeriodicProcessor; // owns |
|
316 |
|
317 RArray<TLpdPeriodicReqInfo> iPeriodicNotQue; // owns |
|
318 |
|
319 CEikonEnv* iEnv; // uses |
|
320 |
|
321 }; |
|
322 |
|
323 #endif // CLPDVERIFIERDLG_H |
|
324 |
|
325 // End of File |