|
1 /* |
|
2 * Copyright (c) 2004 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: Connection opener. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <E32Std.h> |
|
20 #include <CIMPSSAPSettings.h> |
|
21 #include <ApSettingsHandlerUI.h> |
|
22 #include <ApUtils.h> |
|
23 #include <PEngWVPresenceErrors2.h> |
|
24 #include <CPEngNWSessionSlotID2.h> |
|
25 #include <MPEngTransactionStatus2.h> |
|
26 |
|
27 #include "CCnUiConnOpener.h" |
|
28 #include "IMPSPresenceLoginDetailValidator.h" |
|
29 |
|
30 #include "MCnUiConnectionHandler.h" |
|
31 #include "MCnUiClientPlugin.h" |
|
32 #include "MCnUiOpProgressStateObserver.h" |
|
33 |
|
34 #include "CnUiErrors.h" |
|
35 #include "CnUiPanics.h" |
|
36 #include "IMPSCommonUiDebugPrint.h" |
|
37 #include "impscommonuibuilddefinitions.h" |
|
38 |
|
39 |
|
40 // ===================== TOpenerStateProxy MEMBER FUNCTIONS =================== |
|
41 // ----------------------------------------------------------------------------- |
|
42 // TOpenerStateProxy::TOpenerStateProxy |
|
43 // C++ default constructor can NOT contain any code, that |
|
44 // might leave. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CCnUiConnOpener::TOpenerStateProxy::TOpenerStateProxy( TCnUiConnOpenerState aInitial ) |
|
48 : iState( aInitial ), |
|
49 iObs( NULL ) |
|
50 { |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CCnUiConnOpener::TOpenerStateProxy::SetProgressObserver() |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 void CCnUiConnOpener::TOpenerStateProxy::SetProgressObserver( MCnUiOpProgressStateObserver* aObs ) |
|
58 { |
|
59 iObs = aObs; |
|
60 } |
|
61 |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CCnUiConnOpener::TOpenerStateProxy::Set() |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 void CCnUiConnOpener::TOpenerStateProxy::Set( TCnUiConnOpenerState aNewState, |
|
68 TIMPSConnectionClient aClient ) |
|
69 { |
|
70 iState = aNewState; |
|
71 if ( iObs ) |
|
72 { |
|
73 iObs->HandleProgressStateEnter( iState, aClient ); |
|
74 } |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CCnUiConnOpener::TOpenerStateProxy::operator TCnUiConnOpenerState () |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 TCnUiConnOpenerState CCnUiConnOpener::TOpenerStateProxy::operator()() |
|
82 { |
|
83 return iState; |
|
84 } |
|
85 |
|
86 |
|
87 // ============================ MEMBER FUNCTIONS =============================== |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CCnUiConnOpener::CCnUiConnOpener |
|
91 // C++ default constructor can NOT contain any code, that |
|
92 // might leave. |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 CCnUiConnOpener::CCnUiConnOpener() |
|
96 : CActive( EPriorityStandard ), |
|
97 iState( ECnOpenerIdle ) |
|
98 { |
|
99 CActiveScheduler::Add( this ); |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CCnUiConnOpener::ConstructL |
|
104 // Symbian 2nd phase constructor can leave. |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 void CCnUiConnOpener::ConstructL() |
|
108 { |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CCnUiConnOpener::NewL() |
|
113 // Two-phased constructor. |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 CCnUiConnOpener* CCnUiConnOpener::NewL() |
|
117 { |
|
118 CCnUiConnOpener* self = new( ELeave ) CCnUiConnOpener; |
|
119 |
|
120 CleanupStack::PushL( self ); |
|
121 self->ConstructL(); |
|
122 CleanupStack::Pop( self ); |
|
123 |
|
124 return self; |
|
125 } |
|
126 |
|
127 // Destructor |
|
128 CCnUiConnOpener::~CCnUiConnOpener() |
|
129 { |
|
130 CancelLogin(); |
|
131 delete iNWSessionSlotID; |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // CCnUiConnOpener::CopyNWSessionSlotL() |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 CPEngNWSessionSlotID2* CCnUiConnOpener::CopyNWSessionSlotL( CPEngNWSessionSlotID2& aSessionSlot ) |
|
139 { |
|
140 CPEngNWSessionSlotID2* tempSlot = aSessionSlot.CloneL(); |
|
141 return tempSlot; |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CCnUiConnOpener::MakeLoginForClient() |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 TInt CCnUiConnOpener::MakeLoginForClient( TIMPSConnectionClient aClient, |
|
149 const CIMPSSAPSettings& aSap, |
|
150 MCnUiClientPlugin& aPlugin, |
|
151 MCnUiConnectionHandler& aConnHandler, |
|
152 MCnUiOpProgressStateObserver* aProgressObserver, |
|
153 CPEngNWSessionSlotID2& aNWSessionSlotID ) |
|
154 { |
|
155 CPEngNWSessionSlotID2* tempSlot = NULL; |
|
156 TRAPD( error, tempSlot = CopyNWSessionSlotL( aNWSessionSlotID ) ); |
|
157 if ( error ) |
|
158 { |
|
159 return error; |
|
160 } |
|
161 delete iNWSessionSlotID; |
|
162 iNWSessionSlotID = tempSlot; |
|
163 |
|
164 ResetCachedParameters(); |
|
165 ResetStateFlags(); |
|
166 |
|
167 //cache parameters to be later accessible |
|
168 iState.SetProgressObserver( aProgressObserver ); |
|
169 iClient = aClient; |
|
170 iSap = &aSap; |
|
171 iPlugin = &aPlugin; |
|
172 iConnHandler = &aConnHandler; |
|
173 |
|
174 //issue SAP connection open |
|
175 TInt loginStatusCode = KErrNone; |
|
176 TRAP( loginStatusCode, HandleSapConnectionOpenRequestL( ETrue ) ); |
|
177 if ( loginStatusCode == KErrNone ) |
|
178 { |
|
179 //Connection open OK, wait steps to complete if needed |
|
180 WaitCompletion( iOpenWait ); |
|
181 |
|
182 //Login completed. |
|
183 |
|
184 //else handle the real open status & possible cancels |
|
185 if ( iCanceled ) |
|
186 { |
|
187 //if canceled, force the status be KErrCancel |
|
188 loginStatusCode = KErrCancel; |
|
189 } |
|
190 else |
|
191 { |
|
192 //else get the real status code |
|
193 loginStatusCode = iStatus.Int(); |
|
194 } |
|
195 |
|
196 TBool connectionActive( ETrue ); |
|
197 |
|
198 TInt ignore; |
|
199 TRAP( ignore, connectionActive = |
|
200 iConnHandler->NwConnectionActiveL( aNWSessionSlotID ) ); |
|
201 if ( ( !connectionActive ) && |
|
202 ( loginStatusCode == KErrNone ) ) |
|
203 { |
|
204 loginStatusCode = KErrCouldNotConnect; |
|
205 } |
|
206 |
|
207 if ( ( loginStatusCode == KErrNone ) || |
|
208 ( loginStatusCode == KPEngNwErrPartiallySuccessful ) ) |
|
209 { |
|
210 //Ignore ignorable partial errors |
|
211 loginStatusCode = KErrNone; |
|
212 |
|
213 //whole connection open went fine |
|
214 //==>client is now considered to be logged in |
|
215 TRAPD( err, iConnHandler->LoginTheClientL( iClient ) ); |
|
216 loginStatusCode = err; |
|
217 } |
|
218 |
|
219 |
|
220 //If operation was canceled or some error occured during |
|
221 //the opening ==> the real network connection opened by this opener |
|
222 //must be closed. |
|
223 if ( loginStatusCode != KErrNone ) |
|
224 { |
|
225 //Closes the owned connection & sets the client logged out |
|
226 UndoConnectionStateChanges(); |
|
227 } |
|
228 } |
|
229 |
|
230 |
|
231 ResetCachedParameters(); |
|
232 IMPSCUI_DP( D_IMPSCUI_LIT( "CCnUiConnOpener::MakeLoginForClient() loginStatusCode=%d" ), loginStatusCode ); |
|
233 return loginStatusCode; |
|
234 } |
|
235 |
|
236 |
|
237 |
|
238 // ----------------------------------------------------------------------------- |
|
239 // CCnUiConnOpener::CancelLogin() |
|
240 // ----------------------------------------------------------------------------- |
|
241 // |
|
242 void CCnUiConnOpener::CancelLogin() |
|
243 { |
|
244 //cancel the operation step currently running... |
|
245 switch ( iState() ) |
|
246 { |
|
247 case ECnOpenerOpeningSAPConnection: |
|
248 { |
|
249 //opening the SAP connection |
|
250 if ( iConnHandler ) |
|
251 { |
|
252 iConnHandler->CancelSapConnectionOpen( *iNWSessionSlotID ); |
|
253 } |
|
254 iCanceled = ETrue; |
|
255 break; |
|
256 } |
|
257 |
|
258 case ECnOpenerProcessingPlugin: |
|
259 { |
|
260 if ( iPlugin ) |
|
261 { |
|
262 iPlugin->CancelPostLoginProsessing(); |
|
263 } |
|
264 iCanceled = ETrue; |
|
265 break; |
|
266 } |
|
267 |
|
268 //flow through |
|
269 case ECnOpenerClosingInterferingSAPConnection: |
|
270 case ECnOpenerClosingOwnedSAPConnection: |
|
271 { |
|
272 //closing SAP connection |
|
273 if ( iConnHandler ) |
|
274 { |
|
275 iConnHandler->CancelSapConnectionOpen( *iNWSessionSlotID ); |
|
276 } |
|
277 |
|
278 // Waiting connection to close. |
|
279 WaitCompletion( iOpenWait ); |
|
280 |
|
281 iCanceled = ETrue; |
|
282 break; |
|
283 } |
|
284 |
|
285 case ECnOpenerIdle: |
|
286 default: |
|
287 { |
|
288 //nothing to do |
|
289 break; |
|
290 } |
|
291 } |
|
292 |
|
293 //break away from scheduler loop... |
|
294 Completed( iOpenWait ); |
|
295 } |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 // ----------------------------------------------------------------------------- |
|
301 // CCnUiConnOpener::WaitCompletion() |
|
302 // ----------------------------------------------------------------------------- |
|
303 // |
|
304 void CCnUiConnOpener::WaitCompletion( CActiveSchedulerWait& aWaiter ) |
|
305 { |
|
306 //wait with the scheduler loop |
|
307 IMPSCUI_DP_TXT( "CCnUiConnOpener::WaitCompletion() - starting wait" ); |
|
308 if ( !aWaiter.IsStarted() ) |
|
309 { |
|
310 aWaiter.Start(); |
|
311 } |
|
312 IMPSCUI_DP_TXT( "CCnUiConnOpener::WaitCompletion() - wait done" ); |
|
313 } |
|
314 |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CCnUiConnOpener::Completed() |
|
318 // ----------------------------------------------------------------------------- |
|
319 // |
|
320 void CCnUiConnOpener::Completed( CActiveSchedulerWait& aWaiter ) |
|
321 { |
|
322 //break away from the waiting scheduler loop |
|
323 if ( aWaiter.IsStarted() ) |
|
324 { |
|
325 aWaiter.AsyncStop(); |
|
326 } |
|
327 } |
|
328 |
|
329 |
|
330 // ----------------------------------------------------------------------------- |
|
331 // CCnUiConnOpener::HandleSapConnectionOpenRequestL() |
|
332 // State handler. |
|
333 // ----------------------------------------------------------------------------- |
|
334 // |
|
335 void CCnUiConnOpener::HandleSapConnectionOpenRequestL( TBool aCloseOfInterferingConnectionAllowed ) |
|
336 { |
|
337 //New SAP connection needed |
|
338 |
|
339 //are compulsory SAP details ok for login? |
|
340 TInt compulsoryStatus = CheckConnOpenCompulsorySettingsL( *iSap ); |
|
341 if ( compulsoryStatus != KErrNone ) |
|
342 { |
|
343 User::Leave( compulsoryStatus ); |
|
344 return; |
|
345 } |
|
346 |
|
347 |
|
348 //switch the operation according current SAP connection status |
|
349 TCnUiSapCnStatus sapCnStatus = iConnHandler->SapConnectionStatusL( *iSap, iClient ); |
|
350 switch ( sapCnStatus ) |
|
351 { |
|
352 case ECnUiSCS_NotConnected: |
|
353 { |
|
354 //no connected sap, notify plug-in |
|
355 iPlugin->ConnectionOpenInitL( EFalse, *iSap ); |
|
356 |
|
357 //and issue real connection open |
|
358 IssueConnectionOpenL(); |
|
359 break; |
|
360 } |
|
361 |
|
362 case ECnUiSCS_SapConnected: |
|
363 { |
|
364 //SAP already connected, notify plug-in |
|
365 iPlugin->ConnectionOpenInitL( ETrue, *iSap ); |
|
366 |
|
367 //and progress directly to next state.. |
|
368 HandleSapConnectionOpenedL(); |
|
369 break; |
|
370 } |
|
371 |
|
372 |
|
373 case ECnUiSCS_SapConnected_PwdMissMatch: |
|
374 { |
|
375 //SAP already connected |
|
376 //However, session join password not equal to original session password |
|
377 User::Leave( KPEngNwErrInvalidPassword ); |
|
378 break; |
|
379 } |
|
380 |
|
381 |
|
382 case ECnUiSCS_AnotherSapConnected: |
|
383 { |
|
384 //there is a conflicting SAP connection by some known client |
|
385 User::Leave( KCnUiErrorAlreadyConnectedToAnotherSap ); |
|
386 break; |
|
387 } |
|
388 |
|
389 |
|
390 //Flow trough |
|
391 case ECnUiSCS_AnotherSapConnected_ClientsNotKnown: |
|
392 default: |
|
393 { |
|
394 //there is a conflicting SAP connection by unknow client |
|
395 //==>close it if allowed |
|
396 if ( aCloseOfInterferingConnectionAllowed ) |
|
397 { |
|
398 IssueCloseOfInterferingSapConnectionL(); |
|
399 } |
|
400 else |
|
401 { |
|
402 User::Leave( KErrAlreadyExists ); |
|
403 } |
|
404 |
|
405 break; |
|
406 } |
|
407 } |
|
408 } |
|
409 |
|
410 |
|
411 // ----------------------------------------------------------------------------- |
|
412 // CCnUiConnOpener::IssueConnectionOpenL() |
|
413 // Transition to next state. |
|
414 // ----------------------------------------------------------------------------- |
|
415 // |
|
416 void CCnUiConnOpener::IssueConnectionOpenL() |
|
417 { |
|
418 //progress to next state by issuing the |
|
419 //connection open |
|
420 iState.Set( ECnOpenerOpeningSAPConnection, iClient ); |
|
421 |
|
422 iConnHandler->OpenSapConnectionL( *iSap, *iNWSessionSlotID, *this ); |
|
423 iOwnsSapConnection = ETrue; |
|
424 } |
|
425 |
|
426 |
|
427 // ----------------------------------------------------------------------------- |
|
428 // CCnUiConnOpener::HandleSapConnectionOpenedL() |
|
429 // State handler. |
|
430 // ----------------------------------------------------------------------------- |
|
431 // |
|
432 void CCnUiConnOpener::HandleSapConnectionOpenedL() |
|
433 { |
|
434 //SAP connection succesfully open |
|
435 //let client plug-in to verify NW server capabilities |
|
436 if ( iPlugin->VerifySapCapabilitiesL() ) |
|
437 { |
|
438 //Server capabilities OK for client. |
|
439 //progress to next state by issuing the client |
|
440 //plug-in to do its processing |
|
441 IssuePluginPostLoginProcessingL(); |
|
442 |
|
443 //Client is considered to be logged in just after the plug-in |
|
444 //has performed it steps |
|
445 } |
|
446 |
|
447 else |
|
448 { |
|
449 //server capabilities NOT OK for client |
|
450 iStatus = KCnUiErrorInsufficientNWServerCapabilities; |
|
451 } |
|
452 } |
|
453 |
|
454 |
|
455 // ----------------------------------------------------------------------------- |
|
456 // CCnUiConnOpener::IssuePluginPostLoginProcessingL() |
|
457 // Transition to next state. |
|
458 // ----------------------------------------------------------------------------- |
|
459 // |
|
460 void CCnUiConnOpener::IssuePluginPostLoginProcessingL() |
|
461 { |
|
462 IMPSCUI_DP_FUNC_ENTER( "CCnUiConnOpener::IssuePluginPostLoginProcessingL()" ); |
|
463 |
|
464 //initialize the status |
|
465 iStatus = KErrNone; |
|
466 |
|
467 //and issue the post login processing |
|
468 iPlugin->DoPostLoginProsessingL( iStatus ); |
|
469 if ( iStatus == KRequestPending ) |
|
470 { |
|
471 //plug-in started a real asynchronous operation |
|
472 //==> wait it to complete |
|
473 SetActive(); |
|
474 IMPSCUI_DP_TXT( "CCnUiConnOpener::IssuePluginPostLoginProcessingL() set active" ); |
|
475 } |
|
476 |
|
477 // progress to next state by issuing the client |
|
478 // plug-in processing... this is moved here, because it initiates the |
|
479 // showing of the Login ok -note. |
|
480 iState.Set( ECnOpenerProcessingPlugin, iClient ); |
|
481 } |
|
482 |
|
483 |
|
484 // ----------------------------------------------------------------------------- |
|
485 // CCnUiConnOpener::UndoConnectionStateChanges() |
|
486 // ----------------------------------------------------------------------------- |
|
487 // |
|
488 void CCnUiConnOpener::UndoConnectionStateChanges() |
|
489 { |
|
490 // inform client plugin, that creating a connection |
|
491 // was not completed. If this fails, there's nothing we can do |
|
492 TRAPD( ignore, iPlugin->LoginCancelledL() ); |
|
493 |
|
494 //Undo first the possible owned NW connection |
|
495 //If the connection close fails, there isn't much to do. |
|
496 //Actually this should be PEC engine service to |
|
497 //"emergency close" the network connection when needed. |
|
498 TRAP( ignore, IssueSapConnectionCloseIfNeededL() ); |
|
499 |
|
500 if ( iState() == ECnOpenerClosingOwnedSAPConnection ) |
|
501 { |
|
502 //some processing steps started, wait here with scheduler loop |
|
503 WaitCompletion( iOpenWait ); |
|
504 } |
|
505 else |
|
506 { |
|
507 //no owned NW connection to close ==> no logout event is sent for client |
|
508 //==>force sent one |
|
509 TBool networkActive( EFalse ); |
|
510 TInt ignore; |
|
511 TRAP( ignore, networkActive = |
|
512 iConnHandler->NwConnectionActiveL( *iNWSessionSlotID ) ); |
|
513 if ( !networkActive ) |
|
514 { |
|
515 TInt ignore; |
|
516 TRAP( ignore, iConnHandler->LogoutTheClientL( iClient ) ); |
|
517 } |
|
518 } |
|
519 } |
|
520 |
|
521 |
|
522 |
|
523 // ----------------------------------------------------------------------------- |
|
524 // CCnUiConnOpener::IssueSapConnectionCloseIfNeededL() |
|
525 // Transition to next state. |
|
526 // ----------------------------------------------------------------------------- |
|
527 // |
|
528 void CCnUiConnOpener::IssueSapConnectionCloseIfNeededL() |
|
529 { |
|
530 //Login operation has failed at some step |
|
531 //Close network connection if the connection open |
|
532 //was issued by this connection opener & the PEC engine is online... |
|
533 if ( iOwnsSapConnection && iConnHandler->NwConnectionActiveL( *iNWSessionSlotID ) ) |
|
534 { |
|
535 //progress to next state by issuing the |
|
536 //connection close |
|
537 iState.Set( ECnOpenerClosingOwnedSAPConnection, iClient ); |
|
538 |
|
539 iConnHandler->CloseSapConnectionL( *iNWSessionSlotID, *this ); |
|
540 } |
|
541 } |
|
542 |
|
543 |
|
544 // ----------------------------------------------------------------------------- |
|
545 // CCnUiConnOpener::IssueCloseOfInterferingSapConnectionL() |
|
546 // Transition to next state. |
|
547 // ----------------------------------------------------------------------------- |
|
548 // |
|
549 void CCnUiConnOpener::IssueCloseOfInterferingSapConnectionL() |
|
550 { |
|
551 //progress to next state by issuing the connection close |
|
552 iState.Set( ECnOpenerClosingInterferingSAPConnection, iClient ); |
|
553 |
|
554 iConnHandler->CloseSapConnectionL( *iNWSessionSlotID, *this ); |
|
555 } |
|
556 |
|
557 |
|
558 // ----------------------------------------------------------------------------- |
|
559 // CCnUiConnOpener::ResetCachedParameters() |
|
560 // ----------------------------------------------------------------------------- |
|
561 // |
|
562 void CCnUiConnOpener::ResetCachedParameters() |
|
563 { |
|
564 //cache parameters to be later accessible |
|
565 iState.SetProgressObserver( NULL ); |
|
566 |
|
567 iConnHandler = NULL; |
|
568 iPlugin = NULL; |
|
569 iSap = NULL; |
|
570 } |
|
571 |
|
572 |
|
573 // ----------------------------------------------------------------------------- |
|
574 // CCnUiConnOpener::ResetStateFlags() |
|
575 // ----------------------------------------------------------------------------- |
|
576 // |
|
577 void CCnUiConnOpener::ResetStateFlags() |
|
578 { |
|
579 ///set state to idle |
|
580 iState.Set( ECnOpenerIdle, iClient ); |
|
581 iOwnsSapConnection = EFalse; |
|
582 iCanceled = EFalse; |
|
583 |
|
584 //initially there hasn't happened any errors |
|
585 iStatus = KErrNone; |
|
586 } |
|
587 |
|
588 |
|
589 // ----------------------------------------------------------------------------- |
|
590 // CCnUiConnOpener::CheckConnOpenCompulsorySettingsL() |
|
591 // ----------------------------------------------------------------------------- |
|
592 // |
|
593 TInt CCnUiConnOpener::CheckConnOpenCompulsorySettingsL( const CIMPSSAPSettings& aSap ) |
|
594 { |
|
595 //check that SAP has an URL that can used in connection |
|
596 if ( aSap.SAPAddress().Length() == 0 ) |
|
597 { |
|
598 return KCnUiErrorSapMissingCompulsoryFields; |
|
599 } |
|
600 |
|
601 //check that SAP has proper internet access point |
|
602 if ( !IMPSPresenceLoginDetailValidator::ValidWVLoginIAPL( aSap.AccessPoint() ) ) |
|
603 { |
|
604 //SAP doesn't have a proper internet access |
|
605 //point defined in it. |
|
606 return KCnUiErrorSapMissingCompulsoryFields; |
|
607 } |
|
608 |
|
609 return KErrNone; |
|
610 } |
|
611 |
|
612 |
|
613 // ----------------------------------------------------------------------------- |
|
614 // CCnUiConnOpener::HandleNWSessionOperationCompleteL() |
|
615 // ----------------------------------------------------------------------------- |
|
616 // |
|
617 void CCnUiConnOpener::HandleNWSessionOperationCompleteL( |
|
618 MPEngTransactionStatus2& aStatus, |
|
619 CPEngNWSessionSlot2& /* aNWSessionSlot */, |
|
620 TInt /* aNWSessionSlotOperation */ ) |
|
621 { |
|
622 IMPSCUI_DP_TXT( "CCnUiConnOpener::HandleNWSessionOperationCompleteL()" ); |
|
623 iTransactionStatus = &aStatus; |
|
624 iStatus = aStatus.Status(); |
|
625 HandleOperationCompletionsL(); |
|
626 } |
|
627 |
|
628 // ----------------------------------------------------------------------------- |
|
629 // CCnUiConnOpener::HandleNWSessionOperationNotifyError() |
|
630 // ----------------------------------------------------------------------------- |
|
631 // |
|
632 void CCnUiConnOpener::HandleNWSessionOperationNotifyError( |
|
633 TInt aError, |
|
634 CPEngNWSessionSlot2& /* aNWSessionSlot */, |
|
635 TInt /* aNWSessionSlotOperation */ ) |
|
636 { |
|
637 IMPSCUI_DP( D_IMPSCUI_LIT( "CCnUiConnOpener::HandleNWSessionOperationCompleteL [%d]" ), aError ); |
|
638 |
|
639 //HandleNWSessionOperationCompleteL() has left. Stop the processing & store leave code. |
|
640 Completed( iOpenWait ); |
|
641 iStatus = aError; |
|
642 } |
|
643 |
|
644 |
|
645 // ----------------------------------------------------------------------------- |
|
646 // CCnUiConnOpener::RunL() |
|
647 // ----------------------------------------------------------------------------- |
|
648 // |
|
649 void CCnUiConnOpener::RunL() |
|
650 { |
|
651 HandleOperationCompletionsL(); |
|
652 } |
|
653 |
|
654 // ----------------------------------------------------------------------------- |
|
655 // CCnUiConnOpener::DoCancel() |
|
656 // ----------------------------------------------------------------------------- |
|
657 // |
|
658 void CCnUiConnOpener::DoCancel() |
|
659 { |
|
660 CancelLogin(); |
|
661 } |
|
662 |
|
663 // ----------------------------------------------------------------------------- |
|
664 // CCnUiConnOpener::RunError() |
|
665 // ----------------------------------------------------------------------------- |
|
666 // |
|
667 TInt CCnUiConnOpener::RunError( TInt aError ) |
|
668 { |
|
669 IMPSCUI_DP( D_IMPSCUI_LIT( "CCnUiConnOpener::HandleNWSessionOperationCompleteL [%d]" ), aError ); |
|
670 |
|
671 //HandleNWSessionOperationCompleteL() has left. Stop the processing & store leave code. |
|
672 Completed( iOpenWait ); |
|
673 iStatus = aError; |
|
674 return KErrNone; |
|
675 } |
|
676 |
|
677 // ----------------------------------------------------------------------------- |
|
678 // CCnUiConnOpener::Cancel() |
|
679 // ----------------------------------------------------------------------------- |
|
680 // |
|
681 void CCnUiConnOpener::Cancel() |
|
682 { |
|
683 CActive::Cancel(); |
|
684 } |
|
685 |
|
686 // ----------------------------------------------------------------------------- |
|
687 // CCnUiConnOpener::IsActive() |
|
688 // ----------------------------------------------------------------------------- |
|
689 // |
|
690 TBool CCnUiConnOpener::IsActive() const |
|
691 { |
|
692 return CActive::IsActive(); |
|
693 } |
|
694 |
|
695 // ----------------------------------------------------------------------------- |
|
696 // CCnUiConnOpener::HandleOperationCompletionsL() |
|
697 // ----------------------------------------------------------------------------- |
|
698 // |
|
699 void CCnUiConnOpener::HandleOperationCompletionsL() |
|
700 { |
|
701 IMPSCUI_DP_TXT( "CCnUiConnOpener::HandleOperationCompletionsL()" ); |
|
702 |
|
703 switch ( iState() ) |
|
704 { |
|
705 case ECnOpenerOpeningSAPConnection: |
|
706 { |
|
707 IMPSCUI_DP( D_IMPSCUI_LIT( "CCnUiConnOpener::OperationCompleteL - state=ECnOpenerOpeningSAPConnection, status=%d" ), iStatus ); |
|
708 |
|
709 if ( iStatus == KErrNone ) |
|
710 { |
|
711 //SAP connection opened successfully |
|
712 //handling will issue next step if needed. |
|
713 |
|
714 //possible opening errors & errors coming from |
|
715 //handling connection open, are handled from |
|
716 //outside of the wait loop |
|
717 HandleSapConnectionOpenedL(); |
|
718 } |
|
719 break; |
|
720 } |
|
721 |
|
722 |
|
723 case ECnOpenerProcessingPlugin: |
|
724 { |
|
725 IMPSCUI_DP( D_IMPSCUI_LIT( "CCnUiConnOpener::OperationCompleteL - state=ECnOpenerProcessingPlugin, status=%d" ), iStatus ); |
|
726 //plug-in processing completed, no more steps to do. |
|
727 //however, if plug-in failed, the possible errors |
|
728 //are handled from outside of the wait loop |
|
729 break; |
|
730 } |
|
731 |
|
732 case ECnOpenerClosingOwnedSAPConnection: |
|
733 { |
|
734 IMPSCUI_DP( D_IMPSCUI_LIT( "CCnUiConnOpener::OperationCompleteL - state=ECnOpenerClosingOwnedSAPConnection, status=%d" ), iStatus ); |
|
735 //There has been a error somewhere |
|
736 //and now the opened SAP connection |
|
737 //is closed, no more to do |
|
738 |
|
739 // Login canceled: wait for PEC is complete -> we can continue |
|
740 Completed( iOpenWait ); |
|
741 |
|
742 // |
|
743 // must do the transition to prevent uncompleted waits |
|
744 iState.Set( ECnOpenerIdle, iClient ); |
|
745 break; |
|
746 } |
|
747 |
|
748 case ECnOpenerClosingInterferingSAPConnection: |
|
749 { |
|
750 IMPSCUI_DP( D_IMPSCUI_LIT( "CCnUiConnOpener::OperationCompleteL - state=ECnOpenerClosingInterferingSAPConnection, status=%d" ), iStatusInt ); |
|
751 //Interfering SAP connection is closed. |
|
752 //Connection close is assumed to be succesful, |
|
753 //and state is advanced to next by issuing the SAP connection open |
|
754 //However, the interfering connection close handling isn't allowed |
|
755 //to cause looping... |
|
756 HandleSapConnectionOpenRequestL( EFalse ); |
|
757 break; |
|
758 } |
|
759 |
|
760 //Flow trough... |
|
761 case ECnOpenerIdle: |
|
762 default: |
|
763 { |
|
764 IMPSCUI_DP( D_IMPSCUI_LIT( "CCnUiConnOpener::OperationCompleteL - state=ECnOpenerIdle, status=%d" ), iStatus ); |
|
765 //not allowed state completed |
|
766 CnUiPanicOrLeaveL( EIMPSConnOpenerUnknownState, KErrUnknown ); |
|
767 break; |
|
768 } |
|
769 } |
|
770 |
|
771 if ( !IsActive() ) |
|
772 { |
|
773 //if no subsequent processing steps started, |
|
774 //break away from scheduler loop... |
|
775 Completed( iOpenWait ); |
|
776 } |
|
777 } |
|
778 |
|
779 // End of File |
|
780 |
|
781 |