|
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 // INCLUDE FILES |
|
19 #include <eikenv.h> |
|
20 #include <eiknotapi.h> |
|
21 #include <AknIconArray.h> |
|
22 #include <apgcli.h> |
|
23 #include <lbs/epos_rposrequestorstack.h> |
|
24 #include <epos_csuplsettingsconstants.h> |
|
25 #include <StringLoader.h> |
|
26 #include <locverifierdlg.rsg> |
|
27 #include "lpdverifierplugin.h" |
|
28 #include "lpdrequestao.h" |
|
29 #include "lpdrequestorprocessor.h" |
|
30 #include "lpdverifierquerylauncher.h" |
|
31 #include "lpdnotifierquerylauncher.h" |
|
32 #include "lpdbasemodel.h" |
|
33 #include "locconsts.h" |
|
34 #include "locverifierdlgdebug.h" |
|
35 #include "locfileutils.h" |
|
36 #include "locrequestorutilsresolver.h" |
|
37 #include "lpdperiodicprocessor.h" |
|
38 |
|
39 // INCLUDE FILES |
|
40 #include <s32mem.h> |
|
41 #include "locphonenumberformat.h" |
|
42 #include "locverifiercoverui.h" |
|
43 // CONSTANTS |
|
44 |
|
45 // The Increment size for the package buffer used for packing the descriptors |
|
46 const TInt KReqBufferIncrSize = 256; |
|
47 const TInt KLpdItemArrayGranularity = 50; |
|
48 |
|
49 const TInt KNonPeriodicRequest = 0; |
|
50 const TInt KPeriodicRequest = 1; |
|
51 |
|
52 const TInt KNotifyMessageLength = 300; |
|
53 |
|
54 // CONSTANTS |
|
55 |
|
56 // Unnamed namespace for local definitions |
|
57 |
|
58 const MEikSrvNotifierBase2::TNotifierPriority KNotifierPriority = |
|
59 MEikSrvNotifierBase2::ENotifierPriorityHigh; |
|
60 const TUid KNotifierChannel = |
|
61 { |
|
62 0x100065ac |
|
63 }; |
|
64 _LIT_SECURE_ID(KUikonSrvSecureId,0x10003a4a); |
|
65 #ifdef _DEBUG |
|
66 _LIT( KPanicText, "CLpdVerifierPlugin" ); |
|
67 enum TPanicCode |
|
68 { |
|
69 KLpdErrGeneral = 1 |
|
70 }; |
|
71 #endif |
|
72 |
|
73 // ============================ MEMBER FUNCTIONS =============================== |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CLpdVerifierPlugin::CLpdVerifierPlugin |
|
77 // C++ default constructor can NOT contain any code, that |
|
78 // might leave. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 CLpdVerifierPlugin::CLpdVerifierPlugin() : |
|
82 iCurrentRequest(KPosNullQNRequestId), iPeriodicNotQue( |
|
83 KLpdItemArrayGranularity) |
|
84 |
|
85 { |
|
86 iEnv = CEikonEnv::Static(); |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CLpdVerifierPlugin::ConstructL |
|
91 // Symbian 2nd phase constructor can leave. |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 void CLpdVerifierPlugin::ConstructL() |
|
95 { |
|
96 BaseConstructL(KNotifierChannel, KNotifierPriority); |
|
97 |
|
98 TFileName* resourceFile = new (ELeave) TFileName; |
|
99 CleanupStack::PushL(resourceFile); |
|
100 // these appends are always safe: |
|
101 resourceFile->Append(KLocNotifierRscPath); |
|
102 resourceFile->Append(KLocVerifierRscFileName); |
|
103 TFileName* dllDrive = new (ELeave) TFileName; |
|
104 CleanupStack::PushL(dllDrive); |
|
105 Dll::FileName(*dllDrive); |
|
106 LocFileUtils::GetNearestLanguageFileL(iEnv->FsSession(), *dllDrive, |
|
107 *resourceFile); |
|
108 CleanupStack::PopAndDestroy(dllDrive); |
|
109 iResourceOffset = iEnv->AddResourceFileL(*resourceFile); |
|
110 CleanupStack::PopAndDestroy(resourceFile); |
|
111 |
|
112 iRtorProcessor = CLpdRequestorProcessor::NewL(); |
|
113 iPeriodicProcessor = CLpdPeriodicProcessor::NewL( *this ); |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CLpdVerifierPlugin::NewL |
|
118 // Two-phased constructor. |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 CLpdVerifierPlugin* CLpdVerifierPlugin::NewL() |
|
122 { |
|
123 CLpdVerifierPlugin* self = new (ELeave) CLpdVerifierPlugin; |
|
124 |
|
125 CleanupStack::PushL(self); |
|
126 self->ConstructL(); |
|
127 CleanupStack::Pop(self); |
|
128 |
|
129 return self; |
|
130 } |
|
131 |
|
132 // Destructor |
|
133 CLpdVerifierPlugin::~CLpdVerifierPlugin() |
|
134 { |
|
135 // Destruction of this plugin should only occur only in shutdown |
|
136 // or in severe problem situation. |
|
137 |
|
138 // A very special scenario is that base class construction leaves and |
|
139 // this destructor is called. In that case CompleteAllRequests() causes |
|
140 // access violation (noticed this by checking source code of base class). |
|
141 if (NotifierBase()) |
|
142 { // base class has been fully constructed, method call is safe |
|
143 CompleteAllRequests(KErrGeneral); |
|
144 } |
|
145 |
|
146 // It is enough to delete queries so when don't get callbacks. |
|
147 FreeQueryResources(); |
|
148 iPeriodicNotQue.Close(); |
|
149 delete iPeriodicProcessor; |
|
150 delete iRequestActiveObject; |
|
151 delete iRtorProcessor; |
|
152 iEnv->DeleteResourceFile(iResourceOffset); |
|
153 } |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // CLpdVerifierPlugin::HandleNewRequestL |
|
157 // (other items were commented in a header). |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 void CLpdVerifierPlugin::HandleNewRequestL(TPosQNRequestId aRequestId) |
|
161 { |
|
162 EnqueIfPeriodicL(aRequestId); |
|
163 // Check whether the notifier is already handling a request |
|
164 // If yes, do nothing for now. |
|
165 if (iRequestActiveObject) |
|
166 { |
|
167 return; |
|
168 } |
|
169 else |
|
170 { |
|
171 iRequestActiveObject = CLpdRequestAO::NewL(*this); |
|
172 iRequestActiveObject->ScheduleRequest(); |
|
173 } |
|
174 } |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // CLpdVerifierPlugin::EnqueIfPeriodicL |
|
178 // (other items were commented in a header). |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 void CLpdVerifierPlugin::EnqueIfPeriodicL(TPosQNRequestId aRequestId) |
|
182 { |
|
183 SetCurrentRequestL(aRequestId); |
|
184 TRequestType requestType = RequestTypeL(aRequestId); |
|
185 CPosRequestor::TRequestType requestorType = CheckRequestTypeL(); |
|
186 |
|
187 if (requestType == ENotification && requestorType |
|
188 == CPosRequestor::ERequestPeriodic) |
|
189 { |
|
190 TInt64 sessionId = -1; |
|
191 GetSessionIdL( sessionId ); |
|
192 |
|
193 TLpdPeriodicReqInfo newReq(aRequestId, sessionId); |
|
194 |
|
195 if (iPeriodicProcessor) |
|
196 { |
|
197 if (iPeriodicProcessor->GetSessionId() == sessionId) |
|
198 { |
|
199 CompleteRequest(aRequestId, KErrNone); |
|
200 } |
|
201 return; |
|
202 } |
|
203 else |
|
204 { |
|
205 TIdentityRelation<TLpdPeriodicReqInfo> matcher( |
|
206 TLpdPeriodicReqInfo::MatchSession); |
|
207 TInt index = iPeriodicNotQue.Find(newReq, matcher); |
|
208 |
|
209 // Remove if it was present in Que |
|
210 if (index == KErrNotFound) |
|
211 { |
|
212 iPeriodicNotQue.Append(newReq); |
|
213 } |
|
214 else |
|
215 { |
|
216 CompleteRequest(aRequestId, KErrNone); |
|
217 } |
|
218 } |
|
219 } |
|
220 |
|
221 if (KPosNullQNRequestId != iCurrentRequest) |
|
222 SetCurrentRequestL(iCurrentRequest); |
|
223 } |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 // CLpdVerifierPlugin::HandleRequestCancelled |
|
227 // (other items were commented in a header). |
|
228 // ----------------------------------------------------------------------------- |
|
229 // |
|
230 void CLpdVerifierPlugin::HandleRequestCancelled(TPosQNRequestId aRequestId) |
|
231 { |
|
232 // Check whether the request is coming from Uikon Server. |
|
233 // If not reject this request. |
|
234 if (!CheckClientSecureId(KUikonSrvSecureId)) |
|
235 { |
|
236 return; |
|
237 } |
|
238 |
|
239 // This method is called for Verification Query Cancellation. |
|
240 // There are 2 scenarios when the cancellation can come. |
|
241 // 1. The verification query for which the cancellation is done is |
|
242 // currently is running |
|
243 // 2. The verification query is not running currently but is in the |
|
244 // requests Queue maintained by the base class. |
|
245 // |
|
246 // Case 1 : |
|
247 // |
|
248 // If there is a Verification query currently running and the requestId |
|
249 // matches then the cancel notificaiton has to be popped up. |
|
250 // |
|
251 // Case 2 : |
|
252 // |
|
253 // 1. A Verification query was popped up. |
|
254 // 2. The network timed out and sent a cancel request which popped |
|
255 // up a notification request. |
|
256 // 3. The network sends another verification query in the mean time |
|
257 // and also cancels it. The resulting notification dialog will |
|
258 // not be run since there is still a notification that has not |
|
259 // been dismissed by the user. |
|
260 // |
|
261 // Hence in case 2 the notification information is maintained in a Que |
|
262 // in the iRequestActiveObject. Once the current notification dialog |
|
263 // closes and there are no more verification dialogs pending, the |
|
264 // notification dialogs are run one after the other. |
|
265 |
|
266 if (aRequestId != iCurrentRequest) |
|
267 { |
|
268 if (aRequestId == KPosNullQNRequestId) |
|
269 { |
|
270 return; |
|
271 } |
|
272 //Put this new Notification Request on the queue and then process |
|
273 //it later from iRequestActiveObject(CLpdRequestAO class) RunL. |
|
274 RPosRequestorStack* requestors = NULL; |
|
275 TRAP_IGNORE( |
|
276 SetCurrentRequestL(aRequestId); |
|
277 // requestors is allocated in iRtorProcessor and ownership is finally |
|
278 // transferred to iRequestActiveObject. |
|
279 requestors = iRtorProcessor->RetrieveRequestorsL( *this ); |
|
280 // Enqueue the request to iRequestActiveObject |
|
281 iRequestActiveObject->EnqueueRequestL(RequestSource(), |
|
282 CancelReason(), |
|
283 QueryTimeoutStrategy(), |
|
284 requestors);); |
|
285 return; |
|
286 } |
|
287 |
|
288 iCancelInfo.iCancelled = ETrue; |
|
289 iCancelInfo.iReason = CancelReason(); |
|
290 iCancelInfo.iDecision = QueryTimeoutStrategy(); |
|
291 iCancelInfo.iSource = RequestSource(); |
|
292 |
|
293 if (iCurrentRequestType == EQuery) |
|
294 { // Verification was cancelled |
|
295 __ASSERT_DEBUG( iVerifierQuery, HandleDebugAssertError() ); |
|
296 __ASSERT_DEBUG( !iNotifier, HandleDebugAssertError() ); |
|
297 iVerifierQuery->Cancel(); |
|
298 } |
|
299 else |
|
300 { |
|
301 // It must be a notification then, this case is not probable but |
|
302 // we can cancel the dialog if this would happen. |
|
303 __ASSERT_DEBUG( iCurrentRequestType == ENotification, |
|
304 HandleDebugAssertError() ); |
|
305 __ASSERT_DEBUG( !iVerifierQuery, HandleDebugAssertError() ); |
|
306 __ASSERT_DEBUG( iNotifier, HandleDebugAssertError() ); |
|
307 iNotifier->Cancel(); |
|
308 } |
|
309 } |
|
310 |
|
311 // ----------------------------------------------------------------------------- |
|
312 // CLpdVerifierPlugin::HandleAllRequestCancelled |
|
313 // (other items were commented in a header). |
|
314 // ----------------------------------------------------------------------------- |
|
315 // |
|
316 void CLpdVerifierPlugin::HandleAllRequestCancelled() |
|
317 { |
|
318 if (iCurrentRequest != KPosNullQNRequestId) |
|
319 { // current request requires some specific behavior |
|
320 HandleRequestCancelled(iCurrentRequest); |
|
321 } |
|
322 // Note that ScheduleRequest in the end of HandleRequestCancelled() allows |
|
323 // current call chain run to completion and resources are released after |
|
324 // that. Pending requests have been completed so they won't be processed. |
|
325 } |
|
326 |
|
327 // ----------------------------------------------------------------------------- |
|
328 // CLpdVerifierPlugin::HandleVerificationResultL |
|
329 // (other items were commented in a header). |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 void CLpdVerifierPlugin::HandleVerificationResultL(TInt aResultCode) |
|
333 { |
|
334 iVerifyResult = aResultCode; |
|
335 |
|
336 LOCVERIFIERDLGDEBUG1( "CLpdVerifierPlugin::HandleVerificationResultL(%d)", |
|
337 iVerifyResult ); |
|
338 |
|
339 switch (iVerifyResult) |
|
340 { |
|
341 case KErrNone: // fall through |
|
342 case KErrAccessDenied: |
|
343 { |
|
344 // No need for rules now in 3.0 |
|
345 break; |
|
346 } |
|
347 case KErrTimedOut: |
|
348 { // UI's internal timer expired |
|
349 break; |
|
350 } |
|
351 case KErrCancel: |
|
352 { |
|
353 __ASSERT_DEBUG( iCancelInfo.iCancelled, HandleAssertErrorL() ); |
|
354 NotifyCancellationL(iCancelInfo.iSource, iCancelInfo.iReason, |
|
355 iCancelInfo.iDecision); |
|
356 |
|
357 return; // don't handle next req. yet |
|
358 } |
|
359 case KErrAbort: // This is used for emergency call support |
|
360 { |
|
361 CompleteAllRequests(iVerifyResult); |
|
362 // ScheduleRequest() allows the current call chain |
|
363 // run to completion and resources are released after that. |
|
364 iRequestActiveObject->ScheduleRequest(); |
|
365 return; |
|
366 } |
|
367 default: |
|
368 { |
|
369 iEnv->HandleError(iVerifyResult); |
|
370 break; |
|
371 } |
|
372 } |
|
373 |
|
374 CompleteCurrentAndContinue(iVerifyResult); // this request was handled |
|
375 } |
|
376 // ----------------------------------------------------------------------------- |
|
377 // CLpdVerifierPlugin::HandleNotificationResultL |
|
378 // (other items were commented in a header). |
|
379 // ----------------------------------------------------------------------------- |
|
380 // |
|
381 void CLpdVerifierPlugin::HandleNotificationResultL(TInt aResultCode) |
|
382 { |
|
383 |
|
384 TLpdPeriodicReqInfo newReq(iCurrentRequest, -1); |
|
385 TIdentityRelation<TLpdPeriodicReqInfo> matcher( |
|
386 TLpdPeriodicReqInfo::MatchPrivacy); |
|
387 TInt index = iPeriodicNotQue.Find(newReq, matcher); |
|
388 |
|
389 // Remove if it was present in Que |
|
390 if (index != KErrNotFound) |
|
391 { |
|
392 iPeriodicNotQue.Remove(index); |
|
393 } |
|
394 CompleteRequest(iCurrentRequest, aResultCode); |
|
395 iCurrentRequest = KPosNullQNRequestId; |
|
396 |
|
397 switch (aResultCode) |
|
398 { |
|
399 case KErrNone: // fall through |
|
400 case KErrTimedOut: // fall through |
|
401 { |
|
402 break; |
|
403 } |
|
404 case KErrCancel: |
|
405 { |
|
406 break; |
|
407 } |
|
408 case KErrAbort: // This is used for emergency call support |
|
409 { |
|
410 CompleteAllRequests(aResultCode); |
|
411 // ScheduleRequest() -> allows the current call chain |
|
412 // run to completion and resources are released after that. |
|
413 break; |
|
414 } |
|
415 default: |
|
416 { |
|
417 iEnv->HandleError(aResultCode); |
|
418 break; |
|
419 } |
|
420 } |
|
421 |
|
422 iRequestActiveObject->ScheduleRequest(); // handle next req. |
|
423 } |
|
424 |
|
425 // ----------------------------------------------------------------------------- |
|
426 // CLpdVerifierPlugin::HandleLeave |
|
427 // (other items were commented in a header). |
|
428 // ----------------------------------------------------------------------------- |
|
429 // |
|
430 void CLpdVerifierPlugin::HandleLeave(TInt aError) |
|
431 { |
|
432 LOCVERIFIERDLGDEBUG1( "CLpdVerifierPlugin::HandleLeave(%d)", aError); |
|
433 // In this case user needs feedback about the error situation: |
|
434 iEnv->HandleError(aError); |
|
435 |
|
436 // In case of leave current request is completed with |
|
437 // iVerifyResult, but queue handling is still continued. |
|
438 // iVerifyResult is better completion code for request than aError. |
|
439 CompleteCurrentAndContinue(iVerifyResult); |
|
440 } |
|
441 |
|
442 // ----------------------------------------------------------------------------- |
|
443 // CLpdVerifierPlugin::HandleNextRequest |
|
444 // (other items were commented in a header). |
|
445 // ----------------------------------------------------------------------------- |
|
446 // |
|
447 void CLpdVerifierPlugin::HandleNextRequest() |
|
448 { |
|
449 TRAPD( err, HandleNextRequestL() ); |
|
450 if (err) |
|
451 { |
|
452 // In case of leave current request is completed with |
|
453 // error code, but queue handling is still continued. |
|
454 |
|
455 // If we couldn't start handling the request it is |
|
456 // better not to confuse user with an error note. |
|
457 |
|
458 CompleteCurrentAndContinue(iVerifyResult); |
|
459 } |
|
460 } |
|
461 |
|
462 // ----------------------------------------------------------------------------- |
|
463 // CLpdVerifierPlugin::HandleNextRequestL |
|
464 // (other items were commented in a header). |
|
465 // ----------------------------------------------------------------------------- |
|
466 // |
|
467 void CLpdVerifierPlugin::HandleNextRequestL() |
|
468 { |
|
469 |
|
470 // It is better to free previous query resources here, because |
|
471 // now all callback methods have finished (active object allowed |
|
472 // run to completion) |
|
473 this->FreeQueryResources(); |
|
474 |
|
475 // Read the next request: |
|
476 RArray<TPosQNRequestId> requests; |
|
477 CleanupClosePushL(requests); |
|
478 GetRequestsL(requests); |
|
479 |
|
480 if (requests.Count() == 0) |
|
481 { // No more requests to handle |
|
482 CleanupStack::PopAndDestroy(); // requests |
|
483 // This is a very important step, it allows new requests |
|
484 // to flow in ( see HandleNewRequestL() ): |
|
485 delete iRequestActiveObject; |
|
486 iRequestActiveObject = NULL; |
|
487 return; |
|
488 } |
|
489 iCurrentRequest = requests[0]; |
|
490 CleanupStack::PopAndDestroy(); // requests |
|
491 SetCurrentRequestL(iCurrentRequest); |
|
492 |
|
493 // Check whether the request is coming from Uikon Server. If not reject this request. |
|
494 if (!CheckClientSecureId(KUikonSrvSecureId)) |
|
495 { |
|
496 CompleteCurrentAndContinue(KErrPermissionDenied); |
|
497 return; |
|
498 } |
|
499 |
|
500 // Check the request type |
|
501 iCurrentRequestType = RequestTypeL(iCurrentRequest); |
|
502 |
|
503 if ((CheckRequestTypeL() == CPosRequestor::ERequestPeriodic) |
|
504 && (iCurrentRequestType == ENotification)) |
|
505 iRtorProcessor->SetRequestType(KPeriodicRequest); |
|
506 else |
|
507 iRtorProcessor->SetRequestType(KNonPeriodicRequest); |
|
508 |
|
509 iRtorProcessor->ReadRequestorsL(*this); |
|
510 |
|
511 if (iCurrentRequestType == EQuery) |
|
512 { |
|
513 HandleNextVerificationL(); |
|
514 } |
|
515 else if (iCurrentRequestType == ENotification) |
|
516 { |
|
517 HandleNextNotificationL(); |
|
518 } |
|
519 else |
|
520 { |
|
521 User::Leave(KErrNotSupported); |
|
522 } |
|
523 } |
|
524 |
|
525 // ----------------------------------------------------------------------------- |
|
526 // CLpdVerifierPlugin::HandleNextVerificationL |
|
527 // (other items were commented in a header). |
|
528 // ----------------------------------------------------------------------------- |
|
529 // |
|
530 void CLpdVerifierPlugin::HandleNextVerificationL() |
|
531 { |
|
532 __ASSERT_DEBUG( iCurrentRequest != KPosNullQNRequestId, |
|
533 HandleAssertErrorL() ); |
|
534 __ASSERT_DEBUG( !iVerifierQuery, HandleAssertErrorL() ); |
|
535 TInt suplRequest; |
|
536 if (CheckRequestTypeL() == CPosRequestor::ERequestPeriodic) |
|
537 suplRequest = 1; |
|
538 else |
|
539 suplRequest = 0; |
|
540 |
|
541 TPosRequestSource source(RequestSource()); |
|
542 if (source == EPosRequestSourceNotAvailable) |
|
543 { |
|
544 CompleteCurrentAndContinue(KErrNone); |
|
545 } |
|
546 else |
|
547 { |
|
548 if(suplRequest) |
|
549 { |
|
550 iPeriodicProcessor->SetRequestorIdL( CurrentRequest() ); |
|
551 iPeriodicProcessor->SetRequestTypeL(iCurrentRequestType); |
|
552 |
|
553 CPosRequestor* req = NULL; |
|
554 if( RequestorCountL() ) |
|
555 { |
|
556 req = RequestorLC( 0 ); |
|
557 CleanupStack::Pop(); |
|
558 } |
|
559 iPeriodicProcessor->SetRequestorL( req ); |
|
560 |
|
561 } |
|
562 |
|
563 iVerifierQuery = CLpdVerifierQueryLauncher::NewL(*this); |
|
564 TPosRequestDecision decision(QueryTimeoutStrategy()); |
|
565 // Note that item is left in cleanupstack until StartQuery(): |
|
566 if (suplRequest) |
|
567 iVerifierQuery->PrepareSuplVerificationResourcesL(); |
|
568 else |
|
569 iVerifierQuery->PrepareVerificationResourcesL(source, decision); |
|
570 |
|
571 // Ownership of text is immediatelly transferred: |
|
572 CLpdBaseModel* requestors = iRtorProcessor->RtorNamesForVerifNotifL( |
|
573 iVerifierQuery->ListBoxL()); |
|
574 iVerifierQuery->SetQueryTextArray(requestors); |
|
575 |
|
576 // Start the Verification query |
|
577 StartQueryDialogL(iVerifierQuery, EVerificationRequest, decision); |
|
578 } |
|
579 } |
|
580 |
|
581 // ----------------------------------------------------------------------------- |
|
582 // CLpdVerifierPlugin::HandleNextNotificationL |
|
583 // (other items were commented in a header). |
|
584 // ----------------------------------------------------------------------------- |
|
585 // |
|
586 void CLpdVerifierPlugin::HandleNextNotificationL() |
|
587 { |
|
588 __ASSERT_DEBUG( iCurrentRequest != KPosNullQNRequestId, |
|
589 HandleAssertErrorL() ); |
|
590 |
|
591 if (CheckRequestTypeL() == CPosRequestor::ERequestPeriodic) |
|
592 HandleNextPeriodicNotificationL(); |
|
593 else |
|
594 HandleNextNonPeriodicNotificationL(); |
|
595 |
|
596 } |
|
597 // ----------------------------------------------------------------------------- |
|
598 // CLpdVerifierPlugin::HandleNextNonPeriodicNotificationL |
|
599 // (other items were commented in a header). |
|
600 // ----------------------------------------------------------------------------- |
|
601 // |
|
602 void CLpdVerifierPlugin::HandleNextNonPeriodicNotificationL() |
|
603 { |
|
604 __ASSERT_DEBUG( iCurrentRequest != KPosNullQNRequestId, |
|
605 HandleAssertErrorL() ); |
|
606 __ASSERT_DEBUG( !iNotifier, HandleAssertErrorL() ); |
|
607 |
|
608 if (RequestSource() != EPosRequestSourceNetwork) |
|
609 { // Notifications are supported only for network requests |
|
610 User::Leave(KErrNotSupported); |
|
611 } |
|
612 |
|
613 TPosNotificationReason reason = NotificationReason(); |
|
614 switch (reason) |
|
615 { |
|
616 // Decision without user's consent: |
|
617 case EPosDecisionByRequestSource: |
|
618 // Policy conflict, network timeout occurred before user's |
|
619 // response was received |
|
620 { |
|
621 |
|
622 TPosRequestDecision decision = LocationRequestDecision(); |
|
623 if(!iNotifier) |
|
624 iNotifier = CLpdNotifierQueryLauncher::NewL(*this); |
|
625 iNotifier->PrepareNotificationResourcesL(reason, decision); |
|
626 CLpdBaseModel* requestors = |
|
627 iRtorProcessor->RtorNamesForVerifNotifL( |
|
628 iNotifier->ListBoxL()); |
|
629 |
|
630 iNotifier->SetQueryTextArray(requestors); |
|
631 |
|
632 // Start the notification query |
|
633 StartQueryDialogL(iNotifier, ENotification, decision); |
|
634 break; |
|
635 } |
|
636 case EPosVerificationTimeout: |
|
637 { |
|
638 TPosRequestDecision decision = LocationRequestDecision(); |
|
639 if(!iNotifier) |
|
640 iNotifier = CLpdNotifierQueryLauncher::NewL(*this); |
|
641 iNotifier->PrepareNotificationResourcesL(reason, decision); |
|
642 CLpdBaseModel* requestors = |
|
643 iRtorProcessor->RtorNamesForVerifNotifL( |
|
644 iNotifier->ListBoxL()); |
|
645 iNotifier->SetQueryTextArray(requestors); |
|
646 |
|
647 // Start the notification query |
|
648 StartQueryDialogL(iNotifier, ENotificationTimeout, decision); |
|
649 |
|
650 break; |
|
651 } |
|
652 case EPosNotificationReasonNotAvailable: // fall through |
|
653 default: // Future extensions -> EPosNotificationReasonNotAvailable |
|
654 { |
|
655 User::Leave(KErrNotSupported); |
|
656 break; |
|
657 } |
|
658 } |
|
659 } |
|
660 |
|
661 // ----------------------------------------------------------------------------- |
|
662 // CLpdVerifierPlugin::HandleNextPeriodicNotificationL |
|
663 // (other items were commented in a header). |
|
664 // ----------------------------------------------------------------------------- |
|
665 // |
|
666 void CLpdVerifierPlugin::HandleNextPeriodicNotificationL() |
|
667 { |
|
668 __ASSERT_DEBUG( iCurrentRequest != KPosNullQNRequestId, |
|
669 HandleAssertErrorL() ); |
|
670 |
|
671 if (RequestSource() != EPosRequestSourceNetwork) |
|
672 { // Notifications are supported only for network requests |
|
673 User::Leave(KErrNotSupported); |
|
674 } |
|
675 |
|
676 TPosNotificationReason reason = NotificationReason(); |
|
677 |
|
678 switch (reason) |
|
679 { |
|
680 // Decision without user's consent: |
|
681 case EPosDecisionByRequestSource: |
|
682 // Policy conflict, network timeout occurred before user's |
|
683 // response was received |
|
684 { |
|
685 iPeriodicProcessor->SetRequestorIdL( CurrentRequest() ); |
|
686 iPeriodicProcessor->SetRequestTypeL(iCurrentRequestType); |
|
687 CPosRequestor* req = NULL; |
|
688 if( RequestorCountL() ) |
|
689 { |
|
690 req = RequestorLC( 0 ); |
|
691 CleanupStack::Pop(); |
|
692 } |
|
693 iPeriodicProcessor->SetRequestorL( req ); |
|
694 |
|
695 TPosRequestDecision decision = LocationRequestDecision(); |
|
696 |
|
697 if(!iNotifier) |
|
698 iNotifier = CLpdNotifierQueryLauncher::NewL(*this); |
|
699 |
|
700 TInt64 sessionId = -1; |
|
701 sessionId = iRtorProcessor->GetSessionId(); |
|
702 iPeriodicProcessor->SetSessionIdL(sessionId); |
|
703 |
|
704 HBufC* requestorName = NULL; |
|
705 if (iRtorProcessor->Requestors().Count() == 0) |
|
706 { |
|
707 requestorName = StringLoader::LoadL(R_LPD_UNKNOWN_REQUESTER); |
|
708 } |
|
709 else |
|
710 { |
|
711 const CPosRequestor& requestor = |
|
712 *(iRtorProcessor->Requestors())[1]; |
|
713 iUtils = CLocRequestorUtilsResolver::NewL(); |
|
714 requestorName = iUtils->RequestorNameL(requestor); |
|
715 if ((requestorName->Des()).CompareC(_L("Unknown")) == 0) |
|
716 { |
|
717 requestorName = NULL; |
|
718 requestorName = StringLoader::LoadL( |
|
719 R_LPD_UNKNOWN_REQUESTER); |
|
720 } |
|
721 delete iUtils; |
|
722 iUtils = NULL; |
|
723 } |
|
724 iPeriodicProcessor->SetRequestorNameL(requestorName); |
|
725 |
|
726 delete requestorName; |
|
727 iNotifier->PrepareSuplNotificationResourcesL(reason); |
|
728 |
|
729 HBufC* notifyMessage = HBufC::NewLC(KNotifyMessageLength); |
|
730 TRAPD( err, iPeriodicProcessor->NotificationMessageTextL(notifyMessage)); |
|
731 |
|
732 if (err == KErrNotFound) |
|
733 { |
|
734 CleanupStack::PopAndDestroy(); // notifyMessage |
|
735 CompleteCurrentAndContinue(err); |
|
736 } |
|
737 else |
|
738 { |
|
739 iNotifier->SetMessageQueryTextL(notifyMessage->Des(), |
|
740 iPeriodicProcessor->LinkCallBack()); |
|
741 |
|
742 CleanupStack::PopAndDestroy(); // notifyMessage |
|
743 // Start the notification query |
|
744 StartQueryDialogL(iNotifier, ESuplPeriodicNotification, |
|
745 decision); |
|
746 } |
|
747 break; |
|
748 } |
|
749 case EPosVerificationTimeout: |
|
750 { |
|
751 break; |
|
752 } |
|
753 case EPosNotificationReasonNotAvailable: // fall through |
|
754 default: // Future extensions -> EPosNotificationReasonNotAvailable |
|
755 { |
|
756 User::Leave(KErrNotSupported); |
|
757 break; |
|
758 } |
|
759 } |
|
760 } |
|
761 |
|
762 // ----------------------------------------------------------------------------- |
|
763 // CLpdVerifierPlugin::NotifyCancellationL |
|
764 // Helper method |
|
765 // ----------------------------------------------------------------------------- |
|
766 // |
|
767 void CLpdVerifierPlugin::NotifyCancellationL(TPosRequestSource aSource, |
|
768 TPosVerifyCancelReason aReason, TPosRequestDecision aDecision) |
|
769 { |
|
770 __ASSERT_DEBUG( iCurrentRequestType == EQuery, HandleAssertErrorL() ); |
|
771 |
|
772 if (aSource == EPosRequestSourceNetwork) |
|
773 { // Notifications supported only for network-originated requests |
|
774 |
|
775 switch (aReason) |
|
776 { |
|
777 case EPosCancelReasonTimeout: |
|
778 { |
|
779 __ASSERT_DEBUG( !iNotifier, HandleAssertErrorL() ); |
|
780 if(aDecision != EPosDecisionNotAvailable) |
|
781 { |
|
782 iNotifier = CLpdNotifierQueryLauncher::NewL( *this ); |
|
783 iNotifier->PrepareCancelNotifResourcesL( aDecision ); |
|
784 CLpdBaseModel* requestors = |
|
785 iRtorProcessor->RtorNamesForVerifNotifL( |
|
786 iNotifier->ListBoxL() ); |
|
787 iNotifier->SetQueryTextArray( requestors ); |
|
788 |
|
789 // Start the notification query |
|
790 StartQueryDialogL( iNotifier, |
|
791 ECancelNotification, |
|
792 aDecision ); |
|
793 |
|
794 return; |
|
795 } |
|
796 break; |
|
797 } |
|
798 case EPosCancelReasonNotAvailable: // fall through |
|
799 default: // future extensions -> EPosCancelReasonNotAvailable |
|
800 { |
|
801 break; |
|
802 } |
|
803 } |
|
804 } |
|
805 |
|
806 // If notification dialog was not launched, handle next request: |
|
807 iRequestActiveObject->ScheduleRequest(); |
|
808 |
|
809 } |
|
810 |
|
811 // ----------------------------------------------------------------------------- |
|
812 // CLpdVerifierPlugin::CompleteCurrentAndContinue |
|
813 // (other items were commented in a header). |
|
814 // ----------------------------------------------------------------------------- |
|
815 // |
|
816 void CLpdVerifierPlugin::CompleteCurrentAndContinue(TInt aResultCode) |
|
817 { |
|
818 if (iCurrentRequest != KPosNullQNRequestId) |
|
819 { |
|
820 CompleteRequest(iCurrentRequest, aResultCode); |
|
821 } |
|
822 iCurrentRequest = KPosNullQNRequestId; |
|
823 |
|
824 __ASSERT_DEBUG( iRequestActiveObject, HandleDebugAssertError() ); |
|
825 iRequestActiveObject->ScheduleRequest(); // handle next req. |
|
826 } |
|
827 |
|
828 // ----------------------------------------------------------------------------- |
|
829 // CLpdVerifierPlugin::FreeQueryResources |
|
830 // (other items were commented in a header). |
|
831 // ----------------------------------------------------------------------------- |
|
832 // |
|
833 void CLpdVerifierPlugin::FreeQueryResources() |
|
834 { |
|
835 if(iPeriodicProcessor) |
|
836 iPeriodicProcessor->ResetParameters(); |
|
837 iCurrentRequest = KPosNullQNRequestId; |
|
838 delete iVerifierQuery; |
|
839 iVerifierQuery = NULL; |
|
840 iVerifyResult = KErrGeneral; |
|
841 iCancelInfo.iCancelled = EFalse; |
|
842 delete iNotifier; |
|
843 iNotifier = NULL; |
|
844 if (iRtorProcessor) |
|
845 { // if already construction fails iRtorProcessor may |
|
846 // be NULL, otherwise it points to an instance. |
|
847 iRtorProcessor->ResetAndDestroyRequestors(); |
|
848 } |
|
849 } |
|
850 |
|
851 // ----------------------------------------------------------------------------- |
|
852 // CLpdVerifierPlugin::HandleAssertErrorL |
|
853 // (other items were commented in a header). |
|
854 // ----------------------------------------------------------------------------- |
|
855 // |
|
856 void CLpdVerifierPlugin::HandleAssertErrorL() const |
|
857 { |
|
858 #ifdef _DEBUG |
|
859 User::Panic(KPanicText, KLpdErrGeneral); |
|
860 #else |
|
861 User::Leave( KErrCorrupt ); |
|
862 #endif |
|
863 } |
|
864 |
|
865 // ----------------------------------------------------------------------------- |
|
866 // CLpdVerifierPlugin::HandleDebugAssertError |
|
867 // (other items were commented in a header). |
|
868 // ----------------------------------------------------------------------------- |
|
869 // |
|
870 void CLpdVerifierPlugin::HandleDebugAssertError() const |
|
871 { |
|
872 #ifdef _DEBUG |
|
873 User::Panic(KPanicText, KLpdErrGeneral); |
|
874 #endif |
|
875 } |
|
876 |
|
877 // ----------------------------------------------------------------------------- |
|
878 // CLpdVerifierPlugin::NotifyTimeoutL |
|
879 // Helper method |
|
880 // ----------------------------------------------------------------------------- |
|
881 // |
|
882 void CLpdVerifierPlugin::NotifyCancellationL( |
|
883 TPosRequestSource aSource, |
|
884 TPosVerifyCancelReason aReason, |
|
885 TPosRequestDecision aDecision, |
|
886 const RPosRequestorStack& aRequestors ) |
|
887 { |
|
888 if ( aSource == EPosRequestSourceNetwork ) |
|
889 { // Notifications supported only for network-originated requests |
|
890 |
|
891 switch ( aReason ) |
|
892 { |
|
893 case EPosCancelReasonTimeout: |
|
894 { |
|
895 __ASSERT_DEBUG( !iNotifier, HandleAssertErrorL() ); |
|
896 if(aDecision != EPosDecisionNotAvailable) |
|
897 { |
|
898 iNotifier = CLpdNotifierQueryLauncher::NewL( *this ); |
|
899 iNotifier->PrepareCancelNotifResourcesL( aDecision ); |
|
900 iRtorProcessor->ReadRequestorsL(aRequestors); |
|
901 CLpdBaseModel* requestors = |
|
902 iRtorProcessor->RtorNamesForVerifNotifL( |
|
903 iNotifier->ListBoxL() ); |
|
904 iNotifier->SetQueryTextArray( requestors ); |
|
905 |
|
906 // Start the notification query |
|
907 StartQueryDialogL( iNotifier, |
|
908 ECancelNotification, |
|
909 aDecision ); |
|
910 |
|
911 return; |
|
912 } |
|
913 break; |
|
914 } |
|
915 case EPosCancelReasonNotAvailable: // fall through |
|
916 default: // future extensions -> EPosCancelReasonNotAvailable |
|
917 { |
|
918 break; |
|
919 } |
|
920 } |
|
921 } |
|
922 |
|
923 // If notification dialog was not launched, handle next request: |
|
924 iRequestActiveObject->ScheduleRequest(); |
|
925 } |
|
926 |
|
927 // ----------------------------------------------------------------------------- |
|
928 // CLpdVerifierPlugin::StartQueryDialogL |
|
929 // Starts the Query dialog |
|
930 // @param aQueryDialog Query dialog that has to be started |
|
931 // @param aDialogType Dialog type |
|
932 // @param aDecision Decision Type |
|
933 // ----------------------------------------------------------------------------- |
|
934 void CLpdVerifierPlugin::StartQueryDialogL( |
|
935 CLpdQueryLauncherBase* aQueryDialog, TDialogType aDialogType, |
|
936 TPosRequestDecision aDecision) |
|
937 { |
|
938 // Set the Command ID |
|
939 TInt coverUiCmd = CoverUICommandL(aDialogType, aDecision); |
|
940 |
|
941 aQueryDialog->SetCoverUICommand(coverUiCmd); |
|
942 // Set the Requestor buffer |
|
943 CBufFlat* reqBuffer = PackRequestorBufferL(); |
|
944 CleanupStack::PushL(reqBuffer); |
|
945 |
|
946 TPtr8 reqBufferPtr(reqBuffer->Ptr(0)); |
|
947 aQueryDialog->SetRequestorBuffer(reqBufferPtr); |
|
948 |
|
949 if (aDialogType == ESuplPeriodicNotification) |
|
950 aQueryDialog->StartSuplPeriodicQueryL(); |
|
951 else |
|
952 aQueryDialog->StartQueryL(); |
|
953 |
|
954 CleanupStack::PopAndDestroy(reqBuffer); |
|
955 |
|
956 |
|
957 } |
|
958 |
|
959 // ----------------------------------------------------------------------------- |
|
960 // CLpdVerifierPlugin::PackRequestorBufferL |
|
961 // Packs the Requestor buffer to send across to Cover UI. The |
|
962 // ownership of the buffer is transferred back to the callee |
|
963 // @return CBufFlat* Flat buffer containing the list of requestors |
|
964 // ----------------------------------------------------------------------------- |
|
965 // |
|
966 CBufFlat* CLpdVerifierPlugin::PackRequestorBufferL() |
|
967 { |
|
968 // Construct the conversion buffers and the package buffer |
|
969 CBufFlat* requestorBuffer = CBufFlat::NewL(KReqBufferIncrSize); |
|
970 CleanupStack::PushL(requestorBuffer); |
|
971 |
|
972 // Opening a Write stream to assist in packing data onto CBufFlat |
|
973 RBufWriteStream writeStream; |
|
974 writeStream.Open(*requestorBuffer); |
|
975 CleanupClosePushL(writeStream); |
|
976 |
|
977 // Obtain the list of requestors from which the individual requestor |
|
978 // Ids can be obtained |
|
979 const RPointerArray<CPosRequestor>& requestors = |
|
980 iRtorProcessor->Requestors(); |
|
981 |
|
982 // The buffer is packed according to the below mentioned |
|
983 // format. |
|
984 // |
|
985 // | Count | Length(1) | String(1) | ..... | Length( Count ) | String( Count ) | |
|
986 // |
|
987 // where, |
|
988 // Count - ( 4 bytes ) - The number of requestor strings. |
|
989 // Length(n) - ( 4 bytes ) - Length of the nth requestor string. |
|
990 // String(n) - ( Length(n) * 2 bytes ) - String for the nth requestor. |
|
991 // |
|
992 // Each entry is packed one after another without any delimters between them |
|
993 // |
|
994 |
|
995 // Packing the count |
|
996 writeStream.WriteInt32L(requestors.Count()); |
|
997 |
|
998 for (TInt i = 0; i < requestors.Count(); i++) |
|
999 { |
|
1000 const CPosRequestor& req = *(requestors[i]); |
|
1001 |
|
1002 // Obtain the Requestor Id string |
|
1003 TPtrC reqStr = req.RequestorIdString(); |
|
1004 |
|
1005 // We need a 16 bit buffer for converting. Since the requestor strings that |
|
1006 // need to be packed have to always be of the UCS-2 ( UNICODE ) format. |
|
1007 // The buffer would be allocated just before copying the requestor content |
|
1008 HBufC16* conversionBuf = NULL; |
|
1009 TPtr16 conBufPtr(0, 0); |
|
1010 |
|
1011 // If the string is a phone number then it needs to be grouped and the |
|
1012 // converted to a UNICODE string. If not, then simpy convert it to |
|
1013 // a UNICODE string |
|
1014 if (CPosRequestor::EIdFormatPhoneNumber == req.RequestorIdFormat()) |
|
1015 { |
|
1016 // Creating the Phone number formatter for grouping |
|
1017 CLocPhoneNumberFormat* formatter = CLocPhoneNumberFormat::NewL(); |
|
1018 CleanupStack::PushL(formatter); |
|
1019 |
|
1020 HBufC* groupedName = NULL; |
|
1021 TRAPD( error, groupedName = formatter->PhoneNumberGroupL( reqStr )); |
|
1022 if (error || !groupedName) |
|
1023 { |
|
1024 // If there was a Leave in the grouping function or the |
|
1025 // grouping failed then pack the original name |
|
1026 |
|
1027 // Allocate the conversion buffer and copy the Requestor string |
|
1028 conversionBuf = HBufC16::NewL(reqStr.Length()); |
|
1029 conBufPtr.Set(conversionBuf->Des()); |
|
1030 |
|
1031 // Copy the original string to the conversion buffer |
|
1032 conBufPtr.Copy(reqStr); |
|
1033 } |
|
1034 else |
|
1035 { |
|
1036 // Take ownership of the grouped phone number buffer and |
|
1037 // copy it to the conversion buffer |
|
1038 CleanupStack::PushL(groupedName); |
|
1039 |
|
1040 TPtr groupedNamePtr = groupedName->Des(); |
|
1041 |
|
1042 // Allocate the conversion buffer and copy the Requestor string |
|
1043 conversionBuf = HBufC16::NewL(groupedNamePtr.Length()); |
|
1044 conBufPtr.Set(conversionBuf->Des()); |
|
1045 |
|
1046 // Copy the grouped string to the conversion buffer |
|
1047 conBufPtr.Copy(groupedNamePtr); |
|
1048 |
|
1049 CleanupStack::PopAndDestroy(groupedName); |
|
1050 } |
|
1051 |
|
1052 CleanupStack::PopAndDestroy(formatter); |
|
1053 } |
|
1054 else |
|
1055 { |
|
1056 // Copy the Requestor ID string |
|
1057 |
|
1058 // Allocate the conversion buffer and copy the Requestor string |
|
1059 conversionBuf = HBufC16::NewL(reqStr.Length()); |
|
1060 conBufPtr.Set(conversionBuf->Des()); |
|
1061 |
|
1062 // Copy the original string to the conversion buffer |
|
1063 conBufPtr.Copy(reqStr); |
|
1064 } |
|
1065 |
|
1066 // Push the Conversion buffer to the CleanupStack |
|
1067 CleanupStack::PushL(conversionBuf); |
|
1068 |
|
1069 // The conversion buffer now contains the string in the UNICODE |
|
1070 // format. First pack the length of the string and then the |
|
1071 // actual string itself |
|
1072 writeStream.WriteInt32L(conBufPtr.Length()); |
|
1073 |
|
1074 TUint8* buffer = (TUint8*) (conBufPtr.Ptr()); |
|
1075 writeStream.WriteL(buffer, conBufPtr.Size()); |
|
1076 |
|
1077 // Destroying the Conversion buffer before it goes out of scope |
|
1078 CleanupStack::PopAndDestroy(conversionBuf); |
|
1079 } |
|
1080 |
|
1081 // flush stream data to our buffer |
|
1082 writeStream.CommitL(); |
|
1083 CleanupStack::PopAndDestroy(&writeStream); |
|
1084 |
|
1085 // The ownership of the requestor buffer should be transferred to the callee |
|
1086 CleanupStack::Pop(requestorBuffer); |
|
1087 |
|
1088 return requestorBuffer; |
|
1089 } |
|
1090 |
|
1091 // ----------------------------------------------------------------------------- |
|
1092 // Determines the Cover UI command corresponding to a paricular |
|
1093 // request |
|
1094 // @param TRequestType Request Type |
|
1095 // @param TPosRequestDecision Decision Type |
|
1096 // @return TInt Cover UI Command ID. |
|
1097 // ----------------------------------------------------------------------------- |
|
1098 // |
|
1099 TInt CLpdVerifierPlugin::CoverUICommandL(TDialogType aRequestType, |
|
1100 TPosRequestDecision aDecision) |
|
1101 { |
|
1102 TInt result = 0; |
|
1103 |
|
1104 if (EVerificationRequest == aRequestType) |
|
1105 { |
|
1106 switch (aDecision) |
|
1107 { |
|
1108 case EPosDecisionAccepted: |
|
1109 { |
|
1110 result = ECmdDefaultAccept; |
|
1111 break; |
|
1112 } |
|
1113 case EPosDecisionRejected: |
|
1114 { |
|
1115 result = ECmdDefaultReject; |
|
1116 break; |
|
1117 } |
|
1118 default: |
|
1119 { |
|
1120 result = ECmdDefaultNone; |
|
1121 break; |
|
1122 } |
|
1123 } |
|
1124 } |
|
1125 else if ((ENotification == aRequestType) || (ESuplPeriodicNotification |
|
1126 == aRequestType)) |
|
1127 { |
|
1128 result = ECmdNotifyAccept; |
|
1129 } |
|
1130 else if (ENotificationTimeout == aRequestType) |
|
1131 { |
|
1132 switch (aDecision) |
|
1133 { |
|
1134 case EPosDecisionAccepted: |
|
1135 { |
|
1136 result = ECmdNotifyRejectFailure; |
|
1137 break; |
|
1138 } |
|
1139 case EPosDecisionRejected: |
|
1140 { |
|
1141 result = ECmdNotifyAcceptFailure; |
|
1142 break; |
|
1143 } |
|
1144 default: |
|
1145 { |
|
1146 User::Leave(KErrNotFound); |
|
1147 break; |
|
1148 } |
|
1149 } |
|
1150 } |
|
1151 else if (ECancelNotification == aRequestType) |
|
1152 { |
|
1153 switch (aDecision) |
|
1154 { |
|
1155 case EPosDecisionAccepted: |
|
1156 { |
|
1157 result = ECmdNotifyAcceptTimeout; |
|
1158 break; |
|
1159 } |
|
1160 case EPosDecisionRejected: |
|
1161 { |
|
1162 result = ECmdNotifyRejectTimeout; |
|
1163 break; |
|
1164 } |
|
1165 default: |
|
1166 { |
|
1167 User::Leave(KErrNotFound); |
|
1168 break; |
|
1169 } |
|
1170 } |
|
1171 } |
|
1172 else |
|
1173 { |
|
1174 User::Leave(KErrNotFound); |
|
1175 } |
|
1176 return result; |
|
1177 } |
|
1178 |
|
1179 // ----------------------------------------------------------------------------- |
|
1180 // CLpdVerifierPlugin::CheckRequestTypeL |
|
1181 // Checks the type of request and helps to know |
|
1182 // if a given request is of SUPL periodic type |
|
1183 // @param aCurrentRequest request id |
|
1184 // @return TRequestType type of request enum |
|
1185 // ----------------------------------------------------------------------------- |
|
1186 CPosRequestor::TRequestType CLpdVerifierPlugin::CheckRequestTypeL() |
|
1187 { |
|
1188 CPosRequestor::TRequestType reqType = CPosRequestor::ENetworkTypeUnknown; |
|
1189 if (RequestorCountL() > 0) |
|
1190 { |
|
1191 CPosRequestor* requestor = RequestorLC(0); |
|
1192 reqType = requestor->RequestType(); |
|
1193 CleanupStack::PopAndDestroy(requestor); |
|
1194 } |
|
1195 return reqType; |
|
1196 } |
|
1197 |
|
1198 // ----------------------------------------------------------------------------- |
|
1199 // CLpdVerifierPlugin::GetSessionIdL |
|
1200 // (other items were commented in a header). |
|
1201 // ----------------------------------------------------------------------------- |
|
1202 // |
|
1203 void CLpdVerifierPlugin::GetSessionIdL( TInt64& aSessionId ) |
|
1204 { |
|
1205 CPosRequestor* curRequestor = RequestorLC( 0 ); |
|
1206 TInt length = curRequestor->RequestorIdString().Length(); |
|
1207 TPtrC reqString(curRequestor->RequestorIdString().Mid( length - 3 )); |
|
1208 TLex temp(reqString); |
|
1209 temp.Val(aSessionId); |
|
1210 CleanupStack::PopAndDestroy( curRequestor ); |
|
1211 } |
|
1212 |
|
1213 // ----------------------------------------------------------------------------- |
|
1214 // CLpdVerifierPlugin::UpdateCurrentNotifierL |
|
1215 // (other items were commented in a header). |
|
1216 // ----------------------------------------------------------------------------- |
|
1217 // |
|
1218 void CLpdVerifierPlugin::UpdateCurrentNotifierL() |
|
1219 { |
|
1220 // Confirm if the current request type is Notification before |
|
1221 // processing/updating. |
|
1222 |
|
1223 __ASSERT_DEBUG( iCurrentRequestType == ENotification, |
|
1224 HandleDebugAssertError() ); |
|
1225 __ASSERT_DEBUG( iPeriodicProcessor, HandleDebugAssertError() ); |
|
1226 if(iNotifier) |
|
1227 iNotifier->CancelQuietly(); |
|
1228 HandleNextPeriodicNotificationL(); |
|
1229 |
|
1230 } |
|
1231 |
|
1232 // End of File |