wlanutilities/wlansniffer/mainapplication/inc/wsfactivewaiter.h
branchRCL_3
changeset 24 63be7eb3fc78
parent 23 b852595f5cbe
child 25 f28ada11abbf
equal deleted inserted replaced
23:b852595f5cbe 24:63be7eb3fc78
     1 /*
       
     2 * Copyright (c) 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 "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 CWsfActiveWaiter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __WSFMAINAPPLICATION_ACTIVE_WAITER_H__
       
    21 #define __WSFMAINAPPLICATION_ACTIVE_WAITER_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 /**
       
    27  * CWsfActiveWaiter class,
       
    28  * an active object to replace User::WaitForRequest
       
    29  * 
       
    30  * Usage:
       
    31  * CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL();
       
    32  * CleanupStack::PushL( waiter );
       
    33  * server.AsyncFunction( waiter->iStatus );
       
    34  * if ( waiter->WaitForRequest == KErrNone )
       
    35  *      {
       
    36  *      // handle success
       
    37  *      }
       
    38  *      else 
       
    39  *      {
       
    40  *      // handle failure
       
    41  *      }
       
    42  * CleanupStack::PopAndDestroy( waiter );
       
    43  * 
       
    44  */     
       
    45 NONSHARABLE_CLASS( CWsfActiveWaiter ) : public CActive
       
    46     {
       
    47     public:
       
    48 
       
    49         /**
       
    50         * Two-phased constructor
       
    51         * @since S60 5.0 
       
    52         * @return instance of CWsfActiveWaiter class
       
    53         */
       
    54         static CWsfActiveWaiter* NewL();
       
    55 
       
    56         /**
       
    57         * Destructor of CWsfActiveWaiter class
       
    58         * @since S60 5.0     
       
    59         */  
       
    60         virtual ~CWsfActiveWaiter();          
       
    61 
       
    62         /**
       
    63         * Waits for it's TRequestStatus to be completed
       
    64         * @since S60 5.0     
       
    65         * @return Error code returned from server after request is
       
    66         * completed
       
    67         */
       
    68         TInt WaitForRequest();
       
    69         
       
    70     private:
       
    71 
       
    72         /**
       
    73         * 2nd phase constructor
       
    74         * @since S60 5.0 
       
    75         */
       
    76         void ConstructL();
       
    77     
       
    78         /**
       
    79         * Default C++ constructor 
       
    80         * @since S60 5.0 
       
    81         */ 
       
    82         CWsfActiveWaiter();
       
    83             
       
    84         /**
       
    85         * DoCancel from CActive
       
    86         * @since S60 5.0 
       
    87         */    
       
    88         virtual void DoCancel();
       
    89       
       
    90         /**
       
    91         * RunL from CActive
       
    92         * @since S60 5.0 
       
    93         */      
       
    94         virtual void RunL();
       
    95     
       
    96     private:
       
    97 
       
    98         /**
       
    99         * Used to make asynchronous call synchronous
       
   100         */
       
   101         CActiveSchedulerWait iWait;
       
   102     };     
       
   103 
       
   104 #endif // __WSFMAINAPPLICATION_ACTIVE_WAITER_H__
       
   105 
       
   106 // End of file