wlanutilities/wlansniffer/aiplugin/src/wsfrefreshscanactivewrapper.cpp
branchRCL_3
changeset 25 f28ada11abbf
equal deleted inserted replaced
24:63be7eb3fc78 25:f28ada11abbf
       
     1 /*
       
     2 * Copyright (c) 2007-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 "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 CWsfRefreshScanActiveWrapper.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "wsflogger.h"
       
    21 #include "wsfmodel.h"
       
    22 #include "wsfwlaninfoarray.h"
       
    23 #include "wsfrefreshscanactivewrapper.h"
       
    24 
       
    25 // --------------------------------------------------------------------------
       
    26 // CWsfRefreshScanActiveWrapper::CWsfRefreshScanActiveWrapper
       
    27 // --------------------------------------------------------------------------
       
    28 //
       
    29 CWsfRefreshScanActiveWrapper::CWsfRefreshScanActiveWrapper() :
       
    30     CActive(EPriorityStandard) // Standard priority
       
    31     {
       
    32     }
       
    33 
       
    34 
       
    35 // --------------------------------------------------------------------------
       
    36 // CWsfRefreshScanActiveWrapper::NewLC
       
    37 // --------------------------------------------------------------------------
       
    38 //
       
    39 CWsfRefreshScanActiveWrapper* CWsfRefreshScanActiveWrapper::NewLC( CWsfModel* aModel )
       
    40     {
       
    41     LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::NewLC" );
       
    42     CWsfRefreshScanActiveWrapper* self =
       
    43             new (ELeave) CWsfRefreshScanActiveWrapper();
       
    44     CleanupStack::PushL(self);
       
    45     self->ConstructL( aModel );
       
    46     return self;
       
    47     }
       
    48 
       
    49 
       
    50 // --------------------------------------------------------------------------
       
    51 // CWsfRefreshScanActiveWrapper::NewL
       
    52 // --------------------------------------------------------------------------
       
    53 //
       
    54 CWsfRefreshScanActiveWrapper* CWsfRefreshScanActiveWrapper::NewL(  CWsfModel* aModel )
       
    55     {
       
    56     LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::NewL" );
       
    57     CWsfRefreshScanActiveWrapper* self = 
       
    58             CWsfRefreshScanActiveWrapper::NewLC( aModel );
       
    59     CleanupStack::Pop(); // self;
       
    60     return self;
       
    61     }
       
    62 
       
    63 
       
    64 // --------------------------------------------------------------------------
       
    65 // CWsfRefreshScanActiveWrapper::ConstructL
       
    66 // --------------------------------------------------------------------------
       
    67 //
       
    68 void CWsfRefreshScanActiveWrapper::ConstructL( CWsfModel* aModel )
       
    69     {
       
    70     LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::ConstructL" );
       
    71     CActiveScheduler::Add(this); // Add to scheduler
       
    72     iModel = aModel;
       
    73     }
       
    74 
       
    75 
       
    76 // --------------------------------------------------------------------------
       
    77 // CWsfRefreshScanActiveWrapper::~CWsfRefreshScanActiveWrapper
       
    78 // --------------------------------------------------------------------------
       
    79 //
       
    80 CWsfRefreshScanActiveWrapper::~CWsfRefreshScanActiveWrapper()
       
    81     {
       
    82     LOG_ENTERFN( 
       
    83             "WsfRefreshScanActiveWrapper::~WsfRefreshScanActiveWrapper" );
       
    84     Cancel(); // Cancel any request, if outstanding
       
    85     // Delete instance variables if any
       
    86     }
       
    87 
       
    88 
       
    89 // --------------------------------------------------------------------------
       
    90 // CWsfRefreshScanActiveWrapper::DoCancel
       
    91 // --------------------------------------------------------------------------
       
    92 //
       
    93 void CWsfRefreshScanActiveWrapper::DoCancel()
       
    94     {
       
    95     LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::DoCancel" );
       
    96     }
       
    97 
       
    98 
       
    99 // --------------------------------------------------------------------------
       
   100 // CWsfRefreshScanActiveWrapper::StartL
       
   101 // --------------------------------------------------------------------------
       
   102 //
       
   103 void CWsfRefreshScanActiveWrapper::Start()
       
   104     {
       
   105     LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::Start" );
       
   106     Cancel(); // Cancel any request, just to be sure
       
   107     iState = EUninitialized;
       
   108     SetActive();
       
   109     TRequestStatus* status = &iStatus;
       
   110     User::RequestComplete( status, KErrNone );
       
   111     }
       
   112 
       
   113 
       
   114 // --------------------------------------------------------------------------
       
   115 // CWsfRefreshScanActiveWrapper::RunL
       
   116 // --------------------------------------------------------------------------
       
   117 //
       
   118 void CWsfRefreshScanActiveWrapper::RunL()
       
   119     {
       
   120     LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::RunL" );
       
   121     if (iStatus == KErrNone)
       
   122        {
       
   123         if (iState == EUninitialized)
       
   124             {
       
   125             LOG_WRITE( "request scan" );
       
   126             iModel->RefreshScan( iPckg, iStatus );
       
   127             iState = EInitialized;
       
   128             SetActive(); // Tell scheduler a request is active
       
   129             }
       
   130         else if (iState == EInitialized )
       
   131             {
       
   132             LOG_WRITEF( "request result = %d", iPckg() );
       
   133             iModel->SetRefreshState( iPckg() );
       
   134             }
       
   135         else
       
   136             {
       
   137             LOG_WRITEF( "iState = %d", iState );
       
   138             }
       
   139        }
       
   140     else
       
   141         {
       
   142         LOG_WRITEF( "RefreshScanActiveWrapper iStatus = %d", iStatus.Int() );
       
   143         }
       
   144     }
       
   145 
       
   146 
       
   147 // --------------------------------------------------------------------------
       
   148 // CWsfRefreshScanActiveWrapper::RunError
       
   149 // --------------------------------------------------------------------------
       
   150 //
       
   151 #ifdef _DEBUG
       
   152 TInt CWsfRefreshScanActiveWrapper::RunError( TInt aError )
       
   153     {
       
   154     LOG_ENTERFN( "CWsfRefreshScanActiveWrapper::RunError" );
       
   155     LOG_WRITEF( "aError = %d", aError );
       
   156     return aError;
       
   157     }
       
   158 #else
       
   159 TInt CWsfRefreshScanActiveWrapper::RunError( TInt /*aError*/ )
       
   160     {
       
   161     return KErrNone;
       
   162     }
       
   163 #endif
       
   164 
       
   165 
       
   166