wlanutilities/wlansniffer/mainapplication/src/wsfmaincontroller.cpp
branchRCL_3
changeset 16 8b0eae1b1d71
parent 3 ff3b37722600
child 18 981afc7d3841
equal deleted inserted replaced
15:dff6ebfd236f 16:8b0eae1b1d71
   251         LOG_WRITE( "We are connecting just return from here" );
   251         LOG_WRITE( "We are connecting just return from here" );
   252         return;
   252         return;
   253         }
   253         }
   254     
   254     
   255     if ( iModel->Refreshing() )
   255     if ( iModel->Refreshing() )
   256         {          
   256         {
       
   257         // Make sure if leave occures that we don't block ourselves for retry
       
   258         CleanupStack::PushL( TCleanupItem( RestoreRefreshState, this ) );
   257         iModel->SetRefreshState( EFalse );
   259         iModel->SetRefreshState( EFalse );
   258         if ( iAppUi )
   260         if ( iAppUi )
   259             {            
   261             {            
   260             iAppUi->HideWaitNoteL();
   262             iAppUi->HideWaitNoteL();
   261             iInfoArray = iModel->GetWlanListL();
   263             iInfoArray = iModel->GetWlanListL();
   263                 {        
   265                 {        
   264                 iAppUi->ShowNoWlansFoundInfoL();       
   266                 iAppUi->ShowNoWlansFoundInfoL();       
   265                 }
   267                 }
   266             UpdateViewL();        
   268             UpdateViewL();        
   267             }
   269             }
       
   270         // pop cleanup item RestoreRefreshState
       
   271         CleanupStack::Pop();
   268         }
   272         }
   269     }
   273     }
   270     
   274     
   271 // ---------------------------------------------------------------------------
   275 // ---------------------------------------------------------------------------
   272 // TWsfMainController::NotifyEngineError
   276 // TWsfMainController::NotifyEngineError
   309 
   313 
   310 // ---------------------------------------------------------------------------
   314 // ---------------------------------------------------------------------------
   311 // TWsfMainController::WlanConnectionActivatedL
   315 // TWsfMainController::WlanConnectionActivatedL
   312 // ---------------------------------------------------------------------------
   316 // ---------------------------------------------------------------------------
   313 // 
   317 // 
   314 void TWsfMainController::WlanConnectionActivatedL( 
   318 void TWsfMainController::WlanConnectionActivatedL()
   315                                                 const TDesC& aAccessPointName )
       
   316     {
   319     {
   317     LOG_ENTERFN( "TWsfMainController::WlanConnectionActivatedL" ); 
   320     LOG_ENTERFN( "TWsfMainController::WlanConnectionActivatedL" ); 
   318     
   321     
   319     // update the model and refresh ui
   322     // update the model and refresh ui
   320     if ( iInfoArray )
   323     if ( iInfoArray )
   337                }
   340                }
   338             }
   341             }
   339 
   342 
   340         if ( !found )
   343         if ( !found )
   341             {
   344             {
   342             // find the entry for aAccessPointName
   345             // find the entry 
   343             // mark it connected - sort the array and refresh
   346             // mark it connected - sort the array and refresh
   344             TBuf8<KWlanMaxSsidLength> ssid;
   347             TWsfWlanInfo* temp = iInfoArray->Match( info.iSsid, 
   345             CnvUtfConverter::ConvertFromUnicodeToUtf8( ssid, aAccessPointName );
   348                                                     iInfoArray->Count() );
   346             
       
   347             TWsfWlanInfo* temp = iInfoArray->Match( ssid, iInfoArray->Count() );
       
   348             if ( temp )
   349             if ( temp )
   349                 {
   350                 {
   350                 temp->iConnectionState = EConnected;
   351                 temp->iConnectionState = EConnected;
   351                 iInfoArray->SortArrayL();
   352                 iInfoArray->SortArrayL();
   352                 UpdateViewL( iInfoArray );
   353                 UpdateViewL( iInfoArray );
   475         {
   476         {
   476         // if not known yet, create an IAP
   477         // if not known yet, create an IAP
   477         if ( iModel->CreateAccessPointL( info, EFalse ) )
   478         if ( iModel->CreateAccessPointL( info, EFalse ) )
   478             {
   479             {
   479             // update iapID to list
   480             // update iapID to list
   480             UpdateIapIdToInfoArray( info );
   481             UpdateIapIdToInfoArrayL( info );
   481             
   482             
   482             // on success, test it and save it as well
   483             // on success, test it and save it as well
   483             result = iModel->TestAccessPointL( info, ETrue, EFalse );
   484             result = iModel->TestAccessPointL( info, ETrue, EFalse );
   484             }
   485             }
   485         else
   486         else
   561         {
   562         {
   562         // a new access point needs to be created
   563         // a new access point needs to be created
   563         if ( iModel->CreateAccessPointL( info, EFalse ) )
   564         if ( iModel->CreateAccessPointL( info, EFalse ) )
   564             {
   565             {
   565             // update iapID to list
   566             // update iapID to list
   566             UpdateIapIdToInfoArray( info );
   567             UpdateIapIdToInfoArrayL( info );
   567 
   568 
   568             // on success, test it and save it as well
   569             // on success, test it and save it as well
   569             // (testing actually creates the connection)
   570             // (testing actually creates the connection)
   570             if ( iModel->TestAccessPointL( info, ETrue, ETrue ) == KErrCancel )
   571             if ( iModel->TestAccessPointL( info, ETrue, ETrue ) == KErrCancel )
   571                 {
   572                 {
   585     iAppUi->SetSuppressingKeyEvents( EFalse );  
   586     iAppUi->SetSuppressingKeyEvents( EFalse );  
   586 
   587 
   587     }
   588     }
   588 
   589 
   589 // ---------------------------------------------------------------------------
   590 // ---------------------------------------------------------------------------
   590 // TWsfMainController::UpdateIapIdToInfoArray
   591 // TWsfMainController::UpdateIapIdToInfoArrayL
   591 // ---------------------------------------------------------------------------
   592 // ---------------------------------------------------------------------------
   592 //
   593 //
   593 void TWsfMainController::UpdateIapIdToInfoArray( TWsfWlanInfo& aInfo )
   594 void TWsfMainController::UpdateIapIdToInfoArrayL( TWsfWlanInfo& aInfo )
   594     {
   595     {
   595     LOG_ENTERFN( "TWsfMainController::UpdateIapIdToInfoArray" ); 
   596     LOG_ENTERFN( "TWsfMainController::UpdateIapIdToInfoArrayL" ); 
   596     TWsfWlanInfo* temp = iInfoArray->Match( aInfo.iSsid, iInfoArray->Count() );
   597     TWsfWlanInfo* temp = iInfoArray->Match( aInfo.iSsid, iInfoArray->Count() );
   597     if ( temp && !aInfo.Hidden() )
   598     if ( temp && !aInfo.Hidden() )
   598         {
   599         {
   599         LOG_WRITE( "Info found" );
   600         LOG_WRITE( "Info found" );
   600         
   601         
   895                         static_cast<TWsfMainController*>( aPtr );
   896                         static_cast<TWsfMainController*>( aPtr );
   896     self->iAppUi->SetSuppressingKeyEvents( EFalse );
   897     self->iAppUi->SetSuppressingKeyEvents( EFalse );
   897     self->iModel->SetConnecting( EFalse );
   898     self->iModel->SetConnecting( EFalse );
   898     TRAP_IGNORE( self->iModel->RefreshScanL() );
   899     TRAP_IGNORE( self->iModel->RefreshScanL() );
   899     }
   900     }
       
   901 
       
   902 // ---------------------------------------------------------------------------
       
   903 // TWsfMainController::RestoreRefreshState
       
   904 // ---------------------------------------------------------------------------
       
   905 //
       
   906 void TWsfMainController::RestoreRefreshState( TAny* aPtr )
       
   907     {
       
   908     TWsfMainController* self = 
       
   909                         static_cast<TWsfMainController*>( aPtr );
       
   910     LOG_WRITE( "Restore refresh state")
       
   911     self->iModel->SetRefreshState( ETrue );
       
   912     }
   900       
   913       
   901 // End of file
   914 // End of file