wlanutilities/wlansniffer/aiplugin/src/wsfaicontroller.cpp
branchRCL_3
changeset 20 a9524956f6b5
parent 13 858c6c491d0e
equal deleted inserted replaced
18:aaabc7526ded 20:a9524956f6b5
    78 TWsfAiController::TWsfAiController():
    78 TWsfAiController::TWsfAiController():
    79     iModel( NULL ),
    79     iModel( NULL ),
    80     iAiModel( NULL ),
    80     iAiModel( NULL ),
    81     iUi( NULL ),
    81     iUi( NULL ),
    82     iDbObserver( NULL ),
    82     iDbObserver( NULL ),
    83     iShouldConnectOnly( EFalse ),
    83     iConnectOnly( EFalse )
    84     iTestAccessPoint( EFalse )
       
    85     {
    84     {
    86     // null the pointers
    85     // null the pointers
    87     iConnectedWlan.iConnectionState = ENotConnected;
    86     iConnectedWlan.iConnectionState = ENotConnected;
    88     }
    87     }
    89 
    88 
   459         }
   458         }
   460     iAiModel->SetConnecting( EFalse );
   459     iAiModel->SetConnecting( EFalse );
   461     if ( aResult == KErrNone )
   460     if ( aResult == KErrNone )
   462         {
   461         {
   463         iAiModel->SetConnected( ETrue );
   462         iAiModel->SetConnected( ETrue );
   464         if ( !iShouldConnectOnly )
   463         if ( !iConnectOnly )
   465             {
   464             {
   466             StartWebBrowserL( iUsedInfo );
   465             StartWebBrowserL( iUsedInfo );
   467             }
       
   468         if ( iTestAccessPoint )
       
   469             {
       
   470             iModel->TestConnectedAccessPointL( iUsedInfo, iShouldConnectOnly );
       
   471             }
   466             }
   472         }
   467         }
   473     else
   468     else
   474         {
   469         {
   475         iAiModel->SetConnected( EFalse );
   470         iAiModel->SetConnected( EFalse );
   509         ConnectL( iUsedInfo, EFalse, EFalse );
   504         ConnectL( iUsedInfo, EFalse, EFalse );
   510         }
   505         }
   511     else
   506     else
   512         {
   507         {
   513         LOG_WRITE("Start browser to connected network...");
   508         LOG_WRITE("Start browser to connected network...");
   514         iShouldConnectOnly = EFalse;
   509         iConnectOnly = EFalse;
   515         StartWebBrowserL( iUsedInfo );
   510         StartWebBrowserL( iUsedInfo );
   516         }
   511         }
   517     
   512     
   518     // pop cleanup item 
   513     // pop cleanup item 
   519     CleanupStack::Pop();
   514     CleanupStack::Pop();
   556                                  TBool aTestAccessPoint )
   551                                  TBool aTestAccessPoint )
   557     {
   552     {
   558     LOG_ENTERFN( "TWsfAiController::ConnectL" );
   553     LOG_ENTERFN( "TWsfAiController::ConnectL" );
   559     
   554     
   560     _ASS_D( iModel );
   555     _ASS_D( iModel );
   561     iTestAccessPoint = aTestAccessPoint;
   556     TBool testAccessPoint = aTestAccessPoint;
   562     iShouldConnectOnly = aConnectOnly;
   557     iConnectOnly = aConnectOnly;
   563     iUsedInfo = aInfo;
   558     iUsedInfo = aInfo;
   564     
   559     
   565     // Prevent connections to ad-hoc + WPA 
   560     // Prevent connections to ad-hoc + WPA 
   566     if ( iUsedInfo.iNetMode == CMManager::EAdhoc 
   561     if ( iUsedInfo.iNetMode == CMManager::EAdhoc 
   567             && iUsedInfo.iSecurityMode == CMManager::EWlanSecModeWpa )
   562             && iUsedInfo.iSecurityMode == CMManager::EWlanSecModeWpa )
   600         else if ( accessPointCreatedError != KErrNone || !success )
   595         else if ( accessPointCreatedError != KErrNone || !success )
   601             {
   596             {
   602             User::Leave( accessPointCreatedError );
   597             User::Leave( accessPointCreatedError );
   603             }
   598             }
   604         ConnectingL( iUsedInfo.iIapId );
   599         ConnectingL( iUsedInfo.iIapId );
   605         iTestAccessPoint = ETrue;
   600         testAccessPoint = ETrue;
   606         }
   601         }
   607     else if ( !iUsedInfo.iIapId )
   602     else if ( !iUsedInfo.iIapId )
   608         {
   603         {
       
   604         testAccessPoint = ETrue;
   609         // let the helper app do the query if necessary
   605         // let the helper app do the query if necessary
   610         LOG_WRITE("AiHelper needs to be launched");
   606         LOG_WRITE("AiHelper needs to be launched");
   611         iTestAccessPoint = ETrue;
       
   612         iActiveWrappers->LaunchHelperApplicationL( iUsedInfo, 
   607         iActiveWrappers->LaunchHelperApplicationL( iUsedInfo, 
   613                                                    iShouldConnectOnly,
   608                                                    iConnectOnly,
   614                                                    iTestAccessPoint );
   609                                                    testAccessPoint );
   615         }
   610         }
   616     
   611     
   617     // Connect
   612     // Connect
   618     if ( iUsedInfo.iIapId )
   613     if ( iUsedInfo.iIapId )
   619         {
   614         {
   620         if ( iTestAccessPoint )
   615         if ( testAccessPoint )
   621             {
   616             {
   622             iActiveWrappers->Connect( iUsedInfo.iIapId, EIapExpireOnDisconnect );
   617             iActiveWrappers->Connect( iUsedInfo.iIapId, iConnectOnly, 
       
   618                                       EIapExpireOnDisconnect );
   623             
   619             
   624             }
   620             }
   625         else
   621         else
   626             {
   622             {
   627             iActiveWrappers->Connect( iUsedInfo.iIapId, EIapPersistent );
   623             iActiveWrappers->Connect( iUsedInfo.iIapId, iConnectOnly, 
       
   624                                       EIapPersistent );
   628             }
   625             }
   629         }
   626         }
   630     // pop cleanup item 
   627     // pop cleanup item 
   631     CleanupStack::Pop();
   628     CleanupStack::Pop();
   632     }
   629     }