wlan_bearer/wlanldd/wlan_common/umac_common/src/umacdot11ibssscanningmode.cpp
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:   Implementation of the WlanDot11IbssScanningMode class.
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 17 %
       
    20 */
       
    21 
       
    22 #include "config.h"
       
    23 #include "umacdot11ibssscanningmode.h"
       
    24 #include "umacscanfsmcntx.h"
       
    25 #include "UmacContextImpl.h"
       
    26 #include "UmacWsaWriteMib.h"
       
    27 #include "UmacWsaScan.h"
       
    28 #include "umacwhastopscan.h"
       
    29 #include "umacwhatodot11typeconverter.h"
       
    30 
       
    31 #ifndef NDEBUG
       
    32 const TInt8 WlanDot11IbssScanningMode::iName[] = "dot11-ibssscanningmode";
       
    33 
       
    34 const TUint8 WlanDot11IbssScanningMode::iStateName
       
    35     [ESTATEMAX][KMaxStateStringLength] = 
       
    36     {
       
    37         {"EINIT"}, 
       
    38         {"EEXECUTESCANFSM"},
       
    39         {"ECONTINUEDOT11TRAVERSE"}
       
    40     };
       
    41 
       
    42 const TUint8 WlanDot11IbssScanningMode::iEventName
       
    43     [EEVENTMAX][KMaxEventStringLength] = 
       
    44     {
       
    45         {"ESTATEENTRY"}, 
       
    46         {"ETXCOMPLETE"},
       
    47         {"ESTARTSCANNINGMODE"},
       
    48         {"ESCANMODERUNNING"},
       
    49         {"ESTOPSCANNINGMODE"},
       
    50         {"ESCANNINGMODEEXIT"},
       
    51         {"EABORT"}
       
    52     };
       
    53 #endif
       
    54 
       
    55 // ======== MEMBER FUNCTIONS ========
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // 
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 WlanDot11IbssScanningMode::~WlanDot11IbssScanningMode() 
       
    62     {
       
    63     iCtxImpl = NULL;
       
    64     iSSID = NULL;
       
    65     iChannels = NULL;
       
    66     iPimpl = NULL;
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // 
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 void WlanDot11IbssScanningMode::Set( 
       
    74     WlanContextImpl& aCtxImpl )
       
    75     {
       
    76     iCtxImpl = &aCtxImpl;
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // 
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void WlanDot11IbssScanningMode::Set( 
       
    84     WlanContextImpl& /*aCtxImpl*/,
       
    85     TScanMode aMode,                    
       
    86     const TSSID& aSSID,                 
       
    87     TUint32 aScanRate,                    
       
    88     SChannels& aChannels,
       
    89     TUint32 aMinChannelTime,            
       
    90     TUint32 aMaxChannelTime,
       
    91     TBool aSplitScan )    
       
    92     {
       
    93     // we can store pointers as oid parameters are guaranteed to be valid 
       
    94     // to the point the corresponding completion method is called
       
    95     iMode = aMode;
       
    96     iSSID = &aSSID;
       
    97     iScanRate = aScanRate;
       
    98     iChannels = &aChannels;
       
    99     iMinChannelTime = aMinChannelTime;            
       
   100     iMaxChannelTime = aMaxChannelTime;
       
   101     iSplitScan = aSplitScan;
       
   102     }
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // The internal state transition method.
       
   106 // It is guaranteed by the FSM framework that no WHA command is pending
       
   107 // when this method is entered
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 void WlanDot11IbssScanningMode::ChangeInternalState( 
       
   111     WlanContextImpl& aCtxImpl, 
       
   112     TState aNewState )
       
   113     {
       
   114     iState = aNewState;
       
   115     Fsm( aCtxImpl, ESTATEENTRY );
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // The event dispatcher method.
       
   120 // It is guaranteed by the FSM framework that no WHA command is pending
       
   121 // when this method is entered
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 void WlanDot11IbssScanningMode::Fsm( 
       
   125     WlanContextImpl& aCtxImpl, 
       
   126     TEvent aEvent )
       
   127     {
       
   128     OsTracePrint( KScan, 
       
   129         (TUint8*)("UMAC * dot11-ibssscanningmode * FSM EVENT") );
       
   130 #ifndef NDEBUG
       
   131     OsTracePrint( KScan, (TUint8*)("event:"));
       
   132     OsTracePrint( KScan, iEventName[aEvent] );
       
   133     OsTracePrint( KScan, (TUint8*)("state:"));
       
   134     OsTracePrint( KScan, iStateName[iState] );
       
   135 #endif
       
   136 
       
   137     switch ( aEvent )
       
   138         {
       
   139         case ESTATEENTRY:
       
   140             OnStateEntryEvent( aCtxImpl );
       
   141             break;
       
   142         case ETXCOMPLETE:
       
   143             OnTxCompleteEvent( aCtxImpl );
       
   144             break;
       
   145         case ESTARTSCANNINGMODE:
       
   146             OnStartScanningModeEvent( aCtxImpl );
       
   147             break;
       
   148         case ESCANMODERUNNING:
       
   149             OnScanModeRunningEvent( aCtxImpl );
       
   150             break;
       
   151         case ESTOPSCANNINGMODE:
       
   152             OnStopScanningModeEvent( aCtxImpl );
       
   153             break;
       
   154         case ESCANNINGMODEEXIT:
       
   155             OnScanningModeExitEvent( aCtxImpl );
       
   156             break;
       
   157         case EABORT:
       
   158             OnAbortEvent( aCtxImpl );
       
   159             break;
       
   160         default:
       
   161             // catch internal FSM programming error
       
   162 #ifndef NDEBUG
       
   163             OsTracePrint( KErrorLevel, (TUint8*)("event:"));
       
   164             OsTracePrint( KErrorLevel, iEventName[aEvent] );                
       
   165 #endif
       
   166             OsAssert( (TUint8*)("* UMAC * panic"), 
       
   167                 (TUint8*)(WLAN_FILE), __LINE__ );
       
   168             break;
       
   169         }
       
   170     }
       
   171 
       
   172 // -----------------------------------------------------------------------------
       
   173 // Handler for the event.
       
   174 // It is guaranteed by the FSM framework that no WHA command is pending
       
   175 // when this method is entered
       
   176 // -----------------------------------------------------------------------------
       
   177 //
       
   178 void WlanDot11IbssScanningMode::OnStateEntryEvent( 
       
   179     WlanContextImpl& aCtxImpl )
       
   180     {
       
   181     switch ( iState )
       
   182         {
       
   183         case EINIT:
       
   184             iPimpl = static_cast<WlanScanFsmCntx*>
       
   185                 (os_alloc( sizeof(WlanScanFsmCntx) ));
       
   186             if ( iPimpl )
       
   187                 {
       
   188                 // allocation success
       
   189                 new (iPimpl) WlanScanFsmCntx( *this );
       
   190                 // start fsm traversal
       
   191                 ChangeInternalState( aCtxImpl, EEXECUTESCANFSM );                
       
   192                 }
       
   193             else
       
   194                 {
       
   195                 // allocation failure
       
   196                 Fsm( aCtxImpl, EABORT );
       
   197                 }
       
   198 
       
   199             break;
       
   200         case EEXECUTESCANFSM:
       
   201             ExecuteScanFsm( aCtxImpl );
       
   202             break;
       
   203         case ECONTINUEDOT11TRAVERSE:
       
   204             ContinueDot11StateTraversal( aCtxImpl );
       
   205             break;
       
   206         default:
       
   207             // cath internal FSM programming error
       
   208 #ifndef NDEBUG
       
   209             OsTracePrint( KErrorLevel, (TUint8*)("state:"));
       
   210             OsTracePrint( KErrorLevel, iStateName[iState] );
       
   211 #endif
       
   212             OsAssert( (TUint8*)("* UMAC * panic"), 
       
   213                 (TUint8*)(WLAN_FILE), __LINE__ );
       
   214             break;
       
   215         }
       
   216     }
       
   217 
       
   218 // -----------------------------------------------------------------------------
       
   219 // Handler for the event.
       
   220 // It is guaranteed by the FSM framework that no WHA command is pending
       
   221 // when this method is entered
       
   222 // -----------------------------------------------------------------------------
       
   223 //
       
   224 void WlanDot11IbssScanningMode::OnTxCompleteEvent( 
       
   225     WlanContextImpl& /*aCtxImpl*/ ) const
       
   226     {
       
   227     switch ( iState )
       
   228         {
       
   229         case EEXECUTESCANFSM:
       
   230             // we are running the scan fsm 
       
   231             // and we have nothing to do here
       
   232             break;
       
   233         default:
       
   234             // catch internal FSM programming error
       
   235 #ifndef NDEBUG
       
   236             OsTracePrint( KErrorLevel, (TUint8*)("state:"));
       
   237             OsTracePrint( KErrorLevel, iStateName[iState] );
       
   238 #endif
       
   239             OsAssert( (TUint8*)("* UMAC * panic"), 
       
   240                 (TUint8*)(WLAN_FILE), __LINE__ );
       
   241             break;
       
   242         }
       
   243     }
       
   244 
       
   245 // -----------------------------------------------------------------------------
       
   246 // Handler for the event.
       
   247 // It is guaranteed by the FSM framework that no WHA command is pending
       
   248 // when this method is entered
       
   249 // -----------------------------------------------------------------------------
       
   250 //
       
   251 void WlanDot11IbssScanningMode::OnStartScanningModeEvent( 
       
   252     WlanContextImpl& aCtxImpl )
       
   253     {
       
   254     // start the scanning mode
       
   255 
       
   256     // convert scan parameters to WHA types
       
   257     // Note that we need to deallocate the memory from whaChannels
       
   258     // - which is allocated in ConvertToWhaTypes() - when we are done
       
   259 
       
   260     WHA::SSSID* wha_ssid = 
       
   261         static_cast<WHA::SSSID*>(os_alloc( sizeof(WHA::SSSID) )); 
       
   262     if ( !wha_ssid )
       
   263         {
       
   264         // memory allocation failue; that's fatal
       
   265         Fsm( aCtxImpl, EABORT );
       
   266         return;
       
   267         }
       
   268 
       
   269     WHA::SChannels* wha_channels( NULL );
       
   270     TUint8 wha_channelcount( 0 );
       
   271 
       
   272     if ( !(WlanWhaToDot11TypeConverter::ConvertToWhaTypes(       
       
   273         aCtxImpl, 
       
   274         iSSID, 
       
   275         *wha_ssid, 
       
   276         iChannels, 
       
   277         iMinChannelTime,
       
   278         iMaxChannelTime,
       
   279         wha_channels, 
       
   280         wha_channelcount )) )
       
   281         {
       
   282         // memory allocation failue; that's fatal
       
   283         os_free( wha_ssid );
       
   284         Fsm( aCtxImpl, EABORT );
       
   285         }
       
   286     else
       
   287         {
       
   288         // start the scanning process
       
   289         
       
   290         const TUint8 KNbrOfProbeReqsPerCh = 2;
       
   291         const TUint8 KNoProbeReqs = 0;        
       
   292         const TUint8 KNbrOfSsids = 1;
       
   293         const TUint8 KNoSsids = 0;
       
   294         
       
   295         // 1st set the context
       
   296         aCtxImpl.WsaScan().Set( 
       
   297             aCtxImpl,
       
   298             iScanRate,
       
   299             iChannels->iBand,
       
   300             wha_channelcount,
       
   301             wha_channels,
       
   302             WHA::EFgScan,
       
   303             (iMode == EActiveScan) ? KNbrOfProbeReqsPerCh : KNoProbeReqs,
       
   304             iSplitScan,
       
   305             wha_ssid->iSSIDLength ? KNbrOfSsids : KNoSsids,
       
   306             wha_ssid );
       
   307         
       
   308         // change global state: entry procedure triggers action
       
   309         ChangeState( aCtxImpl, 
       
   310             *this,              // prev state
       
   311             aCtxImpl.WsaScan()  // next state
       
   312             );
       
   313             
       
   314         // as the parameters have been supplied we can now deallocate
       
   315         os_free( wha_ssid );
       
   316         os_free( wha_channels );                                    
       
   317         }
       
   318     }
       
   319 
       
   320 // -----------------------------------------------------------------------------
       
   321 // Handler for the event.
       
   322 // It is guaranteed by the FSM framework that no WHA command is pending
       
   323 // when this method is entered
       
   324 // -----------------------------------------------------------------------------
       
   325 //
       
   326 void WlanDot11IbssScanningMode::OnScanModeRunningEvent( 
       
   327     WlanContextImpl& aCtxImpl ) const
       
   328     {
       
   329     // complete the scan request
       
   330     
       
   331     OsTracePrint( KScan, (TUint8*)
       
   332         ("UMAC: WlanDot11IbssScanningMode::OnScanModeRunningEvent: Complete scan request") );
       
   333     OnOidComplete( aCtxImpl );            
       
   334     }
       
   335 
       
   336 // -----------------------------------------------------------------------------
       
   337 // Handler for the event.
       
   338 // It is guaranteed by the FSM framework that no WHA command is pending
       
   339 // when this method is entered
       
   340 // -----------------------------------------------------------------------------
       
   341 //
       
   342 void WlanDot11IbssScanningMode::OnStopScanningModeEvent( 
       
   343     WlanContextImpl& aCtxImpl )
       
   344     {
       
   345     // change global state: entry procedure triggers action
       
   346     ChangeState( aCtxImpl, 
       
   347         *this,                  // prev state
       
   348         aCtxImpl.WhaStopScan()  // next state
       
   349         );
       
   350     }
       
   351 
       
   352 // -----------------------------------------------------------------------------
       
   353 // Handler for the event.
       
   354 // It is guaranteed by the FSM framework that no WHA command is pending
       
   355 // when this method is entered
       
   356 // -----------------------------------------------------------------------------
       
   357 //
       
   358 void WlanDot11IbssScanningMode::OnScanningModeExitEvent( 
       
   359     WlanContextImpl& aCtxImpl )
       
   360     {
       
   361     // scanning mode has stopped and so can we
       
   362     
       
   363     // inform the mgmt client about scan completion
       
   364 
       
   365     OsTracePrint( KScan, (TUint8*)
       
   366         ("UMAC: WlanDot11IbssScanningMode::OnScanningModeExitEvent: Send scan complete indication"));
       
   367     
       
   368     OnInDicationEvent( aCtxImpl, EScanCompleted );
       
   369     
       
   370     // continue with the dot11 state traversal
       
   371     ChangeInternalState( aCtxImpl, ECONTINUEDOT11TRAVERSE );
       
   372     }
       
   373 
       
   374 // ---------------------------------------------------------
       
   375 // simulate macnotresponding error
       
   376 // ---------------------------------------------------------
       
   377 //
       
   378 void WlanDot11IbssScanningMode::OnAbortEvent( 
       
   379     WlanContextImpl& aCtxImpl )
       
   380     {
       
   381     OsTracePrint( KWarningLevel, 
       
   382         (TUint8*)("UMAC * dot11-ibssscanningmode * abort") );
       
   383 
       
   384     DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding );
       
   385     }
       
   386 
       
   387 // -----------------------------------------------------------------------------
       
   388 // 
       
   389 // -----------------------------------------------------------------------------
       
   390 //
       
   391 void WlanDot11IbssScanningMode::ExecuteScanFsm( 
       
   392     WlanContextImpl& /*aCtxImpl*/ )
       
   393     {
       
   394     // start scan fsm
       
   395     iPimpl->Current().StartScanningMode( *iPimpl );
       
   396     }
       
   397 
       
   398 // -----------------------------------------------------------------------------
       
   399 // 
       
   400 // -----------------------------------------------------------------------------
       
   401 //
       
   402 void WlanDot11IbssScanningMode::ContinueDot11StateTraversal( 
       
   403     WlanContextImpl& aCtxImpl )
       
   404     {
       
   405     // return back     
       
   406     ChangeState( aCtxImpl, 
       
   407         *this,                              // prev state
       
   408         aCtxImpl.iStates.iIbssNormalMode    // next state
       
   409         );
       
   410     }
       
   411 
       
   412 // -----------------------------------------------------------------------------
       
   413 // Handler for WHA command response event.
       
   414 // It is guaranteed by the global protocol fsm framework that no WHA command is 
       
   415 // pending when this method is entered
       
   416 // -----------------------------------------------------------------------------
       
   417 //
       
   418 void WlanDot11IbssScanningMode::OnWhaCommandResponse( 
       
   419     WlanContextImpl& aCtxImpl, 
       
   420     WHA::TCommandId aCommandId, 
       
   421     WHA::TStatus aStatus,
       
   422     const WHA::UCommandResponseParams& aCommandResponseParams,
       
   423     TUint32 aAct )
       
   424     {
       
   425     if ( aCommandId == WHA::EScanCommandResponse )
       
   426         {
       
   427         OsTracePrint( KScan, (TUint8*)("UMAC * OnScanningModeStarted"));
       
   428 
       
   429         // morph event to the scan fsm
       
   430         iPimpl->Current().OnScanningModeStarted( *iPimpl );
       
   431         }
       
   432     else if ( aCommandId == WHA::EStopScanResponse )
       
   433         {
       
   434         // complete the stop scan request
       
   435 
       
   436         OsTracePrint( KScan, (TUint8*)
       
   437             ("UMAC: WlanDot11IbssScanningMode::OnWhaCommandResponse: complete stop scan request"));        
       
   438 
       
   439         OnOidComplete( aCtxImpl );
       
   440         }
       
   441     else
       
   442         {
       
   443         // this is a response to a command that was not generated 
       
   444         // by this dot11 state object
       
   445         // so let's forward it to the default handler 
       
   446         WlanDot11State::OnWhaCommandResponse(
       
   447             aCtxImpl, 
       
   448             aCommandId, 
       
   449             aStatus,
       
   450             aCommandResponseParams,
       
   451             aAct );
       
   452         }
       
   453     }
       
   454 
       
   455 // -----------------------------------------------------------------------------
       
   456 // Handler for WHA command completion event.
       
   457 // It is guaranteed by the global protocol fsm framework that no WHA command is 
       
   458 // pending when this method is entered
       
   459 // -----------------------------------------------------------------------------
       
   460 //
       
   461 TBool WlanDot11IbssScanningMode::CommandComplete( 
       
   462     WlanContextImpl& /*aCtxImpl*/, 
       
   463     WHA::TCompleteCommandId aCompleteCommandId, 
       
   464     WHA::TStatus /*aStatus*/,
       
   465     const WHA::UCommandCompletionParams& /*aCommandCompletionParams*/ )
       
   466     {
       
   467     if ( aCompleteCommandId != WHA::EScanComplete )
       
   468         {
       
   469         // implementation error as this can be the only one
       
   470         OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ );
       
   471         }
       
   472     
       
   473     OsTracePrint( KScan, (TUint8*)("UMAC * OnScanningModeStopped"));
       
   474 
       
   475     // morph event to scan fsm
       
   476     iPimpl->Current().OnScanningModeStopped( *iPimpl );
       
   477 
       
   478     // as scanning mode has ended we will change dot11 state.
       
   479     // Signal it to caller
       
   480     return ETrue;
       
   481     }
       
   482 
       
   483 // -----------------------------------------------------------------------------
       
   484 // 
       
   485 // -----------------------------------------------------------------------------
       
   486 //
       
   487 TAny* WlanDot11IbssScanningMode::RequestForBuffer( 
       
   488     WlanContextImpl& aCtxImpl, 
       
   489     TUint16 aLength )
       
   490     {
       
   491     return aCtxImpl.GetRxBuffer( aLength );
       
   492     }
       
   493 
       
   494 // -----------------------------------------------------------------------------
       
   495 // 
       
   496 // -----------------------------------------------------------------------------
       
   497 //
       
   498 void WlanDot11IbssScanningMode::OnBeaconFrameRx( 
       
   499     WlanContextImpl& aCtxImpl,
       
   500     const TAny* aFrame,
       
   501     const TUint32 aLength,
       
   502     WHA::TRcpi aRcpi,
       
   503     TUint8* aBuffer )
       
   504     {
       
   505     // as we have a beacon frame 
       
   506     // we will pass it to the client of the mgmt interface
       
   507     XferDot11FrameToMgmtClient( aCtxImpl, aFrame, aLength, aRcpi, aBuffer );
       
   508     }
       
   509 
       
   510 // -----------------------------------------------------------------------------
       
   511 // 
       
   512 // -----------------------------------------------------------------------------
       
   513 //
       
   514 void WlanDot11IbssScanningMode::OnProbeResponseFrameRx( 
       
   515     WlanContextImpl& aCtxImpl,
       
   516     const TAny* aFrame,
       
   517     const TUint32 aLength,
       
   518     WHA::TRcpi aRcpi,
       
   519     TUint8* aBuffer )
       
   520     {
       
   521     // as we have a probe response frame
       
   522     // we will pass it to the client of the mgmt interface
       
   523     XferDot11FrameToMgmtClient( aCtxImpl, aFrame, aLength, aRcpi, aBuffer );
       
   524     }
       
   525 
       
   526 // -----------------------------------------------------------------------------
       
   527 // 
       
   528 // -----------------------------------------------------------------------------
       
   529 //
       
   530 void WlanDot11IbssScanningMode::Entry( 
       
   531     WlanContextImpl& aCtxImpl )
       
   532     {
       
   533     if ( aCtxImpl.WsaCmdActive() )
       
   534         {
       
   535         // sanity checking code
       
   536         OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ );
       
   537         }
       
   538 
       
   539     // we don't want to do full event dispatching here as we want
       
   540     // to run this dot11 state in non pre-emptive mode.
       
   541     // However, we do want to handle the scan complete event in case it has
       
   542     // been registered
       
   543     if ( aCtxImpl.CommandCompletionEventRegistered( WHA::EScanComplete ) )
       
   544         {
       
   545         OsTracePrint( KScan, (TUint8*)
       
   546             ("UMAC: WlanDot11IbssScanningMode::Entry: Scan complete event registered") );
       
   547         
       
   548         aCtxImpl.DispatchCommandCompletionEvent();
       
   549         // in this case we have actually already changed to another state
       
   550         // so there's nothing more for us to do here
       
   551         }
       
   552     else
       
   553         {
       
   554         // scan complete event not registered. Continue in the normal fashion
       
   555 
       
   556         if ( iState != EINIT )
       
   557             {
       
   558             // this is NOT the start of the the FSM actions
       
   559             // note that we send the ETXCOMPLETE event as the states
       
   560             // that wait for it are the only ones that can be interrupted
       
   561             // as they are asynchronous operations by nature
       
   562             // and wait for corresponding WHA completion method
       
   563             Fsm( aCtxImpl, ETXCOMPLETE );
       
   564             }
       
   565         else
       
   566             {
       
   567             // this is the start of the FSM actions
       
   568             Fsm( aCtxImpl, ESTATEENTRY );
       
   569             }
       
   570         }
       
   571     }
       
   572 
       
   573 // -----------------------------------------------------------------------------
       
   574 // 
       
   575 // -----------------------------------------------------------------------------
       
   576 //
       
   577 void WlanDot11IbssScanningMode::Exit( 
       
   578     WlanContextImpl& /*aCtxImpl*/ )
       
   579     {
       
   580     // reset fsm
       
   581     iState = EINIT;
       
   582 
       
   583     // get rid of scan fsm implementation
       
   584     iPimpl->~WlanScanFsmCntx();
       
   585     os_free( iPimpl );
       
   586     iPimpl = NULL;
       
   587     }
       
   588 
       
   589 // -----------------------------------------------------------------------------
       
   590 // 
       
   591 // -----------------------------------------------------------------------------
       
   592 //
       
   593 TBool WlanDot11IbssScanningMode::StopScan( WlanContextImpl& /*aCtxImpl*/ )
       
   594     {
       
   595     // inform scan fsm that scanning mode stop is desired
       
   596     iPimpl->Current().StopScanningMode( *iPimpl );    
       
   597     // indicate that a state change has occurred
       
   598     return ETrue;
       
   599     }
       
   600 
       
   601 #ifndef NDEBUG                                    
       
   602 // -----------------------------------------------------------------------------
       
   603 // 
       
   604 // -----------------------------------------------------------------------------
       
   605 //
       
   606 const TInt8* WlanDot11IbssScanningMode::GetStateName( 
       
   607     TUint8& aLength ) const
       
   608     {
       
   609     aLength = sizeof( iName );
       
   610     return iName;
       
   611     }
       
   612 #endif
       
   613 
       
   614 // -----------------------------------------------------------------------------
       
   615 // Handler for scan fsm event.
       
   616 // It is guaranteed by the FSM framework that no WHA command is pending
       
   617 // when this method is entered
       
   618 // -----------------------------------------------------------------------------
       
   619 //
       
   620 void WlanDot11IbssScanningMode::OnScanFsmEvent( 
       
   621     MWlanScanFsmCb::TEvent aEvent )
       
   622     {
       
   623     OsTracePrint( KScan, (TUint8*)
       
   624         ("UMAC * dot11-ibssscanningmode * SCAN FSM EVENT: %d"), aEvent );
       
   625 
       
   626     // do what the scan fsm desires
       
   627     switch( aEvent )
       
   628         {
       
   629         case EFSMSTARTSCANNINGMODE:
       
   630             // scanning mode start desired
       
   631             Fsm( *iCtxImpl, ESTARTSCANNINGMODE );
       
   632             break;
       
   633         case EFSMSCANMODERUNNING:
       
   634             // scanning mode is running
       
   635             Fsm( *iCtxImpl, ESCANMODERUNNING );            
       
   636             break;
       
   637         case EFSMSTOPSCANNINGMODE:
       
   638             // scanning mode stop desired
       
   639             Fsm( *iCtxImpl, ESTOPSCANNINGMODE );
       
   640             break;
       
   641 
       
   642         case EFSMSCANMODESTOPPED:
       
   643             // scanning mode has stopped
       
   644             Fsm( *iCtxImpl, ESCANNINGMODEEXIT );
       
   645             break;
       
   646         default:
       
   647             // catch scan FSM programming error
       
   648             OsTracePrint( KErrorLevel, 
       
   649                 (TUint8*)("UMAC* scan fsm event: :%d"), aEvent);
       
   650             OsAssert( (TUint8*)("* UMAC * panic"), 
       
   651                 (TUint8*)(WLAN_FILE), __LINE__ );
       
   652             break;
       
   653         }
       
   654     }