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