wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacWsaScan.cpp
changeset 0 c40eb8fe8501
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2002-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:   Implementation of the WlanWsaScan class
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 15 %
       
    20 */
       
    21 
       
    22 #include "config.h"
       
    23 #include "UmacWsaScan.h"
       
    24 #include "UmacContextImpl.h"
       
    25 
       
    26 #ifndef NDEBUG 
       
    27 const TInt8 WlanWsaScan::iName[] = "wsa-scan";
       
    28 #endif
       
    29 
       
    30 // ======== MEMBER FUNCTIONS ========
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // 
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 WlanWsaScan::~WlanWsaScan() 
       
    37     {
       
    38     iChannels = NULL;
       
    39     iSsid = NULL;    
       
    40     }
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // 
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 void WlanWsaScan::Entry( WlanContextImpl& aCtxImpl )
       
    47     {
       
    48     // mark WSA cmd active
       
    49     aCtxImpl.ActivateWsaCmd();
       
    50 
       
    51     OsTracePrint( KWsaCmdStateDetails, 
       
    52         (TUint8*)("UMAC: WlanWsaScan::Entry: iMaxTransmitRate: 0x%08x"), 
       
    53         iMaxTransmitRate );
       
    54     OsTracePrint( KWsaCmdStateDetails, 
       
    55         (TUint8*)("UMAC: WlanWsaScan::Entry: iScanType: %d"), iScanType );
       
    56     OsTracePrint( KWsaCmdStateDetails, 
       
    57         (TUint8*)("UMAC: WlanWsaScan::Entry: iNumOfProbeRequests: %d"),  
       
    58         iNumOfProbeRequests );
       
    59     OsTracePrint( KWsaCmdStateDetails, 
       
    60         (TUint8*)("UMAC: WlanWsaScan::Entry: iSplitScan: %d"), iSplitScan );
       
    61     OsTracePrint( KWsaCmdStateDetails, 
       
    62         (TUint8*)("UMAC: WlanWsaScan::Entry: iNumOfSSID: %d"), iNumOfSSID );
       
    63 
       
    64 #ifndef NDEBUG 
       
    65     if ( iNumOfSSID )
       
    66         {
       
    67         TUint8 ssidTraceBuf[KMaxSSIDLength + 1]; // + 1 for NULL termination
       
    68 
       
    69         OsTracePrint( KWsaCmdStateDetails, 
       
    70             (TUint8*)("UMAC: WlanWsaScan::Entry: SSIDs:") );
       
    71 
       
    72         const WHA::SSSID* ssid_end = iSsid + iNumOfSSID;     
       
    73 
       
    74         for ( const WHA::SSSID* ssid_ptr = iSsid 
       
    75             ; ssid_ptr != ssid_end ; ++ssid_ptr )
       
    76             {
       
    77             // trace the SSIDs 
       
    78         
       
    79             os_memset( ssidTraceBuf, 0, sizeof( ssidTraceBuf ) );
       
    80             os_memcpy( ssidTraceBuf, ssid_ptr->iSSID, ssid_ptr->iSSIDLength );
       
    81             
       
    82             OsTracePrint( KWsaCmdStateDetails, (TUint8*)
       
    83                 ("UMAC: WlanWsaScan::Entry: SSID length: %d, SSID:"),
       
    84                 ssid_ptr->iSSIDLength );
       
    85             OsTracePrint( KWsaCmdStateDetails, ssidTraceBuf );
       
    86             }
       
    87         }
       
    88 #endif // !NDEBUG 
       
    89 
       
    90     OsTracePrint( KWsaCmdState, (TUint8*)
       
    91         ("UMAC: WHA-CMD-Scan") );
       
    92             
       
    93     // execute the command
       
    94     aCtxImpl.Wha().Scan( 
       
    95         iMaxTransmitRate, 
       
    96         iBand,
       
    97         iNumOfChannels,
       
    98         iChannels, 
       
    99         iScanType, 
       
   100         iNumOfProbeRequests, 
       
   101         iSplitScan, 
       
   102         iNumOfSSID, 
       
   103         iSsid );
       
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // 
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 void WlanWsaScan::Set(             
       
   111     WlanContextImpl& /*aCtxImpl*/,
       
   112     TUint32 aMaxTransmitRate, 
       
   113     WHA::TBand aBand,
       
   114     TUint8 aNumOfChannels,
       
   115     const WHA::SChannels* aChannels, 
       
   116     WHA::TScanType aScanType,
       
   117     TUint8 aNumOfProbeRequests,
       
   118     TBool aSplitScan,
       
   119     TUint8 aNumOfSSID,
       
   120     const WHA::SSSID* aSSID )
       
   121     {
       
   122     iMaxTransmitRate = aMaxTransmitRate;
       
   123     iBand = aBand;
       
   124     iNumOfChannels = aNumOfChannels;
       
   125     iChannels = aChannels;
       
   126     iScanType = aScanType;
       
   127     iNumOfProbeRequests = aNumOfProbeRequests;
       
   128     iSplitScan = aSplitScan;
       
   129     iNumOfSSID = aNumOfSSID;
       
   130     iSsid = aSSID;
       
   131     }
       
   132 
       
   133 // ---------------------------------------------------------------------------
       
   134 // 
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 void WlanWsaScan::CommandResponse( 
       
   138     WlanContextImpl& aCtxImpl, 
       
   139     WHA::TCommandId aCommandId, 
       
   140     WHA::TStatus aStatus,
       
   141     const WHA::UCommandResponseParams& aCommandResponseParams )
       
   142     {
       
   143     OsTracePrint( KWsaCmdState, 
       
   144         (TUint8*)("UMAC* WlanWsaScan::CommandResponse()") );    
       
   145 
       
   146     if ( aCommandId == WHA::EScanCommandResponse )
       
   147         {
       
   148         TraverseToHistoryState( aCtxImpl, 
       
   149             aCommandId, aStatus, aCommandResponseParams );           
       
   150         }
       
   151     else
       
   152         {
       
   153         OsTracePrint( KErrorLevel, 
       
   154             (TUint8*)("UMAC: aCommandId: %d"), aCommandId );
       
   155         OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ );
       
   156         }
       
   157     }
       
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // 
       
   161 // ---------------------------------------------------------------------------
       
   162 //
       
   163 #ifndef NDEBUG 
       
   164 const TInt8* WlanWsaScan::GetStateName( TUint8& aLength ) const
       
   165     {
       
   166     aLength = sizeof( iName );
       
   167     return iName;
       
   168     }
       
   169 #endif