|
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: |
|
15 * Bio control for Provisioning documents. |
|
16 * |
|
17 */ |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CWPBioControl.h" |
|
21 #include <msvapi.h> |
|
22 #include <bldvariant.hrh> |
|
23 #include <msvids.h> |
|
24 #include <featmgr.h> |
|
25 #include <sysutil.h> |
|
26 #include <CWPEngine.h> |
|
27 #include <CWPAdapter.h> |
|
28 #include <MWPPhone.h> |
|
29 #include <WPPhoneFactory.h> |
|
30 #include <CWPPushMessage.h> |
|
31 #include "ProvisioningUIDs.h" |
|
32 #include <MWPContextManager.h> |
|
33 #include "ProvisioningDebug.h" |
|
34 #include "CWPNameValue.h" |
|
35 #include <aknmessagequerydialog.h> |
|
36 #include <ProvisioningInternalCRKeys.h> |
|
37 #include <HbMessageBox> |
|
38 #include <HbAction> |
|
39 #include <QVariant> |
|
40 #include <hbdevicedialog.h> |
|
41 #include <QObject> |
|
42 #include <devicedialogconsts.h> |
|
43 #include "PnpUtilLogger.h" |
|
44 |
|
45 // CONSTANTS |
|
46 _LIT(KNone,""); |
|
47 |
|
48 // ============================ MEMBER FUNCTIONS =============================== |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // Constructor. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CWPBioControl::CWPBioControl(CMsvSession* /*aSession*/,TMsvId /*aId*/): CActive(EPriorityNormal) |
|
55 |
|
56 { |
|
57 CActiveScheduler::Add( this ); |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CWPBioControl::ConstructL |
|
62 // Symbian 2nd phase constructor can leave. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 void CWPBioControl::ConstructL(CMsvSession* aSession,TMsvId aId,CpQtSp* sp) |
|
66 { |
|
67 FLOG( _L( "[ProvisioningBC] CWPBioControl::ConstructL:" ) ); |
|
68 FeatureManager::InitializeLibL(); |
|
69 iSession = aSession; |
|
70 iId = aId; |
|
71 iSp = sp; |
|
72 iEngine = CWPEngine::NewL(); |
|
73 iDevDialog = NULL; |
|
74 ibootstrap = NULL; |
|
75 iMsg = new(ELeave)CpMessage(this); |
|
76 iWait = new( ELeave ) CActiveSchedulerWait; |
|
77 FLOG( _L( "[ProvisioningBC] CWPBioControl::ConstructL: done" ) ); |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CWPBioControl::NewL |
|
82 // Two-phased constructor. |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 EXPORT_C CWPBioControl* CWPBioControl::NewL(CMsvSession* aSession,TMsvId aId,CpQtSp* sp) |
|
86 { |
|
87 CWPBioControl* self = new( ELeave ) CWPBioControl(aSession,aId); |
|
88 CleanupStack::PushL( self ); |
|
89 self->ConstructL(aSession,aId,sp); |
|
90 CleanupStack::Pop(); |
|
91 return self; |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // Destructor |
|
96 // ----------------------------------------------------------------------------- |
|
97 CWPBioControl::~CWPBioControl() |
|
98 { |
|
99 Cancel(); |
|
100 delete iEngine; |
|
101 delete iMessage; |
|
102 FeatureManager::UnInitializeLib(); |
|
103 if (iDevDialog) |
|
104 { |
|
105 delete iDevDialog; |
|
106 } |
|
107 delete ibootstrap; |
|
108 delete iWait; |
|
109 } |
|
110 // ---------------------------------------------------------------------------- |
|
111 // CWPBioControl ::RestoreMsgL |
|
112 // ---------------------------------------------------------------------------- |
|
113 // |
|
114 void CWPBioControl::RestoreMsgL() |
|
115 { |
|
116 CMsvEntry* entry = iSession->GetEntryL(iId); |
|
117 CleanupStack::PushL( entry ); |
|
118 iEntry = entry->Entry(); |
|
119 iMessage = CWPPushMessage::NewL(); |
|
120 CMsvStore* readStore = entry->ReadStoreL(); |
|
121 CleanupStack::PushL( readStore ); |
|
122 iMessage->RestoreL( *readStore ); |
|
123 CleanupStack::PopAndDestroy(); // readStore |
|
124 |
|
125 TRAPD( result, iEngine->ImportDocumentL( iMessage->Body() ) ); |
|
126 if( result == KErrCorrupt ) |
|
127 { |
|
128 //result = KErrMsgBioMessageNotValid; |
|
129 } |
|
130 FTRACE(RDebug::Print(_L("[ProvisioningBC] CWPBioControl::RestoreMsgL result (%d)"), result)); |
|
131 User::LeaveIfError( result ); |
|
132 AuthenticateL( *iMessage ); |
|
133 CleanupStack::PopAndDestroy(); |
|
134 if(iAuth == KAUTENTICATIONCANCEL || iAuth == KAUTENTICATIONSUCCESS) |
|
135 { |
|
136 iSp->authenticationStatus(); |
|
137 } |
|
138 } |
|
139 |
|
140 // ---------------------------------------------------------------------------- |
|
141 // CWPBioControl ::postAuthetication |
|
142 // ---------------------------------------------------------------------------- |
|
143 // |
|
144 |
|
145 void CWPBioControl::postAuthetication() |
|
146 { |
|
147 iMsg->senderUnknown(); |
|
148 } |
|
149 |
|
150 // ---------------------------------------------------------------------------- |
|
151 // CWPBioControl ::senderUnknownContinue |
|
152 // ---------------------------------------------------------------------------- |
|
153 // |
|
154 |
|
155 void CWPBioControl::senderUnknownContinue() |
|
156 { |
|
157 iAuth = KAUTENTICATIONSUCCESS; |
|
158 iSp->authenticationStatus(); |
|
159 } |
|
160 |
|
161 // ---------------------------------------------------------------------------- |
|
162 // CWPBioControl ::senderUnknownCancel |
|
163 // ---------------------------------------------------------------------------- |
|
164 // |
|
165 |
|
166 void CWPBioControl::senderUnknownCancel() |
|
167 { |
|
168 iAuth = KAUTENTICATIONCANCEL; |
|
169 iSp->authenticationStatus(); |
|
170 } |
|
171 |
|
172 // ---------------------------------------------------------------------------- |
|
173 // CWPBioControl ::updateAuthetication |
|
174 // ---------------------------------------------------------------------------- |
|
175 // |
|
176 |
|
177 void CWPBioControl::updateAuthetication() |
|
178 { |
|
179 if (iMessage->Authenticated() ) |
|
180 { |
|
181 //update Cenrep key |
|
182 TBuf8<100> orig; |
|
183 orig.Copy(iMessage->Originator()); |
|
184 TRAPD(err, SetCenrepKeyL(orig)); |
|
185 User::LeaveIfError(err); |
|
186 } |
|
187 |
|
188 TBool preAuthenticated( iMessage->Authenticated() ); |
|
189 if( !iEntry.ReadOnly() && preAuthenticated != iMessage->Authenticated() ) |
|
190 { |
|
191 // If the entry can be written to, get its edit store and save |
|
192 // authentication flag. Failing is not dangerous, as the only |
|
193 // effect is that the user has to re-enter the PIN. |
|
194 // FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 4 " ) ); |
|
195 TRAPD( ignoreError, SaveMessageL() ); |
|
196 if ( ignoreError ) ignoreError = 0; // prevent compiler warning |
|
197 } |
|
198 |
|
199 iEngine->PopulateL(); |
|
200 if( iEngine->ItemCount() == 0 ) |
|
201 { |
|
202 FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 7 " ) ); |
|
203 } |
|
204 |
|
205 TPtrC8 orig8( iMessage->Originator() ); |
|
206 HBufC* orig16 = HBufC::NewLC( orig8.Length() ); |
|
207 orig16->Des().Copy( orig8 ); |
|
208 FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 8 " ) ); |
|
209 if( iMessage->Authenticated() |
|
210 && iEngine->ContextExistsL( *orig16 ) ) |
|
211 { |
|
212 TUint32 context( iEngine->ContextL( *orig16 ) ); |
|
213 iEngine->SetCurrentContextL( context ); |
|
214 } |
|
215 else |
|
216 { |
|
217 iEngine->SetCurrentContextL( KWPMgrUidNoContext ); |
|
218 } |
|
219 |
|
220 |
|
221 CleanupStack::PopAndDestroy(); |
|
222 FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL done" ) ); |
|
223 } |
|
224 |
|
225 // ---------------------------------------------------------------------------- |
|
226 // CWPBioControl ::getAuth |
|
227 // ---------------------------------------------------------------------------- |
|
228 // |
|
229 |
|
230 TInt CWPBioControl::getAuth() |
|
231 { |
|
232 return iAuth; |
|
233 } |
|
234 // ---------------------------------------------------------------------------- |
|
235 // CWPBioControl ::RestoreMsgL |
|
236 // ---------------------------------------------------------------------------- |
|
237 // |
|
238 TBool CWPBioControl::AuthenticateL( CWPPushMessage& aMessage ) |
|
239 { |
|
240 if (!aMessage.Authenticated()) |
|
241 { |
|
242 MWPPhone* phone = NULL; |
|
243 TBuf<KMaxPinSize> imsi; |
|
244 TRAPD(err, phone = WPPhoneFactory::CreateL()); |
|
245 if (err != KErrNone) |
|
246 { |
|
247 imsi = KNone; |
|
248 } |
|
249 else |
|
250 { |
|
251 imsi = phone->SubscriberId(); |
|
252 } |
|
253 ibootstrap = CWPBootstrap::NewL(imsi); |
|
254 |
|
255 if (phone) |
|
256 delete phone; |
|
257 |
|
258 CWPBootstrap::TBootstrapResult result(ibootstrap->BootstrapL(aMessage,*iEngine, KNullDesC)); |
|
259 if (result == CWPBootstrap::EPinRequired) |
|
260 { |
|
261 CMsvEntry* entry = iSession->GetEntryL(iId); |
|
262 TInt count = (entry->Entry()).MtmData1(); |
|
263 // Create a new device dialog if it is not there |
|
264 if( !iDevDialog ) |
|
265 { |
|
266 iDevDialog = CHbDeviceDialogSymbian::NewL(); |
|
267 LOGSTRING("CWPBioControl::AuthenticateL() iDevDialog is created"); |
|
268 } |
|
269 |
|
270 CHbSymbianVariantMap* parameters = CHbSymbianVariantMap::NewL(); |
|
271 CleanupStack::PushL(parameters); |
|
272 for (TInt i(0); i < KPinRetries && !aMessage.Authenticated(); i++) |
|
273 { |
|
274 // Add dialog key and dialog type to the parameters |
|
275 const TPtrC dialog (static_cast<const TUint16*>(keydialog.utf16()), keydialog.length()); |
|
276 CHbSymbianVariant* dialogvariant = NULL; |
|
277 const TInt dialogID = EOmaCPPinDialog; |
|
278 dialogvariant = CHbSymbianVariant::NewL( &dialogID, CHbSymbianVariant::EInt ); |
|
279 parameters->Add(dialog, dialogvariant ); |
|
280 |
|
281 // Add retries value to the parameters |
|
282 itries = i; |
|
283 const TPtrC ptrkeyparam1 (static_cast<const TUint16*>(keyparam1.utf16()), keyparam1.length()); |
|
284 //Retries left after this attempt |
|
285 TInt retries = KPinRetries - itries; |
|
286 CHbSymbianVariant* retriesvariant = NULL; |
|
287 retriesvariant = CHbSymbianVariant::NewL( &retries, CHbSymbianVariant::EInt ); |
|
288 parameters->Add(ptrkeyparam1, retriesvariant ); |
|
289 |
|
290 if (iDevDialog && iIsDisplayingDialog) |
|
291 { |
|
292 LOGSTRING("[CWPBioControl] CWPBioControl::AuthenticateL updating the dialog"); |
|
293 iDevDialog->Update(*parameters); |
|
294 } |
|
295 else if (iDevDialog && !iIsDisplayingDialog) |
|
296 { |
|
297 // Show the device dialog |
|
298 iDevDialog->Show(KDeviceDialogType,*parameters, this); |
|
299 iIsDisplayingDialog = ETrue; |
|
300 // Wait for user response |
|
301 TInt error = WaitUntilDeviceDialogClosed(); |
|
302 LOGSTRING2("WaitUntilDeviceDialogClosed err is %d", error); |
|
303 User::LeaveIfError(error); |
|
304 if(ireturnkey == EHbRSK) |
|
305 { |
|
306 iAuth = KAUTENTICATIONCANCEL; |
|
307 CleanupStack::PopAndDestroy(parameters); |
|
308 return false; |
|
309 } |
|
310 } |
|
311 |
|
312 |
|
313 } |
|
314 |
|
315 CleanupStack::PopAndDestroy(parameters); |
|
316 |
|
317 if (iDevDialog) |
|
318 { |
|
319 iDevDialog->Cancel(); |
|
320 delete iDevDialog; |
|
321 iDevDialog = NULL; |
|
322 } |
|
323 |
|
324 if( !aMessage.Authenticated() && (itries == KPinRetries - 1) ) |
|
325 { |
|
326 iMsg->autheticationFailure(); |
|
327 return false; |
|
328 } |
|
329 } |
|
330 } |
|
331 if(!aMessage.Authenticated()) |
|
332 { |
|
333 postAuthetication(); |
|
334 } |
|
335 else if(aMessage.Authenticated()) |
|
336 { |
|
337 iAuth = KAUTENTICATIONSUCCESS; |
|
338 } |
|
339 FLOG( _L( "[ProvisioningBC] CWPBioControl::AuthenticateL done" ) ); |
|
340 return true; |
|
341 } |
|
342 |
|
343 // ---------------------------------------------------------------------------- |
|
344 // CWPBioControl ::authenticationFailed |
|
345 // ---------------------------------------------------------------------------- |
|
346 // |
|
347 |
|
348 void CWPBioControl::authenticationFailed() |
|
349 { |
|
350 iAuth = KAUTENTICATIONFAILURE; |
|
351 iSp->authenticationStatus(); |
|
352 } |
|
353 // ---------------------------------------------------------------------------- |
|
354 // CWPBioControl ::SaveMessageL |
|
355 // ---------------------------------------------------------------------------- |
|
356 // |
|
357 void CWPBioControl::SaveMessageL() |
|
358 { |
|
359 CMsvEntry* entry = iSession->GetEntryL(iId); |
|
360 CleanupStack::PushL( entry ); |
|
361 |
|
362 CMsvStore* editStore = entry->EditStoreL(); |
|
363 CleanupStack::PushL( editStore ); |
|
364 iMessage->StoreL( *editStore ); |
|
365 editStore->CommitL(); |
|
366 CleanupStack::PopAndDestroy(2); // editStore, entry |
|
367 } |
|
368 |
|
369 // ---------------------------------------------------------------------------- |
|
370 // CWPBioControl ::CollectItemsL |
|
371 // ---------------------------------------------------------------------------- |
|
372 // |
|
373 EXPORT_C RPointerArray<CWPNameValue>* CWPBioControl::CollectItemsLC() const |
|
374 { |
|
375 RPointerArray<CWPNameValue>* array = new(ELeave) RPointerArray<CWPNameValue>; |
|
376 CleanupStack::PushL( TCleanupItem( Cleanup, array ) ); |
|
377 |
|
378 TInt count( iEngine->ItemCount() ); |
|
379 FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 83 " ) ); |
|
380 for( TInt index = 0; index < count; index++ ) |
|
381 { |
|
382 const TDesC& text = iEngine->SummaryText( index ); |
|
383 const TDesC& title = iEngine->SummaryTitle( index ); |
|
384 |
|
385 CWPNameValue* pair = CWPNameValue::NewLC( title, text ); |
|
386 User::LeaveIfError( array->Append( pair ) ); |
|
387 CleanupStack::Pop( pair ); |
|
388 } |
|
389 array->Sort( TLinearOrder<CWPNameValue>( CWPBioControl::Compare ) ); |
|
390 return array; |
|
391 } |
|
392 |
|
393 // ----------------------------------------------------------------------------- |
|
394 // CWPBioControl::Cleanup |
|
395 // ----------------------------------------------------------------------------- |
|
396 // |
|
397 void CWPBioControl::Cleanup( TAny* aAny ) |
|
398 { |
|
399 RPointerArray<CWPNameValue>* array = reinterpret_cast<RPointerArray<CWPNameValue>*>( aAny ); |
|
400 array->ResetAndDestroy(); |
|
401 array->Close(); |
|
402 delete array; |
|
403 } |
|
404 |
|
405 // ----------------------------------------------------------------------------- |
|
406 // CWPBioControl::Compare |
|
407 // ----------------------------------------------------------------------------- |
|
408 // |
|
409 TInt CWPBioControl::Compare( const CWPNameValue& aItem1, |
|
410 const CWPNameValue& aItem2 ) |
|
411 { |
|
412 return aItem1.Name().Compare( aItem2.Name() ); |
|
413 } |
|
414 |
|
415 // ---------------------------------------------------------------------------- |
|
416 // CWPBioControl ::SaveSettingsL |
|
417 // ---------------------------------------------------------------------------- |
|
418 // |
|
419 void CWPBioControl::SaveSettingsL() |
|
420 { |
|
421 if( !iMessage->Saved()) |
|
422 { |
|
423 DoSaveL(); |
|
424 SaveSettingStatus(); |
|
425 } |
|
426 else |
|
427 { |
|
428 iMsg->saveSettingMessage(); |
|
429 } |
|
430 } |
|
431 |
|
432 // ---------------------------------------------------------------------------- |
|
433 // CWPBioControl ::SaveSettingStatus |
|
434 // ---------------------------------------------------------------------------- |
|
435 // |
|
436 |
|
437 void CWPBioControl::SaveSettingStatus() |
|
438 { |
|
439 iMessage->SetSaved( ETrue ); |
|
440 SaveMessageL(); |
|
441 } |
|
442 |
|
443 // ---------------------------------------------------------------------------- |
|
444 // CWPBioControl ::DoSaveL |
|
445 // ---------------------------------------------------------------------------- |
|
446 // |
|
447 void CWPBioControl::DoSaveL() |
|
448 { |
|
449 TInt numSaved( 0 ); |
|
450 CWPSaver* saver = new(ELeave) CWPSaver( *iEngine, EFalse ); |
|
451 TBufC<KLENGTH> Value; |
|
452 TInt err( saver->ExecuteLD( numSaved, Value ) ); |
|
453 if( err >= 0 ) |
|
454 { |
|
455 // Check if any setting can be made default |
|
456 TBool setDefault( EFalse ); |
|
457 TInt itemCount( iEngine->ItemCount() ); |
|
458 for( TInt i( 0 ); i < itemCount && !setDefault; i++ ) |
|
459 { |
|
460 if( iEngine->CanSetAsDefault( i ) ) |
|
461 { |
|
462 setDefault = ETrue; |
|
463 } |
|
464 } |
|
465 |
|
466 // Ask the user if the saved settings should be |
|
467 // made default. |
|
468 if( setDefault ) |
|
469 { |
|
470 iMsg->setAsDefault(); |
|
471 } |
|
472 } |
|
473 else |
|
474 { |
|
475 iMsg->settingNotSaved(); |
|
476 } |
|
477 |
|
478 |
|
479 } |
|
480 |
|
481 // ---------------------------------------------------------------------------- |
|
482 // CWPBioControl ::saveDefaultSetting |
|
483 // ---------------------------------------------------------------------------- |
|
484 // |
|
485 |
|
486 void CWPBioControl::saveDefaultSetting() |
|
487 { |
|
488 CWPSaver* setter = new(ELeave) CWPSaver( *iEngine, ETrue ); |
|
489 TInt numSet( 0 ); |
|
490 TBufC<KLENGTH> Value; |
|
491 TInt result = KErrNone; |
|
492 result = setter->ExecuteLD( numSet,Value ); |
|
493 if (result) |
|
494 { |
|
495 iMsg->settingNotSaved(); |
|
496 } |
|
497 |
|
498 |
|
499 } |
|
500 // ---------------------------------------------------------------------------- |
|
501 // CWPBioControl ::SetCenrepKey |
|
502 // ---------------------------------------------------------------------------- |
|
503 // |
|
504 void CWPBioControl::SetCenrepKeyL(const TDesC8& aValue) |
|
505 { |
|
506 |
|
507 FLOG( _L( "[ProvisioningBC] CWPBioControl::SetCenrepKeyL" ) ); |
|
508 |
|
509 CRepository* rep= NULL; |
|
510 TInt errorStatus = KErrNone; |
|
511 |
|
512 TRAPD( errVal, rep = CRepository::NewL( KCRUidOMAProvisioningLV )) |
|
513 ; |
|
514 |
|
515 if (errVal == KErrNone) |
|
516 { |
|
517 errorStatus = rep->Set(KOMAProvOriginatorContent, aValue); |
|
518 } |
|
519 else |
|
520 { |
|
521 errorStatus = errVal; |
|
522 } |
|
523 |
|
524 if (rep) |
|
525 { |
|
526 delete rep; |
|
527 } |
|
528 |
|
529 if (errorStatus != KErrNone) |
|
530 { |
|
531 User::Leave(errorStatus); |
|
532 } |
|
533 |
|
534 FLOG( _L( "[ProvisioningBC] CWPBioControl::SetCenrepKeyL done" ) ); |
|
535 |
|
536 } |
|
537 |
|
538 // ---------------------------------------------------------------------------- |
|
539 // CWPBioControl ::DataReceived |
|
540 // Slot to handle the data received from the plugin |
|
541 // ---------------------------------------------------------------------------- |
|
542 // |
|
543 void CWPBioControl::DataReceived(CHbSymbianVariantMap& aData) |
|
544 { |
|
545 FLOG(_L("CWPBioControl::DataReceived() start")); |
|
546 |
|
547 // Get the return key |
|
548 const TPtrC ptrreturnkey(static_cast<const TUint16*> (returnkey.utf16()), |
|
549 returnkey.length()); |
|
550 const CHbSymbianVariant* returnkeyvariant = aData.Get(ptrreturnkey); |
|
551 |
|
552 if (returnkeyvariant) |
|
553 { |
|
554 TInt* returnkey = returnkeyvariant->Value<TInt> (); |
|
555 if (returnkey) |
|
556 { |
|
557 ireturnkey = *returnkey; |
|
558 FLOG(_L("CWPBioControl::DataReceived() ireturnkey")); |
|
559 LOGSTRING2("ireturnkey is %d", ireturnkey); |
|
560 if (ireturnkey == EHbLSK) |
|
561 { |
|
562 // Ok key pressed |
|
563 FLOG(_L("Ok key pressed")); |
|
564 LOGSTRING("CWPBioControl::DataReceived() Ok key pressed"); |
|
565 // Get the PIN code |
|
566 const TPtrC ptrpinquery( |
|
567 static_cast<const TUint16*> (pinquery.utf16()), |
|
568 pinquery.length()); |
|
569 const CHbSymbianVariant* pinvariant = aData.Get(ptrpinquery); |
|
570 if (pinvariant) |
|
571 { |
|
572 TPtrC pin = *pinvariant->Value<TDesC> (); |
|
573 // Call BootstrapL to find out whether the PIN is correct or not |
|
574 CWPBootstrap::TBootstrapResult result = |
|
575 CWPBootstrap::EPinRequired; |
|
576 TInt err = KErrNone; |
|
577 TRAP( err, QT_TRYCATCH_LEAVING(result = ibootstrap->BootstrapL(*iMessage, *iEngine, pin) )); |
|
578 if (err == KErrNone && result |
|
579 == CWPBootstrap::EAuthenticationFailed && itries |
|
580 < KPinRetries - 1) |
|
581 { |
|
582 FLOG(_L("CWPBioControl:deviceDialog:DataReceived() Authentication Failed")); |
|
583 LOGSTRING("CWPBioControl::DataReceived() Authentication Failed"); |
|
584 } |
|
585 |
|
586 } |
|
587 |
|
588 } |
|
589 } |
|
590 |
|
591 } |
|
592 |
|
593 FLOG(_L("CWPBioControl:deviceDialog:DataReceived() end")); |
|
594 } |
|
595 |
|
596 // ---------------------------------------------------------------------------- |
|
597 // CWPBioControl ::DeviceDialogClosed |
|
598 // Slot to handle the deviceDialogClosed signal from the plugin |
|
599 // ---------------------------------------------------------------------------- |
|
600 // |
|
601 void CWPBioControl::DeviceDialogClosed(TInt aCompletionCode) |
|
602 { |
|
603 FLOG(_L("CWPBioControl::DeviceDialogClosed() start")); |
|
604 LOGSTRING("CWPBioControl::DeviceDialogClosed() start"); |
|
605 iCompletionCode = aCompletionCode; |
|
606 LOGSTRING2("CWPBioControl::DeviceDialogClosed() iCompletionCode is %d", iCompletionCode); |
|
607 |
|
608 iIsDisplayingDialog = EFalse; |
|
609 |
|
610 TRequestStatus* status(&iStatus); |
|
611 User::RequestComplete(status, KErrNone); |
|
612 LOGSTRING("CWPBioControl::DeviceDialogClosed() end"); |
|
613 FLOG(_L("CWPBioControl::DeviceDialogClosed() end")); |
|
614 } |
|
615 |
|
616 // --------------------------------------------------------------------------- |
|
617 // CWPBioControl::DoCancel() |
|
618 // --------------------------------------------------------------------------- |
|
619 // |
|
620 void CWPBioControl::DoCancel() |
|
621 { |
|
622 FLOG(_L("CWPBioControl::DoCancel() start")); |
|
623 LOGSTRING("CWPBioControl::DoCancel() start"); |
|
624 if (iWait && iWait->IsStarted() && iWait->CanStopNow()) |
|
625 { |
|
626 LOGSTRING("CWPBioControl::DoCancel() In the iWait block"); |
|
627 iCompletionCode = KErrCancel; |
|
628 iWait->AsyncStop(); |
|
629 } |
|
630 LOGSTRING("CWPBioControl::DoCancel() end"); |
|
631 FLOG(_L("CWPBioControl::DoCancel() end")); |
|
632 } |
|
633 |
|
634 // --------------------------------------------------------------------------- |
|
635 // CWPBioControl::RunL() |
|
636 // --------------------------------------------------------------------------- |
|
637 // |
|
638 void CWPBioControl::RunL() |
|
639 { |
|
640 FLOG(_L("CWPBioControl::RunL() start")); |
|
641 LOGSTRING("CWPBioControl::RunL() start"); |
|
642 if (iWait) |
|
643 { |
|
644 LOGSTRING("CWPBioControl::RunL() iWait block "); |
|
645 iWait->AsyncStop(); |
|
646 } |
|
647 LOGSTRING("CWPBioControl::RunL() end"); |
|
648 FLOG(_L("CWPBioControl::RunL() end")); |
|
649 } |
|
650 |
|
651 // --------------------------------------------------------------------------- |
|
652 // CWPBioControl::WaitUntilDeviceDialogClosed() |
|
653 // --------------------------------------------------------------------------- |
|
654 // |
|
655 TInt CWPBioControl::WaitUntilDeviceDialogClosed() |
|
656 { |
|
657 FLOG(_L("CWPBioControl::WaitUntilDeviceDialogClosed() start")); |
|
658 iCompletionCode = KErrInUse; |
|
659 ireturnkey = KErrUnknown; |
|
660 if (!IsActive() && iWait && !iWait->IsStarted()) |
|
661 { |
|
662 FLOG(_L("CWPBioControl::WaitUntilDeviceDialogClosed() In WaitAsynch start block")); |
|
663 LOGSTRING("CWPBioControl::WaitUntilDeviceDialogClosed() In WaitAsynch start block"); |
|
664 iStatus = KRequestPending; |
|
665 SetActive(); |
|
666 LOGSTRING2("CWPBioControl::WaitUntilDeviceDialogClosed() iCompletionCode is %d", iCompletionCode); |
|
667 iWait->Start(); |
|
668 LOGSTRING2("CWPBioControl::WaitUntilDeviceDialogClosed() iCompletionCode is %d", iCompletionCode); |
|
669 } |
|
670 FLOG(_L("CWPBioControl::WaitUntilDeviceDialogClosed() end")); |
|
671 return iCompletionCode; |
|
672 } |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 // End of File |