wlan_bearer/wlanldd/wlan_common/umac_common/inc/umacdot11infrastructurescanningmode.h
changeset 0 c40eb8fe8501
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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 the License "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:   Declaration of the WlanDot11InfrastructureScanningMode
       
    15 *                class.
       
    16 *
       
    17 */
       
    18 
       
    19 /*
       
    20 * %version: 14 %
       
    21 */
       
    22 
       
    23 #ifndef C_WLANDOT11DOT11INFRASTRUCTURESCANNINGMODE_H
       
    24 #define C_WLANDOT11DOT11INFRASTRUCTURESCANNINGMODE_H
       
    25 
       
    26 #include "UmacDot11InfrastructureMode.h"
       
    27 #include "umacscanfsmcb.h"
       
    28 
       
    29 class WlanContextImpl;
       
    30 class WlanScanFsmCntx;
       
    31 
       
    32 /**
       
    33  *  Infrastructure mode scanning state
       
    34  *
       
    35  *  @lib wlanumac.lib
       
    36  *  @since S60 v3.1
       
    37  */
       
    38 class WlanDot11InfrastructureScanningMode : 
       
    39     public WlanDot11InfrastructureMode,
       
    40     public MWlanScanFsmCb
       
    41     {
       
    42 
       
    43 public:
       
    44 
       
    45     /**  backtrack to previous dot11 state when internal fsm is complete */
       
    46     static const TUint32 KDot11StateBackTrack          = ( 1 << 0 );
       
    47 
       
    48     /**  
       
    49     * does difference in dot11 power management mode exist 
       
    50     * between pre and post scanning mode 
       
    51     */
       
    52     static const TUint32 KDot11PwrMgmtModeDifference   = ( 1 << 1 );
       
    53 
       
    54     /**  Types for the FSM */
       
    55     
       
    56     /**  events for the FSM */
       
    57     enum TEvent
       
    58         {
       
    59         ESTATEENTRY,        // state entry action to be executed                        
       
    60         ETXCOMPLETE,        // underlying sw layer tx delivery complete event   
       
    61         ESTARTSCANNINGMODE, // start scanning mode event
       
    62         ESCANMODERUNNING,   // scan running event
       
    63         ESTOPSCANNINGMODE,  // stop scanning mode request
       
    64         ESCANNINGMODEEXIT,  // scanning mode termination event 
       
    65 
       
    66         EABORT,             // abort execution event
       
    67         EEVENTMAX           // defined as an upper bound
       
    68         };
       
    69 
       
    70     /**  states of the FSM */
       
    71     enum TState
       
    72         {
       
    73         EINIT,                  // start state of the state machine
       
    74         EEXECUTESCANFSM,        // execute scan fsm
       
    75         ECONTINUEDOT11TRAVERSE, // continue dot11 state traversal
       
    76         ESTATEMAX               // defined as an upper bound        
       
    77         }; 
       
    78 
       
    79     WlanDot11InfrastructureScanningMode() 
       
    80         : iState( EINIT ), iMode( static_cast<TScanMode>(0) ), 
       
    81           iScanRate( 0 ), iFlags( 0 ), iPimpl( NULL ), iCtxImpl( NULL ),
       
    82           iSSID( NULL ),  iChannels( NULL ), iMinChannelTime( 0 ), 
       
    83           iMaxChannelTime( 0 ), 
       
    84           iScanType( WHA::EForcedBgScan ),
       
    85           iSplitScan( EFalse ) {};
       
    86 
       
    87     virtual ~WlanDot11InfrastructureScanningMode();
       
    88 
       
    89     /**
       
    90      * 
       
    91      *
       
    92      * @since S60 3.1
       
    93      * @param ?arg1 ?description
       
    94      * @param ?arg2 ?description
       
    95      */
       
    96     inline void Dot11StateBackTrack();
       
    97 
       
    98     /**
       
    99      * 
       
   100      *
       
   101      * @since S60 3.1
       
   102      * @param ?arg1 ?description
       
   103      * @param ?arg2 ?description
       
   104      */
       
   105     void Set( WlanContextImpl& aCtxImpl );
       
   106 
       
   107     /**
       
   108      * 
       
   109      *
       
   110      * @since S60 3.1
       
   111      * @param ?arg1 ?description
       
   112      * @param ?arg2 ?description
       
   113      */
       
   114     void Set( 
       
   115         TScanMode aMode,                    
       
   116         const TSSID& aSSID,                 
       
   117         TUint32 aScanRate,                    
       
   118         SChannels& aChannels,
       
   119         TUint32 aMinChannelTime,            
       
   120         TUint32 aMaxChannelTime,
       
   121         TBool aSplitScan,
       
   122         WHA::TScanType aScanType = WHA::EForcedBgScan );
       
   123 
       
   124 private:
       
   125 
       
   126     /**
       
   127      * Internal state transition method
       
   128      *
       
   129      * @since S60 3.1
       
   130      * @param aCtxImpl global statemachine context
       
   131      * @param aNewState new internal state
       
   132      */
       
   133     void ChangeInternalState( WlanContextImpl& aCtxImpl, TState aNewState );
       
   134 
       
   135     /**
       
   136      * Feeds an event to internal fsm
       
   137      *
       
   138      * @since S60 3.1
       
   139      * @param aCtxImpl global statemachine context
       
   140      * @param aEvent fsm event
       
   141      */
       
   142     void Fsm( WlanContextImpl& aCtxImpl, TEvent aEvent ); 
       
   143 
       
   144     /**
       
   145      * ?description
       
   146      *
       
   147      * @since S60 3.1
       
   148      * @param aCtxImpl global statemachine context
       
   149      */
       
   150     void OnStateEntryEvent( WlanContextImpl& aCtxImpl );
       
   151 
       
   152     /**
       
   153      * ?description
       
   154      *
       
   155      * @since S60 3.1
       
   156      * @param aCtxImpl global statemachine context
       
   157      */
       
   158     void OnTxCompleteEvent( WlanContextImpl& aCtxImpl ) const;
       
   159 
       
   160     /**
       
   161      * ?description
       
   162      *
       
   163      * @since S60 3.1
       
   164      * @param aCtxImpl global statemachine context
       
   165      */
       
   166     void OnStartScanningModeEvent( WlanContextImpl& aCtxImpl );
       
   167 
       
   168     /**
       
   169      * Handles Scan Running event from scan fsm
       
   170      *
       
   171      * @since S60 3.2
       
   172      * @param aCtxImpl global statemachine context
       
   173      */
       
   174     void OnScanModeRunningEvent( WlanContextImpl& aCtxImpl ) const;
       
   175     
       
   176     /**
       
   177      * Handles Stop Scanning Mode event from scan fsm
       
   178      *
       
   179      * @since S60 3.2
       
   180      * @param aCtxImpl global statemachine context
       
   181      */
       
   182     void OnStopScanningModeEvent( WlanContextImpl& aCtxImpl );
       
   183 
       
   184     /**
       
   185      * ?description
       
   186      *
       
   187      * @since S60 3.1
       
   188      * @param aCtxImpl global statemachine context
       
   189      */
       
   190     void OnScanningModeExitEvent( WlanContextImpl& aCtxImpl );
       
   191 
       
   192     /**
       
   193      * ?description
       
   194      *
       
   195      * @since S60 3.1
       
   196      * @param aCtxImpl global statemachine context
       
   197      */
       
   198     void OnAbortEvent( WlanContextImpl& aCtxImpl );
       
   199 
       
   200     /**
       
   201      * ?description
       
   202      *
       
   203      * @since S60 3.1
       
   204      * @param aCtxImpl global statemachine context
       
   205      */
       
   206     void ExecuteScanFsm( WlanContextImpl& aCtxImpl );
       
   207 
       
   208     /**
       
   209      * ?description
       
   210      *
       
   211      * @since S60 3.1
       
   212      * @param aCtxImpl global statemachine context
       
   213      */
       
   214     void ContinueDot11StateTraversal( WlanContextImpl& aCtxImpl );
       
   215 
       
   216     // from base class MWlanWhaCommandClient
       
   217 
       
   218     /**
       
   219      * From MWlanWhaCommandClient.
       
   220      * ?description
       
   221      *
       
   222      * @since S60 3.1
       
   223      * @param aCtxImpl global statemachine context
       
   224      */
       
   225     virtual void OnWhaCommandResponse( 
       
   226         WlanContextImpl& aCtxImpl, 
       
   227         WHA::TCommandId aCommandId,
       
   228         WHA::TStatus aStatus,        
       
   229         const WHA::UCommandResponseParams& aCommandResponseParams,
       
   230         TUint32 aAct );
       
   231 
       
   232     // from base class MWlanWsaEvent
       
   233 
       
   234     /**
       
   235      * From MWlanWsaEvent.
       
   236      * ?description
       
   237      *
       
   238      * @since S60 3.1
       
   239      * @param aCtxImpl global statemachine context
       
   240      */
       
   241     virtual TBool CommandComplete( 
       
   242         WlanContextImpl& aCtxImpl, 
       
   243         WHA::TCompleteCommandId aCompleteCommandId, 
       
   244             WHA::TStatus aStatus,
       
   245         const WHA::UCommandCompletionParams& aCommandCompletionParams );
       
   246 
       
   247     /**
       
   248      * From MWlanWsaEvent.
       
   249      * ?description
       
   250      *
       
   251      * @since S60 3.1
       
   252      * @param aCtxImpl global statemachine context
       
   253      */
       
   254     virtual TAny* RequestForBuffer( 
       
   255         WlanContextImpl& aCtxImpl, 
       
   256         TUint16 aLength );
       
   257 
       
   258     // from base class WlanDot11Associated
       
   259 
       
   260     /**
       
   261      * From WlanDot11Associated.
       
   262      * Called upon receiving a beacon type frame
       
   263      *
       
   264      * @since S60 3.1
       
   265      * @param aCtxImpl global statemachine context
       
   266      * @param aRcpi RCPI of the frame
       
   267      * @param aBuffer pointer to the beginning of the Rx buffer allocated
       
   268      *        for the frame
       
   269      */
       
   270     virtual void OnBeaconFrameRx( 
       
   271         WlanContextImpl& aCtxImpl,
       
   272         const TAny* aFrame,
       
   273         const TUint32 aLength,
       
   274         WHA::TRcpi aRcpi,
       
   275         TUint8* aBuffer );
       
   276 
       
   277     /**
       
   278      * From WlanDot11Associated.
       
   279      * ?description
       
   280      *
       
   281      * @since S60 3.1
       
   282      * @param aCtxImpl global statemachine context
       
   283      * @param aRcpi RCPI of the frame
       
   284      * @param aBuffer pointer to the beginning of the Rx buffer allocated
       
   285      *        for the frame
       
   286      */
       
   287     virtual void OnProbeResponseFrameRx( 
       
   288         WlanContextImpl& aCtxImpl,
       
   289         const TAny* aFrame,
       
   290         const TUint32 aLength,
       
   291         WHA::TRcpi aRcpi,
       
   292         TUint8* aBuffer );
       
   293 
       
   294     // from base class WlanMacState
       
   295 
       
   296     /**
       
   297      * From WlanMacState.
       
   298      * ?description
       
   299      *
       
   300      * @since S60 3.1
       
   301      * @param aCtxImpl global statemachine context
       
   302      */
       
   303     virtual void Entry( WlanContextImpl& aCtxImpl );
       
   304 
       
   305     /**
       
   306      * From WlanMacState.
       
   307      * ?description
       
   308      *
       
   309      * @since S60 3.1
       
   310      * @param aCtxImpl global statemachine context
       
   311      */
       
   312     virtual void Exit( WlanContextImpl& aCtxImpl );
       
   313                                    
       
   314     /**
       
   315     * From WlanMacState.
       
   316     * Stop a previously started scan process. 
       
   317     *
       
   318     * @since S60 3.2
       
   319     * @param aCtxImpl global statemachine context
       
   320     * @return ETrue if a state transition occurred
       
   321     *         EFalse otherwise
       
   322     */
       
   323     virtual TBool StopScan( WlanContextImpl& aCtxImpl );
       
   324 
       
   325     /**
       
   326      * From WlanMacState.
       
   327      * ?description
       
   328      *
       
   329      * @since S60 3.1
       
   330      * @param aCtxImpl global statemachine context
       
   331      */
       
   332 #ifndef NDEBUG 
       
   333         virtual const TInt8* GetStateName( TUint8& aLength ) const;
       
   334 #endif // !NDEBUG 
       
   335 
       
   336     // from base class MWlanScanFsmCb
       
   337 
       
   338     virtual void OnScanFsmEvent( MWlanScanFsmCb::TEvent aEvent );
       
   339 
       
   340     // Prohibit copy constructor.
       
   341     WlanDot11InfrastructureScanningMode( 
       
   342         const WlanDot11InfrastructureScanningMode& );
       
   343     // Prohibit assigment operator.
       
   344     WlanDot11InfrastructureScanningMode& operator= ( 
       
   345         const WlanDot11InfrastructureScanningMode& ); 
       
   346 
       
   347 private: // data
       
   348 
       
   349 #ifndef NDEBUG
       
   350     /**  max length of state name for tracing */
       
   351     enum { KMaxStateStringLength = 50 };
       
   352 
       
   353     /**  max length of event name for tracing */
       
   354     enum { KMaxEventStringLength = KMaxStateStringLength };
       
   355 
       
   356     /**
       
   357      * state names for tracing
       
   358      */
       
   359     static const TUint8 iStateName[ESTATEMAX][KMaxStateStringLength];
       
   360 
       
   361     /**
       
   362      * event names for tracing 
       
   363      */
       
   364     static const TUint8 iEventName[EEVENTMAX][KMaxEventStringLength];         
       
   365     /**
       
   366      * name of the state
       
   367      */
       
   368     static const TInt8  iName[];
       
   369 #endif
       
   370 
       
   371     /**
       
   372      * state of the fsm 
       
   373      */
       
   374     TState              iState;
       
   375 
       
   376     /**
       
   377      * scan parameter as non-WHA types
       
   378      */
       
   379     TScanMode           iMode;                  
       
   380 
       
   381     /**
       
   382      * scan parameter as non-WHA types
       
   383      */
       
   384     TUint32             iScanRate;     
       
   385     
       
   386     /**
       
   387      * storage for interal flag values
       
   388      */
       
   389     TUint32             iFlags;
       
   390 
       
   391     /**
       
   392      * pointer to the scan fsm implementation
       
   393      * Own.
       
   394      */
       
   395     WlanScanFsmCntx*    iPimpl;
       
   396 
       
   397     /**
       
   398      * global state machine context 
       
   399      * Not own.  
       
   400      */
       
   401     WlanContextImpl*    iCtxImpl;
       
   402 
       
   403     /**
       
   404      * scan parameter as non-WHA types
       
   405      * Not own.  
       
   406      */
       
   407     const TSSID*        iSSID;                 
       
   408 
       
   409     /**
       
   410      * scan parameter as non-WHA types
       
   411      * Not own.  
       
   412      */
       
   413     SChannels*          iChannels;
       
   414 
       
   415     /**
       
   416      * minimum channel time
       
   417      */
       
   418     TUint32 iMinChannelTime;
       
   419 
       
   420     /**
       
   421      * maximum channel time
       
   422      */
       
   423     TUint32 iMaxChannelTime;
       
   424 
       
   425     /**
       
   426      * WHA scan type
       
   427      */
       
   428     WHA::TScanType iScanType;
       
   429 
       
   430     /**
       
   431      * should split scan be used
       
   432      */
       
   433     TBool iSplitScan;
       
   434     };
       
   435 
       
   436 #include "umacdot11infrastructurescanningmode.inl"
       
   437 
       
   438 #endif // C_WLANDOT11DOT11INFRASTRUCTURESCANNINGMODE_H