wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/src/wlanbgscanstates.cpp
branchRCL_3
changeset 6 e0f767079796
parent 5 51a71243e562
child 17 a828660c511c
equal deleted inserted replaced
5:51a71243e562 6:e0f767079796
    14 * Description:  This class implements WLAN background scan logic.
    14 * Description:  This class implements WLAN background scan logic.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 3 %
    19 * %version: 4 %
    20 */
    20 */
    21 
    21 
    22 #include <e32base.h>
    22 #include <e32base.h>
    23 #include <e32const.h> 
    23 #include <e32const.h> 
    24 
    24 
    55     iProvider( aProvider ),
    55     iProvider( aProvider ),
    56     iTimerServices( aTimerServices ),
    56     iTimerServices( aTimerServices ),
    57     iBgScanState( EBgScanStateMax ),
    57     iBgScanState( EBgScanStateMax ),
    58     iIntervalChangeRequestId( 0 ),
    58     iIntervalChangeRequestId( 0 ),
    59     iCompletedAwsCommand( MWlanBgScanAwsComms::EAwsCommandMax ),
    59     iCompletedAwsCommand( MWlanBgScanAwsComms::EAwsCommandMax ),
    60     iAwsCommandCompletionCode( KErrNone )
    60     iAwsCommandCompletionCode( KErrNone ),
       
    61     iWlanState( MWlanBgScanProvider::EWlanStateMax )
    61     {
    62     {
    62     DEBUG( "CWlanBgScanStates::CWlanBgScanStates()" );
    63     DEBUG( "CWlanBgScanStates::CWlanBgScanStates()" );
    63     }
    64     }
    64 
    65 
    65 // ---------------------------------------------------------------------------
    66 // ---------------------------------------------------------------------------
   834 //
   835 //
   835 void CWlanBgScanStates::RefreshUsedInterval()
   836 void CWlanBgScanStates::RefreshUsedInterval()
   836     {
   837     {
   837     TUint oldInterval = iUsedBgScanInterval;
   838     TUint oldInterval = iUsedBgScanInterval;
   838     
   839     
   839     DEBUG2( "CWlanBgScanStates::RefreshUsedInterval() - agg: %u, normal: %u",
   840     DEBUG4( "CWlanBgScanStates::RefreshUsedInterval() - agg: %u, normal: %u, used: %u, wlan state: %u",
   840         iAggressiveBgScanInterval, iBgScanInterval );
   841         iAggressiveBgScanInterval, iBgScanInterval, iUsedBgScanInterval, iWlanState );
   841     
   842     
   842     // Smaller of the two intervals will be taken into use
   843     // If      ( WLAN state is connected )               -> use interval: KWlanNoScanning 
   843     if( iAggressiveBgScanInterval < iBgScanInterval )
   844     // Else If ( aggressive interval < normal interval ) -> use interval: aggressive interval
       
   845     // Otherwise                                         -> use interval: background scan interval
       
   846     if( iWlanState == MWlanBgScanProvider::EWlanStateConnected )
       
   847         {
       
   848         iUsedBgScanInterval = KWlanNoScanning;
       
   849         }
       
   850     else if( iAggressiveBgScanInterval < iBgScanInterval )
   844         {
   851         {
   845         iUsedBgScanInterval = iAggressiveBgScanInterval;
   852         iUsedBgScanInterval = iAggressiveBgScanInterval;
   846         }
   853         }
   847     else
   854     else
   848         {
   855         {
   874         iProvider.Scan( KWlanBgScanMaxDelayExpireImmediately );
   881         iProvider.Scan( KWlanBgScanMaxDelayExpireImmediately );
   875         }
   882         }
   876     // else
   883     // else
   877         // In case the new interval is bigger than the old one, it
   884         // In case the new interval is bigger than the old one, it
   878         // is taken into use after the pending scan request completes.
   885         // is taken into use after the pending scan request completes.
   879     }
   886     DEBUG1( "CWlanBgScanStates::RefreshUsedInterval() - using interval: %u", iUsedBgScanInterval );
   880 
   887     
   881     
   888     }
   882     
   889 
       
   890     
       
   891