wlanutilities/wlansniffer/mainapplication/src/wsfmaincontroller.cpp
branchRCL_3
changeset 44 a9524956f6b5
parent 35 aaabc7526ded
equal deleted inserted replaced
35:aaabc7526ded 44:a9524956f6b5
   348             TWsfWlanInfo* temp = iInfoArray->Match( info.iSsid, 
   348             TWsfWlanInfo* temp = iInfoArray->Match( info.iSsid, 
   349                                                     iInfoArray->Count() );
   349                                                     iInfoArray->Count() );
   350             if ( temp )
   350             if ( temp )
   351                 {
   351                 {
   352                 temp->iConnectionState = EConnected;
   352                 temp->iConnectionState = EConnected;
       
   353                 temp->iIapId = info.iIapId;
   353                 iInfoArray->SortArrayL();
   354                 iInfoArray->SortArrayL();
   354                 UpdateViewL( iInfoArray );
   355                 UpdateViewL( iInfoArray );
   355                 }
   356                 }
   356             }
   357             }
   357         }
   358         }
   474         return;
   475         return;
   475         }
   476         }
   476 
   477 
   477     TInt result( KErrNone );
   478     TInt result( KErrNone );
   478     
   479     
       
   480     TWsfIapPersistence persistence = EIapPersistent;
       
   481     
   479     if ( !info.Known() && !info.Connected() )
   482     if ( !info.Known() && !info.Connected() )
   480         {
   483         {
   481         // if not known yet, create an IAP
   484         // if not known yet, create an IAP
   482         if ( iModel->CreateAccessPointL( info, EFalse ) )
   485         if ( iModel->CreateAccessPointL( info, EFalse ) )
   483             {
   486             {
       
   487             persistence = EIapExpireOnDisconnect;
   484             // update iapID to list
   488             // update iapID to list
   485             UpdateIapIdToInfoArrayL( info );
   489             UpdateIapIdToInfoArrayL( info );
   486             
       
   487             // on success, test it and save it as well
       
   488             result = iModel->TestAccessPointL( info, ETrue, EFalse );
       
   489             }
   490             }
   490         else
   491         else
   491             {
   492             {
   492             result = KErrGeneral;
   493             result = KErrGeneral;
   493             }
   494             }
   494         }
   495         }
   495     else if ( info.iIapId && !info.Connected() )
   496     
       
   497     if ( info.iIapId && !info.Connected() )
   496         {
   498         {
   497         // hopefully we have a valid IAP id inside
   499         // hopefully we have a valid IAP id inside
   498         result = iModel->ConnectL( info.iIapId );
   500         result = iModel->ConnectL( info.iIapId, EFalse, persistence );
       
   501         }
       
   502     else if ( !info.Connected() )
       
   503         {
       
   504         result = KErrGeneral;
   499         }
   505         }
   500     
   506     
   501     // pop cleanup item ReleaseSuppressingKeyEvents
   507     // pop cleanup item ReleaseSuppressingKeyEvents
   502     CleanupStack::Pop();
   508     CleanupStack::Pop();
   503     iAppUi->SetSuppressingKeyEvents( EFalse );
   509     iAppUi->SetSuppressingKeyEvents( EFalse );
   560         {
   566         {
   561         iAppUi->ShowGlobalErrorNoteL( KErrNotSupported );
   567         iAppUi->ShowGlobalErrorNoteL( KErrNotSupported );
   562         CleanupStack::PopAndDestroy();
   568         CleanupStack::PopAndDestroy();
   563         return;
   569         return;
   564         }
   570         }
       
   571     
       
   572     TWsfIapPersistence persistence = EIapPersistent;
   565         
   573         
   566     if ( !info.Known() )
   574     if ( !info.Known() )
   567         {
   575         {
   568         // a new access point needs to be created
   576         // a new access point needs to be created
   569         if ( iModel->CreateAccessPointL( info, EFalse ) )
   577         if ( iModel->CreateAccessPointL( info, EFalse ) )
   570             {
   578             {
       
   579             persistence = EIapExpireOnDisconnect;
   571             // update iapID to list
   580             // update iapID to list
   572             UpdateIapIdToInfoArrayL( info );
   581             UpdateIapIdToInfoArrayL( info );
   573 
   582             }
   574             // on success, test it and save it as well
   583         }
   575             // (testing actually creates the connection)
   584     
   576             if ( iModel->TestAccessPointL( info, ETrue, ETrue ) == KErrCancel )
   585     if ( info.iIapId )
   577                 {
       
   578                 // connection creation was cancelled, refresh the view
       
   579                 iModel->RefreshScanL();
       
   580                 }
       
   581             }
       
   582         }
       
   583     else if ( info.iIapId )
       
   584         {
   586         {
   585         // hopefully we have a valid IAP id inside
   587         // hopefully we have a valid IAP id inside
   586         iModel->ConnectL( info.iIapId );
   588         iModel->ConnectL( info.iIapId, ETrue, persistence );
   587         }
   589         }
   588 
   590 
   589     // pop cleanup item ReleaseSuppressingKeyEvents
   591     // pop cleanup item ReleaseSuppressingKeyEvents
   590     CleanupStack::Pop();
   592     CleanupStack::Pop();
   591     iAppUi->SetSuppressingKeyEvents( EFalse );  
   593     iAppUi->SetSuppressingKeyEvents( EFalse );